fix(confidence-engine): expose reconstruction validation issues
This commit is contained in:
+5
-3
@@ -91,7 +91,7 @@ export async function analyseScenario(scenario, opts = {}) {
|
||||
try {
|
||||
rawResponseStr = JSON.stringify(rawResponse);
|
||||
} catch {
|
||||
rawResponseStr = String(rawResponse).slice(0, 2000);
|
||||
rawResponseStr = String(rawResponse);
|
||||
}
|
||||
|
||||
const compatibility = normaliseAnalysisResponse(rawResponse);
|
||||
@@ -129,7 +129,7 @@ export async function analyseScenario(scenario, opts = {}) {
|
||||
|
||||
// ── Neither schema matched — partial failure ───────
|
||||
return buildPartialResult(
|
||||
rawResponseStr?.slice(0, 2000),
|
||||
rawResponseStr,
|
||||
resultV2.error ?? resultV1.error,
|
||||
OLLAMA_MODEL,
|
||||
duration,
|
||||
@@ -218,6 +218,7 @@ function buildPartialResult(
|
||||
compatibility,
|
||||
) {
|
||||
let errors = [];
|
||||
const validationIssues = error?.issues ?? [];
|
||||
if (error && typeof error.flatten === "function") {
|
||||
errors = error.flatten().fieldErrors
|
||||
? Object.entries(error.flatten().fieldErrors).flatMap(([k, v]) => [
|
||||
@@ -233,13 +234,14 @@ function buildPartialResult(
|
||||
validationStatus: "invalid",
|
||||
modelName: model,
|
||||
responseDurationMs: duration,
|
||||
rawResponse: rawResp?.slice(0, 2000),
|
||||
rawResponse: rawResp,
|
||||
promptVersion: version,
|
||||
inputClassification: null,
|
||||
reconstruction: null,
|
||||
evidence: undefined,
|
||||
nextQuestion: undefined,
|
||||
errors,
|
||||
validationIssues,
|
||||
...buildCompatibilityDiagnostics(compatibility),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user