fix(coding-teacher): restore context and read project files

This commit is contained in:
2026-09-22 19:12:59 +08:00
parent 7f5131e92f
commit 44e754a43e
14 changed files with 626 additions and 37 deletions

View File

@@ -276,7 +276,13 @@ export class CodingTeacherService {
throw new TeacherError(422, 'teacher_definition_invalid', '请先配置老师的系统提示词。');
const model = await (this.options.prepareModel ?? prepareTeacherModel)(
account,
topic.definition
topic.definition,
scope.projectId === 'preview' ? undefined : {
projectPath: (await this.options.projects.getProject(scope.projectId)).path,
source,
history: topic.requests,
assertCurrent: () => this.assertAccount(account),
}
);
const compiled = compileTeacherContext(
topic.definition,
@@ -284,7 +290,8 @@ export class CodingTeacherService {
topic.requests,
input.text,
references,
model.inputLimit
model.inputLimit,
scope.projectId !== 'preview'
);
const request = {
id: input.requestId,
@@ -295,6 +302,7 @@ export class CodingTeacherService {
sourceCapturedAt: source.capturedAt,
includedSourceMessageIds: compiled.includedSourceMessageIds,
omittedMessages: compiled.omittedMessages,
truncatedMessages: compiled.truncatedMessages,
status: 'preparing' as const,
response: '',
};