Add teacher microphone and per-question model selection

This commit is contained in:
鲨鱼辣椒
2026-09-29 19:43:45 +08:00
parent cd1ba41e21
commit 78cfde6734
20 changed files with 517 additions and 37 deletions

View File

@@ -870,3 +870,19 @@ it('keeps only the cloud main-thread answer while advancing past child events on
expect(transport.events).toHaveBeenCalledTimes(2);
expect(streamUrls[1]).toContain('after_seq=2-0');
});
it('transmits the frozen per-question model while retaining the teacher version', async () => {
const f = await fixture();
f.topic.requests.push({ id: requestId, modelId: 'selected-model', teacherVersion: 9, text: '问题', references: [], status: 'running',
createdAt: 'now', sourceCapturedAt: 'now', sourceCursor: f.access.source.cursor,
includedSourceMessageIds: [], omittedMessages: 0, response: '' });
const transport: TeacherCloudTransport = {
json: vi.fn(async url => url === '/questions'
? { request_id: requestId, run_id: 'run' } : { status: 'completed', output: '已回复' }),
events: vi.fn(),
};
const model = prepareCloudTeacher(f.account, f.topic, requestId, f.access, f.progress, f.saveRequest, transport);
await model.run([{ role: 'user', content: '问题' }], new AbortController().signal, vi.fn());
expect(transport.json).toHaveBeenCalledWith('/questions', expect.objectContaining({ model_id: 'selected-model', teacher_version: f.topic.version }), expect.anything());
expect(f.topic.definition.model.model_id).toBe('deepseek-flash');
});