fix: simplify refusal handling in message response by removing is-refusal field
Deploy Function / deploy (push) Successful in 22s
Deploy Migrations to Production / deploy (push) Successful in 13s

This commit is contained in:
2026-02-25 10:04:08 -06:00
parent 5fae2165b0
commit 824db85305
@@ -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