data pipeline refactor and fix

This commit is contained in:
2026-04-13 18:30:04 -04:00
parent 6418729b16
commit 326bf80846
96 changed files with 7107 additions and 1763 deletions

View File

@@ -59,6 +59,18 @@ const addToolCallBubble = (label: string) => {
}]
}
const appendToolCallStatus = (status: string) => {
if (!toolCallMessageId) return
const idx = messages.value.findIndex(m => m._id === toolCallMessageId)
if (idx !== -1) {
messages.value[idx] = {
...messages.value[idx],
content: messages.value[idx].content + `\n↳ ${status}`
}
messages.value = [...messages.value]
}
}
const removeToolCallBubble = () => {
if (toolCallMessageId) {
messages.value = messages.value.filter(m => m._id !== toolCallMessageId)
@@ -76,11 +88,47 @@ const streamingImages = ref<any[]>([])
const handleMessage = (data: WebSocketMessage) => {
console.log('[ChatPanel] Received message:', data)
if (data.type === 'conversation_history') {
messages.value = (data.messages as any[]).map((m: any) => {
const ts = new Date(m.timestamp / 1000) // microseconds → ms
const files = (m.files ?? []).map((b: any) => ({
name: `image_${b.id}.png`,
size: 0,
type: b.mimeType.split('/')[1] ?? 'png',
url: `data:${b.mimeType};base64,${b.data}`,
preview: `data:${b.mimeType};base64,${b.data}`,
}))
return {
_id: m.id,
content: m.content,
senderId: m.role === 'user' ? CURRENT_USER_ID : AGENT_ID,
timestamp: ts.toTimeString().split(' ')[0].slice(0, 5),
date: ts.toLocaleDateString(),
saved: true,
distributed: true,
seen: true,
files,
}
})
messagesLoaded.value = true
return
}
if (data.type === 'agent_tool_call') {
addToolCallBubble(data.label ?? data.toolName ?? 'Tool call...')
return
}
if (data.type === 'subagent_tool_call') {
appendToolCallStatus(data.toolName ?? data.label ?? 'tool')
return
}
if (data.type === 'subagent_chunk') {
// Subagent final text — not shown separately; the main agent will incorporate it in its response
return
}
if (data.type === 'image') {
// Handle image message - attach to current streaming message or create standalone
console.log('[ChatPanel] Processing image message')