fix: display direct_response message in frontend (#763) (#764)

Extract message content from direct_response tool call args
and display it as the message content when tool call completes.

Note: This is a workaround. The message is not streamed because
direct_response uses tool calling mechanism where args are JSON,
not natural language text that can be streamed directly.
This commit is contained in:
Jiahe Wu
2025-12-17 21:04:37 +08:00
committed by GitHub
parent a4f64abd1f
commit b85130b849

View File

@@ -62,6 +62,11 @@ export function mergeMessage(message: Message, event: ChatEvent) {
toolCall.args = safeParseToolArgs(toolCall.argsChunks.join(""));
delete toolCall.argsChunks;
}
// Handle direct_response tool: extract message content for display
if (toolCall.name === "direct_response" && toolCall.args?.message) {
message.content = toolCall.args.message as string;
message.contentChunks = [message.content];
}
});
}
}