Integrate project classroom with teacher and friend consultations

This commit is contained in:
鲨鱼辣椒
2026-09-22 15:50:18 +08:00
parent e5d271bc45
commit 68e676cb62
28 changed files with 957 additions and 314 deletions

View File

@@ -1,20 +1,22 @@
import { hostApiFetch, createHostEventSource, ensureHostApiToken } from './host-api';
import type {
ConsultationRole,
TeacherAvailability,
TeacherDefinition,
TeacherSend,
TeacherTopic,
TeacherTopicList,
} from '../../shared/coding-teacher';
export function teacherTopicsPath(projectId: string, sourceId: string) {
export function teacherTopicsPath(projectId: string, sourceId: string, role?: ConsultationRole) {
if (role && projectId !== 'preview') return `/api/coding/projects/${encodeURIComponent(projectId)}/${role}-topics`;
return projectId === 'preview'
? '/api/coding/teacher-preview/topics'
: `/api/coding/projects/${encodeURIComponent(projectId)}/conversations/${encodeURIComponent(sourceId)}/teacher-topics`;
}
export const teacherApi = {
config: () =>
config: (role: ConsultationRole = 'teacher') =>
hostApiFetch<TeacherAvailability & { definition: TeacherDefinition | null }>(
'/api/coding/teacher/config'
`/api/coding/${role}/config`
),
preview: (draftRevision: number) =>
hostApiFetch<{ payload: TeacherDefinition; draft_revision: number }>(