experiment(confidence-engine): route UI journey provider centrally
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
import { analyseScenario } from "../analysis.js";
|
||||
import { assertConfig } from "../config.js";
|
||||
import { getProvider } from "../llm/provider.js";
|
||||
import { getProvider, getProviderModelName } from "@/lib/llm/provider.js";
|
||||
import {
|
||||
makeGraph,
|
||||
startCaseRequestSchema,
|
||||
@@ -666,8 +666,8 @@ async function updateCaseWithDependencies(body, dependencies = {}) {
|
||||
const startedAt = Date.now();
|
||||
|
||||
try {
|
||||
const config = dependencies.config ?? assertConfig();
|
||||
modelName = config.OLLAMA_MODEL;
|
||||
if (!dependencies.config) assertConfig();
|
||||
modelName = dependencies.modelName ?? dependencies.config?.modelName ?? dependencies.config?.OLLAMA_MODEL ?? getProviderModelName();
|
||||
|
||||
const prompt = buildPrompt({
|
||||
situationGraph,
|
||||
@@ -1185,7 +1185,7 @@ export async function reconsiderCompletedEpisode(epiParams, deps = {}) {
|
||||
try {
|
||||
// Preserve original priority (deps.modelName > deps.config.OLLAMA_MODEL > getModelName) with assertConfig fallback only when no deps provide a model
|
||||
let resolvedConfig = undefined;
|
||||
if (deps.modelName == null && deps.config?.OLLAMA_MODEL == null && deps.config !== null) {
|
||||
if (deps.modelName == null && deps.config?.OLLAMA_MODEL == null && deps.config?.modelName == null && deps.config !== null) {
|
||||
const hasOtherDeps = Object.keys(deps).some((k) => k !== "config" && k !== "modelName");
|
||||
if (hasOtherDeps) {
|
||||
resolvedConfig = undefined; // don't call assertConfig when deps is non-empty with other keys
|
||||
@@ -1196,8 +1196,9 @@ export async function reconsiderCompletedEpisode(epiParams, deps = {}) {
|
||||
const config = deps.config ?? resolvedConfig;
|
||||
modelName =
|
||||
deps.modelName ??
|
||||
(config != null ? config.OLLAMA_MODEL : undefined) ??
|
||||
(config != null ? (config.modelName ?? config.OLLAMA_MODEL) : undefined) ??
|
||||
getModelName?.() ??
|
||||
getProviderModelName() ??
|
||||
null;
|
||||
|
||||
const promptBuilder = buildEpisodePrompt ?? buildEpisodeAwareGraphPrompt;
|
||||
|
||||
Reference in New Issue
Block a user