ГЛОБАЛЬНЫЙ РЕФАКТОРИНГ АРХИТЕКТУРЫ - Рефакторинг этапов 2.40: вынос runAddressLaneAttempt (с merge контекста и вызовом addressQueryService) в отдельный runtime-адаптер из handleMessage
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import type { AssistantAddressLaneLike } from "./assistantAddressLaneRuntimeAdapter";
|
||||
import type { AssistantAddressCarryoverLike } from "./assistantAddressOrchestrationRuntimeAdapter";
|
||||
|
||||
export interface RunAssistantAddressLaneAttemptRuntimeInput {
|
||||
messageUsed: string;
|
||||
carryMeta: AssistantAddressCarryoverLike | null;
|
||||
analysisDateHint: string | null;
|
||||
activeOrganization: string | null;
|
||||
mergeFollowupContextWithOrganizationScope: (
|
||||
followupContext: Record<string, unknown> | null,
|
||||
organization: string | null
|
||||
) => Record<string, unknown> | null;
|
||||
runAddressQueryTryHandle: (
|
||||
messageUsed: string,
|
||||
options: {
|
||||
followupContext?: Record<string, unknown>;
|
||||
analysisDateHint?: string | null;
|
||||
}
|
||||
) => Promise<AssistantAddressLaneLike | null>;
|
||||
}
|
||||
|
||||
export async function runAssistantAddressLaneAttemptRuntime(
|
||||
input: RunAssistantAddressLaneAttemptRuntimeInput
|
||||
): Promise<AssistantAddressLaneLike | null> {
|
||||
const followupContext =
|
||||
input.carryMeta?.followupContext && typeof input.carryMeta.followupContext === "object"
|
||||
? (input.carryMeta.followupContext as Record<string, unknown>)
|
||||
: null;
|
||||
const scopedFollowupContext = input.mergeFollowupContextWithOrganizationScope(
|
||||
followupContext,
|
||||
input.activeOrganization
|
||||
);
|
||||
if (scopedFollowupContext) {
|
||||
return input.runAddressQueryTryHandle(input.messageUsed, {
|
||||
followupContext: scopedFollowupContext,
|
||||
analysisDateHint: input.analysisDateHint
|
||||
});
|
||||
}
|
||||
return input.runAddressQueryTryHandle(input.messageUsed, {
|
||||
analysisDateHint: input.analysisDateHint
|
||||
});
|
||||
}
|
||||
@@ -33,6 +33,7 @@ import * as assistantDeepTurnNormalizationRuntimeAdapter_1 from "./assistantDeep
|
||||
import * as assistantDeepTurnResponseRuntimeAdapter_1 from "./assistantDeepTurnResponseRuntimeAdapter";
|
||||
import * as assistantDeepTurnRetrievalRuntimeAdapter_1 from "./assistantDeepTurnRetrievalRuntimeAdapter";
|
||||
import * as assistantAddressRuntimeAdapter_1 from "./assistantAddressRuntimeAdapter";
|
||||
import * as assistantAddressLaneAttemptRuntimeAdapter_1 from "./assistantAddressLaneAttemptRuntimeAdapter";
|
||||
import * as assistantLivingChatHandlerRuntimeAdapter_1 from "./assistantLivingChatHandlerRuntimeAdapter";
|
||||
import * as assistantLivingChatLlmRuntimeAdapter_1 from "./assistantLivingChatLlmRuntimeAdapter";
|
||||
import * as assistantUserTurnBootstrapRuntimeAdapter_1 from "./assistantUserTurnBootstrapRuntimeAdapter";
|
||||
@@ -4431,18 +4432,14 @@ export class AssistantService {
|
||||
});
|
||||
};
|
||||
let addressRuntimeMetaForDeep = null;
|
||||
const runAddressLaneAttempt = async (messageUsed, carryMeta, analysisDateHint) => {
|
||||
const scopedFollowupContext = mergeFollowupContextWithOrganizationScope(carryMeta?.followupContext ?? null, sessionOrganizationScope.activeOrganization);
|
||||
if (scopedFollowupContext) {
|
||||
return this.addressQueryService.tryHandle(messageUsed, {
|
||||
followupContext: scopedFollowupContext,
|
||||
analysisDateHint
|
||||
});
|
||||
}
|
||||
return this.addressQueryService.tryHandle(messageUsed, {
|
||||
analysisDateHint
|
||||
});
|
||||
};
|
||||
const runAddressLaneAttempt = async (messageUsed, carryMeta, analysisDateHint) => (0, assistantAddressLaneAttemptRuntimeAdapter_1.runAssistantAddressLaneAttemptRuntime)({
|
||||
messageUsed,
|
||||
carryMeta: carryMeta ?? null,
|
||||
analysisDateHint: analysisDateHint ?? null,
|
||||
activeOrganization: sessionOrganizationScope.activeOrganization,
|
||||
mergeFollowupContextWithOrganizationScope,
|
||||
runAddressQueryTryHandle: (laneMessageUsed, options) => this.addressQueryService.tryHandle(laneMessageUsed, options)
|
||||
});
|
||||
const addressRuntime = await (0, assistantAddressRuntimeAdapter_1.runAssistantAddressRuntime)({
|
||||
featureAssistantAddressQueryV1: config_1.FEATURE_ASSISTANT_ADDRESS_QUERY_V1,
|
||||
sessionId,
|
||||
|
||||
Reference in New Issue
Block a user