fix: handle 404 gracefully for admin config endpoint

- loadConfig now uses default values when config file doesn't exist (404)
- No error shown to user when config file is missing
- Config tab loads with empty defaults instead of error message
This commit is contained in:
2026-10-27 02:37:30 +08:00
parent 969b4d85ef
commit 776cf197c8

View File

@@ -1296,6 +1296,17 @@ async function loadConfig() {
configError.value = ''
try {
const res = await fetch('/api/v1/admin/config')
if (res.status === 404) {
// Config file doesn't exist yet, use defaults
vlmPrompts.value = {}
llmConfig.value = {}
processorConfig.value = {}
filterConfig.value = {}
systemConfig.value = {}
searchConfig.value = { vlm_min_score: 0.0, vlm_max_results: 5, vlm_output_language: 'en' }
pipelineConfig.value = { enabled: false, max_concurrent_stages: 3, default_timeout_secs: 3600 }
return
}
if (!res.ok) throw new Error(`HTTP ${res.status}`)
const data = await res.json()
vlmPrompts.value = data.vlm_prompts || {}