diff --git a/supabase/functions/create-chat-conversation/index.ts b/supabase/functions/create-chat-conversation/index.ts index 8c352e4..b7791d1 100644 --- a/supabase/functions/create-chat-conversation/index.ts +++ b/supabase/functions/create-chat-conversation/index.ts @@ -378,12 +378,15 @@ app.post(`${prefix}/conversations/:id/messages`, async (c) => { }); const respuestaJSON = JSON.parse(resp.output_text ?? "{}"); + const refusal = respuestaJSON["is-refusal"] === true; + //remove the is-refusal field from respuestaJSON to avoid confusion + delete respuestaJSON["is-refusal"]; // Now an item with the assistant response and the structured data (if any) should be appended = { timestamp: new Date().toISOString(), user: "assistant", - refusal: resp.output_text === "refusal", + refusal, // the ai-message field is the response message: respuestaJSON?.["ai-message"] ?? "", recommendations: resp.output_text