fix: simplify refusal handling in message response by removing is-refusal field
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user