feat: add convert_output_to_messages for OR-aligned message building

This commit is contained in:
Tim Baek
2026-01-22 19:54:05 -05:00
parent 46cf40ec82
commit d2c695eb11
3 changed files with 207 additions and 2 deletions

View File

@@ -1403,7 +1403,12 @@
};
const chatCompletionEventHandler = async (data, message, chatId) => {
const { id, done, choices, content, sources, selected_model_id, error, usage } = data;
const { id, done, choices, content, output, sources, selected_model_id, error, usage } = data;
// Store raw OR-aligned output items from backend
if (output) {
message.output = output;
}
if (error) {
await handleOpenAIError(error, message);
@@ -1899,7 +1904,9 @@
: undefined,
..._messages.map((message) => ({
...message,
content: processDetails(message.content)
content: processDetails(message.content),
// Include output for temp chats (backend will use it and strip before LLM)
...(message.output ? { output: message.output } : {})
}))
].filter((message) => message);