fix(confidence-engine): retain successful provider path
This commit is contained in:
+16
-1
@@ -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
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user