chore: format codebase

This commit is contained in:
yiling
2026-07-11 16:58:37 +08:00
parent 482df3315c
commit bd897b951a
5 changed files with 24 additions and 8 deletions
+3 -1
View File
@@ -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
+1 -2
View File
@@ -199,8 +199,7 @@ export const useChatbotStore = create<ChatbotState>((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