feat(teacher): 连接 Yuxi 老师并提供项目与会话只读工具
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { hostApiFetch, createHostEventSource, ensureHostApiToken } from './host-api';
|
||||
import type {
|
||||
TeacherAvailability,
|
||||
TeacherCatalog,
|
||||
TeacherDefinition,
|
||||
TeacherSend,
|
||||
TeacherTopic,
|
||||
@@ -12,6 +13,7 @@ export function teacherTopicsPath(projectId: string, sourceId: string) {
|
||||
: `/api/coding/projects/${encodeURIComponent(projectId)}/conversations/${encodeURIComponent(sourceId)}/teacher-topics`;
|
||||
}
|
||||
export const teacherApi = {
|
||||
catalog: () => hostApiFetch<TeacherCatalog>('/api/coding/teacher/teachers'),
|
||||
config: () =>
|
||||
hostApiFetch<TeacherAvailability & { definition: TeacherDefinition | null }>(
|
||||
'/api/coding/teacher/config'
|
||||
@@ -21,10 +23,10 @@ export const teacherApi = {
|
||||
'/api/coding/teacher-preview?draftRevision=' + draftRevision
|
||||
),
|
||||
list: (base: string) => hostApiFetch<TeacherTopicList>(base),
|
||||
create: (base: string, draftRevision?: number, sampleContext?: string) =>
|
||||
create: (base: string, draftRevision?: number, sampleContext?: string, teacherVersion?: number) =>
|
||||
hostApiFetch<TeacherTopic>(base, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ draftRevision, sampleContext }),
|
||||
body: JSON.stringify({ draftRevision, sampleContext, teacherVersion }),
|
||||
}),
|
||||
read: (base: string, id: string) =>
|
||||
hostApiFetch<TeacherTopic>(base + '/' + encodeURIComponent(id)),
|
||||
|
||||
Reference in New Issue
Block a user