АРЧ АП11 - Архитектура после регресса: Архитектура: исправить deep-turn normalizer schema contract и вернуть hybrid follow-up authority в phase13 replay
This commit is contained in:
+30
-2
@@ -1,6 +1,24 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.buildAssistantDeepTurnNormalizationRuntime = buildAssistantDeepTurnNormalizationRuntime;
|
||||
const routeHintAdapter_1 = require("./routeHintAdapter");
|
||||
function resolveDeepTurnNormalizerPromptVersion(promptVersion) {
|
||||
const normalized = String(promptVersion ?? "").trim().toLowerCase();
|
||||
if (normalized === "normalizer_v2_0_2" ||
|
||||
normalized === "normalizer_v2_0_1" ||
|
||||
normalized === "normalizer_v2" ||
|
||||
normalized === "normalizer_v1") {
|
||||
return String(promptVersion);
|
||||
}
|
||||
return "normalizer_v2_0_2";
|
||||
}
|
||||
function canSynthesizeRouteSummary(normalized) {
|
||||
if (!normalized || typeof normalized !== "object") {
|
||||
return false;
|
||||
}
|
||||
const source = normalized;
|
||||
return Array.isArray(source.fragments);
|
||||
}
|
||||
async function buildAssistantDeepTurnNormalizationRuntime(input) {
|
||||
const investigationState = input.sessionInvestigationState;
|
||||
const canUseFollowupBinding = input.featureInvestigationStateV1 &&
|
||||
@@ -25,7 +43,8 @@ async function buildAssistantDeepTurnNormalizationRuntime(input) {
|
||||
baseUrl: input.payload.baseUrl,
|
||||
temperature: input.payload.temperature,
|
||||
maxOutputTokens: input.payload.maxOutputTokens,
|
||||
promptVersion: input.payload.promptVersion ?? "address_query_runtime_v1",
|
||||
promptVersion: resolveDeepTurnNormalizerPromptVersion(input.payload.promptVersion),
|
||||
schemaVersion: "v2_0_2",
|
||||
systemPrompt: input.payload.systemPrompt,
|
||||
developerPrompt: input.payload.developerPrompt,
|
||||
domainPrompt: input.payload.domainPrompt,
|
||||
@@ -35,9 +54,18 @@ async function buildAssistantDeepTurnNormalizationRuntime(input) {
|
||||
useMock: Boolean(input.payload.useMock)
|
||||
};
|
||||
const normalized = await input.normalize(normalizePayload);
|
||||
const normalizedPayload = normalized.normalized;
|
||||
const synthesizedRouteSummary = normalized.route_hint_summary ??
|
||||
(normalizedPayload && canSynthesizeRouteSummary(normalizedPayload) ? (0, routeHintAdapter_1.toRouteHintSummary)(normalizedPayload) : null);
|
||||
const normalizedWithRouteSummary = synthesizedRouteSummary === normalized.route_hint_summary
|
||||
? normalized
|
||||
: {
|
||||
...normalized,
|
||||
route_hint_summary: synthesizedRouteSummary
|
||||
};
|
||||
return {
|
||||
followupBinding,
|
||||
normalizePayload,
|
||||
normalized
|
||||
normalized: normalizedWithRouteSummary
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user