fix copy render msg

This commit is contained in:
2023-11-10 17:12:57 +08:00
parent 626e7780f8
commit 33f4ab7b42
3 changed files with 85 additions and 45 deletions

View File

@@ -47,6 +47,14 @@ export interface StreamingResponseChunk {
}
export const getMessageText = (message: Message): string => {
if (typeof message.content === "string") {
// function call message
if (message.tool_calls) {
return message.tool_calls
.map((tc) => {
return `Tool Call ID: ${tc.id}\nType: ${tc.type}\nFunction: ${tc.function.name}\nArguments: ${tc.function.arguments}}`;
})
.join("\n");
}
return message.content;
}
return message.content