Skip to content

Commit 6b5c9c6

Browse files
feat(config): add YAML support for model client configuration
1 parent a608453 commit 6b5c9c6

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

frontend/src/components/settings.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import SignInModal from "./signin";
55
import { useSettingsStore, generateOpenAIModelConfig } from "./store";
66
import MonacoEditor from "@monaco-editor/react";
77
import { settingsAPI } from "./views/api";
8+
import * as yaml from 'js-yaml';
89
import {
910
Input,
1011
Switch,
@@ -604,11 +605,16 @@ action_guard_client: *client
604605
Advanced Configuration (YAML)
605606
</div>
606607
<MonacoEditor
607-
value={config.model_configs}
608+
value={yaml.dump(config.model_client_configs)}
608609
onChange={(value) => {
609-
handleUpdateConfig({
610-
model_configs: value,
611-
});
610+
try {
611+
const parsed = yaml.load(value || '');
612+
handleUpdateConfig({
613+
model_client_configs: parsed,
614+
});
615+
} catch (e) {
616+
// Invalid YAML, don't update
617+
}
612618
}}
613619
language="yaml"
614620
height="300px"

0 commit comments

Comments
 (0)