@wendongfly/myhi 1.3.209 → 1.3.210

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.html CHANGED
@@ -965,6 +965,8 @@
965
965
  <div class="set-ctl"><input class="set-inp" id="set-gw-url" placeholder="https://gateway.example.com" autocomplete="off" spellcheck="false"></div></div>
966
966
  <div class="set-item inp"><div class="set-lbl">Token / API Key</div>
967
967
  <div class="set-ctl"><input class="set-inp" id="set-gw-key" type="password" placeholder="Token / API Key" autocomplete="new-password"></div></div>
968
+ <label class="set-item" style="cursor:pointer;align-items:flex-start;gap:0.5rem"><input type="checkbox" id="set-gw-sync" style="margin-top:0.2rem">
969
+ <div class="set-lbl">同时写入 Claude Code 配置<small id="set-gw-sync-hint">终端里直接运行的 claude 也用这个网关。只改 ~/.claude/settings.json 里 env 的网关地址和 Key,其它设置不动,写之前先备份;取消勾选会把写进去的删掉</small></div></label>
968
970
  <div class="set-item" style="justify-content:flex-end"><button class="set-btn" id="set-gw-save" onclick="saveGatewayCfg()">保存</button></div>
969
971
  </div>
970
972
  <div id="set-gw-status" class="set-status"></div>
@@ -1531,15 +1533,19 @@
1531
1533
  document.getElementById('set-gw-url').value = d.baseUrl || '';
1532
1534
  document.getElementById('set-gw-key').value = '';
1533
1535
  document.getElementById('set-gw-key').placeholder = d.hasKey ? `已设置(${d.apiKey}),留空保持不变` : 'Token / API Key';
1536
+ const sync = document.getElementById('set-gw-sync');
1537
+ sync.checked = !!d.syncClaude;
1538
+ if (d.claudeSettings) document.getElementById('set-gw-sync-hint').textContent = `终端里直接运行的 claude 也用这个网关。只改 ${d.claudeSettings} 里 env 的网关地址和 Key,其它设置不动,写之前先备份(.myhi-bak);取消勾选会把写进去的删掉`;
1534
1539
  const btn = document.getElementById('set-gw-save');
1535
1540
  btn.classList.remove('dirty');
1536
1541
  ['set-gw-url', 'set-gw-key'].forEach(id => document.getElementById(id).oninput = () => btn.classList.add('dirty'));
1542
+ sync.onchange = () => btn.classList.add('dirty');
1537
1543
  }
1538
1544
  window.saveGatewayCfg = async function() {
1539
1545
  const baseUrl = document.getElementById('set-gw-url').value.trim(), apiKey = document.getElementById('set-gw-key').value.trim();
1540
1546
  if (baseUrl && !/^https?:\/\//i.test(baseUrl)) { setStatus('set-gw-status', '网关地址要以 http:// 或 https:// 开头'); return; }
1541
- let r; try { r = await (await fetch('/api/gateway', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ baseUrl, apiKey }) })).json(); } catch (e) { r = { error: e.message }; }
1542
- setStatus('set-gw-status', r.ok ? '已保存:新建的任务走新网关;正在跑的任务下次重启 AI 后生效' : '保存失败:' + (r.error || ''));
1547
+ let r; try { r = await (await fetch('/api/gateway', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ baseUrl, apiKey, syncClaude: document.getElementById('set-gw-sync').checked }) })).json(); } catch (e) { r = { error: e.message }; }
1548
+ setStatus('set-gw-status', r.ok ? '已保存:新建的任务走新网关;正在跑的任务下次重启 AI 后生效' + (r.synced ? `。已同步到 ${r.synced},终端里新开的 claude 生效` : '') : '保存失败:' + (r.error || ''));
1543
1549
  if (r.ok) { await loadGatewayCfg(); fetch('/api/models?refresh=1').catch(() => {}).finally(loadSceneModels); }
1544
1550
  };
1545
1551
 
Binary file