From 824db8530557bedd3c44d68fef6035ebbc07b704 Mon Sep 17 00:00:00 2001 From: Alejandro Rosales Date: Wed, 25 Feb 2026 10:04:08 -0600 Subject: [PATCH] fix: simplify refusal handling in message response by removing is-refusal field --- supabase/functions/create-chat-conversation/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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