feat(consultation): unify server-distributed agents without fixed roles

This commit is contained in:
2026-09-24 11:56:42 +08:00
parent 248776d855
commit 8a157be4f6
35 changed files with 625 additions and 668 deletions

View File

@@ -24,10 +24,10 @@ export async function handleCodingTeacherRoutes(
/^\/api\/coding\/teacher-preview\/topics(?:\/([^/]+))?(?:\/(messages|events|save|discussion|requests\/([^/]+)\/cancel))?$/
);
const projectTopics = url.pathname.match(
/^\/api\/coding\/projects\/([^/]+)\/(teacher|friend)-topics(?:\/([^/]+))?(?:\/(messages|events|save|discussion|requests\/([^/]+)\/cancel))?$/
/^\/api\/coding\/projects\/([^/]+)\/(agent|teacher|friend)-topics(?:\/([^/]+))?(?:\/(messages|events|save|discussion|requests\/([^/]+)\/cancel))?$/
);
const checkIn = url.pathname.match(/^\/api\/coding\/projects\/([^/]+)\/teacher-check-in$/);
const role = projectTopics?.[2] === 'friend' || url.pathname === '/api/coding/friend/config' ? 'friend' : 'teacher';
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 draft = url.pathname === '/api/coding/teacher-preview';
@@ -43,7 +43,7 @@ export async function handleCodingTeacherRoutes(
}
const service = ctx.codingProducts?.teacher;
if (!service) {
sendJson(res, 503, { error: '老师服务暂不可用。', code: 'teacher_unavailable' });
sendJson(res, 503, { error: '智能体服务暂不可用。', code: 'teacher_unavailable' });
return true;
}
try {
@@ -60,7 +60,7 @@ export async function handleCodingTeacherRoutes(
return true;
}
if (config && req.method === 'GET') {
sendJson(res, 200, await service.definition(role));
sendJson(res, 200, await service.definition());
return true;
}
if (draft && req.method === 'GET') {