- 装配只认 prompt_order.enabled;squash_system_messages 只合并相邻 system(新增 system 档,连接符按酒馆用单换行)
- 包装层:new_chat_prompt、示例对话(new_example_chat_prompt + <START> 切段 + name)、角色卡三块与 personality_format/scenario_format、{{user}}/{{char}} 取值、任务契约并进预设条目
- 工具协议:按 ToolBindings / 伪工具协议数据声明真 tools(presetToolPolicy=preset),工具描述用到的条目不再重复作为消息发出
- 正则:promptOnly 作用于对话历史(含 depth 过滤)、写入时脚本改写回复;{{//}} 注释按配平扫描
- tools/st-request-diff:真假上游抓包对比工具、三份预设的机制结论与实测报告
298 lines
11 KiB
HTML
298 lines
11 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="zh-CN">
|
||
<head>
|
||
<meta charset="UTF-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||
<title>直聊 · Writing Agent</title>
|
||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||
<link
|
||
href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700&family=Noto+Serif+SC:wght@500;600;700&display=swap"
|
||
rel="stylesheet"
|
||
/>
|
||
<script src="/theme-init.js"></script>
|
||
<link rel="stylesheet" href="/settings.css" />
|
||
<link rel="stylesheet" href="/chat.css" />
|
||
</head>
|
||
<body class="settings-page chat-page">
|
||
<header class="st-top">
|
||
<a class="st-brand" href="/">Writing Agent</a>
|
||
<nav class="st-nav" aria-label="主导航">
|
||
<a href="/">对话</a>
|
||
<a href="/chat.html" aria-current="page">直聊</a>
|
||
<a href="/modules.html">技能</a>
|
||
<a href="/libraries.html">库</a>
|
||
<a href="/stats.html">Token</a>
|
||
<a href="/settings.html">设置</a>
|
||
</nav>
|
||
</header>
|
||
|
||
<div class="st-shell chat-shell">
|
||
<aside class="chat-rail" aria-label="直聊导航">
|
||
<nav class="path-bar chat-path" id="chat-path" aria-label="位置">
|
||
<ol class="path-bar-list" id="chat-path-list"></ol>
|
||
</nav>
|
||
<div class="chat-rail-actions">
|
||
<button type="button" class="st-btn" id="btn-new-shell">新建上下文</button>
|
||
<button type="button" class="st-btn" id="btn-new-conv" hidden>
|
||
新建会话
|
||
</button>
|
||
<button type="button" class="st-btn" id="btn-save-temp" hidden>
|
||
保存
|
||
</button>
|
||
</div>
|
||
<div class="chat-rail-list" id="chat-rail-list"></div>
|
||
<p class="chat-rail-note">
|
||
未选存档即为快速对话(浏览器缓存,最多 2 条),可保存为持久会话。
|
||
</p>
|
||
<button
|
||
type="button"
|
||
class="chat-rail-toggle chat-rail-toggle-left"
|
||
id="btn-hide-left"
|
||
title="收起对话列表"
|
||
aria-label="收起对话列表"
|
||
>‹</button>
|
||
</aside>
|
||
|
||
<main class="chat-main" id="chat-main">
|
||
<button
|
||
type="button"
|
||
class="chat-rail-reopen chat-rail-reopen-left"
|
||
id="btn-show-left"
|
||
title="展开对话列表"
|
||
aria-label="展开对话列表"
|
||
hidden
|
||
>›</button>
|
||
<button
|
||
type="button"
|
||
class="chat-rail-reopen chat-rail-reopen-right"
|
||
id="btn-show-right"
|
||
title="展开上下文"
|
||
aria-label="展开上下文"
|
||
hidden
|
||
>‹</button>
|
||
<section class="chat-room" id="chat-room">
|
||
<p class="chat-temp-mark" id="chat-temp-mark" hidden>临时会话</p>
|
||
<div class="chat-arena" id="chat-arena" aria-live="polite" aria-label="模型竞技场"></div>
|
||
|
||
<footer class="chat-composer">
|
||
<p class="chat-status" id="chat-status" hidden></p>
|
||
<div class="chat-composer-row">
|
||
<details class="chat-more" id="chat-more">
|
||
<summary class="chat-more-sum" title="更多操作" aria-label="更多操作">
|
||
<span class="hamburger-icon" aria-hidden="true"></span>
|
||
</summary>
|
||
<div class="chat-more-panel" id="chat-more-panel" role="menu"></div>
|
||
</details>
|
||
<div class="chat-input-shell">
|
||
<textarea
|
||
id="chat-input"
|
||
rows="1"
|
||
placeholder="输入消息,Enter 发送(所有模型同时回复),Shift+Enter 换行"
|
||
></textarea>
|
||
<div class="chat-shell-actions">
|
||
<button
|
||
type="button"
|
||
class="chat-btn-icon chat-btn-icon-primary"
|
||
id="btn-send"
|
||
title="发送(Enter)"
|
||
aria-label="发送"
|
||
>
|
||
<svg class="chat-send-icon" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true">
|
||
<path fill="currentColor" d="M1.4 2.1 14.6 8 1.4 13.9l.2-4.4L10 8 1.6 6.5l-.2-4.4Z"/>
|
||
</svg>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</footer>
|
||
</section>
|
||
</main>
|
||
|
||
<aside class="chat-context" id="chat-context" aria-label="上下文配置">
|
||
<button
|
||
type="button"
|
||
class="chat-rail-toggle chat-rail-toggle-right"
|
||
id="btn-hide-right"
|
||
title="收起上下文"
|
||
aria-label="收起上下文"
|
||
>›</button>
|
||
<header class="chat-context-head">
|
||
<p class="chat-context-sub" id="context-sub">选择或新建后编辑</p>
|
||
</header>
|
||
<div class="chat-context-tabs" role="tablist" aria-label="上下文面板">
|
||
<button
|
||
type="button"
|
||
class="chat-context-tab is-active"
|
||
id="tab-shell"
|
||
data-context-tab="shell"
|
||
role="tab"
|
||
aria-selected="true"
|
||
aria-controls="shell-editor"
|
||
>
|
||
上下文
|
||
</button>
|
||
<button
|
||
type="button"
|
||
class="chat-context-tab"
|
||
id="tab-keep"
|
||
data-context-tab="keep"
|
||
role="tab"
|
||
aria-selected="false"
|
||
aria-controls="keep-stats"
|
||
>
|
||
保留统计
|
||
</button>
|
||
</div>
|
||
<div class="chat-shell-editor" id="shell-editor">
|
||
<label>
|
||
名称
|
||
<input type="text" id="shell-name" disabled />
|
||
</label>
|
||
<label>
|
||
系统提示
|
||
<textarea
|
||
id="shell-system"
|
||
rows="3"
|
||
placeholder="空则用默认直聊契约"
|
||
disabled
|
||
></textarea>
|
||
</label>
|
||
<label>
|
||
史前设定
|
||
<textarea id="shell-lore-before" rows="3" disabled></textarea>
|
||
</label>
|
||
<label>
|
||
种子历史
|
||
<textarea
|
||
id="shell-seed-history"
|
||
rows="4"
|
||
placeholder="手填历史,会拼在多轮之前"
|
||
disabled
|
||
></textarea>
|
||
</label>
|
||
<label>
|
||
史后状态
|
||
<textarea id="shell-lore-after" rows="2" disabled></textarea>
|
||
</label>
|
||
<label>
|
||
尾注
|
||
<textarea id="shell-post-turn" rows="2" disabled></textarea>
|
||
</label>
|
||
<label>
|
||
角色名(对应预设里的 {{char}})
|
||
<input type="text" id="shell-char-name" placeholder="空则用「作品」" disabled />
|
||
</label>
|
||
<label>
|
||
角色描述(酒馆 Char Description 洞)
|
||
<textarea
|
||
id="shell-char-desc"
|
||
rows="3"
|
||
placeholder="空则这一条不发"
|
||
disabled
|
||
></textarea>
|
||
</label>
|
||
<label>
|
||
角色性格(酒馆 Char Personality 洞,会套预设的性格模板)
|
||
<textarea id="shell-char-pers" rows="2" disabled></textarea>
|
||
</label>
|
||
<label>
|
||
场景(酒馆 Scenario 洞,会套预设的场景模板)
|
||
<textarea id="shell-scenario" rows="2" disabled></textarea>
|
||
</label>
|
||
<label>
|
||
示例对话(酒馆 mes_example 格式,用 <START> 分块)
|
||
<textarea
|
||
id="shell-examples"
|
||
rows="3"
|
||
placeholder="例:<START> {{user}}: 你好 {{char}}: 你也好"
|
||
disabled
|
||
></textarea>
|
||
</label>
|
||
<div class="chat-shell-editor-actions">
|
||
<button
|
||
type="button"
|
||
class="st-btn"
|
||
id="btn-clear-shell"
|
||
disabled
|
||
title="清空提示和设定,保留名称与已选模型"
|
||
>
|
||
清空
|
||
</button>
|
||
<button type="button" class="st-btn st-btn-primary" id="btn-save-shell" disabled>
|
||
应用
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<div class="chat-keep-stats" id="keep-stats" role="tabpanel" aria-labelledby="tab-keep" hidden>
|
||
<p class="chat-keep-stats-hint" id="keep-stats-hint"></p>
|
||
<div class="chat-keep-stats-list" id="keep-stats-list"></div>
|
||
<div class="chat-keep-stats-foot">
|
||
<button type="button" class="st-btn" id="btn-clear-keep" hidden>清空统计</button>
|
||
</div>
|
||
</div>
|
||
</aside>
|
||
</div>
|
||
|
||
<dialog class="chat-dialog" id="dialog-promote">
|
||
<form method="dialog" id="form-promote">
|
||
<h3>保存临时会话</h3>
|
||
<label>
|
||
上下文名称
|
||
<input type="text" id="promote-shell-name" value="临时上下文" required />
|
||
</label>
|
||
<label>
|
||
会话名称
|
||
<input type="text" id="promote-conv-name" value="会话" required />
|
||
</label>
|
||
<div class="chat-dialog-actions">
|
||
<button type="submit" class="st-btn st-btn-primary" value="ok">保存</button>
|
||
<button type="submit" class="st-btn" value="cancel">取消</button>
|
||
</div>
|
||
</form>
|
||
</dialog>
|
||
|
||
<dialog class="chat-dialog" id="dialog-new-conv">
|
||
<form method="dialog" id="form-new-conv">
|
||
<h3>新建会话</h3>
|
||
<p class="chat-dialog-hint">勾选要同时回复的模型,可以多选。未勾选也能创建,之后再加。</p>
|
||
<label>
|
||
会话名称
|
||
<input type="text" id="new-conv-name" value="新会话" required />
|
||
</label>
|
||
<fieldset class="chat-model-pick">
|
||
<legend>模型</legend>
|
||
<div class="chat-compare-list" id="new-conv-models"></div>
|
||
<p class="chat-dialog-hint" id="new-conv-models-empty" hidden>
|
||
没有带 Key 的 API 配置。请先到设置里添加。
|
||
</p>
|
||
</fieldset>
|
||
<div class="chat-dialog-actions">
|
||
<button type="submit" class="st-btn st-btn-primary" value="ok">创建</button>
|
||
<button type="submit" class="st-btn" value="cancel" formnovalidate>取消</button>
|
||
</div>
|
||
</form>
|
||
</dialog>
|
||
|
||
<dialog class="chat-dialog" id="dialog-add-window">
|
||
<form method="dialog" id="form-add-window">
|
||
<h3>新增窗口</h3>
|
||
<p class="chat-dialog-hint">勾选要加入的模型,可以多选。已经在会话里的不能再选。</p>
|
||
<fieldset class="chat-model-pick">
|
||
<legend>模型</legend>
|
||
<div class="chat-compare-list" id="add-window-models"></div>
|
||
<p class="chat-dialog-hint" id="add-window-models-empty" hidden>
|
||
请至少再勾选一个模型。
|
||
</p>
|
||
</fieldset>
|
||
<div class="chat-dialog-actions">
|
||
<button type="submit" class="st-btn st-btn-primary" value="ok">添加</button>
|
||
<button type="submit" class="st-btn" value="cancel" formnovalidate>取消</button>
|
||
</div>
|
||
</form>
|
||
</dialog>
|
||
|
||
<script type="module" src="/chat.js"></script>
|
||
</body>
|
||
</html>
|