feat(ai-chat): AI 导入确认流程完善并清理代码质量
- 新增导入确认/映射解析辅助,支持预检后生成导入向导 - 抽取 parseAttachmentArgs/beginImportToolRun 等重复逻辑 - 双重类型断言改为运行时守卫,消除 aislop 告警
This commit is contained in:
@@ -58,7 +58,9 @@ import {
|
||||
} from './ai-chat.streaming';
|
||||
import {
|
||||
resolveFormConversationId,
|
||||
resolvePreflightConversationId,
|
||||
resolveReviewConversationId,
|
||||
resolveImportPreflight,
|
||||
submitForm,
|
||||
submitReview,
|
||||
confirmReviewStep,
|
||||
@@ -297,10 +299,10 @@ export class AiChatService implements AiChatServiceContext {
|
||||
executePreflightImport(
|
||||
messageId: number,
|
||||
call: ModelToolCall,
|
||||
userId: number,
|
||||
context: ReturnType<typeof AgentToolContextFactory.fromAuthenticatedUser>,
|
||||
emit: AiSseEmitter,
|
||||
): Promise<string> {
|
||||
return executePreflightImport(this, messageId, call, userId, emit);
|
||||
return executePreflightImport(this, messageId, call, context, emit);
|
||||
}
|
||||
|
||||
executeGeneration(input: GenerationInput): Promise<void> {
|
||||
@@ -407,6 +409,10 @@ export class AiChatService implements AiChatServiceContext {
|
||||
return resolveReviewConversationId(this, userId, reviewId);
|
||||
}
|
||||
|
||||
resolvePreflightConversationId(userId: number, messageId: number): Promise<number> {
|
||||
return resolvePreflightConversationId(this, userId, messageId);
|
||||
}
|
||||
|
||||
submitForm(
|
||||
user: AuthenticatedUser,
|
||||
formId: string,
|
||||
@@ -433,6 +439,21 @@ export class AiChatService implements AiChatServiceContext {
|
||||
return submitReview(this, user, reviewId, dto, signal, emit, onReady);
|
||||
}
|
||||
|
||||
resolveImportPreflight(
|
||||
user: AuthenticatedUser,
|
||||
messageId: number,
|
||||
dto: {
|
||||
clientRequestId: string;
|
||||
mapping?: Record<string, unknown>;
|
||||
settings?: Record<string, unknown>;
|
||||
},
|
||||
signal: AbortSignal,
|
||||
emit: AiSseEmitter,
|
||||
onReady: () => void,
|
||||
): Promise<void> {
|
||||
return resolveImportPreflight(this, user, messageId, dto, signal, emit, onReady);
|
||||
}
|
||||
|
||||
confirmReviewStep(
|
||||
user: AuthenticatedUser,
|
||||
reviewId: string,
|
||||
|
||||
Reference in New Issue
Block a user