feat(coding): add conversation archive and first-message titles

This commit is contained in:
brother7 committed 2026-09-20 12:43:51 +08:00
1 parent d61226532a
commit fd0293fe3d
22 files changed
+698 -69

No files matched your search

+14 -1
View File
@@ -8,6 +8,7 @@ import {
} from '../../shared/coding-conversation-reducer';
import { AppError } from '@/lib/error-model';
import { queueCodingConversationSessionSync } from '@/lib/agent-session-sync';
import { codingWorkspaceStore } from './coding-workspace';
import {
getCodingConversationSnapshot,
openCodingConversationEvents,
@@ -660,8 +661,20 @@ export function createCodingConversationStore(
set({ connectionState: 'error', globalError: 'Conversation 事件更新无法读取。' });
}
});
source.addEventListener('conversation.metadata-changed', (event) => {
if (eventSource !== source) return;
try {
const metadata = parse<{ projectId: string }>(event);
if (typeof metadata.projectId === 'string') {
void codingWorkspaceStore.getState().refreshConversations(metadata.projectId).catch(() => undefined);
}
} catch { /* Reconnection refreshes authoritative metadata. */ }
});
source.onopen = () => {
if (eventSource === source) set({ connectionState: 'live', globalError: null });
if (eventSource !== source) return;
set({ connectionState: 'live', globalError: null });
const workspace = codingWorkspaceStore.getState();
if (workspace.activeProjectId) void workspace.refreshConversations(workspace.activeProjectId).catch(() => undefined);
};
source.onerror = () => {
if (eventSource === source) {