fix(confidence-engine): retain successful provider path

This commit is contained in:
2026-09-05 17:12:31 +01:00
parent dabd9e2245
commit 46b9bd8b03
5 changed files with 34 additions and 3 deletions
+16 -1
View File
@@ -72,11 +72,23 @@ export async function analyseScenario(scenario, opts = {}) {
// ── Call provider ──────────────────────────────────
const provider = getProvider();
let rawResponse;
let providerApiPath;
try {
rawResponse = await provider.generateReconstruction(
const providerResult = await provider.generateReconstruction(
promptObj.prompt,
OLLAMA_MODEL,
);
if (
providerResult &&
typeof providerResult === "object" &&
"response" in providerResult &&
"providerApiPath" in providerResult
) {
rawResponse = providerResult.response;
providerApiPath = providerResult.providerApiPath;
} else {
rawResponse = providerResult;
}
} catch (e) {
return buildErrorResponse(
e.message || "Provider error during analysis",
@@ -137,6 +149,7 @@ export async function analyseScenario(scenario, opts = {}) {
duration,
promptVersion,
compatibility,
providerApiPath,
);
}
@@ -219,6 +232,7 @@ function buildPartialResult(
duration,
version,
compatibility,
providerApiPath,
) {
let errors = [];
const validationIssues = error?.issues ?? [];
@@ -245,6 +259,7 @@ function buildPartialResult(
nextQuestion: undefined,
errors,
validationIssues,
providerApiPath,
...buildCompatibilityDiagnostics(compatibility),
};
}
+4 -1
View File
@@ -247,7 +247,10 @@ class OllamaLlmProvider {
// Step 5: Parse and return
// ================================================================
try {
return recoverJson(rawResponse);
return {
response: recoverJson(rawResponse),
providerApiPath: apiUsed,
};
} catch (e) {
if (e instanceof SyntaxError) {
const error = new Error(