{#snippet systemPromptField(value: string, onInput: (v: string) => void, placeholder: string)}
{$t('models.systemPrompt')}
{#if value.trim()} {/if}
{#if showVariables}
{#each TEMPLATE_VARIABLES as v}
{`{{${v.name}}}`} {v.desc}
{/each}
{/if}
{/snippet} {#snippet paramRows( rows: ParamRow[], onInput: () => void, onRemove: (i: number) => void, onAdd: () => void )}
{$t('models.requestParams')} {#each rows as row, i}
{/each}
{/snippet} {#snippet compactThresholdField( inputId: string, value: number | null, onInput: (value: number | null) => void )}
onInput(readThresholdInput(e))} min="1" step="1" placeholder={$t('admin.compactTokenThreshold')} class="w-24 h-7 px-2 rounded-lg text-xs bg-gray-100 dark:bg-white/6 text-gray-700 dark:text-gray-300 border border-gray-200 dark:border-white/8 outline-none focus:border-blue-400 dark:focus:border-blue-500 transition-colors" /> {$t('admin.compactTokenThresholdUnit')}
{/snippet} {#snippet builtinToolsField( tools: BuiltinToolsConfig, inherited: BuiltinToolsConfig | null, onChange: (tools: BuiltinToolsConfig) => void, resetLabel: string )}
{$t('models.builtinTools')} {#if Object.keys(tools).length > 0} {/if}
{#each BUILTIN_TOOL_GROUPS as group}
{$t(group.label)}
{$t(group.desc)}
onChange(setBuiltinEnabled(tools, group.id, enabled, inherited))} />
{/each}
{/snippet}
{#if loading}
{:else}

{$t('admin.models')}

{$t('models.defaultModel')}

{$t('models.defaultModelHint')}

{$t('admin.contextCompaction')}

(compactDirty = true)} min="10000" max="1000000" step="10000" class="w-24 h-7 px-2 rounded-lg text-xs bg-gray-100 dark:bg-white/6 text-gray-700 dark:text-gray-300 border border-gray-200 dark:border-white/8 outline-none focus:border-blue-400 dark:focus:border-blue-500 transition-colors" /> {$t('admin.compactTokenThresholdUnit')}

{$t('admin.compactTokenThresholdHint')}

{#if globalExpanded} {@render compactThresholdField( 'global-compact-threshold', globalCompactTokenThreshold, (value) => { globalCompactTokenThreshold = value; globalDirty = true; } )} {@render systemPromptField( globalSystemPrompt, (v) => { globalSystemPrompt = v; globalDirty = true; }, DEFAULT_PROMPT_PLACEHOLDER )} {@render builtinToolsField( globalBuiltinTools, null, (tools) => { globalBuiltinTools = tools; globalDirty = true; }, $t('models.resetToDefault') )} {@render paramRows( globalRows, () => (globalDirty = true), (i) => { globalRows = globalRows.filter((_, idx) => idx !== i); globalDirty = true; }, () => { globalRows = [...globalRows, { key: '', value: '' }]; globalDirty = true; } )} {/if} {#each models as model} {#if selectedId === model.id} {@render compactThresholdField( `model-${model.id}-compact-threshold`, model.compactTokenThreshold, (value) => { model.compactTokenThreshold = value; model.dirty = true; } )} {@render systemPromptField( model.systemPrompt, (v) => { model.systemPrompt = v; model.dirty = true; }, $t('models.systemPromptInherited') )} {@render builtinToolsField( model.builtinTools, globalBuiltinTools, (tools) => { model.builtinTools = tools; model.dirty = true; models = [...models]; }, $t('models.resetToDefault') )} {@render paramRows( model.rows, () => (model.dirty = true), (i) => { model.rows = model.rows.filter((_, idx) => idx !== i); model.dirty = true; }, () => { model.rows = [...model.rows, { key: '', value: '' }]; model.dirty = true; } )} {/if} {/each} {#if models.length === 0}

{$t('models.noModels')}

{/if}
{/if}