fix(confidence-engine): unwrap focused deconstruction response
This commit is contained in:
@@ -52,11 +52,14 @@ export async function POST(request) {
|
||||
|
||||
const provider = getProvider();
|
||||
const startedAt = Date.now();
|
||||
const raw = await provider.generateReconstruction(prompt, process.env.OLLAMA_MODEL);
|
||||
const wrapper = await provider.generateReconstruction(prompt, process.env.OLLAMA_MODEL);
|
||||
const elapsedMs = Date.now() - startedAt;
|
||||
|
||||
// Unwrap the semantic deconstruction from the provider envelope.
|
||||
const deconstruction = wrapper.response;
|
||||
|
||||
// Validate schema (required fields present, no graph-mutation fields)
|
||||
const validationErrors = validateFocusedDeconstructSchema(raw);
|
||||
const validationErrors = validateFocusedDeconstructSchema(deconstruction);
|
||||
if (validationErrors.length > 0) {
|
||||
return Response.json(
|
||||
{
|
||||
@@ -73,11 +76,11 @@ export async function POST(request) {
|
||||
return Response.json({
|
||||
success: true,
|
||||
targetNodeId: body.targetNodeId,
|
||||
observations: raw.observations,
|
||||
uncertainties: raw.uncertainties,
|
||||
assumptions: raw.assumptions,
|
||||
relationships: raw.relationships,
|
||||
possibleFollowUpQuestions: raw.possibleFollowUpQuestions,
|
||||
observations: deconstruction.observations,
|
||||
uncertainties: deconstruction.uncertainties,
|
||||
assumptions: deconstruction.assumptions,
|
||||
relationships: deconstruction.relationships,
|
||||
possibleFollowUpQuestions: deconstruction.possibleFollowUpQuestions,
|
||||
elapsedMs,
|
||||
});
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user