feat(chat): add multi-model comparison mode (M9.1)
Split-screen comparison of two AI models streaming simultaneously. Toggle via header button. Desktop shows side-by-side panes, mobile shows swipeable tabs. Uses streamWithModel() for provider-agnostic parallel streaming. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
5fdf62520c
commit
0ae497f1db
@@ -326,6 +326,32 @@ async function generateAutoTitle(conversationId: string) {
|
||||
}
|
||||
}
|
||||
|
||||
/** Stream a specific provider/model — used by comparison mode */
|
||||
export async function streamWithModel(
|
||||
provider: string,
|
||||
model: string,
|
||||
messages: { role: string; content: string }[],
|
||||
onToken: (text: string) => void,
|
||||
onError: (err: string) => void,
|
||||
signal: AbortSignal,
|
||||
): Promise<void> {
|
||||
const history = messages.map(m => ({ role: m.role as 'user' | 'assistant', content: m.content }))
|
||||
const savedModel = activeModel.value
|
||||
activeModel.value = model
|
||||
|
||||
try {
|
||||
if (provider === 'claude') {
|
||||
await streamClaude(history, onToken, onError, 'You are a helpful assistant.', false, signal)
|
||||
} else if (provider === 'openrouter') {
|
||||
await streamOpenRouter(history, onToken, onError, 'You are a helpful assistant.', signal)
|
||||
} else {
|
||||
await streamMock(history, onToken, signal)
|
||||
}
|
||||
} finally {
|
||||
activeModel.value = savedModel
|
||||
}
|
||||
}
|
||||
|
||||
export function useAI() {
|
||||
const chatStore = useChatStore()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user