feat: integrate pinned teacher discussion workspace

This commit is contained in:
鲨鱼辣椒
2026-09-23 19:13:51 +08:00
parent 7951cca700
commit 404cfcde46
21 changed files with 1666 additions and 11 deletions

View File

@@ -8,7 +8,7 @@ import {
} from '../route-utils';
import { TeacherError } from '../../coding-teacher/config-client';
import type { TeacherScope } from '../../coding-teacher/service';
import type { TeacherCheckInInput, TeacherSend } from '../../../shared/coding-teacher';
import type { TeacherCheckInInput, TeacherDiscussionAction, TeacherSend } from '../../../shared/coding-teacher';
import { takeTeacherPreviewRevision } from '../../main/app-deep-link';
export async function handleCodingTeacherRoutes(
@@ -18,13 +18,13 @@ export async function handleCodingTeacherRoutes(
ctx: HostApiContext
): Promise<boolean> {
const source = url.pathname.match(
/^\/api\/coding\/projects\/([^/]+)\/conversations\/([^/]+)\/teacher-topics(?:\/([^/]+))?(?:\/(messages|events|save|requests\/([^/]+)\/cancel))?$/
/^\/api\/coding\/projects\/([^/]+)\/conversations\/([^/]+)\/teacher-topics(?:\/([^/]+))?(?:\/(messages|events|save|discussion|requests\/([^/]+)\/cancel))?$/
);
const preview = url.pathname.match(
/^\/api\/coding\/teacher-preview\/topics(?:\/([^/]+))?(?:\/(messages|events|save|requests\/([^/]+)\/cancel))?$/
/^\/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|requests\/([^/]+)\/cancel))?$/
/^\/api\/coding\/projects\/([^/]+)\/(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';
@@ -90,6 +90,10 @@ export async function handleCodingTeacherRoutes(
sendJson(res, 202, await service.send(scope, id, await parseJsonBody<TeacherSend>(req)));
return true;
}
if (id && action === 'discussion' && req.method === 'POST') {
sendJson(res, 200, await service.updateDiscussion(scope, id, await parseJsonBody<TeacherDiscussionAction>(req)));
return true;
}
if (id && action === 'save' && req.method === 'POST') {
sendJson(res, 200, await service.save(scope, id));
return true;