feat(chatbot): return rich AgentMessage structure directly from listMessages API

This commit is contained in:
yiling
2026-07-07 12:25:32 +08:00
parent d326a4cab8
commit b8eddcd854
3 changed files with 202 additions and 61 deletions
+13 -8
View File
@@ -37,12 +37,17 @@ export const chatSessionInfoSchema = z.object({
export type ChatSessionInfo = z.infer<typeof chatSessionInfoSchema>
export const chatMessageSchema = z.object({
id: z.string(),
role: z.enum(['user', 'assistant', 'toolCall', 'toolResult', 'thinking_level_change']),
content: z.string(),
timestamp: z.string(),
entry: z.unknown(), // Raw session entry data
})
export const chatMessageSchema = z.intersection(
z.object({
id: z.string(),
}),
z.record(z.string(), z.unknown()),
)
export type ChatMessage = z.infer<typeof chatMessageSchema>
export type ChatMessage = {
id: string
role: string
content: string | unknown[]
timestamp?: number
[key: string]: unknown
}