refactor(teacher): retire discussion components and keep text replies

This commit is contained in:
鲨鱼辣椒
2026-09-28 13:54:55 +08:00
parent ae0f72d8fa
commit 998796d77c
32 changed files with 1060 additions and 1794 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, TeacherDiscussionAction, TeacherSend } from '../../../shared/coding-teacher';
import type { TeacherCheckInInput, 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|discussion|requests\/([^/]+)\/cancel))?$/
/^\/api\/coding\/projects\/([^/]+)\/conversations\/([^/]+)\/teacher-topics(?:\/([^/]+))?(?:\/(messages|events|save|requests\/([^/]+)\/cancel))?$/
);
const preview = url.pathname.match(
/^\/api\/coding\/teacher-preview\/topics(?:\/([^/]+))?(?:\/(messages|events|save|discussion|requests\/([^/]+)\/cancel))?$/
/^\/api\/coding\/teacher-preview\/topics(?:\/([^/]+))?(?:\/(messages|events|save|requests\/([^/]+)\/cancel))?$/
);
const projectTopics = url.pathname.match(
/^\/api\/coding\/projects\/([^/]+)\/(agent|teacher|friend)-topics(?:\/([^/]+))?(?:\/(messages|events|save|discussion|requests\/([^/]+)\/cancel))?$/
/^\/api\/coding\/projects\/([^/]+)\/(agent|teacher|friend)-topics(?:\/([^/]+))?(?:\/(messages|events|save|requests\/([^/]+)\/cancel))?$/
);
const checkIn = url.pathname.match(/^\/api\/coding\/projects\/([^/]+)\/teacher-check-in$/);
const role = projectTopics?.[2] === 'friend' ? 'friend' : undefined;
@@ -95,10 +95,6 @@ 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;