diff --git a/frontend/src/routes/command-configs/+page.svelte b/frontend/src/routes/command-configs/+page.svelte
index 5858963..d8663fa 100644
--- a/frontend/src/routes/command-configs/+page.svelte
+++ b/frontend/src/routes/command-configs/+page.svelte
@@ -62,7 +62,14 @@
finally { loaded = true; }
}
- function openNew() { form = defaultForm(); editing = null; showForm = true; }
+ function openNew() {
+ form = defaultForm();
+ // Auto-select first matching template for the default provider_type
+ const match = cmdTemplateConfigs.find((c: any) => c.provider_type === form.provider_type);
+ if (match) form.command_template_config_id = match.id;
+ editing = null;
+ showForm = true;
+ }
function editConfig(cfg: any) {
form = {
name: cfg.name,
@@ -71,9 +78,9 @@
enabled_commands: [...(cfg.enabled_commands || [])],
locale: cfg.locale || 'en',
response_mode: cfg.response_mode || 'media',
- default_count: cfg.default_count || 5,
- rate_limits: { search: cfg.rate_limits?.search || 30, default: cfg.rate_limits?.default || 10 },
- command_template_config_id: cfg.command_template_config_id || null,
+ default_count: cfg.default_count ?? 5,
+ rate_limits: { search: cfg.rate_limits?.search ?? 30, default: cfg.rate_limits?.default ?? 10 },
+ command_template_config_id: cfg.command_template_config_id ?? null,
};
editing = cfg.id;
showForm = true;
@@ -167,7 +174,6 @@