feat: 添加全局人设与头像设置并优化对话及弹窗交互

This commit is contained in:
2026-09-05 22:26:12 +08:00
parent 7551716e13
commit a1ab1024f0
18 changed files with 450 additions and 22 deletions
+12
View File
@@ -10,6 +10,7 @@ import {
} from '@/services/chatService'
import type { ChatMessage, Conversation } from '@/contracts'
import type { SseClient } from '@/services/sseClient'
import { useChatPreferences } from './chatPreferences'
vi.mock('@/services/chatService', () => ({
createConversation: vi.fn(),
@@ -63,6 +64,17 @@ it('sends persistent message ids and restores messages from the backend', async
expect(store.messages[1]?.citations?.[0]?.heading_path).toBe('Heading')
})
it('leaves global persona assembly to the backend', async () => {
useChatPreferences().settings = {persona:'stale browser persona',presetDialogue:'old example',aiAvatar:'',userAvatar:''}
const store = useChatStore()
store.selectedProviderId = 'real'
store.selectedModel = 'configured-model'
await store.sendMessage('hello')
const request = vi.mocked(streamChat).mock.calls[0]![0]
expect(request).not.toHaveProperty('system')
expect(request).not.toHaveProperty('aiAvatar')
})
it('loads the newest persisted conversation on initialization', async () => {
const conversation: Conversation = {
conversation_id: 'persisted', title: 'Saved', created_at: '2026-01-01T00:00:00Z',