Remove teacher conversation discussion components
This commit is contained in:
1 parent
592920da06
commit
317def7912
9 files changed
+150
-371
No files matched your search
@@ -1,5 +1,5 @@
|
||||
// Deterministic responses for layout/interaction tests only; never imported by the app.
|
||||
import type { TeacherDefinition, TeacherTopic, TeacherSend, TeacherDiscussionAction } from '../../../shared/coding-teacher';
|
||||
import type { TeacherDefinition, TeacherTopic, TeacherSend } from '../../../shared/coding-teacher';
|
||||
import type { TeacherDiscussionContent } from '../../../shared/teacher-discussion';
|
||||
const definition: TeacherDefinition = { schema_version: 1, teacher_id: 'coding-teacher', name: '麦洛智能体', description: '', avatar_id: 'avatar-01', welcome_message: '', suggested_questions: [], system_prompt: '测试', skills: [], model: { model_id: 'fixture', reasoning_choice: { mode: 'default' } }, limits: { max_input_tokens: 8000, max_output_tokens: 1500 } };
|
||||
const samples: Record<string, TeacherDiscussionContent> = {
|
||||
@@ -28,42 +28,14 @@ export const teacherApi = {
|
||||
read: async () => structuredClone(current),
|
||||
create: async () => structuredClone(current),
|
||||
events: async () => stream,
|
||||
updateDiscussion: async (_base: string, _id: string, input: TeacherDiscussionAction) => {
|
||||
const tool = current.discussion!;
|
||||
if (input.action === 'pause' || input.action === 'finish') tool.status = input.action === 'pause' ? 'paused' : 'finished';
|
||||
else tool.status = 'active';
|
||||
if (input.action === 'back-ideas' && tool.previousIdeas) {
|
||||
if (tool.content.kind === 'structure') tool.previousStructure = structuredClone(tool.content);
|
||||
tool.content = structuredClone(tool.previousIdeas);
|
||||
}
|
||||
if (tool.content.kind === 'ideas') {
|
||||
const item = tool.content.items.find(item => item.id === input.itemId);
|
||||
if (item && input.action === 'keep-idea') item.state = 'kept';
|
||||
if (item && input.action === 'aside-idea') item.state = 'aside';
|
||||
if (item && input.action === 'first-idea') tool.content.firstItemId = item.id;
|
||||
}
|
||||
tool.revision++;
|
||||
snapshot();
|
||||
return structuredClone(current);
|
||||
},
|
||||
send: async (_base: string, _id: string, input: TeacherSend) => {
|
||||
if (input.presentation || input.discussion) throw new Error('New chat requests must not ask for components');
|
||||
current.requests.push({ id: input.requestId, text: input.text, references: [], createdAt: 'now', status: 'running', sourceCursor: { workerGeneration: 0, seq: 1 }, sourceCapturedAt: 'now', includedSourceMessageIds: [], omittedMessages: 0, response: '', discussionContext: input.discussion });
|
||||
snapshot();
|
||||
timer = setTimeout(() => {
|
||||
const request = current.requests.at(-1)!;
|
||||
request.status = 'completed';
|
||||
request.response = '好,已经把你的补充放在上面了。我们可以接着想。';
|
||||
const tool = current.discussion;
|
||||
if (tool?.status === 'active' && input.discussion) {
|
||||
if (input.discussion.transition === 'structure' && tool.content.kind === 'ideas') {
|
||||
tool.previousIdeas = structuredClone(tool.content);
|
||||
tool.content = structuredClone(samples.structure);
|
||||
} else if (tool.content.kind === 'ideas') tool.content.items.push({ id: `new-${tool.revision}`, text: input.text, state: 'kept' });
|
||||
else if (tool.content.kind === 'structure') tool.content.nodes.push({ id: `new-${tool.revision}`, label: input.text, parentId: 'world' });
|
||||
else if (tool.content.kind === 'flow') tool.content.nodes.push({ id: `new-${tool.revision}`, label: input.text, kind: 'outcome' });
|
||||
else tool.content.rows.push({ id: `new-${tool.revision}`, label: '再想想这一点', cells: tool.content.columns.map(col => ({ columnId: col.id, text: '先观察实际玩的时候有什么不同。' })) });
|
||||
tool.revision++;
|
||||
}
|
||||
request.response = '好,我们可以接着聊。';
|
||||
snapshot();
|
||||
}, 350);
|
||||
return structuredClone(current);
|
||||
@@ -73,3 +45,5 @@ export const teacherApi = {
|
||||
export const teacherTopicsPath = () => '/fixture';
|
||||
|
||||
export const legacyTopicBase = (base: string) => base;
|
||||
|
||||
export const teacherConversationsPath = () => '/fixture/conversations';
|
||||
Reference in new issue
Block a user