feat(consultation): unify server-distributed agents without fixed roles
This commit is contained in:
@@ -7,7 +7,7 @@ import { parseTeacherDiscussionContent } from '../../shared/teacher-discussion';
|
||||
|
||||
export function teacherTopicId(id: string): string {
|
||||
if (!/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(id))
|
||||
throw new TeacherError(400, 'teacher_topic_invalid', '老师话题标识无效。');
|
||||
throw new TeacherError(400, 'teacher_topic_invalid', '智能体话题标识无效。');
|
||||
return id;
|
||||
}
|
||||
export class TeacherTopicStore {
|
||||
@@ -35,7 +35,7 @@ export class TeacherTopicStore {
|
||||
.map((topic) => ({
|
||||
id: topic.id,
|
||||
title: topic.requests.find((request) => request.intent !== 'check-in')?.text.slice(0, 32)
|
||||
|| (topic.requests.some((request) => request.intent === 'check-in') ? '和老师聊聊' : '新话题'),
|
||||
|| (topic.requests.some((request) => request.intent === 'check-in') ? '和智能体聊聊' : '新话题'),
|
||||
updatedAt: topic.updatedAt,
|
||||
version: topic.version,
|
||||
}))
|
||||
@@ -54,10 +54,10 @@ export class TeacherTopicStore {
|
||||
try {
|
||||
topic = (await readJsonFile(path.join(this.directory, id + '.json'))) as TeacherTopic;
|
||||
} catch {
|
||||
throw new TeacherError(404, 'teacher_topic_not_found', '老师话题不存在或无法读取。');
|
||||
throw new TeacherError(404, 'teacher_topic_not_found', '智能体话题不存在或无法读取。');
|
||||
}
|
||||
if (topic.id !== id || topic.schemaVersion !== 1 || !Array.isArray(topic.requests))
|
||||
throw new TeacherError(409, 'teacher_topic_invalid', '老师历史无法读取。');
|
||||
throw new TeacherError(409, 'teacher_topic_invalid', '智能体历史无法读取。');
|
||||
let recovered = false;
|
||||
if (topic.discussion) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user