fix(coding-teacher): restore context and read project files
This commit is contained in:
@@ -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: '',
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user