| 17 | |
| 18 | /** Project stored settings onto engine runtime overrides (only set fields). */ |
| 19 | export function settingsToRuntime(settings: Settings): Record<string, unknown> { |
| 20 | const runtime: Record<string, unknown> = {}; |
| 21 | if (settings.llmProvider) runtime.llmProvider = settings.llmProvider; |
| 22 | if (settings.deepThinkLlm) runtime.deepThinkLlm = settings.deepThinkLlm; |
| 23 | if (settings.quickThinkLlm) runtime.quickThinkLlm = settings.quickThinkLlm; |
| 24 | if (settings.backendUrl) runtime.backendUrl = settings.backendUrl; |
| 25 | if (settings.outputLanguage) runtime.outputLanguage = settings.outputLanguage; |
| 26 | if (settings.maxDebateRounds) runtime.maxDebateRounds = settings.maxDebateRounds; |
| 27 | if (settings.maxRiskDiscussRounds) |
| 28 | runtime.maxRiskDiscussRounds = settings.maxRiskDiscussRounds; |
| 29 | if (settings.dataVendors) runtime.dataVendors = settings.dataVendors; |
| 30 | return runtime; |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Builds (and caches) a per-user engine. Config is DEFAULT_CONFIG → env → the |