feat(coding): complete PI conversation UI

This commit is contained in:
2026-08-24 08:59:16 +08:00
parent 2613d6530b
commit 863f005203
21 changed files with 2040 additions and 137 deletions

View File

@@ -103,12 +103,20 @@ const projectApi = vi.hoisted(() => ({
config: vi.fn(),
conversations: vi.fn(),
create: vi.fn(),
patch: vi.fn(),
}));
const conversationApi = vi.hoisted(() => ({
snapshot: vi.fn(),
events: vi.fn(),
submit: vi.fn(),
recover: vi.fn(),
abort: vi.fn(),
model: vi.fn(),
thinking: vi.fn(),
compact: vi.fn(),
fork: vi.fn(),
respond: vi.fn(),
diagnostics: vi.fn(),
}));
const attachmentApi = vi.hoisted(() => ({ upload: vi.fn() }));
@@ -117,6 +125,7 @@ vi.mock('@/lib/coding-projects', () => ({
getCodingProjectConfig: projectApi.config,
listCodingProjectConversations: projectApi.conversations,
createCodingProjectConversation: projectApi.create,
patchCodingProjectConversation: projectApi.patch,
}));
vi.mock('@/lib/coding-conversations', () => ({
@@ -124,6 +133,13 @@ vi.mock('@/lib/coding-conversations', () => ({
openCodingConversationEvents: conversationApi.events,
submitCodingConversationPrompt: conversationApi.submit,
recoverCodingConversation: conversationApi.recover,
abortCodingConversation: conversationApi.abort,
setCodingConversationModel: conversationApi.model,
setCodingConversationThinking: conversationApi.thinking,
compactCodingConversation: conversationApi.compact,
forkCodingConversation: conversationApi.fork,
respondCodingConversationInteraction: conversationApi.respond,
getCodingRuntimeDiagnostics: conversationApi.diagnostics,
}));
vi.mock('@/lib/coding-attachments', async (importOriginal) => ({
@@ -200,6 +216,7 @@ describe('CodingChatPanel first Conversation', () => {
'utf8',
);
expect(sourceText).not.toMatch(/(?:import|export)[\s\S]*?from\s+['"][^'"]*opencode/i);
expect(sourceText).not.toMatch(/['"](?:share|unshare|unrevert|revert|todo|todos|global runtime)['"]/i);
}
});
@@ -539,6 +556,8 @@ describe('CodingChatPanel first Conversation', () => {
preparing
recovering={false}
runStatus="preparing"
mode="prompt"
queue={{ items: [] }}
error={null}
recoverableError={false}
acceptedCount={1}
@@ -546,6 +565,7 @@ describe('CodingChatPanel first Conversation', () => {
submitting={false}
placeholder="Message"
onChange={vi.fn()}
onModeChange={vi.fn()}
onSubmit={onSubmit}
onRecover={vi.fn()}
onAddFiles={vi.fn()}