98 lines
3.7 KiB
HTML
98 lines
3.7 KiB
HTML
<!DOCTYPE html>
|
|||
|
|
<html lang="zh-CN" data-theme="dark">
|
||
|
|
<head>
|
||
|
|
<meta charset="UTF-8">
|
||
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
|
|
<title>后端服务设置</title>
|
||
|
|
<style>
|
||
|
|
:root { color-scheme: dark; }
|
||
|
|
body {
|
||
|
|
margin: 0;
|
||
|
|
padding: 20px;
|
||
|
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
|
||
|
|
background: #0f1115;
|
||
|
|
color: #e6e8eb;
|
||
|
|
font-size: 13px;
|
||
|
|
user-select: none;
|
||
|
|
}
|
||
|
|
h1 { font-size: 15px; margin: 0 0 4px; font-weight: 600; }
|
||
|
|
p.desc { color: #9aa0a6; margin: 0 0 16px; font-size: 12px; line-height: 1.5; }
|
||
|
|
.field { display: flex; align-items: center; margin-bottom: 10px; gap: 10px; }
|
||
|
|
label { width: 120px; flex: none; color: #c6cad1; font-size: 12px; text-align: right; }
|
||
|
|
input {
|
||
|
|
flex: 1;
|
||
|
|
box-sizing: border-box;
|
||
|
|
padding: 7px 10px;
|
||
|
|
font-size: 12px;
|
||
|
|
color: #e6e8eb;
|
||
|
|
background: #1a1d23;
|
||
|
|
border: 1px solid #2a2f38;
|
||
|
|
border-radius: 6px;
|
||
|
|
outline: none;
|
||
|
|
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||
|
|
}
|
||
|
|
input:focus { border-color: #3b82f6; }
|
||
|
|
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
|
||
|
|
button {
|
||
|
|
padding: 7px 16px;
|
||
|
|
font-size: 13px;
|
||
|
|
border-radius: 6px;
|
||
|
|
border: 1px solid #2a2f38;
|
||
|
|
cursor: pointer;
|
||
|
|
background: #1a1d23;
|
||
|
|
color: #e6e8eb;
|
||
|
|
}
|
||
|
|
button.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
|
||
|
|
button:hover { filter: brightness(1.1); }
|
||
|
|
p.hint { color: #9aa0a6; font-size: 12px; margin: 10px 0 0; min-height: 16px; }
|
||
|
|
</style>
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
<h1>后端服务地址</h1>
|
||
|
|
<p class="desc">各服务地址可指向本机或其它服务器。前端统一经 BFF 总入口访问,由 BFF 内部再路由到其余服务。保存后立即重载。</p>
|
||
|
|
|
||
|
|
<div class="field"><label for="bff">BFF 总入口</label><input id="bff" spellcheck="false"></div>
|
||
|
|
<div class="field"><label for="qa">QA 问答</label><input id="qa" spellcheck="false"></div>
|
||
|
|
<div class="field"><label for="rag">方法学 RAG</label><input id="rag" spellcheck="false"></div>
|
||
|
|
<div class="field"><label for="legacy">旧版 RAG</label><input id="legacy" spellcheck="false"></div>
|
||
|
|
<div class="field"><label for="vstore">文档向量库</label><input id="vstore" spellcheck="false"></div>
|
||
|
|
<div class="field"><label for="paper">论文撰写</label><input id="paper" spellcheck="false"></div>
|
||
|
|
<div class="field"><label for="bioflow">生信 bioflow</label><input id="bioflow" spellcheck="false"></div>
|
||
|
|
|
||
|
|
<div class="actions">
|
||
|
|
<button id="cancel">取消</button>
|
||
|
|
<button id="save" class="primary">保存</button>
|
||
|
|
</div>
|
||
|
|
<p id="hint" class="hint"></p>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
const KEYS = ['bff', 'qa', 'rag', 'legacy', 'vstore', 'paper', 'bioflow'];
|
||
|
|
const hint = document.getElementById('hint');
|
||
|
|
|
||
|
|
window.desktopApi.getConfig().then((services) => {
|
||
|
|
for (const k of KEYS) {
|
||
|
|
const el = document.getElementById(k);
|
||
|
|
if (el) el.value = (services && services[k]) || '';
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
document.getElementById('save').addEventListener('click', async () => {
|
||
|
|
const services = {};
|
||
|
|
for (const k of KEYS) {
|
||
|
|
const el = document.getElementById(k);
|
||
|
|
services[k] = (el && el.value || '').trim();
|
||
|
|
}
|
||
|
|
if (!services.bff) { hint.textContent = 'BFF 总入口不能为空'; return; }
|
||
|
|
try {
|
||
|
|
await window.desktopApi.setConfig(services);
|
||
|
|
window.close();
|
||
|
|
} catch (e) {
|
||
|
|
hint.textContent = '保存失败:' + (e && e.message ? e.message : e);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
document.getElementById('cancel').addEventListener('click', () => window.close());
|
||
|
|
</script>
|
||
|
|
</body>
|
||
|
|
</html>
|