33 lines
626 B
JavaScript
33 lines
626 B
JavaScript
/*
|
|
import { OpenAI } from "langchain/llms";
|
|
|
|
import * as dotenv from 'dotenv';
|
|
dotenv.config();
|
|
|
|
|
|
|
|
if (process.env.NODE_ENV == 'production') {
|
|
OPENAI_API_KEY = process.env.OPENAI_API_KEY;
|
|
}
|
|
|
|
|
|
export async function load(event) {
|
|
return {
|
|
test : "123",
|
|
}
|
|
}
|
|
|
|
export const actions = {
|
|
generate: async ({request}) => {
|
|
const form = await request.formData();
|
|
const prompt = form.get('prompt');
|
|
|
|
const model = new OpenAI({ temperature: 0.9 });
|
|
const res = await model.call(prompt);
|
|
return {
|
|
prompt: prompt,
|
|
generated: res
|
|
}
|
|
}
|
|
};
|
|
*/ |