diff --git a/packages/agent/src/workflows/agent-chat.ts b/packages/agent/src/workflows/agent-chat.ts index 730193d7..2a395e8c 100644 --- a/packages/agent/src/workflows/agent-chat.ts +++ b/packages/agent/src/workflows/agent-chat.ts @@ -150,7 +150,11 @@ export async function agentChat(task: WorkflowTask): Promise { referencedAssetDetailsList.push( `- Name: ${referencedAsset.name} (ID: ${referencedAsset.id}, Type: ${referencedAsset.type}, Media Type: ${referencedAsset.mediaType || 'unknown'}, Project ID: ${referencedAsset.projectId || 'unknown'}, Path: ${path})`, ) - attachedAssets.push({ id: referencedAsset.id, name: referencedAsset.name, type: referencedAsset.type }) + attachedAssets.push({ + id: referencedAsset.id, + name: referencedAsset.name, + type: referencedAsset.type, + }) } } } diff --git a/packages/core/src/chat/chat.ts b/packages/core/src/chat/chat.ts index 518774b6..59693b60 100644 --- a/packages/core/src/chat/chat.ts +++ b/packages/core/src/chat/chat.ts @@ -100,7 +100,10 @@ export function mapEntryToMessage( entryRecord: Prisma.AgentSessionEntryGetPayload>, ): ChatMessage | null { const entryObj = entryRecord.entry as unknown as SessionTreeEntry - if (entryObj.type === 'custom_message' && (entryObj as { customType?: string }).customType === 'context') { + if ( + entryObj.type === 'custom_message' && + (entryObj as { customType?: string }).customType === 'context' + ) { return null } const pathEntries = [{ ...entryObj, id: entryRecord.id }] diff --git a/packages/webui/components/chatbot-sidebar.tsx b/packages/webui/components/chatbot-sidebar.tsx index e4463c37..973f11a2 100644 --- a/packages/webui/components/chatbot-sidebar.tsx +++ b/packages/webui/components/chatbot-sidebar.tsx @@ -90,12 +90,20 @@ export function ChatbotSidebar({ projectId, contextAssetId }: ChatbotSidebarProp } const renderMessage = (msg: ChatMessage) => { - if (msg.role === 'custom' && (msg as { customType?: string }).customType === 'context_display_info') { - const details = msg.details as { assets?: Array<{ id: string; name: string; type: string }> } | undefined + if ( + msg.role === 'custom' && + (msg as { customType?: string }).customType === 'context_display_info' + ) { + const details = msg.details as + | { assets?: Array<{ id: string; name: string; type: string }> } + | undefined const assets = details?.assets || [] if (assets.length === 0) return null return ( -
+
{m.assets_added_to_context()}
    {assets.map((asset) => ( diff --git a/packages/webui/stores/chatbot.test.ts b/packages/webui/stores/chatbot.test.ts index bce68f33..3d2560a5 100644 --- a/packages/webui/stores/chatbot.test.ts +++ b/packages/webui/stores/chatbot.test.ts @@ -106,7 +106,9 @@ describe('useChatbotStore', () => { const stateWithOptimistic = useChatbotStore.getState() expect(stateWithOptimistic.messages).toHaveLength(1) expect(stateWithOptimistic.messages[0].id).toContain('temp-') - expect((stateWithOptimistic.messages[0] as { content: unknown }).content).toEqual([{ type: 'text', text: 'hello' }]) + expect((stateWithOptimistic.messages[0] as { content: unknown }).content).toEqual([ + { type: 'text', text: 'hello' }, + ]) expect(stateWithOptimistic.isStreaming).toBe(true) await sendPromise diff --git a/packages/webui/stores/chatbot.ts b/packages/webui/stores/chatbot.ts index 56acd3bc..41e5bb6d 100644 --- a/packages/webui/stores/chatbot.ts +++ b/packages/webui/stores/chatbot.ts @@ -199,8 +199,7 @@ export const useChatbotStore = create((set) => ({ const isExisting = s.messages.some((m) => m.id === entry.id) // Replace temp/optimistic message when the real user message streams back const filtered = s.messages.filter( - (m) => - !(entry.role === 'user' && !isExisting && m.id.startsWith('temp-')), + (m) => !(entry.role === 'user' && !isExisting && m.id.startsWith('temp-')), ) // Prevent duplicates by ID