fix(teacher): 区分读取额度与上下文失效

This commit is contained in:
2026-09-26 18:03:47 +08:00
parent 287dcd303d
commit 60c20f996e
4 changed files with 106 additions and 7 deletions

View File

@@ -300,18 +300,20 @@ export function prepareCloudTeacher(
'teacher_interaction_unsupported',
'智能体请求了当前面板不支持的交互,请联系运营调整该智能体。'
);
if (
pending.context_id !== requestId ||
!Array.isArray(pending.calls) ||
!pending.calls.length ||
pending.calls.length > 32 ||
++rounds > 6
)
if (pending.context_id !== requestId)
throw new TeacherError(
409,
'teacher_context_expired',
'智能体读取请求已失效,请重新提问。'
);
if (!Array.isArray(pending.calls) || !pending.calls.length || pending.calls.length > 32)
throw new TeacherError(502, 'teacher_protocol_invalid', '智能体读取请求格式无效,请重试。');
if (++rounds > 6)
throw new TeacherError(
409,
'teacher_read_limit',
'智能体已达到本次读取上限,但尚未完成回答。请缩小检查范围后重试。'
);
onProgress('正在读取项目与会话…');
const results = [];
for (const raw of pending.calls) {