28 lines
3.3 KiB
TypeScript
28 lines
3.3 KiB
TypeScript
import { createRoot } from 'react-dom/client';
|
|
import { CodingConversationTimeline } from '../../../src/pages/Chat/CodingConversationTimeline';
|
|
import { TeacherChatPanel } from '../../../src/pages/Chat/TeacherChatPanel';
|
|
import { codingConversationStore } from '../../../src/stores/coding-conversations';
|
|
import { createProductSnapshot } from '../../fixtures/coding-conversation-product-fixtures';
|
|
import type { TeacherDefinition, TeacherTopic } from '../../../shared/coding-teacher';
|
|
import '../../../src/styles/globals.css';
|
|
import '../../../src/pages/Chat/classroom-workspace.css';
|
|
|
|
const sent = '2026-09-28T08:01:02.000Z', finished = '2026-09-28T08:01:42.000Z';
|
|
const snapshot = createProductSnapshot('timestamp-fixture', 1);
|
|
snapshot.run = { status: 'idle' };
|
|
snapshot.nodes = [
|
|
{ kind: 'message', id: 'u', role: 'user', status: 'complete', timestamp: Date.parse(sent), blocks: [{ kind: 'text', id: 'ut', status: 'complete', text: '我想做一个会长大的小宠物。' }] },
|
|
{ kind: 'message', id: 'a', role: 'assistant', status: 'complete', timestamp: Date.parse(finished), blocks: [{ kind: 'text', id: 'at', status: 'complete', text: '小宠物的家搭好啦。你可以试着点一下喂食按钮,看看它的变化。' }] },
|
|
];
|
|
codingConversationStore.getState().primeConversation(snapshot);
|
|
const definition: TeacherDefinition = { schema_version: 1, config_id: 'teacher-fixture', teacher_id: 'teacher-fixture', name: '设计老师', description: '', avatar_id: 'avatar-06', welcome_message: '', suggested_questions: [], system_prompt: '', skills: [], model: { model_id: 'fixture', reasoning_choice: { mode: 'default' } }, limits: { max_input_tokens: 8000, max_output_tokens: 1000 } };
|
|
const topic: TeacherTopic = { schemaVersion: 1, revision: 1, id: 'teacher-fixture', accountId: 'fixture', projectId: 'fixture', sourceConversationId: 'timestamp-fixture', definition, version: 1, conversation: { agentId: 'teacher-fixture', segmentTurns: 1, discussions: {} }, createdAt: sent, updatedAt: finished, requests: [{ id: 'r', createdAt: sent, finishedAt: finished, text: '我想让它长大以后变得很特别。', response: '先想一个你最希望它学会的小本领吧。你希望它会帮你做什么?', suggestedQuestions: ['我想让它陪我讲故事。', '我想让它记住我的习惯。'], references: [], sourceCursor: { workerGeneration: 1, seq: 1 }, sourceCapturedAt: sent, includedSourceMessageIds: [], omittedMessages: 0, status: 'completed' }] };
|
|
(window as typeof window & { __timestampTopic: TeacherTopic }).__timestampTopic = topic;
|
|
const agent = { teacher_id: definition.config_id!, version: 1, is_default: true, definition };
|
|
createRoot(document.getElementById('root')!).render(
|
|
<div className="classroom-workspace min-h-screen bg-white" style={{ display: 'grid', gridTemplateColumns: innerWidth >= 768 ? 'minmax(0, 1fr) 420px' : 'minmax(0, 1fr)' }}>
|
|
<main className="min-w-0 p-6" aria-label="操作对话"><h1 className="mb-8 text-lg">操作对话</h1><CodingConversationTimeline conversationId="timestamp-fixture" /></main>
|
|
<div className="consultation-pane h-[850px] border-l"><TeacherChatPanel projectId="fixture" sourceId="timestamp-fixture" selectedAgent={agent} catalogState={{ config: { enabled: true, definition }, catalog: { items: [agent] } }} /></div>
|
|
</div>,
|
|
);
|