优化日志

This commit is contained in:
h88782481 2026-03-14 10:35:32 +08:00
parent 4de6db13f9
commit 3c4a50dc05
10 changed files with 233 additions and 36 deletions

View file

@ -55,6 +55,17 @@
</div>
<div class="hint" id="envKey"></div>
</div>
<div class="field">
<label>日志模式</label>
<div class="input-wrap">
<select id="debugMode">
<option value="off">关闭</option>
<option value="simple">简易日志(仅控制台)</option>
<option value="verbose">详细日志(写入文件)</option>
</select>
</div>
<div class="hint">关闭:不输出调试日志;简易日志:仅控制台输出;详细日志:额外写入对话级文件日志,并对流式事件做采样截断。</div>
</div>
<button class="btn btn-primary" onclick="saveSettings()">保存设置</button>
</div>

View file

@ -66,6 +66,7 @@ async function loadDashboard() {
const s = await api('/api/admin/settings');
document.getElementById('targetUrl').value = s.proxy_target_url || '';
document.getElementById('proxyKey').value = s.proxy_api_key || '';
document.getElementById('debugMode').value = s.debug_mode || 'off';
document.getElementById('envUrl').textContent = s.env_target_url ? '环境变量: ' + s.env_target_url : '';
document.getElementById('envKey').textContent = s.env_api_key ? '环境变量: (已配置)' : '环境变量: (未设置)';
await loadMappings();
@ -130,6 +131,7 @@ async function saveSettings() {
body: JSON.stringify({
proxy_target_url: document.getElementById('targetUrl').value.trim(),
proxy_api_key: document.getElementById('proxyKey').value.trim(),
debug_mode: document.getElementById('debugMode').value,
}),
});
toast('设置已保存');