diff --git a/console-ui/public/portal/index.html b/console-ui/public/portal/index.html
index d1669f4..fa5f21c 100644
--- a/console-ui/public/portal/index.html
+++ b/console-ui/public/portal/index.html
@@ -331,6 +331,25 @@
+
+
+
同步小幫手
+
把你電腦上的資料夾變成知識庫。換電腦或重裝時可以再下載一次。
+
+
下載 Mac 版
+
封測版未簽章,第一次請右鍵→打開。裝好第一次開啟時,貼上這個網址+你的帳號密碼就連上了。
+
+
+
@@ -356,17 +375,9 @@
庫目錄管理
- 這裡是「庫」的登記簿——條目歸哪個庫由資料導入(ingest)時蓋章決定;未蓋章的舊資料一律視同 general。標了「圖譜來源」的庫決定誰能用圖譜模式(全都沒標=預設 general)。
-
-
-
登記新庫
-
-
-
-
-
-
-
+
+ 裝好
同步小幫手並選好要看守的資料夾之後,每個資料夾會自動成為一個「庫」出現在下面——
不需要人工新增。下面還是空的,代表小幫手還沒裝好或還沒選資料夾。標了「圖譜來源」的庫決定誰能用圖譜模式(全都沒標=預設 general)。
@@ -656,6 +667,36 @@ function taipeiMonthDay(ms) { var d = new Date(ms + TAIPEI_OFFSET_MS); return {
})
.catch(function (e) { $('login-submit').disabled = false; $('login-status').textContent = friendlyErr(e); });
}
+ // 07-27:設定頁的常駐入口(下載小幫手/換 AI 金鑰)——與一次性卡片同一組 API
+ (function () {
+ var dl = $('st-daemon-dl');
+ if (dl) {
+ var u = (window.ARCRUN_CONFIG && window.ARCRUN_CONFIG.daemonDownload)
+ || 'https://raw.githubusercontent.com/youlinhsieh/arcrun-rag-bundles/main/daemon/ArcrunRAG-mac-unsigned.zip';
+ dl.setAttribute('href', u);
+ }
+ var kb = $('st-key-save');
+ if (kb) kb.addEventListener('click', function () {
+ var k = ($('st-key').value || '').trim();
+ var m = $('st-key-status');
+ if (!k) { m.textContent = '請先貼上金鑰'; m.style.color = ''; return; }
+ kb.disabled = true; m.textContent = '儲存中…'; m.style.color = '';
+ fetch(API_BASE + '/portal/admin/chat-key', {
+ method: 'POST',
+ headers: Object.assign({ 'Content-Type': 'application/json' }, authHeaders()),
+ body: JSON.stringify({ key: k })
+ }).then(function (r) { return r.json().then(function (d) { return { ok: r.ok, d: d }; }); })
+ .then(function (x) {
+ kb.disabled = false;
+ if (guard401(x.status)) return;
+ if (!x.ok) { m.textContent = (x.d && x.d.error) || '儲存失敗'; m.style.color = '#b4462f'; return; }
+ $('st-key').value = '';
+ m.textContent = '已儲存,AI 問答可以用了'; m.style.color = '#3f7a4f';
+ })
+ .catch(function (e) { kb.disabled = false; m.textContent = friendlyErr(e); m.style.color = '#b4462f'; });
+ });
+ })();
+
$('st-logout').addEventListener('click', function () {
fetch(API_BASE + '/portal/logout', { method: 'POST', headers: authHeaders() }).catch(function () { /* 盡力而為 */ });
dropSession();
@@ -1369,28 +1410,6 @@ function taipeiMonthDay(ms) { var d = new Date(ms + TAIPEI_OFFSET_MS); return {
.catch(function (e) { $('ad-nu-create').disabled = false; st.textContent = friendlyErr(e); });
});
- // 登記新庫
- $('ad-nl-create').addEventListener('click', function () {
- var name = $('ad-nl-name').value.trim();
- var st = $('ad-nl-status');
- if (!name) { st.textContent = '請填庫名(英數 _ -)'; return; }
- st.textContent = '';
- $('ad-nl-create').disabled = true;
- adminApi('POST', '/portal/admin/libraries', {
- name: name,
- display_name: $('ad-nl-display').value.trim(),
- description: $('ad-nl-desc').value.trim()
- })
- .then(function (x) {
- $('ad-nl-create').disabled = false;
- if (guard401(x.status)) return;
- if (!x.ok) { st.textContent = x.d.error || ('登記失敗(HTTP ' + x.status + ')'); return; }
- $('ad-nl-name').value = ''; $('ad-nl-display').value = ''; $('ad-nl-desc').value = '';
- toast('庫已登記');
- loadAdmin();
- })
- .catch(function (e) { $('ad-nl-create').disabled = false; st.textContent = friendlyErr(e); });
- });
// 「全部知識庫」勾選 → 其餘庫勾選框連動停用(存的就是 ["*"],個別勾選無意義)
document.addEventListener('change', function (ev) {