Skip to content

Agent Zero AI framework

FIX: Fix per-subagent model configs

Louis Giliberto45a223dae089
diff --git a/plugins/_model_config/webui/config.html b/plugins/_model_config/webui/config.html
index ebfde4021..31e477ade 100644
--- a/plugins/_model_config/webui/config.html
+++ b/plugins/_model_config/webui/config.html
@@ -7,12 +7,20 @@
</head>
<body>
- <div x-data
+ <div x-data="{ lastConfig: null }"
+ x-effect="
+ if (config && config !== lastConfig) {
+ lastConfig = config;
+ $store.modelConfig.initConfigFields(config);
+ if (typeof context !== 'undefined') {
+ context.settingsSnapshotJson = context._toComparableJson(config);
+ }
+ }
+ "
x-init="
await $store.modelConfig.ensureLoaded();
$store.modelConfig.resetApiKeyDrafts();
await $store.modelConfig.refreshApiKeyStatus();
- $store.modelConfig.initConfigFields(config);
$store.modelConfig.installSettingsHooks(context, config);
">
<template x-if="config && $store.modelConfig._loaded">
@@ -21,7 +29,7 @@
<!-- Model Sections (Main, Utility, Embedding) -->
<template x-for="section in $store.modelConfig.MODEL_SECTIONS" :key="section.key">
<div class="model-section"
- x-data="{ model: config[section.key], modelType: section.key.replace('_model', ''), providers: $store.modelConfig.getProviders(section.key), searchType: $store.modelConfig.getSearchType(section.key), apiKeyMode: 'store' }">
+ x-data="{ get model() { return config[section.key]; }, modelType: section.key.replace('_model', ''), providers: $store.modelConfig.getProviders(section.key), searchType: $store.modelConfig.getSearchType(section.key), apiKeyMode: 'store' }">
<div class="section-title" x-text="section.title"></div>
<div class="section-description" x-text="section.desc"></div>
<x-component path="/plugins/_model_config/webui/model-field.html"></x-component>
diff --git a/plugins/_model_config/webui/model-config-store.js b/plugins/_model_config/webui/model-config-store.js
index 183a4b781..f16056828 100644
--- a/plugins/_model_config/webui/model-config-store.js
+++ b/plugins/_model_config/webui/model-config-store.js
@@ -311,7 +311,7 @@ export const store = createStore("modelConfig", {
context.save = async () => {
context.error = null;
try {
- await this.persistApiKeysForConfig(config);
+ await this.persistApiKeysForConfig(context.settings);
} catch (e) {
context.error = e?.message || 'Failed to save API keys.';
return;