dsh-github-copilot 0.1.0-alpha.1.dsh.0.2.1.alpha.5
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/AGENTS.md +439 -0
- package/CHANGELOG.md +875 -0
- package/CONTRIBUTING.md +55 -0
- package/LICENSE +21 -0
- package/README.md +366 -0
- package/README.zh.md +341 -0
- package/SECURITY.md +29 -0
- package/cordis.patch.yml +16 -0
- package/deployment-baseline.json +1580 -0
- package/docs/account-management-experience.md +143 -0
- package/docs/agent-readiness.md +110 -0
- package/docs/auto-high-cost.md +255 -0
- package/docs/auto-iteration-review.json +22 -0
- package/docs/auto-review-sampling.md +60 -0
- package/docs/auto-task-routing.md +341 -0
- package/docs/automatic-model-routing.md +236 -0
- package/docs/copilot-accounts.md +424 -0
- package/docs/copilot-compaction.md +148 -0
- package/docs/copilot-usage.md +133 -0
- package/docs/dual-model.md +66 -0
- package/docs/evidence-driven-iteration.md +86 -0
- package/docs/image-input-compatibility.md +64 -0
- package/docs/images/copilot-accounts-credits.png +0 -0
- package/docs/images/copilot-accounts.png +0 -0
- package/docs/images/copilot-current-provenance.json +39 -0
- package/docs/images/copilot-model-preferences.png +0 -0
- package/docs/images/copilot-search-routing.png +0 -0
- package/docs/images/copilot-session-continuation.png +0 -0
- package/docs/images/dual-model-desktop.png +0 -0
- package/docs/images/dual-model-mobile.png +0 -0
- package/docs/images/dual-model-provenance.json +35 -0
- package/docs/images/parent-model-follow.png +0 -0
- package/docs/manual-compaction-recovery.md +109 -0
- package/docs/mockups/copilot-account-dropdown.html +71 -0
- package/docs/mockups/copilot-account-management.html +393 -0
- package/docs/model-compatibility-acceptance.md +182 -0
- package/docs/npm-distribution.md +202 -0
- package/docs/official-first-016-alpha2.md +66 -0
- package/docs/official-first-020-rc1.md +32 -0
- package/docs/official-first-020-rc2.md +17 -0
- package/docs/official-first-021-alpha4.md +157 -0
- package/docs/official-first-021-alpha5.md +83 -0
- package/docs/plugin-diagnostics.md +605 -0
- package/docs/session-continuation.md +141 -0
- package/docs/session-search-routing.md +133 -0
- package/docs/single-route-migration.md +131 -0
- package/docs/web-lifecycle-rc2.md +55 -0
- package/lib/client.js +13236 -0
- package/lib/client.js.map +1 -0
- package/lib/copilot-identity-DRZY_d2X.js +15 -0
- package/lib/diagnostics-analysis-io.js +78 -0
- package/lib/diagnostics-analysis.js +427 -0
- package/lib/diagnostics-types-CF-qg8Do.js +708 -0
- package/lib/index.js +15661 -0
- package/lib/manual-compaction-recovery.js +485 -0
- package/lib/remote.js +1507 -0
- package/lib/request-budget-DLY_aRq0.js +87 -0
- package/lib/routed-web.js +120 -0
- package/lib/search-routing-CV2hs8as.js +792 -0
- package/lib/types/account-dropdown.d.ts +22 -0
- package/lib/types/account-model-auth.d.ts +15 -0
- package/lib/types/account-model-catalog.d.ts +70 -0
- package/lib/types/account-model-source.d.ts +85 -0
- package/lib/types/agent-compaction.d.ts +4 -0
- package/lib/types/authorization-code-clipboard.d.ts +4 -0
- package/lib/types/authorization-controller.d.ts +121 -0
- package/lib/types/auto-allocation-card.d.ts +9 -0
- package/lib/types/auto-allocation-diagnostics.d.ts +126 -0
- package/lib/types/auto-allocation-evidence.d.ts +44 -0
- package/lib/types/auto-allocation.d.ts +47 -0
- package/lib/types/auto-assessment-evidence.d.ts +111 -0
- package/lib/types/auto-model-host.d.ts +30 -0
- package/lib/types/auto-model-intent.d.ts +36 -0
- package/lib/types/auto-model-presentation.d.ts +57 -0
- package/lib/types/auto-model-routing.d.ts +64 -0
- package/lib/types/auto-review-sampling.d.ts +6 -0
- package/lib/types/auto-selection-explanation.d.ts +9 -0
- package/lib/types/auto-task-assessment.d.ts +49 -0
- package/lib/types/auto-task-classifier.d.ts +10 -0
- package/lib/types/background-compaction.d.ts +30 -0
- package/lib/types/client.d.ts +129 -0
- package/lib/types/compact-account.d.ts +42 -0
- package/lib/types/compaction-continuation-ui.d.ts +29 -0
- package/lib/types/compaction-continuation.d.ts +48 -0
- package/lib/types/compaction-input-estimate.d.ts +28 -0
- package/lib/types/compaction-pressure.d.ts +23 -0
- package/lib/types/compaction-replay.d.ts +18 -0
- package/lib/types/compatibility.d.ts +17 -0
- package/lib/types/composer-notice-style.d.ts +7 -0
- package/lib/types/config.d.ts +141 -0
- package/lib/types/content-file.d.ts +10 -0
- package/lib/types/context-evidence-ui.d.ts +28 -0
- package/lib/types/context-evidence.d.ts +256 -0
- package/lib/types/context-usage.d.ts +4 -0
- package/lib/types/copilot-account-presentation.d.ts +7 -0
- package/lib/types/copilot-accounts-card.d.ts +43 -0
- package/lib/types/copilot-accounts-host.d.ts +93 -0
- package/lib/types/copilot-accounts-remote.d.ts +85 -0
- package/lib/types/copilot-accounts-types.d.ts +43 -0
- package/lib/types/copilot-auth.d.ts +31 -0
- package/lib/types/copilot-grant.d.ts +11 -0
- package/lib/types/copilot-identity.d.ts +11 -0
- package/lib/types/copilot-request.d.ts +11 -0
- package/lib/types/copilot-stream-liveness.d.ts +23 -0
- package/lib/types/copilot-usage-card.d.ts +51 -0
- package/lib/types/copilot-usage-host.d.ts +61 -0
- package/lib/types/copilot-usage-normalize.d.ts +9 -0
- package/lib/types/copilot-usage-remote.d.ts +63 -0
- package/lib/types/copilot-usage-types.d.ts +20 -0
- package/lib/types/copilot-usage-ui.d.ts +4 -0
- package/lib/types/current-provider.d.ts +59 -0
- package/lib/types/deepseek-search-fallback.d.ts +11 -0
- package/lib/types/diagnostics-analysis-io.d.ts +23 -0
- package/lib/types/diagnostics-analysis.d.ts +298 -0
- package/lib/types/diagnostics-card.d.ts +12 -0
- package/lib/types/diagnostics-client.d.ts +13 -0
- package/lib/types/diagnostics-collector.d.ts +50 -0
- package/lib/types/diagnostics-host.d.ts +183 -0
- package/lib/types/diagnostics-remote.d.ts +113 -0
- package/lib/types/diagnostics-types.d.ts +893 -0
- package/lib/types/dual-model-host.d.ts +119 -0
- package/lib/types/dual-model-remote.d.ts +63 -0
- package/lib/types/dual-model-types.d.ts +34 -0
- package/lib/types/external-link.d.ts +3 -0
- package/lib/types/failure.d.ts +38 -0
- package/lib/types/http.d.ts +48 -0
- package/lib/types/image-input-admission.d.ts +5 -0
- package/lib/types/index.d.ts +39 -0
- package/lib/types/manual-compaction-recovery.d.ts +67 -0
- package/lib/types/migration-status.d.ts +50 -0
- package/lib/types/model-exclusions.d.ts +15 -0
- package/lib/types/model-preferences-card.d.ts +9 -0
- package/lib/types/model-protocol.d.ts +31 -0
- package/lib/types/native-select-style.d.ts +4 -0
- package/lib/types/native-settings-style.d.ts +10 -0
- package/lib/types/parent-model-follow-card.d.ts +32 -0
- package/lib/types/parent-model-follow.d.ts +44 -0
- package/lib/types/pi-provider-bridge.d.ts +22 -0
- package/lib/types/plan.d.ts +148 -0
- package/lib/types/pre-step-pressure.d.ts +8 -0
- package/lib/types/preview-provider.d.ts +77 -0
- package/lib/types/preview-route.d.ts +76 -0
- package/lib/types/probe.d.ts +39 -0
- package/lib/types/remote-codec.d.ts +10 -0
- package/lib/types/remote.d.ts +202 -0
- package/lib/types/replay-recovery-host.d.ts +28 -0
- package/lib/types/replay-recovery-remote.d.ts +14 -0
- package/lib/types/replay-recovery-types.d.ts +24 -0
- package/lib/types/replay-recovery-ui.d.ts +28 -0
- package/lib/types/replay-recovery.d.ts +17 -0
- package/lib/types/request-body-composition.d.ts +17 -0
- package/lib/types/request-body-evidence.d.ts +37 -0
- package/lib/types/request-body-timeout-marker.d.ts +2 -0
- package/lib/types/request-body-timeout.d.ts +4 -0
- package/lib/types/request-budget.d.ts +58 -0
- package/lib/types/request-diagnostics.d.ts +278 -0
- package/lib/types/request-upload-evidence.d.ts +23 -0
- package/lib/types/response-error-body.d.ts +3 -0
- package/lib/types/responses-reasoning-text.d.ts +24 -0
- package/lib/types/responses-reasoning.d.ts +7 -0
- package/lib/types/responses-replay-compat.d.ts +31 -0
- package/lib/types/responses-request-compression.d.ts +33 -0
- package/lib/types/route-ownership.d.ts +70 -0
- package/lib/types/routed-web.d.ts +50 -0
- package/lib/types/search-backend.d.ts +16 -0
- package/lib/types/search-routing-host.d.ts +19 -0
- package/lib/types/search-routing-policy.d.ts +18 -0
- package/lib/types/search-routing-remote.d.ts +20 -0
- package/lib/types/search-routing.d.ts +43 -0
- package/lib/types/search-tool-routing.d.ts +22 -0
- package/lib/types/serialize.d.ts +106 -0
- package/lib/types/session-accounts-controller.d.ts +20 -0
- package/lib/types/session-accounts-host.d.ts +33 -0
- package/lib/types/session-accounts-remote.d.ts +114 -0
- package/lib/types/session-accounts.d.ts +38 -0
- package/lib/types/session-continuation-host.d.ts +45 -0
- package/lib/types/session-continuation-remote.d.ts +22 -0
- package/lib/types/session-continuation-types.d.ts +62 -0
- package/lib/types/session-continuation-ui.d.ts +49 -0
- package/lib/types/session-continuation.d.ts +14 -0
- package/lib/types/settings-reader.d.ts +16 -0
- package/lib/types/sse.d.ts +28 -0
- package/lib/types/temporary-models.d.ts +25 -0
- package/lib/types/tool-schema-compat.d.ts +17 -0
- package/lib/types/traditional-search.d.ts +17 -0
- package/lib/types/turn-model-provenance.d.ts +45 -0
- package/lib/types/turn-request-models.d.ts +55 -0
- package/lib/types/turn-selection-card.d.ts +24 -0
- package/lib/types/turn-selection-host.d.ts +35 -0
- package/lib/types/turn-selection-remote.d.ts +17 -0
- package/lib/types/turn-selection.d.ts +186 -0
- package/lib/types/turn-usage-evidence.d.ts +66 -0
- package/lib/types/turn-usage-notice.d.ts +7 -0
- package/lib/types/types.d.ts +69 -0
- package/lib/types/usage.d.ts +26 -0
- package/lib/types/watchdog.d.ts +22 -0
- package/lib/types/web-delegate.d.ts +12 -0
- package/lib/types/web-search-routing-card.d.ts +16 -0
- package/lib/types/web-search-routing-config.d.ts +12 -0
- package/lib/types/wire-anthropic.d.ts +37 -0
- package/lib/types/wire.d.ts +56 -0
- package/lib/web-delegate.js +9 -0
- package/output/auto-model-mockup/index.html +207 -0
- package/package.json +261 -0
- package/scripts/analyze-diagnostics.mjs +91 -0
- package/scripts/check-search-composition.mjs +191 -0
- package/scripts/iteration-review.mjs +53 -0
- package/scripts/release-policy.mjs +353 -0
- package/scripts/select-core-release.mjs +11 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<meta charset="utf-8">
|
|
4
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
5
|
+
<title>账号切换 · Approved Dropdown Mock</title>
|
|
6
|
+
<style>
|
|
7
|
+
:root{color-scheme:dark;--bg:#202020;--panel:#2b2b2b;--popup:#333;--line:#505050;--text:#f2f2f2;--muted:#c0c0c0;--hover:#414141}
|
|
8
|
+
*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font:14px/1.55 system-ui,"Segoe UI",sans-serif;padding:28px}
|
|
9
|
+
button,input,textarea{font:inherit;color:inherit}button{cursor:pointer;background:transparent;border:1px solid var(--line);border-radius:8px;padding:8px 14px}button:hover{background:var(--hover)}button:focus-visible,summary:focus-visible,textarea:focus-visible{outline:2px solid #aacfff;outline-offset:3px}
|
|
10
|
+
button:disabled{opacity:.5;cursor:default}[hidden]{display:none!important}h1{font-size:18px;margin:0}h2{font-size:16px;margin:0 0 12px}p{color:var(--muted);margin:8px 0}small{color:var(--muted);font-size:12px}
|
|
11
|
+
.preview{max-width:840px;margin:auto}.preview-head{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:22px}.tabs{display:flex;gap:6px}.tabs button[aria-pressed=true]{background:var(--hover)}
|
|
12
|
+
.provider{background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:22px}.provider-head,.account-row{display:flex;align-items:center;justify-content:space-between;gap:16px}.provider-head strong{font-size:19px}.provider-head small{margin-left:10px}.manage{border-top:1px solid var(--line);margin-top:20px;padding-top:22px}
|
|
13
|
+
.account-row{position:relative;margin:16px 0}.identity strong{font-size:17px;display:block}.identity small{display:block;margin-top:2px}.switch{white-space:nowrap}.caret{font-size:11px;margin-left:9px}.account-menu{position:absolute;right:0;top:calc(100% + 8px);width:min(300px,100%);z-index:5;background:var(--popup);border:1px solid #666;border-radius:10px;box-shadow:0 10px 28px #0006;padding:5px}
|
|
14
|
+
.options{max-height:228px;overflow:auto;overscroll-behavior:contain}.option{width:100%;display:flex;align-items:center;gap:10px;text-align:left;border:0;padding:10px;border-radius:5px;min-height:46px}.check{width:18px;flex-shrink:0;color:#c7ddff}.option .name{flex:1;min-width:0;overflow-wrap:anywhere}.option small{display:block}.add{border-top:1px solid var(--line);margin-top:5px;padding-top:5px}.add button{width:100%;text-align:left;border:0}.account-actions{display:flex;flex-wrap:wrap;gap:8px;margin:16px 0}.quiet{border:0;color:var(--muted);padding-left:0;padding-right:8px}.danger{color:#ffb8b8}
|
|
15
|
+
details{margin-top:18px}summary{cursor:pointer}label{display:flex;align-items:center;gap:9px;margin:12px 0}input{accent-color:#c7ddff}.preferences{border-top:1px solid var(--line);margin-top:24px;padding-top:22px}.model{display:flex;align-items:center;justify-content:space-between;padding:12px 0;border-bottom:1px solid var(--line)}.model button{font-size:12px;padding:5px 10px}.caption{margin-top:20px;font-size:12px}.status{min-height:22px;font-size:12px;color:#c7ddff;margin-top:12px}
|
|
16
|
+
.chat{min-height:490px;display:flex;flex-direction:column}.messages{flex:1;padding:20px 0}.message{max-width:75%;padding:12px 16px;background:var(--panel);border-radius:12px;margin-bottom:20px}.message.user{margin-left:auto;background:#373737}.composer{border:1px solid var(--line);border-radius:12px;padding:14px}.composer textarea{width:100%;min-height:60px;resize:vertical;border:0;background:none;outline-offset:0}.toolbar{display:flex;justify-content:space-between;color:var(--muted)}.credits{display:flex;justify-content:flex-end;margin-top:8px}.chat-panel{width:min(410px,100%);margin:10px 0 0 auto;background:var(--panel);border:1px solid var(--line);border-radius:12px;padding:18px}.chat-panel .account-row{margin-top:0}.chat-panel .account-menu{top:auto;bottom:calc(100% + 8px)}
|
|
17
|
+
dialog{width:min(420px,calc(100% - 32px));background:var(--panel);color:var(--text);border:1px solid var(--line);border-radius:12px;padding:24px}dialog::backdrop{background:#0008}.dialog-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:20px}
|
|
18
|
+
@media(max-width:520px){body{padding:16px}.preview-head{align-items:flex-start;flex-direction:column}.provider{padding:16px}.provider-head{align-items:flex-start}.provider-head small{display:block;margin:4px 0 0}.message{max-width:90%}.account-actions{gap:4px}.chat{min-height:450px}}
|
|
19
|
+
</style>
|
|
20
|
+
<div class="preview">
|
|
21
|
+
<header class="preview-head"><div><h1>账号切换 · 简化版</h1><small>交互 Mock · 全部为虚构数据,不操作真实账号</small></div><nav class="tabs" aria-label="预览页面"><button id="models-tab" aria-pressed="true">Models</button><button id="chat-tab" aria-pressed="false">Chat</button></nav></header>
|
|
22
|
+
<section id="models" class="provider">
|
|
23
|
+
<div class="provider-head"><div><strong>GitHub Copilot</strong><small>Signed in · 19 models</small></div><button id="manage-button" aria-expanded="true">Manage</button></div>
|
|
24
|
+
<div class="manage" id="manage">
|
|
25
|
+
<h2>账号管理</h2><p>选择全局默认账号。已有 Session 的显式选择不变。</p>
|
|
26
|
+
<div class="account-row"><div class="identity"><strong id="global-name">@demo-personal</strong><small>全局默认账号</small></div><button class="switch" id="models-switch" aria-expanded="false" aria-controls="models-menu">切换<span class="caret">▾</span></button>
|
|
27
|
+
<div id="models-menu" class="account-menu" hidden><div class="options" aria-label="全局默认账号"></div><div class="add"><button data-add>+ 添加账号</button></div></div></div>
|
|
28
|
+
<div class="account-actions"><button data-action="刷新账号信息">刷新账号信息</button><button data-action="重新授权">重新授权</button><button class="quiet danger" id="remove">删除账号</button></div>
|
|
29
|
+
<details><summary>新 Session 续聊默认</summary><label><input type="checkbox" checked>默认开启有损续聊</label><p><small>新轮次省略旧加密推理及其内嵌摘要;可见消息、工具记录和磁盘历史不变。仅影响新 Session,不自动发送或重试。</small></p></details>
|
|
30
|
+
<section class="preferences"><h2>模型偏好</h2><p><small>偏好跨账号共享;可用性按当前账号验证。</small></p><div class="model"><span>GPT-6.1 Sol <small>· 可用</small></span><button data-model>排除</button></div><div class="model"><span>Claude Sonnet <small>· 可用</small></span><button data-model>排除</button></div><div class="model"><span>Gemini Pro <small>· 当前账号不可用</small></span><button data-model>排除</button></div></section>
|
|
31
|
+
</div>
|
|
32
|
+
</section>
|
|
33
|
+
<section id="chat" class="chat" hidden>
|
|
34
|
+
<div class="messages"><div class="message user">继续完善账号切换的交互。</div><div class="message">保留当前账号,点击「切换」后用一个紧凑下拉菜单选择,不再展开搜索表单。</div></div>
|
|
35
|
+
<div class="composer"><textarea aria-label="模拟消息" placeholder="输入消息…(仅模拟)"></textarea><div class="toolbar"><span>+ Full access ▾</span><span>Auto ▾ ↑</span></div></div>
|
|
36
|
+
<div class="credits"><button id="credits">Credits · <span id="credits-name">@demo-personal</span> ▾</button></div>
|
|
37
|
+
<div class="chat-panel" id="chat-panel">
|
|
38
|
+
<div class="account-row"><div class="identity"><strong id="session-name">@demo-personal</strong><small>本 Session 账号</small></div><button class="switch" id="chat-switch" aria-expanded="false" aria-controls="chat-menu">切换<span class="caret">▾</span></button>
|
|
39
|
+
<div id="chat-menu" class="account-menu" hidden><div class="options" aria-label="本 Session 账号"></div><div class="add"><button data-add>+ 添加账号</button></div></div></div>
|
|
40
|
+
<details><summary>本 Session 有损续聊 · 开启</summary><label><input id="session-policy" type="checkbox" checked>持续开启</label><p><small>每轮省略旧加密推理及内嵌摘要;可见历史不变。不自动发送或重试。</small></p></details>
|
|
41
|
+
<button class="quiet" id="simulate-rejection">模拟旧推理被拒绝</button>
|
|
42
|
+
</div>
|
|
43
|
+
</section>
|
|
44
|
+
<p id="status" class="status" role="status" aria-live="polite"></p>
|
|
45
|
+
<footer class="caption">点击「切换」查看菜单。无搜索框,无逐账号 Switch 按钮;当前账号打勾,长列表内部滚动。<button class="quiet" id="many">模拟 24 个账号</button></footer>
|
|
46
|
+
</div>
|
|
47
|
+
<dialog id="dialog"><h2 id="dialog-title"></h2><p id="dialog-copy"></p><div id="dialog-actions" class="dialog-actions"></div></dialog>
|
|
48
|
+
<script>
|
|
49
|
+
const $=id=>document.getElementById(id);
|
|
50
|
+
let accounts=['@demo-personal','@demo-work','@demo-backup'],globalAccount=accounts[0],sessionAccount=accounts[0],lastTrigger;
|
|
51
|
+
function notice(text){$('status').textContent=text}
|
|
52
|
+
function closeMenus(){for(const scope of ['models','chat']){$(scope+'-menu').hidden=true;$(scope+'-switch').setAttribute('aria-expanded','false')}}
|
|
53
|
+
function dialog(title,copy,actions){closeMenus();$('dialog-title').textContent=title;$('dialog-copy').textContent=copy;$('dialog-actions').replaceChildren();for(const [label,action] of actions){const b=document.createElement('button');b.textContent=label;b.onclick=()=>{$('dialog').close();action?.()};$('dialog-actions').append(b)}$('dialog').showModal()}
|
|
54
|
+
$('simulate-rejection').onclick=()=>dialog('旧推理回放被拒绝',$('session-policy').checked?'本 Session 已开启降级续聊,请另行使用原生重试。如果仍被拒绝,请查看技术诊断或新建会话;不重复授权或自动重试。':'降级续聊省略旧加密推理及内嵌摘要,保留可见消息、工具记录和磁盘历史;可能损失隐含细节。开启后在本 Session 持续生效,跨账号和重启保留,直到关闭。不会自动重试。',$('session-policy').checked?[['关闭提示']]:[['开启降级续聊',()=>{$('session-policy').checked=true;render();notice('模拟:持久策略已开启,请另行点击原生重试。没有发送消息。')}],['取消']]);
|
|
55
|
+
function render(){for(const scope of ['models','chat']){const list=$(scope+'-menu').querySelector('.options'),current=scope==='models'?globalAccount:sessionAccount;list.replaceChildren();for(const account of accounts){const b=document.createElement('button');b.className='option';b.setAttribute('aria-pressed',String(account===current));const check=document.createElement('span');check.className='check';check.textContent=account===current?'✓':'';check.setAttribute('aria-hidden','true');const name=document.createElement('span');name.className='name';name.textContent=account;b.append(check,name);if(account===current){const tag=document.createElement('small');tag.textContent='当前';b.append(tag)}b.onclick=()=>{if(scope==='chat'&&!$('session-policy').checked&&account!==current){dialog('切换账号前确认','有损续聊会省略旧加密推理及其内嵌摘要。可见消息、工具记录和磁盘历史不变。授权不会自动发送或重试。',[['开启并切换',()=>{$('session-policy').checked=true;choose(scope,account)}],['保持关闭并切换',()=>choose(scope,account)],['取消']])}else choose(scope,account)};list.append(b)}}$('global-name').textContent=globalAccount;$('session-name').textContent=sessionAccount;$('credits-name').textContent=sessionAccount;$('session-policy').closest('details').querySelector('summary').textContent='本 Session 有损续聊 · '+($('session-policy').checked?'开启':'关闭')}
|
|
56
|
+
function choose(scope,account){if(scope==='models')globalAccount=account;else sessionAccount=account;closeMenus();render();notice('模拟:'+(scope==='models'?'全局默认':'本 Session')+'已切换至 '+account+';没有发送消息。');lastTrigger?.focus()}
|
|
57
|
+
for(const scope of ['models','chat'])$(scope+'-switch').onclick=()=>{const open=$(scope+'-menu').hidden;closeMenus();lastTrigger=$(scope+'-switch');$(scope+'-menu').hidden=!open;lastTrigger.setAttribute('aria-expanded',String(open));if(open)$(scope+'-menu').querySelector('.option').focus()};
|
|
58
|
+
document.addEventListener('click',e=>{if(!e.target.closest('.account-row'))closeMenus()});
|
|
59
|
+
document.addEventListener('keydown',e=>{const menu=e.target.closest('.account-menu');if(e.key==='Escape'){closeMenus();lastTrigger?.focus()}if(menu&&['ArrowDown','ArrowUp','Home','End'].includes(e.key)){const buttons=Array.from(menu.querySelectorAll('button'));let index=buttons.indexOf(document.activeElement);index=e.key==='Home'?0:e.key==='End'?buttons.length-1:(index+(e.key==='ArrowDown'?1:-1)+buttons.length)%buttons.length;buttons[index].focus();e.preventDefault()}});
|
|
60
|
+
for(const page of ['models','chat'])$(page+'-tab').onclick=()=>{closeMenus();for(const p of ['models','chat']){$(p).hidden=p!==page;$(p+'-tab').setAttribute('aria-pressed',String(p===page))}notice('')};
|
|
61
|
+
$('manage-button').onclick=()=>{$('manage').hidden=!$('manage').hidden;$('manage-button').setAttribute('aria-expanded',String(!$('manage').hidden))};
|
|
62
|
+
$('credits').onclick=()=>{$('chat-panel').hidden=!$('chat-panel').hidden;closeMenus()};
|
|
63
|
+
$('session-policy').onchange=render;
|
|
64
|
+
$('many').onclick=()=>{accounts=accounts.slice(0,3);for(let n=4;n<=24;n++)accounts.push('@demo-account-'+n);render();notice('已模拟 24 个账号。打开菜单后在内部滚动。')};
|
|
65
|
+
document.querySelectorAll('[data-add]').forEach(b=>b.onclick=()=>dialog('添加账号','正式功能将进入 GitHub 授权。这里仅模拟添加,不访问网络,也不会自动切换账号。',[['模拟授权完成',()=>{accounts.push('@demo-new-'+accounts.length);render();notice('已添加模拟账号,当前账号不变。')}],['取消']]));
|
|
66
|
+
document.querySelectorAll('[data-action]').forEach(b=>b.onclick=()=>notice('模拟:'+b.dataset.action+',未执行网络请求。'));
|
|
67
|
+
document.querySelectorAll('[data-model]').forEach(b=>b.onclick=()=>{b.textContent=b.textContent==='排除'?'恢复':'排除';notice('仅修改模拟偏好。')});
|
|
68
|
+
$('remove').onclick=()=>dialog('删除 '+globalAccount+'?','当前全局默认账号不能直接删除。请先切换至其他账号;这里不会删除真实账号或凭据。',[['知道了']]);
|
|
69
|
+
render();
|
|
70
|
+
</script>
|
|
71
|
+
</html>
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
4
|
+
<title>Chat → Models · 完整多账号体验 Mock</title>
|
|
5
|
+
<!-- Shared current-account summary; searchable bounded selector only after Switch.
|
|
6
|
+
Chat owns session selection, Models owns global default. All data is synthetic. -->
|
|
7
|
+
<style>
|
|
8
|
+
:root{color-scheme:dark;--bg:#171717;--panel:#252525;--text:#eee;--muted:#bdbdbd;--line:#555;--hover:#353535;--accent:#b9d5ff}
|
|
9
|
+
*{box-sizing:border-box}body{margin:0;padding:24px;background:var(--bg);color:var(--text);font:13px/1.55 system-ui,"Segoe UI",sans-serif}
|
|
10
|
+
button,input,select,textarea{font:inherit;color:inherit}button,select,input{background:transparent;border:1px solid var(--line);border-radius:6px;padding:7px 10px}
|
|
11
|
+
button{cursor:pointer}button:hover{background:var(--hover)}button:disabled{opacity:.5;cursor:default}button:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
|
|
12
|
+
header{display:flex;gap:14px;align-items:center;flex-wrap:wrap;padding-bottom:14px;border-bottom:1px solid var(--line)}header span,p,small{color:var(--muted)}
|
|
13
|
+
nav{display:flex;gap:8px;margin:20px 0}nav button[aria-pressed=true]{background:var(--hover)}main{max-width:952px;margin:auto}
|
|
14
|
+
h1{font-size:22px;margin:0 0 18px}h2{font-size:17px;margin:0}p{margin:6px 0}small{font-size:12px}.row{display:flex;align-items:center;justify-content:space-between;gap:12px}
|
|
15
|
+
.history{height:160px;display:grid;place-content:center;color:var(--muted)}.composer{border:1px solid var(--line);border-radius:12px;padding:12px}textarea{width:100%;min-height:72px;background:none;border:0;resize:vertical}.toolbar{display:flex;justify-content:space-between;color:var(--muted)}
|
|
16
|
+
.dock{display:flex;justify-content:flex-end;margin:8px 0}.quiet{border:0;color:var(--accent)}.account-surface{position:relative;background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:16px;width:min(100%,430px);margin-left:auto;box-shadow:0 6px 20px #0003}.models .account-surface{width:100%;margin:0;box-shadow:none}
|
|
17
|
+
.identity{min-width:0}.identity strong{display:block}.identity small{display:block}.account-summary{padding:12px 0}.section{border-top:1px solid var(--line);padding-top:14px;margin-top:10px}
|
|
18
|
+
.selector{border-top:1px solid var(--line);padding-top:12px}.search{width:100%;margin:10px 0}.account-list{max-height:220px;overflow:auto;overscroll-behavior:contain}.account-option{display:flex;justify-content:space-between;align-items:center;gap:12px;border:0;width:100%;text-align:left;padding:9px 8px}.account-option[aria-pressed=true]{background:var(--hover)}.account-option small{display:block}.selected{color:var(--accent);white-space:nowrap}.selector-footer{border-top:1px solid var(--line);padding-top:10px;margin-top:8px}.selector-footer button{width:100%;text-align:left}
|
|
19
|
+
.notice{padding:8px 10px;background:var(--hover);border-radius:6px;margin:10px 0}.actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}.primary{background:#e4e4e4;color:#171717;border-color:#e4e4e4}.primary:hover{background:white}
|
|
20
|
+
details p{font-size:12px}summary{cursor:pointer}.label{display:block;margin-top:10px}input[type=checkbox]{accent-color:#adcfff}
|
|
21
|
+
.models-list{margin-top:20px;border-top:1px solid var(--line)}.model-row{padding:12px 0;border-bottom:1px solid var(--line)}.simulation{margin:24px auto 0;max-width:952px;border-top:1px dashed var(--line);padding-top:14px;display:flex;align-items:center;flex-wrap:wrap;gap:8px;color:var(--muted);font-size:12px}
|
|
22
|
+
[hidden]{display:none!important}.save-error{color:var(--text)}#status{font-size:12px;min-height:18px}
|
|
23
|
+
@media(max-width:480px){body{padding:14px}.history{height:90px}.account-surface{padding:14px}.row{gap:8px}.row select{max-width:150px}.account-list{max-height:190px}header{gap:6px}}
|
|
24
|
+
@media(prefers-color-scheme:light){:root{color-scheme:light;--bg:#fafafa;--panel:#fff;--text:#222;--muted:#555;--line:#bbb;--hover:#f0f0f0;--accent:#24599b}.primary{background:#303030;color:white;border-color:#303030}.primary:hover{background:#444}}
|
|
25
|
+
|
|
26
|
+
body{background:#191919;padding:24px;color-scheme:dark}
|
|
27
|
+
.app-backdrop{position:fixed;inset:0;z-index:-1;display:grid;grid-template-columns:220px 1fr;opacity:.35;pointer-events:none;color:#bbb}
|
|
28
|
+
.app-sidebar{border-right:1px solid #555;padding:100px 16px 24px}.app-sidebar div{margin:22px 0}.app-chat{padding:100px 60px}
|
|
29
|
+
header{max-width:1100px;margin:0 auto 18px;border:0;padding:0;font-size:12px}
|
|
30
|
+
.settings-shell{display:grid;grid-template-columns:185px minmax(0,1fr);max-width:880px;height:min(820px,calc(100vh - 110px));min-height:480px;margin:auto;border-radius:22px;background:#2a2a2c;box-shadow:0 18px 60px #0006;overflow:hidden;border:1px solid #3b3b3d}
|
|
31
|
+
.settings-nav{padding:24px 12px}.settings-nav strong{display:block;margin:0 12px 22px;font-size:16px}.settings-nav button{display:block;text-align:left;width:100%;margin:6px 0;border:0;padding:10px 12px}.settings-nav .active{background:#444449}
|
|
32
|
+
main{max-width:none;margin:0;padding:20px 24px;overflow:auto;min-width:0;background:#2a2a2c}
|
|
33
|
+
main>nav{display:none}.settings-actions{display:flex;justify-content:flex-end;gap:8px;margin-bottom:16px}.settings-actions button{font-size:12px}
|
|
34
|
+
h1{font-size:17px;margin-bottom:12px}h2{font-size:17px}.intro{margin-bottom:20px}
|
|
35
|
+
.native-provider{display:flex;align-items:center;justify-content:space-between;border:1px solid #48484b;border-radius:12px;padding:13px;margin-top:18px}
|
|
36
|
+
.missing{color:#fb7777;font-size:12px}.native-add{width:100%;border-style:dashed;margin:10px 0 24px;padding:12px}
|
|
37
|
+
.models .account-surface{background:transparent;border-color:#48484b;border-radius:12px;padding:14px}
|
|
38
|
+
.account-summary{padding:14px 0}.account-summary strong{font-size:14px}.section{border-color:#48484b}
|
|
39
|
+
.provider-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:4px 0 14px}.provider-heading span{color:#bdbdbd;font-size:12px}.provider-heading strong{font-size:15px}
|
|
40
|
+
.model-status{border-top:1px solid #48484b;padding-top:14px;margin-top:14px;display:flex;gap:8px;align-items:center;flex-wrap:wrap}.model-status small{font-size:12px}.model-status button{margin-left:auto}
|
|
41
|
+
.manage{margin-top:12px;border-top:1px solid #48484b;padding-top:12px}.manage details{padding:8px 0}.manage summary{font-size:13px}.manage .actions button{font-size:12px}
|
|
42
|
+
.preferences{display:grid;gap:6px;max-height:190px;overflow:auto;margin-top:10px}.preference{display:flex;align-items:center;gap:10px;padding:5px}.preference input{accent-color:#adcfff}
|
|
43
|
+
#policy{margin:12px 0 0}#policy-summary{font-size:13px}#models-list{display:none!important}
|
|
44
|
+
.simulation{max-width:880px;margin:16px auto;background:#191919;border:0}
|
|
45
|
+
.account-list{max-height:210px}#policy-details>p{font-size:12px}
|
|
46
|
+
.management-section+.management-section{border-top:1px solid #48484b;margin-top:20px;padding-top:18px}.management-section h3{font-size:15px;margin:0 0 8px}.compact-identity{color:#bdbdbd;font-size:12px;margin-top:4px}.model-status{border:0;padding:0;margin:0}.provider-heading{margin-bottom:8px}.model-owner{font-size:12px;color:#bdbdbd;margin-bottom:10px}.manage{padding-top:18px;margin-top:16px}.manage .account-summary{padding-top:0}.management-section #policy{padding-top:10px}
|
|
47
|
+
.account-entry{display:flex;align-items:center;gap:6px}.account-entry .account-option{flex:1;min-width:0}.remove-account{border:0;color:#ffb3b3;font-size:12px;flex-shrink:0}.remove-review{padding:12px;background:#353535;border-radius:6px;margin:10px 0}.model-search{width:100%;margin:8px 0}.model-filters{display:flex;gap:6px;flex-wrap:wrap}.model-filters button[aria-pressed=true]{background:#444449}.model-preference{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 0;border-bottom:1px solid #48484b}.model-preference small{display:block}.model-preference strong{font-size:13px}.model-preference button{flex-shrink:0;font-size:12px}
|
|
48
|
+
@media(max-width:620px){body{padding:12px}.settings-shell{grid-template-columns:1fr;height:calc(100vh - 160px);min-height:450px;border-radius:14px}.settings-nav{display:none}main{padding:16px}.settings-actions{margin-bottom:12px}header{flex-direction:column;align-items:flex-start}.simulation{margin-top:12px}.model-status button{margin-left:0}}
|
|
49
|
+
|
|
50
|
+
.settings-shell{position:fixed;z-index:10;left:50%;top:80px;transform:translateX(-50%);width:calc(100% - 40px);max-height:calc(100vh - 110px)}
|
|
51
|
+
.modal-shade{position:fixed;inset:0;background:#0009;z-index:9}
|
|
52
|
+
.settings-actions{position:sticky;top:0;z-index:2;background:#2a2a2c;padding:8px 0;border-bottom:1px solid #48484b}
|
|
53
|
+
select{color-scheme:dark;background:#252525;color:#eee}option{background:#252525;color:#eee}
|
|
54
|
+
.switch-review,.replay-guidance{padding:12px;background:#353535;border:1px solid #555;border-radius:8px;margin:12px 0}
|
|
55
|
+
.switch-review strong,.replay-guidance strong{display:block;margin-bottom:6px}.switch-review button,.replay-guidance button{font-size:12px}
|
|
56
|
+
.chat-host .history{height:auto;min-height:210px;display:flex;flex-direction:column;gap:18px;padding:20px 0;color:#eee}.mock-message{max-width:78%;padding:12px 16px;border-radius:10px;background:#252525}.mock-message.user{align-self:flex-end;background:#303036}.mock-message p{margin:5px 0}.mock-message small{display:block;color:#bdbdbd}.mock-message.failure{max-width:100%;border:1px solid #795454;background:#302727}.mock-message .actions{margin-top:10px}.scenario-heading{color:#bdbdbd;font-size:12px}
|
|
57
|
+
.chat-host{max-width:952px;margin:45px auto 0}.chat-host .history{height:210px}
|
|
58
|
+
.chat-host .account-surface{background:#252525;width:min(100%,430px);max-height:62vh;overflow:auto}
|
|
59
|
+
.chat-host .provider-heading{margin-bottom:0}.chat-host .account-summary{padding:12px 0}
|
|
60
|
+
.chat-host .model-status,.chat-host .compact-identity{display:none}
|
|
61
|
+
.chat-host .manage{border:0;padding:0;margin:0}
|
|
62
|
+
.chat-host #policy{border-top:1px solid #555;margin-top:12px;padding-top:12px}
|
|
63
|
+
.chat-host .preferences{display:none}.manage-link{border-top:1px solid #555;margin-top:12px;padding-top:10px;display:flex;justify-content:flex-end}
|
|
64
|
+
.chat-host .account-surface .management-section h3{display:none}
|
|
65
|
+
.mock-caption{max-width:952px;margin:12px auto;color:#bdbdbd;font-size:12px}
|
|
66
|
+
@media(max-width:620px){.settings-shell{top:72px;width:calc(100% - 24px);height:calc(100vh - 100px)}.chat-host{margin-top:20px}.chat-host .history{height:auto;min-height:100px}}
|
|
67
|
+
</style>
|
|
68
|
+
<div class="app-backdrop"><div class="app-sidebar"><strong>deepseek HARNESS</strong><div>+ New Session</div><div>Plugins</div><div>Automation tasks</div><div>Workspaces</div></div><div class="app-chat">Chat</div></div>
|
|
69
|
+
<header><strong>Chat → Models · 完整多账号体验 Mock</strong><span>参照当前 Desktop Settings;24 个虚构账号,不操作真实账号或设置</span></header>
|
|
70
|
+
<div class="settings-shell"><aside class="settings-nav"><strong>Settings</strong><button>⚙ General</button><button class="active">▤ Models</button><button>Built-in plugins</button><button>Agent presets</button></aside>
|
|
71
|
+
<main><div class="settings-actions"><button disabled>Open configuration file</button><button disabled aria-label="Close Settings">×</button></div>
|
|
72
|
+
<nav aria-label="预览页面"><button id="chat-tab" aria-pressed="true">Chat 页面</button><button id="models-tab" aria-pressed="false">Models 页面</button></nav>
|
|
73
|
+
<div id="chat"><div class="history">聊天区不显示账号列表或续聊设置</div><div class="composer"><textarea aria-label="模拟消息" placeholder="输入消息或任务…(仅模拟)"></textarea><div class="toolbar"><span>+ Full access⌄</span><span>GPT-6.1 Sol⌄ <button disabled aria-label="发送已禁用">↑</button></span></div></div><div class="dock"><button id="credits" class="quiet">Credits · <span id="dock-account"></span> ⌄</button></div></div>
|
|
74
|
+
<div id="models-heading" hidden><h1>Models</h1><p class="intro">Enter your API keys to use models from the following providers.</p>
|
|
75
|
+
<div class="native-provider"><span><strong>DeepSeek</strong> <span class="missing" title="API key missing">●</span></span><button disabled>Edit</button></div><button class="native-add" disabled>+ Add model provider</button></div>
|
|
76
|
+
<div id="surface-holder">
|
|
77
|
+
<section class="account-surface" aria-label="Copilot 账号">
|
|
78
|
+
<div class="provider-heading"><strong>GitHub Copilot</strong><span id="scope">全局默认</span></div>
|
|
79
|
+
<div class="row account-summary"><div class="identity"><strong id="current-name"></strong><small id="current-credit"></small><small id="source"></small></div><button id="switch" aria-expanded="false" aria-controls="selector">Switch</button></div>
|
|
80
|
+
<p id="running" class="notice" hidden></p>
|
|
81
|
+
<div id="selector" class="selector" hidden>
|
|
82
|
+
<div class="row"><strong id="selector-title">切换本 Session 账号</strong><button id="cancel-switch" class="quiet">取消</button></div>
|
|
83
|
+
<input id="search" class="search" type="search" aria-label="搜索账号" placeholder="搜索账号名称或标识">
|
|
84
|
+
<div id="account-list" class="account-list" role="group" aria-label="可选账号"></div>
|
|
85
|
+
<p id="empty" hidden>未找到匹配账号。可修改搜索,或添加新账号。</p>
|
|
86
|
+
<p id="save-error" class="save-error" role="alert" hidden>模拟保存失败,原账号保持不变。<button id="retry" class="quiet">重试</button></p>
|
|
87
|
+
<div class="selector-footer"><button id="add">+ 添加新账号</button></div>
|
|
88
|
+
<div id="add-view" hidden><label class="label" for="new-name">账号显示名称</label><input id="new-name" placeholder="例如:备用工作账号"><p><small>正式功能将在 GitHub 授权完成后添加。这里只模拟,不收集 token 或凭据。</small></p><div class="actions"><button id="finish-add">模拟授权完成</button><button id="cancel-add" class="quiet">取消添加</button></div><p id="add-error" role="alert" hidden>请输入账号显示名称。</p></div>
|
|
89
|
+
</div>
|
|
90
|
+
<p><small>全局默认用于跟随默认的后续轮次。正在运行的轮次和 Session 显式账号不变。</small></p><div class="section" id="policy">
|
|
91
|
+
<details id="policy-details"><summary id="policy-summary">降级续聊 · 关闭</summary>
|
|
92
|
+
<div id="session-policy-view"><div class="row" style="margin-top:12px"><label for="session-policy">本 Session 默认策略</label><select id="session-policy"><option value="follow">沿用创建时默认</option><option value="on">开启</option><option value="off">关闭</option></select></div><p><small>每个新轮次不回放旧加密推理及内嵌摘要,同账号也适用;可见消息、工具记录和磁盘历史不变。</small></p><div id="shortcuts" class="actions"><button id="once">仅下一轮降级</button><button id="enable" class="primary">一键持续开启</button></div><p id="consent"><small>点击即同意上述损失,不自动发送或重试。</small></p><p id="once-state" hidden>已授权仅下一轮降级 <button id="revoke" class="quiet">撤销</button></p></div>
|
|
93
|
+
<div id="global-policy-view" hidden><label class="label"><input id="global-policy" type="checkbox"> 新 Session 默认开启降级续聊</label><p><small>勾选即同意新 Session 每轮不回放旧加密推理及内嵌摘要,同账号也适用。已有 Session 不批量修改。</small></p></div>
|
|
94
|
+
<p><small>可能失去旧推理隐含细节。关闭不恢复已生成回答。不解决额度、408 或上下文超限,也不保证请求成功。</small></p>
|
|
95
|
+
</details>
|
|
96
|
+
</div>
|
|
97
|
+
<div class="model-status"><strong>Models</strong><small>Signed in</small><small>19 models</small><small title="Synthetic timestamp">Updated 1 hour ago</small><button id="manage-toggle" aria-expanded="false">Manage</button></div>
|
|
98
|
+
<div id="manage" class="manage" hidden>
|
|
99
|
+
<details><summary>Model preferences · <span id="enabled-count">7</span> enabled · exclusions</summary><p><small>取消勾选将排除模型,不改写已有 Session 的选择。</small></p><div class="preferences">
|
|
100
|
+
<label class="preference"><input class="model-enabled" type="checkbox" checked> GPT-6.1 Sol</label><label class="preference"><input class="model-enabled" type="checkbox" checked> GPT-6 Sol</label><label class="preference"><input class="model-enabled" type="checkbox" checked> Claude Sonnet</label><label class="preference"><input class="model-enabled" type="checkbox" checked> Claude Opus</label><label class="preference"><input class="model-enabled" type="checkbox" checked> Gemini Pro</label><label class="preference"><input class="model-enabled" type="checkbox" checked> GPT-5.4</label><label class="preference"><input class="model-enabled" type="checkbox" checked> GPT-5.4 mini</label></div></details>
|
|
101
|
+
<details><summary>Discovery details</summary><p><small>模拟:账号模型缓存有效。时间戳、账号及模型均为演示数据,不证明线上可用性。</small></p></details>
|
|
102
|
+
<div class="actions"><button id="refresh-models">Refresh models</button><button id="refresh-identity">Refresh account information</button><button id="reauthorize">Reauthorize</button></div>
|
|
103
|
+
<p><small>以上操作作用于当前默认账号。此 mock 仅模拟状态,不发起授权或网络请求。</small></p></div>
|
|
104
|
+
<p id="status" role="status" aria-live="polite"></p>
|
|
105
|
+
</section>
|
|
106
|
+
</div>
|
|
107
|
+
<div id="models-list" class="models-list" hidden><div class="model-row row"><span>GPT-6.1 Sol</span><small>演示模型 · 可用</small></div><div class="model-row row"><span>Claude Sonnet</span><small>演示模型 · 可用</small></div></div>
|
|
108
|
+
</main></div>
|
|
109
|
+
<aside class="simulation"><span>演示专用:</span><button id="turn">开始模拟轮</button><button id="new-session">模拟新 Session</button><label><input id="fail" type="checkbox">下一次切换保存失败</label><span>不属于正式产品控件。</span></aside>
|
|
110
|
+
<script>
|
|
111
|
+
const $=id=>document.getElementById(id)
|
|
112
|
+
const accounts=Array.from({length:24},(_,i)=>({id:String(i+1),name:i===0?'个人账号':i===1?'工作账号':`备用账号 ${String(i+1).padStart(2,'0')}`,handle:`demo-account-${String(i+1).padStart(2,'0')}`,credits:i===0?'180 / 300':i===1?'420 / 1,000':'未读取额度'}))
|
|
113
|
+
let page='chat',globalAccount='1',sessionAccount=null,globalOn=false,initialOn=false,policy='follow',once=false,active=null,saving=false,target=null
|
|
114
|
+
const effective=()=>sessionAccount??globalAccount
|
|
115
|
+
const on=()=>policy==='follow'?initialOn:policy==='on'
|
|
116
|
+
const find=id=>accounts.find(a=>a.id===id)
|
|
117
|
+
function status(s){$('status').textContent=s}
|
|
118
|
+
function closeSelector(){$('selector').hidden=true;$('switch').setAttribute('aria-expanded','false');$('search').value='';$('add-view').hidden=true;$('switch').focus()}
|
|
119
|
+
function render(){
|
|
120
|
+
const current=find(page==='chat'?effective():globalAccount)
|
|
121
|
+
$('current-name').textContent=current.name
|
|
122
|
+
$('current-credit').textContent=current.credits==='未读取额度'?'额度未读取':current.credits+' Credits 剩余 · 演示账期数据'
|
|
123
|
+
$('source').textContent=page==='models'?'全局默认账号':sessionAccount===null?'跟随全局默认':'本 Session 已指定'
|
|
124
|
+
$('scope').textContent=page==='chat'?'本 Session':'全局默认'
|
|
125
|
+
$('dock-account').textContent=active?find(active.account).name+(active.account!==effective()?' → 下轮 '+find(effective()).name:''):find(effective()).name
|
|
126
|
+
$('running').hidden=page!=='chat'||!active
|
|
127
|
+
$('running').textContent=active?'本轮:'+find(active.account).name+' · '+(active.on?'降级开启':'降级关闭')+';下一轮:'+find(effective()).name+' · '+(on()||once?'降级开启':'降级关闭'):''
|
|
128
|
+
$('policy-summary').textContent=page==='models'?'新 Session 降级默认 · '+(globalOn?'开启':'关闭'):'降级续聊 · '+(on()?'开启':once?'仅下一轮':'关闭')
|
|
129
|
+
$('shortcuts').hidden=on();$('consent').hidden=on();$('once').disabled=once;$('once-state').hidden=!once
|
|
130
|
+
$('turn').textContent=active?'结束模拟轮':'开始模拟轮'
|
|
131
|
+
$('switch').disabled=saving
|
|
132
|
+
$('cancel-switch').disabled=saving;$('add').disabled=saving
|
|
133
|
+
renderList()
|
|
134
|
+
}
|
|
135
|
+
function renderList(){
|
|
136
|
+
const query=$('search').value.trim().toLowerCase(), list=$('account-list');list.replaceChildren()
|
|
137
|
+
const selected=page==='models'?globalAccount:sessionAccount
|
|
138
|
+
const entries=[...(page==='chat'?[{id:'follow',name:'跟随全局默认',handle:'当前默认:'+find(globalAccount).name}]:[]),...accounts].filter(a=>(a.name+' '+a.handle).toLowerCase().includes(query))
|
|
139
|
+
for(const a of entries){
|
|
140
|
+
const button=document.createElement('button');button.className='account-option';button.dataset.account=a.id;button.disabled=saving
|
|
141
|
+
const checked=a.id===(selected??'follow');button.setAttribute('aria-pressed',String(checked))
|
|
142
|
+
const text=document.createElement('span'),name=document.createElement('strong'),sub=document.createElement('small');name.textContent=a.name;sub.textContent=a.handle;text.append(name,sub)
|
|
143
|
+
const marker=document.createElement('span');marker.className='selected';marker.textContent=saving&&target===a.id?'保存中…':checked?'当前':''
|
|
144
|
+
button.append(text,marker);button.onclick=()=>choose(a.id);list.append(button)
|
|
145
|
+
}
|
|
146
|
+
$('empty').hidden=entries.length>0
|
|
147
|
+
}
|
|
148
|
+
async function choose(id){
|
|
149
|
+
if(saving)return;saving=true;target=id;$('save-error').hidden=true;render()
|
|
150
|
+
await new Promise(r=>setTimeout(r,250));saving=false
|
|
151
|
+
if($('fail').checked){$('fail').checked=false;$('save-error').hidden=false;status('保存失败;账号未改变。');render();return}
|
|
152
|
+
if(page==='models')globalAccount=id;else sessionAccount=id==='follow'?null:id
|
|
153
|
+
closeSelector();status(page==='models'?'已模拟设置全局默认;已有 Session 的显式账号不变。':active?'已保存,下一轮生效;当前轮不受影响。':'已保存,下次发送使用所选账号。');render()
|
|
154
|
+
}
|
|
155
|
+
function setPage(next){
|
|
156
|
+
if(saving)return;page=next;closeSelector()
|
|
157
|
+
document.querySelector('.account-surface').hidden=false
|
|
158
|
+
$('chat').hidden=page!=='chat';$('models-heading').hidden=page!=='models';$('models-list').hidden=page!=='models'
|
|
159
|
+
$('surface-holder').className=page==='models'?'models':''
|
|
160
|
+
$('chat-tab').setAttribute('aria-pressed',String(page==='chat'));$('models-tab').setAttribute('aria-pressed',String(page==='models'))
|
|
161
|
+
$('session-policy-view').hidden=page!=='chat';$('global-policy-view').hidden=page!=='models'
|
|
162
|
+
$('selector-title').textContent=page==='chat'?'切换本 Session 账号':'设置全局默认账号';status('');render()
|
|
163
|
+
}
|
|
164
|
+
$('chat-tab').onclick=()=>setPage('chat');$('models-tab').onclick=()=>setPage('models')
|
|
165
|
+
$('switch').onclick=()=>{$('selector').hidden=!$('selector').hidden;$('switch').setAttribute('aria-expanded',String(!$('selector').hidden));if(!$('selector').hidden)$('search').focus();renderList()}
|
|
166
|
+
$('cancel-switch').onclick=closeSelector;$('search').oninput=renderList;$('retry').onclick=()=>choose(target)
|
|
167
|
+
$('credits').onclick=()=>{const surface=document.querySelector('.account-surface');surface.hidden=!surface.hidden}
|
|
168
|
+
$('add').onclick=()=>{$('add-view').hidden=false;$('new-name').focus()}
|
|
169
|
+
$('cancel-add').onclick=()=>{$('add-view').hidden=true}
|
|
170
|
+
$('finish-add').onclick=()=>{const name=$('new-name').value.trim();$('add-error').hidden=!!name;if(!name)return;accounts.push({id:String(accounts.length+1),name,handle:'demo-new-account',credits:'未读取额度'});$('search').value=name;$('add-view').hidden=true;$('new-name').value='';status('已模拟添加账号,尚未切换;请选择该账号使用。');render()}
|
|
171
|
+
$('session-policy').onchange=e=>{policy=e.target.value;if(on())once=false;status(active?'策略已保存,下一轮生效。':'本 Session 策略已模拟保存。');render()}
|
|
172
|
+
$('global-policy').onchange=e=>{globalOn=e.target.checked;status('新 Session 默认已保存;已有 Session 不变。');render()}
|
|
173
|
+
$('once').onclick=()=>{once=true;status('已同意仅下一轮损失,请手动发送或重试。');render()}
|
|
174
|
+
$('revoke').onclick=()=>{once=false;status('已撤销下一轮授权。');render()}
|
|
175
|
+
$('enable').onclick=()=>{policy='on';once=false;$('session-policy').value='on';status('已同意损失并持续开启;可切回关闭。');render()}
|
|
176
|
+
$('turn').onclick=()=>{if(active){active=null;status('模拟轮结束。')}else{active={account:effective(),on:on()||once};once=false;status('模拟轮已开始,未执行任何推理。')}render()}
|
|
177
|
+
$('new-session').onclick=()=>{if(saving)return;active=null;sessionAccount=null;initialOn=globalOn;policy='follow';once=false;$('session-policy').value='follow';setPage('chat');document.querySelector('.account-surface').hidden=false;status('新模拟 Session 继承全局默认。');render()}
|
|
178
|
+
document.addEventListener('keydown',e=>{if(e.key==='Escape'&&!saving)closeSelector()})
|
|
179
|
+
|
|
180
|
+
const manage=$('manage'),surface=document.querySelector('.account-surface')
|
|
181
|
+
const accountSection=document.createElement('section');accountSection.className='management-section';accountSection.setAttribute('aria-label','账号管理')
|
|
182
|
+
accountSection.innerHTML='<h3>账号管理</h3>'
|
|
183
|
+
const accountSummary=surface.querySelector('.account-summary')
|
|
184
|
+
const explanation=$('policy').previousElementSibling
|
|
185
|
+
accountSection.append(accountSummary,$('selector'),explanation,$('policy'))
|
|
186
|
+
const accountActions=document.createElement('div');accountActions.className='actions';accountActions.append($('refresh-identity'),$('reauthorize'));accountSection.append(accountActions)
|
|
187
|
+
const modelSection=document.createElement('section');modelSection.className='management-section';modelSection.setAttribute('aria-label','当前账号的模型')
|
|
188
|
+
modelSection.innerHTML='<h3>模型偏好</h3><p class="model-owner" id="model-owner">适用于所有 Copilot 账号;可用性按当前账号判断。</p>'
|
|
189
|
+
while(manage.firstChild)modelSection.append(manage.firstChild)
|
|
190
|
+
manage.append(accountSection,modelSection)
|
|
191
|
+
const compact=document.createElement('p');compact.className='compact-identity';compact.id='compact-identity';surface.querySelector('.provider-heading').after(compact)
|
|
192
|
+
function updateOwnership(){
|
|
193
|
+
compact.textContent=$('current-name').textContent+' · 全局默认'
|
|
194
|
+
$('model-owner').textContent='偏好适用于所有 Copilot 账号 · 当前可用性:'+$('current-name').textContent+'(模拟)'
|
|
195
|
+
renderPreferences()
|
|
196
|
+
}
|
|
197
|
+
new MutationObserver(updateOwnership).observe($('current-name'),{childList:true})
|
|
198
|
+
$('manage-toggle').onclick=()=>{const open=manage.hidden;manage.hidden=!open;$('manage-toggle').setAttribute('aria-expanded',String(open));if(!open)closeSelector()}
|
|
199
|
+
const preferences=modelSection.querySelector('details')
|
|
200
|
+
preferences.innerHTML='<summary>启用与排除 · 跨账号共享</summary><p><small>新发现模型默认启用;账号缺失模型时保留偏好,恢复可用后沿用原设置。不自动切模型或账号。</small></p><input class="model-search" id="model-search" type="search" aria-label="搜索模型" placeholder="搜索模型名称或 ID"><div class="model-filters" id="model-filters"></div><div class="preferences" id="preference-rows"></div>'
|
|
201
|
+
const models=[
|
|
202
|
+
{id:'gpt-6.1-sol',name:'GPT-6.1 Sol',accounts:['1','2']},
|
|
203
|
+
{id:'gpt-6-sol',name:'GPT-6 Sol',accounts:['1','2']},
|
|
204
|
+
{id:'claude-sonnet',name:'Claude Sonnet',accounts:['1']},
|
|
205
|
+
{id:'claude-opus',name:'Claude Opus',accounts:['2']},
|
|
206
|
+
{id:'gemini-pro',name:'Gemini Pro',accounts:['1','2'],fresh:true},
|
|
207
|
+
{id:'gpt-5.4',name:'GPT-5.4',accounts:['1','2']},
|
|
208
|
+
{id:'gpt-5.4-mini',name:'GPT-5.4 mini',accounts:['1','2']}
|
|
209
|
+
]
|
|
210
|
+
const excluded=new Set(['gpt-5.4-mini']);let filter='all'
|
|
211
|
+
function renderPreferences(){
|
|
212
|
+
const query=$('model-search').value.trim().toLowerCase(),rows=$('preference-rows');rows.replaceChildren()
|
|
213
|
+
const filters=$('model-filters');filters.replaceChildren()
|
|
214
|
+
for(const [id,name] of [['all','全部'],['available','当前可用'],['excluded','已排除'],['unavailable','当前不可用']]){
|
|
215
|
+
const b=document.createElement('button');b.textContent=name;b.setAttribute('aria-pressed',String(filter===id));b.onclick=()=>{filter=id;renderPreferences()};filters.append(b)
|
|
216
|
+
}
|
|
217
|
+
for(const model of models){
|
|
218
|
+
const available=model.accounts.includes(globalAccount),off=excluded.has(model.id)
|
|
219
|
+
if(!(model.name+' '+model.id).toLowerCase().includes(query)||filter==='available'&&!available||filter==='excluded'&&!off||filter==='unavailable'&&available)continue
|
|
220
|
+
const row=document.createElement('div');row.className='model-preference';row.dataset.model=model.id
|
|
221
|
+
const label=document.createElement('span'),name=document.createElement('strong'),detail=document.createElement('small')
|
|
222
|
+
name.textContent=model.name+(model.fresh?' · 新发现':'')
|
|
223
|
+
detail.textContent=(off?'已排除':'已启用')+' · '+(available?'当前账号可用':'当前账号不可用,偏好保留')
|
|
224
|
+
label.append(name,detail)
|
|
225
|
+
const action=document.createElement('button');action.textContent=off?'恢复':'排除';action.onclick=()=>{off?excluded.delete(model.id):excluded.add(model.id);status('跨账号偏好已模拟保存;不会自动选择模型。');renderPreferences()}
|
|
226
|
+
row.append(label,action);rows.append(row)
|
|
227
|
+
}
|
|
228
|
+
if(!rows.childElementCount){const empty=document.createElement('p');empty.textContent='没有匹配模型。';rows.append(empty)}
|
|
229
|
+
}
|
|
230
|
+
$('model-search').oninput=renderPreferences
|
|
231
|
+
const removal=document.createElement('div');removal.className='remove-review';removal.hidden=true;removal.setAttribute('role','group');removal.setAttribute('aria-label','确认移除账号')
|
|
232
|
+
removal.innerHTML='<strong id="remove-title"></strong><p><small>仅移除本机保存的授权,不撤销 GitHub 端权限,不删除对话,也不清除共享模型偏好。不会自动切换到其他账号。</small></p><div class="actions"><button id="confirm-remove">确认移除</button><button id="cancel-remove">取消</button></div>'
|
|
233
|
+
$('selector').append(removal)
|
|
234
|
+
let removeTarget=null
|
|
235
|
+
const originalRenderList=renderList
|
|
236
|
+
renderList=function(){
|
|
237
|
+
originalRenderList()
|
|
238
|
+
document.querySelectorAll('#account-list .account-option').forEach(button=>{
|
|
239
|
+
const id=button.dataset.account
|
|
240
|
+
if(id==='follow')return
|
|
241
|
+
const wrapper=document.createElement('div');wrapper.className='account-entry'
|
|
242
|
+
button.replaceWith(wrapper);wrapper.append(button)
|
|
243
|
+
const remove=document.createElement('button');remove.className='remove-account';remove.textContent='移除';remove.setAttribute('aria-label','移除 '+find(id).name)
|
|
244
|
+
remove.disabled=saving||id===globalAccount||active?.account===id
|
|
245
|
+
remove.title=id===globalAccount?'请先切换全局默认账号':active?.account===id?'正在使用的账号不可移除':'移除本机保存的授权'
|
|
246
|
+
remove.onclick=()=>{removeTarget=id;$('remove-title').textContent='移除 '+find(id).name+'?';removal.hidden=false}
|
|
247
|
+
wrapper.append(remove)
|
|
248
|
+
})
|
|
249
|
+
}
|
|
250
|
+
$('search').oninput=()=>renderList()
|
|
251
|
+
$('cancel-remove').onclick=()=>{removal.hidden=true;removeTarget=null}
|
|
252
|
+
$('confirm-remove').onclick=()=>{
|
|
253
|
+
if(!removeTarget||removeTarget===globalAccount||active?.account===removeTarget)return
|
|
254
|
+
const id=removeTarget,name=find(id).name,index=accounts.findIndex(a=>a.id===id)
|
|
255
|
+
accounts.splice(index,1);removal.hidden=true;removeTarget=null
|
|
256
|
+
status('已模拟移除 '+name+';共享模型偏好保留。');render()
|
|
257
|
+
}
|
|
258
|
+
$('refresh-models').onclick=()=>status('模拟模型刷新完成;未发起网络请求。')
|
|
259
|
+
$('refresh-identity').onclick=()=>status('模拟账号信息刷新完成;未读取真实账号。')
|
|
260
|
+
$('reauthorize').onclick=()=>status('这里只演示重新授权入口;未打开 GitHub 或修改凭据。')
|
|
261
|
+
setPage('models')
|
|
262
|
+
updateOwnership()
|
|
263
|
+
|
|
264
|
+
const shell=document.querySelector('.settings-shell')
|
|
265
|
+
const shade=document.createElement('div');shade.className='modal-shade';shade.hidden=true;shell.before(shade)
|
|
266
|
+
const chatHost=document.createElement('div');chatHost.className='chat-host';shell.before(chatHost)
|
|
267
|
+
const chatNode=$('chat'),holder=$('surface-holder'),main=document.querySelector('main')
|
|
268
|
+
chatHost.append(chatNode,holder)
|
|
269
|
+
const link=document.createElement('div');link.className='manage-link';link.innerHTML='<button class="quiet" id="full-management">管理账号与模型 →</button>';surface.append(link)
|
|
270
|
+
const accountTitle=accountSection.querySelector('h3')
|
|
271
|
+
const accountActionsForModels=accountActions
|
|
272
|
+
const explanationForModels=explanation
|
|
273
|
+
const originalSetPage=setPage
|
|
274
|
+
function showChat(){
|
|
275
|
+
originalSetPage('chat');shell.hidden=true;shade.hidden=true;chatNode.hidden=false
|
|
276
|
+
chatHost.append(holder);holder.className=''
|
|
277
|
+
manage.hidden=false;accountSection.hidden=false;modelSection.hidden=true
|
|
278
|
+
accountActionsForModels.hidden=true;explanationForModels.hidden=true;accountTitle.hidden=true;link.hidden=false
|
|
279
|
+
compact.hidden=true;$('manage-toggle').hidden=true
|
|
280
|
+
surface.querySelector('.model-status').hidden=true
|
|
281
|
+
surface.hidden=false;render()
|
|
282
|
+
}
|
|
283
|
+
function showModels(){
|
|
284
|
+
closeSelector();originalSetPage('models');chatNode.hidden=false
|
|
285
|
+
main.insertBefore(holder,$('models-list'));holder.className='models'
|
|
286
|
+
shell.hidden=false;shade.hidden=false;manage.hidden=false
|
|
287
|
+
accountActionsForModels.hidden=false;explanationForModels.hidden=false;accountTitle.hidden=false
|
|
288
|
+
modelSection.hidden=false;link.hidden=true;compact.hidden=false
|
|
289
|
+
$('manage-toggle').hidden=false;$('manage-toggle').setAttribute('aria-expanded','true')
|
|
290
|
+
surface.querySelector('.model-status').hidden=false
|
|
291
|
+
$('scope').textContent='全局默认'
|
|
292
|
+
main.scrollTop=0
|
|
293
|
+
$('manage-toggle').focus()
|
|
294
|
+
}
|
|
295
|
+
$('full-management').onclick=showModels
|
|
296
|
+
const closeSettings=document.querySelector('[aria-label="Close Settings"]');closeSettings.disabled=false;closeSettings.onclick=()=>{showChat();$('full-management').focus()}
|
|
297
|
+
$('manage-toggle').onclick=()=>{manage.hidden=!manage.hidden;$('manage-toggle').setAttribute('aria-expanded',String(!manage.hidden));if(manage.hidden)closeSelector()}
|
|
298
|
+
const removeList=renderList
|
|
299
|
+
renderList=function(){removeList();if(page==='chat')document.querySelectorAll('.remove-account').forEach(b=>b.hidden=true);else document.querySelectorAll('.account-entry').forEach(row=>{if(row.querySelector('[data-account]')?.dataset.account===sessionAccount){const button=row.querySelector('.remove-account');button.disabled=true;button.title='此账号被当前 Session 显式绑定,需先解除绑定'}})}
|
|
300
|
+
$('search').oninput=()=>renderList()
|
|
301
|
+
const switchReview=document.createElement('div');switchReview.className='switch-review';switchReview.hidden=true
|
|
302
|
+
switchReview.setAttribute('role','group');switchReview.setAttribute('aria-label','确认关闭降级后切换账号')
|
|
303
|
+
switchReview.innerHTML='<strong>降级续聊已关闭</strong><p id="switch-warning"></p><p><small>旧加密推理可能无法跨账号回放。未发送新请求,不能确认它一定失败;切换不会修改历史。</small></p><div class="actions"><button id="enable-switch" class="primary">开启降级并切换</button><button id="once-switch">仅下一轮降级并切换</button><button id="keep-off-switch">保持关闭并切换</button><button id="cancel-switch-review" class="quiet">取消</button></div>'
|
|
304
|
+
$('selector').append(switchReview)
|
|
305
|
+
let pendingAccount=null
|
|
306
|
+
const originalChoose=choose
|
|
307
|
+
choose=async function(id){
|
|
308
|
+
const resolved=id==='follow'?globalAccount:id
|
|
309
|
+
if(page==='chat'&&!on()&&!once&&resolved!==effective()){
|
|
310
|
+
pendingAccount=id;$('switch-warning').textContent='将从 '+find(effective()).name+' 切换到 '+find(resolved).name+'。'
|
|
311
|
+
switchReview.hidden=false;return
|
|
312
|
+
}
|
|
313
|
+
return originalChoose(id)
|
|
314
|
+
}
|
|
315
|
+
async function applySwitch(mode){
|
|
316
|
+
const id=pendingAccount;if(id===null)return
|
|
317
|
+
switchReview.hidden=true;pendingAccount=null
|
|
318
|
+
if(mode==='on'){policy='on';$('session-policy').value='on'}
|
|
319
|
+
if(mode==='once')once=true
|
|
320
|
+
await originalChoose(id)
|
|
321
|
+
}
|
|
322
|
+
$('enable-switch').onclick=()=>applySwitch('on')
|
|
323
|
+
$('once-switch').onclick=()=>applySwitch('once')
|
|
324
|
+
$('keep-off-switch').onclick=()=>applySwitch('off')
|
|
325
|
+
$('cancel-switch-review').onclick=()=>{switchReview.hidden=true;pendingAccount=null;status('已取消切换,账号及降级策略不变。')}
|
|
326
|
+
const guidance=document.createElement('div');guidance.className='replay-guidance';guidance.hidden=true;guidance.setAttribute('role','alert')
|
|
327
|
+
guidance.innerHTML='<strong>旧推理回放被当前账号拒绝(模拟)</strong><p><small>可见消息与工具记录仍保留。开启降级后不回放旧加密推理及内嵌摘要,可能失去隐含细节。不会自动重试。</small></p><div class="actions"><button id="failure-enable" class="primary">开启本 Session 降级</button><button id="failure-once">仅下一轮降级</button><button id="failure-manage" class="quiet">管理账号与模型 →</button></div><p id="failure-next" hidden>已授权。请手动重试原任务;这里没有发送任何请求。</p>'
|
|
328
|
+
accountSection.append(guidance)
|
|
329
|
+
const failButton=document.createElement('button');failButton.id='simulate-replay-mismatch';failButton.textContent='模拟回放不一致';document.querySelector('.simulation').append(failButton)
|
|
330
|
+
failButton.onclick=()=>{if(!shell.hidden)showChat();surface.hidden=false;guidance.hidden=false;status('模拟供应方已明确拒绝旧回放;未执行真实推理。')}
|
|
331
|
+
const scenario=document.createElement('button');scenario.id='off-scenario';scenario.textContent='体验:降级关闭后 A → B'
|
|
332
|
+
document.querySelector('.simulation').prepend(scenario)
|
|
333
|
+
function startOffScenario(){
|
|
334
|
+
active=null;sessionAccount='1';globalAccount='1';policy='off';once=false
|
|
335
|
+
$('session-policy').value='off';guidance.hidden=true;$('failure-next').hidden=true
|
|
336
|
+
showChat();surface.hidden=false;$('policy-details').open=false
|
|
337
|
+
$('selector').hidden=false;$('switch').setAttribute('aria-expanded','true')
|
|
338
|
+
$('search').value='demo-account-02';renderList()
|
|
339
|
+
choose('2')
|
|
340
|
+
status('演示起点:个人账号 A,降级关闭。你刚选择了工作账号 B;请在确认区选择下一步。')
|
|
341
|
+
renderConversation('switch')
|
|
342
|
+
switchReview.scrollIntoView({block:'nearest'})
|
|
343
|
+
}
|
|
344
|
+
scenario.onclick=startOffScenario
|
|
345
|
+
const originalApplySwitch=applySwitch
|
|
346
|
+
applySwitch=async function(mode){
|
|
347
|
+
await originalApplySwitch(mode)
|
|
348
|
+
if(mode==='off'){
|
|
349
|
+
renderConversation('ready')
|
|
350
|
+
status('已切换到 B,降级仍关闭。下一步可模拟一次发送,观察供应方拒绝旧回放后的引导。')
|
|
351
|
+
sendSimulation.hidden=false
|
|
352
|
+
}else{sendSimulation.hidden=true;renderConversation('authorized');status('已授权降级并切换。可手动发送;这里不会执行真实推理。')}
|
|
353
|
+
}
|
|
354
|
+
const sendSimulation=document.createElement('button');sendSimulation.id='simulate-off-send';sendSimulation.textContent='模拟发送:旧回放被拒绝';sendSimulation.hidden=true
|
|
355
|
+
document.querySelector('.simulation').append(sendSimulation)
|
|
356
|
+
sendSimulation.onclick=()=>{guidance.hidden=false;sendSimulation.hidden=true;renderConversation('failed');status('模拟发送已失败:供应方拒绝旧回放。尚未开启降级,也没有自动重试。');document.querySelector('.history').scrollIntoView({block:'start'})}
|
|
357
|
+
function renderConversation(state){
|
|
358
|
+
const history=chatNode.querySelector('.history')
|
|
359
|
+
history.innerHTML='<div class="scenario-heading">模拟对话 · 账号 A 的历史保留在同一个 Session</div><div class="mock-message user"><small>你 · 之前使用账号 A</small><p>帮我设计一个支持多账号切换的界面。</p></div><div class="mock-message"><small>助手 · 账号 A · 模拟内容</small><p>建议平时只显示当前账号,用 Switch 打开搜索列表。完整管理放在 Models 页面。</p></div>'
|
|
360
|
+
if(state==='switch')history.insertAdjacentHTML('beforeend','<p class="scenario-heading">现在你准备切到账号 B。降级关闭,下方先确认切换;还没有发送下一条消息。</p>')
|
|
361
|
+
else{
|
|
362
|
+
history.insertAdjacentHTML('beforeend','<div class="mock-message user"><small>你 · 准备使用账号 B</small><p>继续刚才的方案,补上删除账号的确认流程。</p></div>')
|
|
363
|
+
if(state==='failed')history.insertAdjacentHTML('beforeend','<div class="mock-message failure" role="alert"><strong>这一轮失败 · 未生成回答(模拟)</strong><p>账号 B 拒绝了账号 A 历史中的旧加密推理。可见对话与工具记录仍然保留。</p><small>COPILOT_RESPONSES_REPLAY_SCOPE_MISMATCH</small><div class="actions"><button id="message-enable">开启降级续聊</button><button id="message-once">仅下一轮降级</button></div><p><small>这两个操作只授权,不会自动重发这条消息。</small></p></div>')
|
|
364
|
+
else history.insertAdjacentHTML('beforeend','<p class="scenario-heading">'+(state==='authorized'?'已授权降级。请手动发送上面的后续消息(模拟)。':'已切到账号 B,降级仍关闭。点击下方“模拟发送:旧回放被拒绝”查看失败状态。')+'</p>')
|
|
365
|
+
}
|
|
366
|
+
for(const [id,action] of [['message-enable','failure-enable'],['message-once','failure-once']]){
|
|
367
|
+
const b=document.getElementById(id);if(b)b.onclick=()=>{$(action).click();showRetry()}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
function showRetry(){
|
|
371
|
+
const history=chatNode.querySelector('.history')
|
|
372
|
+
const old=document.getElementById('mock-manual-retry');if(old)return
|
|
373
|
+
const box=document.createElement('div');box.className='notice';box.innerHTML='<p>降级已授权。原失败消息还没有重发。</p><button id="mock-manual-retry">手动重试刚才的消息(模拟)</button>'
|
|
374
|
+
history.append(box)
|
|
375
|
+
$('mock-manual-retry').onclick=()=>{
|
|
376
|
+
box.innerHTML='<p>你手动重试了原消息 · 使用账号 B · 不回放旧加密推理(模拟)</p>'
|
|
377
|
+
history.insertAdjacentHTML('beforeend','<div class="mock-message"><small>助手 · 账号 B · 演示回答,不代表真实供应方验收</small><p>可以继续。删除账号前展示确认说明:只移除本机保存的授权,不删除对话或共享模型偏好;当前默认账号需要先切换。</p></div>')
|
|
378
|
+
guidance.hidden=true;status('模拟重试已完成;未执行真实请求。')
|
|
379
|
+
}
|
|
380
|
+
box.scrollIntoView({block:'nearest'})
|
|
381
|
+
}
|
|
382
|
+
$('failure-enable').onclick=()=>{policy='on';once=false;$('session-policy').value='on';$('failure-next').hidden=false;render();showRetry()}
|
|
383
|
+
$('failure-once').onclick=()=>{once=true;$('failure-next').hidden=false;render();showRetry()}
|
|
384
|
+
$('failure-manage').onclick=showModels
|
|
385
|
+
$('new-session').onclick=()=>{if(saving)return;active=null;sessionAccount=null;initialOn=globalOn;policy='follow';once=false;$('session-policy').value='follow';showChat();status('新模拟 Session 已继承全局默认;未创建真实会话。')}
|
|
386
|
+
$('credits').onclick=()=>{surface.hidden=!surface.hidden}
|
|
387
|
+
document.addEventListener('keydown',event=>{if(event.key==='Escape'&&!saving&&!shell.hidden&&$('selector').hidden){showChat();$('full-management').focus()}})
|
|
388
|
+
globalOn=true;initialOn=true;$('global-policy').checked=true
|
|
389
|
+
showChat()
|
|
390
|
+
status('降级续聊默认开启(模拟)。可展开详情关闭;每轮不回放旧加密推理,同账号也适用。')
|
|
391
|
+
if(new URLSearchParams(location.search).get('scenario')==='off-switch')startOffScenario()
|
|
392
|
+
</script>
|
|
393
|
+
</html>
|