Replies: 1 comment
-
|
The solution I found is writing an
onTextMessageStartEvent: ({ event, messages}) => {
const { messageId: id, role = "assistant", name } = event;
// Always create a new message
messages.push({
id,
role,
content: "",
...(name !== undefined && { name}),
} as Message);
return {
messages,
stopPropagation: true
}
},
onTextMessageContentEvent({ event, messages}){
const targetMessage = [...messages].reverse().find((m) => m.id === event.messageId)!;
const existingContent = typeof targetMessage.content === "string" ? targetMessage.content : "";
targetMessage.content = `${existingContent}${event.delta}`;
return {
messages,
stopPropagation: true
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The current reducer only creates a single assistant message where all text content is included:
ag-ui/sdks/typescript/packages/client/src/apply/default.ts
Line 135 in 872665d
This way, despite having references to toolCalls, is not possible to reconstruct the order of tool-call vs assistant-message
Eg.: With the following events:
tool-1calltool-2callBecause a single message is generated to include all assistant content, the resulting messages include:
Is this intended behavior, or is it a limitation?
Beta Was this translation helpful? Give feedback.
All reactions