Se usan modelos de openai a partir de variables de entorno
This commit is contained in:
@@ -29,6 +29,13 @@ app.options(
|
||||
);
|
||||
|
||||
const prefix = "/create-chat-conversation";
|
||||
// Model names (module-level) — pueden ser sobrescritos por variables de entorno
|
||||
const CREATE_CHAT_CONVERSATION_NONSTRUCTURED_MODELO = Deno.env.get(
|
||||
"CREATE_CHAT_CONVERSATION_NONSTRUCTURED_MODELO",
|
||||
) ?? "gpt-5-nano";
|
||||
const CREATE_CHAT_CONVERSATION_STRUCTURED_MODELO = Deno.env.get(
|
||||
"CREATE_CHAT_CONVERSATION_STRUCTURED_MODELO",
|
||||
) ?? "gpt-5-nano";
|
||||
|
||||
app.get(`${prefix}/health`, (c) => withCors(jsonResponse({ ok: true })));
|
||||
|
||||
@@ -241,7 +248,7 @@ app.post(`${prefix}/conversations/:id/messages`, async (c) => {
|
||||
if (!wantsStructured) {
|
||||
await openai.responses.create({
|
||||
conversation: row.openai_conversation_id,
|
||||
model: "gpt-5-nano",
|
||||
model: CREATE_CHAT_CONVERSATION_NONSTRUCTURED_MODELO,
|
||||
input: [
|
||||
{
|
||||
role: "system",
|
||||
@@ -284,7 +291,7 @@ app.post(`${prefix}/conversations/:id/messages`, async (c) => {
|
||||
const schema = pickSchemaFields(definicion, body.campos);
|
||||
const planForPrompt = safePlanForPrompt(plan);
|
||||
|
||||
const model = "gpt-5-nano";
|
||||
const model = CREATE_CHAT_CONVERSATION_STRUCTURED_MODELO;
|
||||
const prompt = body.user_prompt ?? body.content;
|
||||
|
||||
const resp = await openai.responses.create({
|
||||
|
||||
Reference in New Issue
Block a user