fix(teacher): 独立刷新老师目录以缩短配置更新延迟

This commit is contained in:
2026-09-29 12:03:06 +08:00
parent 2767a15017
commit 913ccad577
9 changed files with 184 additions and 7 deletions

View File

@@ -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 catalogRevision = url.pathname === '/api/coding/teacher/teachers/revision';
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 && !catalogRevision && !draft && !pending) return false;
if ((config || catalog || catalogRevision || draft || pending) && req.method !== 'GET') {
sendJson(res, 405, { error: '不支持此操作。' });
return true;
}
@@ -82,6 +83,10 @@ export async function handleCodingTeacherRoutes(
));
return true;
}
if (catalogRevision) {
sendJson(res, 200, await service.catalogRevision());
return true;
}
if (catalog) {
sendJson(res, 200, await service.catalog());
return true;