Add teacher microphone and per-question model selection
This commit is contained in:
@@ -32,10 +32,11 @@ export async function handleCodingTeacherRoutes(
|
||||
const role = projectTopics?.[2] === 'friend' ? 'friend' : undefined;
|
||||
const config = url.pathname === '/api/coding/teacher/config' || url.pathname === '/api/coding/friend/config';
|
||||
const catalog = url.pathname === '/api/coding/teacher/teachers';
|
||||
const models = url.pathname === '/api/coding/teacher/models';
|
||||
const draft = url.pathname === '/api/coding/teacher-preview';
|
||||
const pending = url.pathname === '/api/coding/teacher-preview/pending-link';
|
||||
if (!legacy && !conversation && !source && !preview && !projectTopics && !checkIn && !config && !catalog && !draft && !pending) return false;
|
||||
if ((config || catalog || draft || pending) && req.method !== 'GET') {
|
||||
if (!legacy && !conversation && !source && !preview && !projectTopics && !checkIn && !config && !catalog && !models && !draft && !pending) return false;
|
||||
if ((config || catalog || models || draft || pending) && req.method !== 'GET') {
|
||||
sendJson(res, 405, { error: '不支持此操作。' });
|
||||
return true;
|
||||
}
|
||||
@@ -78,6 +79,12 @@ export async function handleCodingTeacherRoutes(
|
||||
));
|
||||
return true;
|
||||
}
|
||||
if (models) {
|
||||
const runtime = url.searchParams.get('runtime');
|
||||
if (runtime !== 'local' && runtime !== 'yuxi') throw new TeacherError(422, 'teacher_runtime_invalid', '模型来源无效。');
|
||||
sendJson(res, 200, await service.models(runtime));
|
||||
return true;
|
||||
}
|
||||
if (catalog) {
|
||||
sendJson(res, 200, await service.catalog());
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user