Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b4621d64bf | |||
| 35c67263a1 | |||
| ef2e8fed53 | |||
| bade4541fe |
57
豆鲍/AGENTS.md
57
豆鲍/AGENTS.md
@@ -790,3 +790,60 @@ App 的对外显示名从「豆包」改成了「小人间」——这是**显
|
||||
- **长按 @ 决斗(v3.42)**:`bindMemberActions()` 同时绑在场成员和底部 @ 片;
|
||||
点=插 `@名字`,长按 560ms(或 contextmenu)= `openDuelPrompt` → `GameUI.startDuel`
|
||||
→ `GameUI.openScreen('duel')`。不要用 click 直接开打;没有武器要让内核报错并 toast。
|
||||
|
||||
## 游戏界面 v3.43:@ 收进 rail / 可折叠底栏 / 动态对白窗
|
||||
|
||||
- **@ 在左侧 rail**:`index.html` 的 `在场 / @` 下面是成员 chip(`@名字`)。**不要再放底部
|
||||
`#quick` 快捷条**(用户明确让删)。点=插 `@`,长按=弹「私聊 / 决斗 / 信息」;
|
||||
`bindMemberActions` 同时绑 rail 成员;长按时 `touch-action:none`,否则父级滚动会抢走
|
||||
长按(真机踩过)。
|
||||
- **私聊**:菜单里 `privateTo` → `GameUI.send(text, { privateTo })`,SDK 转成
|
||||
`/api/chat` 的 `privateTo`;输入框上方 `#privateBar` 显示「🔒 私聊 · 某人 / 退出」。
|
||||
单人会话(在场成员 < 2)直接 toast,不进私聊。
|
||||
- **底栏 8 功能 + 折叠**:存档/信息/读档/跳过/记录/设置/朗读/新话题;最左 `⌄` 收起,
|
||||
`body.actions-collapsed` 时只显示 `#actionsToggle`「功能 ⌃」。状态存
|
||||
`localStorage['galgame:actionsCollapsed']`;收起时 `.dock` 要加 42px 底部 padding,
|
||||
别让「功能」小钮压住输入框。
|
||||
- **对白窗定高**:`.box` 150px(≥760px 高时 180px),`.text` 自己 `height:100%; overflow-y:auto`。
|
||||
**不要用 `min-height + max-height:百分比`** —— Chrome 会把 `.dialogue` 按文字内容撑高,
|
||||
多出 100px 空白(用户反馈「这个咋那么高」)。名字牌放 box 外,始终可见;文字只滚 `.text`。
|
||||
- **rail 动态高度**:`fitRail()` 取 `.dialogue` top,把 rail 底边收到其上方 10px;
|
||||
可用高 <240px 自动 `rail-compact`(隐藏标签、成员竖排收窄、nav 缩高)。改布局后
|
||||
必须在 360×640 验证 4 个 nav + @ 都在,不能只信 390×844。
|
||||
- **探针**:`probe-ui-packs` 检查 `privateBar` / `actions-fold` / `actionsToggle` /
|
||||
`speak`/`newtopic` / `openMemberMenu` / `fitRail` / `rail-compact` / SDK `privateTo`,
|
||||
并断言 HTML 里没有 `id="quick"`。
|
||||
|
||||
## 导出相关 v3.44
|
||||
|
||||
- **智能体包导出**:`image.front` 是**五档 dict**,不是字符串。`_export_agent` 必须逐档
|
||||
打包成 `front-<档位><ext>`,`smartInfo.json.image.front` 写回档位字典;旧代码对 dict
|
||||
调 `os.path.isfile` 会 TypeError → 带立绘的智能体导出 500。世界观导出已有同款测试,
|
||||
智能体这条路也必须保住;回归 `probe-agent-system` §9(设置 front:平常 → 导出 → 导入)。
|
||||
- **UI 包导出入口**:设置 →「游戏界面(HTML)」每个包右侧「导出」;编辑器右上角也有。
|
||||
导出走 `KernelClient.exportUiPack`,zip base64 → SAF,别只藏在「编辑」里。
|
||||
|
||||
## 工具调用动效 v3.45
|
||||
|
||||
- 内核 `agent_loop` 发 `tool_call` / `tool_result` 事件;SDK 没有专门 switch 分支,会落到
|
||||
通用 `event`。game.js 监听 `GameUI.on('event')`,在 `#toolToast` 显示
|
||||
「AI 正在调用 · 工具名」→「✓ AI 调用了 · 工具名」;工具失败显示「工具失败」,
|
||||
1.2s 后隐藏。工具 id 用 `TOOL_LABELS` 映射中文,未知显示原 id。
|
||||
- 位置:`.dialogue` 内的绝对定位胶囊,**右对齐**在对话框上方,别放左边(会压住 rail 的
|
||||
地图/背包)。别让它进入 dock 文档流,否则会把对白窗顶下去。
|
||||
|
||||
## 工具调用铁律 v3.46(弱模型只说不做)
|
||||
|
||||
- **用户反馈最大问题**:小/弱模型移动、用物品时只在正文写「我走向商店 / 我用了药」,
|
||||
实际没调 `move_to` / `use_item`;必须让动作落成工具。
|
||||
- **三处同时改**:
|
||||
1. `defaults.BUILTIN_SKILL` 第一段「行动必须调用工具」(映射 + 不许口头完成);
|
||||
2. `agent_context.build_system_prompt` 末尾追加 `TOOL_ACTION_POLICY`(最后一段,弱模型更敏感);
|
||||
3. `agent_loop.action_turn_hint()` 检测到用户行动句时再加一轮 system 提醒。
|
||||
- **降级模式**(provider.noTools):`DEGRADED_HINT` 不能只列 memory/emotion —— 必须列
|
||||
`move_to/list_places/use_item/use_item_on/give_item/drop_item/...` 并给 `doubao-call` 示例,
|
||||
否则不能 function calling 的模型永远只会说。
|
||||
- **工具描述**也要写「必须调用本工具;只写正文位置/背包不会变」。
|
||||
- 回归:`probe-agent-system` §16(prompt 末尾/技能首段/工具描述/降级提示/行动句提醒)。
|
||||
- **别加 `tool_choice:'required'` 硬强制**:闲聊/用户描述自己动作时会被迫乱调工具,比只说不做更糟;
|
||||
先用分层提示 + 降级可写调用兜底。
|
||||
|
||||
@@ -30,8 +30,8 @@ android {
|
||||
* versionCode 每次发版 +1(Android 靠它判断"能不能覆盖安装",
|
||||
* 改小了会装不上)。
|
||||
*/
|
||||
versionCode = 366
|
||||
versionName = "2.0.166"
|
||||
versionCode = 370
|
||||
versionName = "2.0.170"
|
||||
|
||||
ndk {
|
||||
// Chaquopy 只支持这两个;Termux bootstrap 也只准备了这两份
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
const $ = (id) => document.getElementById(id);
|
||||
|
||||
const UI = {
|
||||
privateTarget: '',
|
||||
privateTargetName: '',
|
||||
displayMsg: null,
|
||||
displayEl: null,
|
||||
speakerId: '',
|
||||
@@ -47,6 +49,13 @@
|
||||
send: $('sendBtn'),
|
||||
stop: $('stopBtn'),
|
||||
quick: $('quick'),
|
||||
privateBar: $('privateBar'),
|
||||
privateName: $('privateName'),
|
||||
privateExit: $('privateExit'),
|
||||
toolToast: $('toolToast'),
|
||||
toolSpinner: $('toolSpinner'),
|
||||
toolText: $('toolText'),
|
||||
toolName: $('toolName'),
|
||||
memberBar: $('memberBar'),
|
||||
scene: $('sceneName'),
|
||||
hud: $('hud'),
|
||||
@@ -246,7 +255,7 @@
|
||||
cancel();
|
||||
timer = setTimeout(() => {
|
||||
longPressed = true;
|
||||
openDuelPrompt(agent);
|
||||
openMemberMenu(agent);
|
||||
}, 560);
|
||||
};
|
||||
el.addEventListener('pointerdown', start);
|
||||
@@ -257,7 +266,7 @@
|
||||
e.preventDefault();
|
||||
cancel();
|
||||
longPressed = true;
|
||||
openDuelPrompt(agent);
|
||||
openMemberMenu(agent);
|
||||
});
|
||||
el.addEventListener('click', (e) => {
|
||||
cancel();
|
||||
@@ -272,6 +281,67 @@
|
||||
});
|
||||
}
|
||||
|
||||
/** 长按 @ 成员:私聊 / 决斗 / 看信息 三选一(v3.43) */
|
||||
function openMemberMenu(agent) {
|
||||
if (!agent) return;
|
||||
openPanel(`「${agent.name || agent.id}」`, (body) => {
|
||||
const hint = document.createElement('div');
|
||||
hint.className = 'panel-hint';
|
||||
hint.textContent = '点成员 = 插入 @;长按 = 私聊 / 决斗 / 看信息。';
|
||||
body.appendChild(hint);
|
||||
|
||||
const privateBtn = document.createElement('button');
|
||||
privateBtn.className = 'panel-btn';
|
||||
privateBtn.textContent = '🔒 私聊(只有 TA 能看到)';
|
||||
privateBtn.onclick = () => {
|
||||
closePanel();
|
||||
const conv = GameUI.conversation() || {};
|
||||
if (memberIds(conv).length < 2) {
|
||||
toast('单人会话不用私聊');
|
||||
return;
|
||||
}
|
||||
UI.privateTarget = agent.id;
|
||||
UI.privateTargetName = agent.name || agent.id;
|
||||
if (els.privateName) els.privateName.textContent = UI.privateTargetName;
|
||||
if (els.privateBar) els.privateBar.classList.remove('hidden');
|
||||
els.input.focus();
|
||||
toast(`🔒 已进入和「${UI.privateTargetName}」的私聊`);
|
||||
};
|
||||
body.appendChild(privateBtn);
|
||||
|
||||
const duelBtn = document.createElement('button');
|
||||
duelBtn.className = 'panel-btn';
|
||||
duelBtn.textContent = '⚔ 决斗';
|
||||
duelBtn.onclick = () => {
|
||||
closePanel();
|
||||
openDuelPrompt(agent);
|
||||
};
|
||||
body.appendChild(duelBtn);
|
||||
|
||||
const infoBtn = document.createElement('button');
|
||||
infoBtn.className = 'panel-btn ghost';
|
||||
infoBtn.textContent = '信息';
|
||||
infoBtn.onclick = () => {
|
||||
closePanel();
|
||||
openInfo(agent.id);
|
||||
};
|
||||
body.appendChild(infoBtn);
|
||||
|
||||
const cancel = document.createElement('button');
|
||||
cancel.className = 'panel-btn ghost';
|
||||
cancel.textContent = '取消';
|
||||
cancel.onclick = closePanel;
|
||||
body.appendChild(cancel);
|
||||
});
|
||||
}
|
||||
|
||||
function exitPrivateChat() {
|
||||
UI.privateTarget = '';
|
||||
UI.privateTargetName = '';
|
||||
if (els.privateBar) els.privateBar.classList.add('hidden');
|
||||
toast('已退出私聊,回到正常发言');
|
||||
}
|
||||
|
||||
/** 长按 @ 成员 / 快捷 @ 片:确认后发起决斗并打开决斗页 */
|
||||
function openDuelPrompt(agent) {
|
||||
if (!agent) return;
|
||||
@@ -325,7 +395,7 @@
|
||||
const img = el.querySelector('img');
|
||||
img.src = GameUI.agentAvatar(agent);
|
||||
img.onerror = () => { img.src = 'assets/avatars/custom.png'; };
|
||||
el.querySelector('span').textContent = agent.name || id;
|
||||
el.querySelector('span').textContent = '@' + (agent.name || id);
|
||||
// 点在场成员 = 插入 @名字;成员档案走底部「信息」,不再抢占点击
|
||||
el.title = `点=@${agent.name || id} · 长按=决斗`;
|
||||
bindMemberActions(el, agent);
|
||||
@@ -359,6 +429,7 @@
|
||||
}
|
||||
|
||||
function renderQuick() {
|
||||
if (!els.quick) return;
|
||||
const conv = GameUI.conversation() || {};
|
||||
const ids = memberIds(conv);
|
||||
els.quick.innerHTML = '';
|
||||
@@ -448,10 +519,29 @@
|
||||
els.hpFill.style.width = `${Math.round(ratio * 100)}%`;
|
||||
}
|
||||
|
||||
/** 左侧 rail 高度动态跟着对白窗走:对白变长/底栏收起/转屏都不重叠(v3.43) */
|
||||
function fitRail() {
|
||||
requestAnimationFrame(() => {
|
||||
if (document.body.classList.contains('keyboard-open')) return;
|
||||
const rail = document.querySelector('.side-rail');
|
||||
const dialogue = document.querySelector('.dialogue');
|
||||
if (!rail || !dialogue) return;
|
||||
const top = dialogue.getBoundingClientRect().top;
|
||||
const h = window.innerHeight || document.documentElement.clientHeight;
|
||||
if (!top || !h) return;
|
||||
// 留 10px 呼吸位;最低保留 120px 给导航,别把 rail 压没
|
||||
const bottom = Math.max(96, h - top + 10);
|
||||
rail.style.bottom = `${Math.round(bottom)}px`;
|
||||
const avail = top - 72 - 10;
|
||||
rail.classList.toggle('rail-compact', avail < 240);
|
||||
});
|
||||
}
|
||||
|
||||
async function refreshChrome() {
|
||||
applyBackground();
|
||||
renderMembers();
|
||||
renderQuick();
|
||||
fitRail();
|
||||
const speaker = currentSpeaker();
|
||||
if (speaker && speaker.id) UI.speakerId = speaker.id;
|
||||
applySpeaker(speaker);
|
||||
@@ -484,7 +574,7 @@
|
||||
function renderShown() {
|
||||
els.text.textContent = UI.shown;
|
||||
els.cursor.classList.toggle('show', UI.typing || !!UI.streamingMessage);
|
||||
if (UI.typing) els.box.scrollTop = els.box.scrollHeight;
|
||||
if (UI.typing) els.text.scrollTop = els.text.scrollHeight;
|
||||
}
|
||||
|
||||
function finishTyping() {
|
||||
@@ -494,7 +584,7 @@
|
||||
UI.shown = UI.target;
|
||||
els.text.innerHTML = GameUI.stageify(GameUI.markdown(UI.target));
|
||||
els.cursor.classList.toggle('show', !!UI.streamingMessage);
|
||||
els.box.scrollTop = els.box.scrollHeight;
|
||||
els.text.scrollTop = els.text.scrollHeight;
|
||||
}
|
||||
|
||||
function startTyping(text, opts) {
|
||||
@@ -534,7 +624,7 @@
|
||||
UI.timer = null;
|
||||
UI.typing = false;
|
||||
els.cursor.classList.add('show');
|
||||
els.box.scrollTop = els.box.scrollHeight;
|
||||
els.text.scrollTop = els.text.scrollHeight;
|
||||
return;
|
||||
}
|
||||
UI.shown = UI.target.slice(0, Math.min(UI.target.length, UI.shown.length + step));
|
||||
@@ -566,6 +656,8 @@
|
||||
els.choice.classList.remove('show');
|
||||
}
|
||||
|
||||
fitRail();
|
||||
|
||||
function showGreeting(instant) {
|
||||
const agent = GameUI.currentAgent() || { name: '……' };
|
||||
const greeting = (agent.greeting || '').trim()
|
||||
@@ -627,8 +719,9 @@
|
||||
}
|
||||
|
||||
// SDK 的方法名是 send,这里包一层,避免和 DOM 变量重名
|
||||
const gameChatSend = (text) => GameUI.send(text);
|
||||
const gameChatSend = (text) => GameUI.send(text, { privateTo: UI.privateTarget || undefined });
|
||||
|
||||
if (els.privateExit) els.privateExit.addEventListener('click', exitPrivateChat);
|
||||
els.send.addEventListener('click', () => { doSend(); });
|
||||
els.stop.addEventListener('click', () => {
|
||||
GameUI.stop();
|
||||
@@ -904,6 +997,14 @@
|
||||
openLoad();
|
||||
return;
|
||||
}
|
||||
if (act === 'speak') {
|
||||
speakLatest();
|
||||
return;
|
||||
}
|
||||
if (act === 'newtopic') {
|
||||
GameUI.openScreen('newTopic');
|
||||
return;
|
||||
}
|
||||
if (act === 'info') {
|
||||
openInfo(UI.speakerId);
|
||||
return;
|
||||
@@ -952,6 +1053,61 @@
|
||||
});
|
||||
});
|
||||
|
||||
/* 底栏折叠:收起后只留一个「功能 ⌃」小钮,展开后右上角 ⌄ 收起 */
|
||||
const ACTIONS_KEY = 'galgame:actionsCollapsed';
|
||||
const actionsCollapseBtn = document.getElementById('actionsCollapse');
|
||||
const actionsToggleBtn = document.getElementById('actionsToggle');
|
||||
function setActionsCollapsed(collapsed) {
|
||||
document.body.classList.toggle('actions-collapsed', collapsed);
|
||||
setTimeout(fitRail, 30);
|
||||
try { localStorage.setItem(ACTIONS_KEY, collapsed ? '1' : '0'); } catch (_) { /* ignore */ }
|
||||
}
|
||||
if (actionsCollapseBtn) actionsCollapseBtn.addEventListener('click', () => setActionsCollapsed(true));
|
||||
if (actionsToggleBtn) actionsToggleBtn.addEventListener('click', () => setActionsCollapsed(false));
|
||||
try {
|
||||
if (localStorage.getItem(ACTIONS_KEY) === '1') setActionsCollapsed(true);
|
||||
} catch (_) { /* ignore */ }
|
||||
|
||||
/* ---------------- 工具调用提示(v3.45) ---------------- */
|
||||
const TOOL_LABELS = {
|
||||
memory_add: '写入记忆', memory_search: '搜索记忆', memory_update: '更新记忆',
|
||||
memory_delete: '删除记忆', memory_list: '查看记忆',
|
||||
list_places: '查看地点', list_place_links: '查看路线', list_characters: '查看角色',
|
||||
move_to: '移动', use_item: '使用物品', use_item_on: '对别人使用物品',
|
||||
give_item: '给予物品', drop_item: '丢弃物品', start_duel: '发起决斗',
|
||||
duel_attack: '决斗出招', request_stop_duel: '请求停手', show_ui: '打开界面',
|
||||
speak: '朗读', remember: '写入记忆', recall: '回忆',
|
||||
};
|
||||
let toolTimer = 0;
|
||||
function toolLabel(name) {
|
||||
const key = String(name || '').trim();
|
||||
return TOOL_LABELS[key] || key || '工具';
|
||||
}
|
||||
function showToolCall(name) {
|
||||
if (!els.toolToast) return;
|
||||
clearTimeout(toolTimer);
|
||||
els.toolName.textContent = toolLabel(name);
|
||||
els.toolText.textContent = 'AI 正在调用';
|
||||
if (els.toolSpinner) els.toolSpinner.textContent = '';
|
||||
els.toolToast.classList.remove('hidden', 'ok', 'error');
|
||||
els.toolToast.classList.add('running');
|
||||
}
|
||||
function finishToolCall(name, ok) {
|
||||
if (!els.toolToast) return;
|
||||
clearTimeout(toolTimer);
|
||||
els.toolName.textContent = toolLabel(name);
|
||||
els.toolText.textContent = ok ? 'AI 调用了' : '工具失败';
|
||||
if (els.toolSpinner) els.toolSpinner.textContent = ok ? '✓' : '!';
|
||||
els.toolToast.classList.remove('running');
|
||||
els.toolToast.classList.add(ok ? 'ok' : 'error');
|
||||
toolTimer = setTimeout(() => els.toolToast.classList.add('hidden'), 1200);
|
||||
}
|
||||
GameUI.on('event', (ev) => {
|
||||
if (!ev) return;
|
||||
if (ev.type === 'tool_call') showToolCall(ev.name);
|
||||
else if (ev.type === 'tool_result') finishToolCall(ev.name, ev.ok !== false);
|
||||
});
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* GameUI 事件 */
|
||||
/* ------------------------------------------------------------------ */
|
||||
@@ -1049,7 +1205,7 @@
|
||||
await loadProfile();
|
||||
await refreshChrome();
|
||||
els.choice.classList.remove('show');
|
||||
els.box.scrollTop = els.box.scrollHeight;
|
||||
els.text.scrollTop = els.text.scrollHeight;
|
||||
});
|
||||
|
||||
GameUI.on('opened', async () => {
|
||||
@@ -1109,9 +1265,10 @@
|
||||
const open = !!vv && vv.height < screenH * 0.72;
|
||||
document.body.classList.toggle('keyboard-open', open);
|
||||
};
|
||||
if (window.visualViewport) window.visualViewport.addEventListener('resize', update);
|
||||
if (window.visualViewport) window.visualViewport.addEventListener('resize', () => { update(); fitRail(); });
|
||||
input.addEventListener('focus', () => setTimeout(update, 500));
|
||||
input.addEventListener('blur', () => document.body.classList.remove('keyboard-open'));
|
||||
window.addEventListener('resize', fitRail);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
</div>
|
||||
|
||||
<div class="rail-block rail-grow">
|
||||
<div class="rail-label">在场</div>
|
||||
<div class="rail-label">在场 / @</div>
|
||||
<div id="memberBar" class="member-bar"></div>
|
||||
</div>
|
||||
|
||||
@@ -69,6 +69,12 @@
|
||||
<section class="dock">
|
||||
<div id="choiceEcho" class="choice-echo"></div>
|
||||
<div class="dialogue">
|
||||
<!-- 工具调用动效:在对话框上方浮一条,告诉用户 AI 刚调了什么工具(v3.45) -->
|
||||
<div id="toolToast" class="tool-toast hidden">
|
||||
<span id="toolSpinner" class="tool-spinner"></span>
|
||||
<span id="toolText" class="tool-text">AI 正在调用</span>
|
||||
<b id="toolName" class="tool-name"></b>
|
||||
</div>
|
||||
<div class="nameplate"><span id="speakerName">……</span></div>
|
||||
<div id="box" class="box">
|
||||
<div id="dialogueText" class="text"></div>
|
||||
@@ -78,7 +84,10 @@
|
||||
|
||||
<!-- 输入 -->
|
||||
<div id="inputBar" class="input-bar">
|
||||
<div class="quick" id="quick"></div>
|
||||
<div id="privateBar" class="private-bar hidden">
|
||||
<span>🔒 私聊 · <b id="privateName"></b></span>
|
||||
<button id="privateExit">退出</button>
|
||||
</div>
|
||||
<div class="input-row">
|
||||
<textarea id="input" rows="1" placeholder="说点什么……(Enter 发送)" autocomplete="off"></textarea>
|
||||
<button id="sendBtn" class="send-btn" title="发送">➤</button>
|
||||
@@ -87,13 +96,17 @@
|
||||
</div>
|
||||
|
||||
<!-- 底部按钮(图里的 Save / Info / Load / Skip / Log) -->
|
||||
<nav class="actions">
|
||||
<button id="actionsToggle" class="actions-toggle" title="展开功能栏">功能 <span>⌃</span></button>
|
||||
<nav class="actions" id="actions">
|
||||
<button id="actionsCollapse" class="actions-fold" title="收起功能栏">⌄</button>
|
||||
<button class="act" data-act="save"><span class="ico">↓</span><span>存档</span></button>
|
||||
<button class="act" data-act="info"><span class="ico">i</span><span>信息</span></button>
|
||||
<button class="act" data-act="load"><span class="ico">↑</span><span>读档</span></button>
|
||||
<button class="act" data-act="skip"><span class="ico">»</span><span>跳过</span></button>
|
||||
<button class="act" data-act="log"><span class="ico">☰</span><span>记录</span></button>
|
||||
<button class="act" data-act="settings"><span class="ico">⚙</span><span>设置</span></button>
|
||||
<button class="act" data-act="speak"><span class="ico">♪</span><span>朗读</span></button>
|
||||
<button class="act" data-act="newtopic"><span class="ico">+</span><span>新话题</span></button>
|
||||
</nav>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -642,13 +642,6 @@ body.has-bg-image .bg-room { display: none; }
|
||||
box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
|
||||
}
|
||||
|
||||
.quick {
|
||||
display: flex;
|
||||
gap: 5px;
|
||||
overflow-x: auto;
|
||||
scrollbar-width: none;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.quick::-webkit-scrollbar { display: none; }
|
||||
|
||||
@@ -1332,24 +1325,22 @@ body::before {
|
||||
}
|
||||
.dialogue { position: relative; align-items: stretch; }
|
||||
.nameplate {
|
||||
position: absolute;
|
||||
top: 9px;
|
||||
left: 18px;
|
||||
z-index: 3;
|
||||
min-width: 0;
|
||||
max-width: 70%;
|
||||
padding: 0 8px;
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 0 0 6px 2px;
|
||||
padding: 0 0 0 8px;
|
||||
border: 0;
|
||||
border-left: 2px solid rgba(211, 180, 131, .75);
|
||||
border-radius: 0;
|
||||
background: rgba(10, 15, 25, .45);
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
color: var(--gold);
|
||||
font-family: var(--serif);
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
letter-spacing: .2em;
|
||||
text-align: left;
|
||||
max-width: 100%;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
@@ -1357,9 +1348,10 @@ body::before {
|
||||
}
|
||||
.nameplate::before, .nameplate::after { content: none; }
|
||||
.box {
|
||||
min-height: 154px;
|
||||
max-height: 32%;
|
||||
padding: 30px 20px 18px;
|
||||
height: 150px;
|
||||
min-height: 0;
|
||||
max-height: none;
|
||||
padding: 12px 18px 13px;
|
||||
border: 1px solid rgba(255, 255, 255, .13);
|
||||
border-top-color: rgba(211, 180, 131, .55);
|
||||
border-radius: 18px;
|
||||
@@ -1376,7 +1368,7 @@ body::before {
|
||||
.text {
|
||||
color: #f2ebdf;
|
||||
font-size: var(--dialogue-size);
|
||||
line-height: 1.9;
|
||||
line-height: 1.76;
|
||||
letter-spacing: .015em;
|
||||
text-shadow: 0 1px 3px rgba(0, 0, 0, .45);
|
||||
}
|
||||
@@ -1393,13 +1385,6 @@ body::before {
|
||||
|
||||
box-shadow: 0 12px 30px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .05);
|
||||
}
|
||||
.quick {
|
||||
display: flex;
|
||||
gap: 5px;
|
||||
padding: 1px 2px 4px;
|
||||
overflow-x: auto;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
.quick::-webkit-scrollbar { display: none; }
|
||||
.chip {
|
||||
border: 1px solid rgba(255, 255, 255, .09);
|
||||
@@ -1654,7 +1639,200 @@ body.keyboard-open .side-rail,
|
||||
body.keyboard-open .quick,
|
||||
body.keyboard-open .actions { display: none !important; }
|
||||
body.keyboard-open .dock { padding-top: 10px; }
|
||||
body.keyboard-open .box { min-height: 92px; max-height: 118px; }
|
||||
body.keyboard-open .box { height: 118px; min-height: 0; max-height: none; }
|
||||
body.keyboard-open .box .text { line-height: 1.7; }
|
||||
|
||||
.bg-room::before, .bg-room::after { display: none !important; content: none !important; }
|
||||
|
||||
/* ---------------- 底栏折叠 + 8 个功能(v3.43) ---------------- */
|
||||
.actions {
|
||||
gap: 2px;
|
||||
}
|
||||
.act {
|
||||
flex: 1 1 0;
|
||||
min-width: 0;
|
||||
padding: 6px 1px 5px;
|
||||
}
|
||||
.act span:last-child { font-size: 7.8px; letter-spacing: 0; }
|
||||
.actions-fold {
|
||||
flex: 0 0 24px;
|
||||
min-width: 24px;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: rgba(240, 234, 224, .38);
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
}
|
||||
.actions-fold:active { color: var(--gold); }
|
||||
.actions-toggle {
|
||||
display: none;
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
bottom: 10px;
|
||||
transform: translateX(-50%);
|
||||
z-index: 31;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
padding: 7px 16px;
|
||||
border: 1px solid rgba(211, 180, 131, .35);
|
||||
border-radius: 14px;
|
||||
background: rgba(10, 15, 24, .9);
|
||||
color: rgba(240, 234, 224, .7);
|
||||
font-family: var(--sans);
|
||||
font-size: 10px;
|
||||
letter-spacing: .12em;
|
||||
box-shadow: 0 8px 22px rgba(0, 0, 0, .35);
|
||||
}
|
||||
.actions-toggle span { color: var(--gold); font-size: 12px; }
|
||||
body.actions-collapsed .actions { display: none; }
|
||||
body.actions-collapsed .actions-fold { display: none; }
|
||||
body.actions-collapsed .actions-toggle { display: flex; }
|
||||
body.keyboard-open .actions-toggle,
|
||||
body.keyboard-open .actions-collapse { display: none !important; }
|
||||
|
||||
/* ---------------- 私聊状态条(v3.43) ---------------- */
|
||||
.private-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
margin: 0 2px 5px;
|
||||
padding: 4px 8px;
|
||||
border: 1px solid rgba(143, 184, 220, .28);
|
||||
border-radius: 9px;
|
||||
background: rgba(32, 58, 82, .55);
|
||||
color: rgba(206, 226, 242, .82);
|
||||
font-size: 9px;
|
||||
letter-spacing: .02em;
|
||||
}
|
||||
.private-bar b { color: #cfe6f7; font-weight: 600; }
|
||||
.private-bar button {
|
||||
appearance: none;
|
||||
border: 1px solid rgba(255, 255, 255, .15);
|
||||
border-radius: 7px;
|
||||
background: rgba(255, 255, 255, .06);
|
||||
color: rgba(230, 240, 248, .72);
|
||||
padding: 2px 8px;
|
||||
font-size: 8px;
|
||||
}
|
||||
.private-bar.hidden { display: none; }
|
||||
|
||||
/* 折叠后给底部「功能」小钮留出位置,别压住输入框 */
|
||||
body.actions-collapsed .dock { padding-bottom: calc(42px + env(safe-area-inset-bottom)); }
|
||||
|
||||
/* 空间不足时自动压缩 rail:隐藏标签、成员横排、nav 缩高(v3.43 动态调节) */
|
||||
.side-rail.rail-compact { gap: 4px; }
|
||||
.side-rail.rail-compact .rail-label { display: none; }
|
||||
.side-rail.rail-compact .rail-block { flex: 0 0 auto; }
|
||||
.side-rail.rail-compact .scene-chip { font-size: 10px; line-height: 1.25; }
|
||||
.side-rail.rail-compact .hud .pill { padding: 1px 5px; font-size: 7px; }
|
||||
.side-rail.rail-compact .rail-grow { flex: 0 0 auto; min-height: 22px; }
|
||||
.side-rail.rail-compact .member-bar {
|
||||
flex: 0 0 auto;
|
||||
flex-direction: column;
|
||||
min-height: 22px;
|
||||
max-height: 46px;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
gap: 2px;
|
||||
}
|
||||
.side-rail.rail-compact .member {
|
||||
width: 100%;
|
||||
flex: 0 0 auto;
|
||||
padding: 1px 5px 1px 2px;
|
||||
font-size: 8.5px;
|
||||
max-width: none;
|
||||
}
|
||||
.side-rail.rail-compact .member img, .side-rail.rail-compact .member .avatar {
|
||||
width: 16px; height: 16px;
|
||||
}
|
||||
.side-rail.rail-compact .rail-nav { padding-top: 1px; gap: 2px; }
|
||||
.side-rail.rail-compact .rail-nav button { padding: 1px 1px 0; font-size: 6.8px; }
|
||||
.side-rail.rail-compact .rail-nav button .ico { font-size: 9px; }
|
||||
|
||||
/* 大屏给对白窗多留一点高度(小屏保持 150px,避免对白窗自己撑高) */
|
||||
@media (min-height: 760px) {
|
||||
.box { height: 180px; }
|
||||
}
|
||||
|
||||
/* 对白窗固定高度后,只让文字层自己滚动,避免内容画到框外(v3.43) */
|
||||
.box { overflow: hidden; }
|
||||
.text {
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
.text::-webkit-scrollbar { display: none; }
|
||||
|
||||
/* 成员条:长按不能被父级的横向/纵向滚动手势抢走 */
|
||||
.side-rail .member { touch-action: none; }
|
||||
|
||||
/* ---------------- 工具调用浮条(v3.45) ---------------- */
|
||||
.tool-toast {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
left: auto;
|
||||
bottom: calc(100% + 6px);
|
||||
z-index: 6;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
max-width: calc(100% - 122px);
|
||||
padding: 5px 11px 5px 9px;
|
||||
border: 1px solid rgba(211, 180, 131, .35);
|
||||
border-radius: 999px;
|
||||
background: rgba(12, 18, 30, .94);
|
||||
color: rgba(235, 228, 216, .65);
|
||||
font-family: var(--sans);
|
||||
font-size: 9.5px;
|
||||
letter-spacing: .04em;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
box-shadow: 0 8px 22px rgba(0, 0, 0, .35);
|
||||
pointer-events: none;
|
||||
animation: toolIn .18s ease both;
|
||||
}
|
||||
.tool-toast.hidden { display: none; }
|
||||
.tool-toast .tool-text { opacity: .72; }
|
||||
.tool-toast .tool-name {
|
||||
color: var(--gold);
|
||||
font-weight: 600;
|
||||
max-width: 42vw;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.tool-spinner {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
flex: 0 0 12px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 50%;
|
||||
border: 1.5px solid rgba(211, 180, 131, .25);
|
||||
border-top-color: var(--gold);
|
||||
color: var(--gold);
|
||||
font-size: 8px;
|
||||
line-height: 1;
|
||||
animation: toolSpin .7s linear infinite;
|
||||
}
|
||||
.tool-toast.ok .tool-spinner {
|
||||
border-color: rgba(143, 214, 168, .45);
|
||||
color: #8fd6a8;
|
||||
animation: none;
|
||||
}
|
||||
.tool-toast.error .tool-spinner {
|
||||
border-color: rgba(240, 160, 160, .45);
|
||||
color: #f0a0a0;
|
||||
animation: none;
|
||||
}
|
||||
.tool-toast.ok .tool-name { color: #8fd6a8; }
|
||||
.tool-toast.error .tool-name { color: #f0a0a0; }
|
||||
@keyframes toolSpin { to { transform: rotate(360deg); } }
|
||||
@keyframes toolIn {
|
||||
from { opacity: 0; transform: translateY(4px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
@@ -312,6 +312,7 @@
|
||||
transport: 'poll',
|
||||
};
|
||||
if (options.agentId) body.agentId = options.agentId;
|
||||
if (options.privateTo) body.privateTo = String(options.privateTo);
|
||||
if (options.attachments && options.attachments.length) body.attachments = options.attachments;
|
||||
|
||||
let start;
|
||||
|
||||
@@ -62,6 +62,46 @@ fun GameUiSettingsScreen(vm: AppViewModel, onBack: () -> Unit) {
|
||||
var importId by remember { mutableStateOf("") }
|
||||
var importName by remember { mutableStateOf("") }
|
||||
var busy by remember { mutableStateOf(false) }
|
||||
var pendingExport by remember { mutableStateOf<Pair<String, String>?>(null) }
|
||||
|
||||
val exportLauncher = rememberLauncherForActivityResult(
|
||||
ActivityResultContracts.CreateDocument("application/zip"),
|
||||
) { uri: Uri? ->
|
||||
val payload = pendingExport
|
||||
pendingExport = null
|
||||
if (uri == null || payload == null) return@rememberLauncherForActivityResult
|
||||
scope.launch {
|
||||
val ok = withContext(Dispatchers.IO) {
|
||||
runCatching {
|
||||
val bytes = Base64.decode(payload.second, Base64.DEFAULT)
|
||||
ctx.contentResolver.openOutputStream(uri)?.use { it.write(bytes) } != null
|
||||
}.getOrDefault(false)
|
||||
}
|
||||
vm.showHint(if (ok) "界面包已导出" else "导出失败:写不进去")
|
||||
}
|
||||
}
|
||||
|
||||
fun doExport(packId: String) {
|
||||
if (busy) return
|
||||
busy = true
|
||||
scope.launch {
|
||||
try {
|
||||
val res = withContext(Dispatchers.IO) { vm.client.exportUiPack(packId) }
|
||||
val b64 = res.optString("base64")
|
||||
if (b64.isBlank()) {
|
||||
vm.showHint("导出失败:内核没有返回内容")
|
||||
return@launch
|
||||
}
|
||||
val name = res.optString("filename").ifBlank { "$packId.zip" }
|
||||
pendingExport = name to b64
|
||||
exportLauncher.launch(name)
|
||||
} catch (e: Exception) {
|
||||
vm.showHint("导出失败:${e.message}")
|
||||
} finally {
|
||||
busy = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (editingPack.isNotBlank()) {
|
||||
UiPackEditorScreen(vm, editingPack, onBack = {
|
||||
@@ -221,6 +261,7 @@ fun GameUiSettingsScreen(vm: AppViewModel, onBack: () -> Unit) {
|
||||
active = vm.state.settings.gameUiEnabled && pack.id == vm.gameUiPack,
|
||||
onUse = { vm.applyGameUiPack(pack.id) },
|
||||
onEdit = { editingPack = pack.id },
|
||||
onExport = { doExport(pack.id) },
|
||||
onReset = if (pack.builtin) ({ vm.resetUiPack(pack.id) }) else null,
|
||||
)
|
||||
}
|
||||
@@ -326,6 +367,7 @@ private fun UiPackRow(
|
||||
active: Boolean,
|
||||
onUse: () -> Unit,
|
||||
onEdit: () -> Unit,
|
||||
onExport: () -> Unit,
|
||||
onReset: (() -> Unit)?,
|
||||
) {
|
||||
Column(
|
||||
@@ -400,6 +442,15 @@ private fun UiPackRow(
|
||||
.clickable { onEdit() }
|
||||
.padding(horizontal = 7.dp, vertical = 4.dp),
|
||||
)
|
||||
Text(
|
||||
"导出",
|
||||
fontSize = 11.sp,
|
||||
color = Doubao.Blue,
|
||||
modifier = Modifier
|
||||
.clip(RoundedCornerShape(8.dp))
|
||||
.clickable { onExport() }
|
||||
.padding(horizontal = 8.dp, vertical = 4.dp),
|
||||
)
|
||||
if (onReset != null) {
|
||||
Text(
|
||||
"恢复内置",
|
||||
|
||||
@@ -2436,21 +2436,58 @@ def _export_agent(handler, agent_id: str, err) -> bool:
|
||||
err(404, '没有这个智能体')
|
||||
return True
|
||||
files = {}
|
||||
image = agent.get('image') or {}
|
||||
for key, path in image.items():
|
||||
if not path or not os.path.isfile(path):
|
||||
continue
|
||||
info_image = {}
|
||||
|
||||
def add_file(pkg_name: str, path: str) -> str:
|
||||
"""读一个外观文件进包;坏路径/读失败返回空串(不阻断导出)。"""
|
||||
if not path or not isinstance(path, str) or not os.path.isfile(path):
|
||||
return ''
|
||||
try:
|
||||
with open(path, 'rb') as fh:
|
||||
files[f'{key}{os.path.splitext(path)[1]}'] = fh.read()
|
||||
files[pkg_name] = fh.read()
|
||||
except OSError:
|
||||
return ''
|
||||
return pkg_name
|
||||
|
||||
image = agent.get('image') or {}
|
||||
front = image.get('front')
|
||||
# ★ v1.2:front 是五档立绘表(喜/怒/哀/平常/死亡),不是字符串。
|
||||
# 旧代码对 dict 直接 os.path.isfile(dict) → TypeError,带立绘的智能体
|
||||
# 一导出就 500(用户反馈「为什么带立绘的角色导出不了」)。
|
||||
if isinstance(front, dict):
|
||||
packed = {}
|
||||
for preset, path in front.items():
|
||||
slot = str(preset or '').strip()
|
||||
if not slot:
|
||||
continue
|
||||
ext = os.path.splitext(str(path or ''))[1] or '.png'
|
||||
name = f'front-{_safe_segment(slot)}{ext}'
|
||||
got = add_file(name, path)
|
||||
if got:
|
||||
packed[slot] = got
|
||||
if packed:
|
||||
info_image['front'] = packed
|
||||
elif isinstance(front, str):
|
||||
ext = os.path.splitext(front)[1] or '.png'
|
||||
got = add_file(f'front{ext}', front)
|
||||
if got:
|
||||
info_image['front'] = got
|
||||
|
||||
for key in ('back', 'border-main', 'border-info'):
|
||||
path = image.get(key)
|
||||
if not isinstance(path, str):
|
||||
continue
|
||||
ext = os.path.splitext(path)[1] or '.png'
|
||||
got = add_file(f'{key}{ext}', path)
|
||||
if got:
|
||||
info_image[key] = got
|
||||
|
||||
# ★ 包里**不存内部 ID、不存模型引用、不存限额**(需求 2.5 的"包的边界约定")
|
||||
info = {
|
||||
'name': agent.get('name') or '',
|
||||
'description': agent.get('description') or '',
|
||||
'prompt': agent.get('systemPrompt') or '',
|
||||
'image': {k: f'{k}{os.path.splitext(v)[1]}' for k, v in image.items() if v},
|
||||
'image': info_image,
|
||||
}
|
||||
files['smartInfo.json'] = json.dumps(info, ensure_ascii=False, indent=2).encode('utf-8')
|
||||
blob = _zip_of(files)
|
||||
@@ -2460,7 +2497,6 @@ def _export_agent(handler, agent_id: str, err) -> bool:
|
||||
'bytes': len(blob),
|
||||
})
|
||||
|
||||
|
||||
#: 外观四件套的槽位名(和需求 2.5 的 smartInfo.json 一一对应)
|
||||
ASSET_KEYS = ('front', 'back', 'border-main', 'border-info')
|
||||
|
||||
|
||||
@@ -548,6 +548,19 @@ def sections(settings: dict, agent: dict, container: dict = None) -> list:
|
||||
return out
|
||||
|
||||
|
||||
#: 每轮 system prompt 末尾的"行动必须落成工具"铁律(v3.46)。
|
||||
#: 弱模型/降级模型经常只写"我走向商店"而不调用 move_to;这段放在最后提高遵从率。
|
||||
TOOL_ACTION_POLICY = '\n'.join([
|
||||
'【本轮行动校验 · 必须遵守】',
|
||||
'· 正文不能代替工具。你要移动、使用/给予/丢弃物品、攻击、决斗、改数值或状态时,',
|
||||
' **必须先调用对应工具,再描述结果**;没调用工具就不许写"我已经到了/我用了/我给了他"。',
|
||||
'· 去别的地点 → move_to;用物品 → use_item;对别人用 → use_item_on;',
|
||||
' 给/递/交给 → give_item;扔/丢 → drop_item;查地点/路线/人物 → list_places / list_place_links / list_characters。',
|
||||
'· 用户不用喊"调用 move_to";剧情里你要动,就自己调用。',
|
||||
'· 如果模型不支持函数调用,仍要把调用写成 ```doubao-call {"tool":"move_to","args":{"place":"..."}}```,不能改口头。',
|
||||
'· 工具报错照实说,别把失败演成成功。',
|
||||
])
|
||||
|
||||
def build_system_prompt(settings: dict, agent: dict, container: dict = None) -> str:
|
||||
"""
|
||||
这一轮要用的 system prompt。
|
||||
@@ -572,6 +585,10 @@ def build_system_prompt(settings: dict, agent: dict, container: dict = None) ->
|
||||
extra.append(f'<slot>\n{slot_text}\n</slot>')
|
||||
if extra:
|
||||
out = (out + '\n\n' + '\n\n'.join(extra)).strip()
|
||||
# ★ v3.46:放在 system prompt **最后** —— 弱模型对最后一段更敏感。
|
||||
# 只靠 <skills> 里的长手册时,小模型经常"读到了但不执行",
|
||||
# 于是出现"嘴上走到商店、实际没调 move_to"。
|
||||
out = (out + '\n\n' + TOOL_ACTION_POLICY).strip()
|
||||
return out
|
||||
|
||||
|
||||
|
||||
@@ -172,8 +172,20 @@ DEGRADED_HINT = '\n'.join([
|
||||
'{"tool": "memory_add", "args": {"title": "标题", "content": "内容"}}',
|
||||
'```',
|
||||
'',
|
||||
'可用的工具:memory_add、memory_update、memory_forget、memory_search、'
|
||||
'emotion_set、get_token_usage。',
|
||||
'★ 需要做**动作**时必须写 doubao-call,不能只在正文说做了:',
|
||||
'',
|
||||
'```doubao-call',
|
||||
'{"tool": "move_to", "args": {"place": "商店"}}',
|
||||
'```',
|
||||
'',
|
||||
'```doubao-call',
|
||||
'{"tool": "use_item", "args": {"name": "面包"}}',
|
||||
'```',
|
||||
'',
|
||||
'可用工具:memory_add、memory_update、memory_forget、memory_search、'
|
||||
'emotion_set、get_token_usage、move_to、list_places、list_place_links、'
|
||||
'list_characters、use_item、use_item_on、give_item、drop_item、'
|
||||
'start_duel、duel_attack、request_stop_duel。',
|
||||
'这一段会被系统执行并从你的回复里**去掉**,用户看不到它。',
|
||||
'★ 需要记住什么的时候,**必须**写这一段 —— 只在正文里说"我记住了"是没用的,'
|
||||
'那样你其实什么都没记。',
|
||||
@@ -289,6 +301,30 @@ UI_TOOLS_HINT = '\n'.join([
|
||||
])
|
||||
|
||||
|
||||
#: 用户这句话像"行动场景"时,额外在 system prompt 尾部提醒(v3.46)。
|
||||
#: 只做**提醒**,不替模型决定;弱模型最常犯的错是"嘴上完成动作、没调工具"。
|
||||
_ACTION_HINT_RE = re.compile(
|
||||
r'(去|走到|走向|前往|移动|进入|进去|离开|回到|返回|逃到|赶到|赶到|用|使用|喝|吃|'
|
||||
r'装备|拿起|捡起|拿起|扔|丢|给|递给|交给|攻击|打|决斗|买|卖|搜查|找)'
|
||||
)
|
||||
|
||||
|
||||
def action_turn_hint(messages: list) -> str:
|
||||
latest = ''
|
||||
for msg in reversed(messages or []):
|
||||
if isinstance(msg, dict) and msg.get('role') == 'user':
|
||||
latest = str(msg.get('content') or '')
|
||||
break
|
||||
if not latest or not _ACTION_HINT_RE.search(latest):
|
||||
return ''
|
||||
return (
|
||||
'\n\n【本轮检测到行动场景】用户这句话里有动作/移动/物品/战斗意图。'
|
||||
'如果这个动作是**你(AI)**要做的(换地点、用物品、给/丢东西、攻击),'
|
||||
'必须先调用工具再描述,不能只在正文说“我做到了”;'
|
||||
'如果只是用户在描述他自己,别替他动,按世界设定回应。'
|
||||
)
|
||||
|
||||
|
||||
def run_agent(*, settings: dict, messages: list, agent=None, emit: Callable[[dict], None],
|
||||
should_stop: Optional[Callable[[], bool]] = None,
|
||||
conversation_id: str = '', send_depth: int = 0,
|
||||
@@ -417,6 +453,7 @@ def run_agent(*, settings: dict, messages: list, agent=None, emit: Callable[[dic
|
||||
if degraded:
|
||||
tool_defs = []
|
||||
system_prompt = (system_prompt + '\n' + DEGRADED_HINT).strip()
|
||||
system_prompt = (system_prompt + action_turn_hint(messages)).strip()
|
||||
thinking_level = settings.get('thinkingLevel') or 'auto'
|
||||
|
||||
emit({
|
||||
|
||||
@@ -908,6 +908,7 @@ USE_ITEM = {
|
||||
'name': 'use_item',
|
||||
'description': (
|
||||
'使用**自己背包**里的一个物品(对自己 / 无目标)。\n'
|
||||
'★★ 想用/喝/吃/装备/打开物品时**必须调用本工具**;只在正文说“我用了”不会真的消耗或生效。\n'
|
||||
'★ 主动类物品不能用它 —— 那种物品一直生效,每轮自动算。\n'
|
||||
'★ 对别人用的物品(target 类)要用 use_item_on。\n'
|
||||
'★ 需要材料/燃料的物品(比如「工作台」):用 with 把材料一起带上,'
|
||||
@@ -1191,6 +1192,7 @@ def give_item(args: dict) -> dict:
|
||||
MOVE_TO = {
|
||||
'name': 'move_to',
|
||||
'description': (
|
||||
'★★ 你要去别的地点时**必须调用本工具**;只在正文写“我走到商店/我前往学校”不会改变位置。\n'
|
||||
'去这个世界里的另一个地点(地图)。\n'
|
||||
'★ 只能去**当前地点能直达**的地方(世界包的 exits 配了邻接关系);\n'
|
||||
' 想知道能去哪儿,看 <scene> 段、用 list_places,或问用户。\n'
|
||||
|
||||
@@ -274,6 +274,19 @@ SECRET_KEYS = {'apiKey'}
|
||||
# `scripts/probe-agent-system.py` 的"新功能手册"那节(它会检查关键词)。
|
||||
# 不写的话,模型根本不知道那个功能存在 —— 界面上有、AI 不会用。
|
||||
BUILTIN_SKILL = '\n'.join([
|
||||
'【行动必须调用工具 · 第一优先】',
|
||||
'· 你的正文只能描述**真的已经发生**的结果。任何会改变位置、物品、数值、状态、',
|
||||
' 关系或战斗的动作,**必须先调用工具,再写正文**;不能只在嘴上说“我走到了/我用了/我给了他”。',
|
||||
'· 用户不需要喊“调用 move_to”。只要剧情里**你**要换地点,就调用 move_to;',
|
||||
' 用户说“去商店/走到门口/进学校/离开这里/回房间”都是调用信号。',
|
||||
'· 常见映射:换地点→move_to;用/喝/吃/装备背包物品→use_item;',
|
||||
' 对别人用物品→use_item_on;给/递/交给→give_item;扔/丢→drop_item;',
|
||||
' 查地点/路线/谁在哪→list_places / list_place_links / list_characters;',
|
||||
' 记住/回忆→memory_add / memory_search。',
|
||||
'· **只在正文写“我走向商店”而没有 move_to,系统里位置根本没变**,用户会当场发现,',
|
||||
' 这是最出戏的错误之一。用物品、给物品、决斗、改数值/状态同理。',
|
||||
'· 工具报错就照实说,不要改写成“我做到了”;没调用工具就不许写出动作结果。',
|
||||
'',
|
||||
'【记忆】你有自己的记忆库,**跨对话保留**:',
|
||||
'· 用户说了值得长期记住的事(称呼、偏好、重要事实、约定、他的项目),用 memory_add 记下来。',
|
||||
'· 记之前先看上面的记忆清单 —— 已经记过的不要再记一遍,否则清单会越来越乱。',
|
||||
@@ -356,7 +369,7 @@ BUILTIN_SKILL = '\n'.join([
|
||||
'· **同地点的人看得见你做了什么**(v3.33):你使用物品、对别人用、给人/丢东西、',
|
||||
' 发起决斗、找常驻角色办事,都会被同地点的其他角色注意到(进他们的地点动态)。',
|
||||
' 所以别说"没人看见我"、也别假装偷偷做了什么;反过来你也会看到别人做了什么。',
|
||||
'· 地图是给用户看的:世界包定义了地点在背景图上的位置/区域框/连线,你不需要画地图;按地点名 move_to 或描述行动即可。',
|
||||
'· 地图是给用户看的:世界包定义了地点在背景图上的位置/区域框/连线,你不需要画地图;但**你要去某个地点时必须调用 move_to**,不能只在正文写“我走向那里”。',
|
||||
'· 用户如果在一个**只有他一个人**的地点,系统会直接禁止他开口(没人可对话);'
|
||||
'你可以提醒他换地方或者用地图把人叫过来。',
|
||||
'',
|
||||
@@ -370,12 +383,12 @@ BUILTIN_SKILL = '\n'.join([
|
||||
# · `give_item` 所有 AI 都能用,但它只**转移自己背包里的东西**,
|
||||
# 不能凭空造物;物品产出只走物品脚本 / 世界规则 / 用户手动。
|
||||
'【物品与状态】「items」段是你的背包,「status」段是你身上的状态,「stats」段是你的数值。',
|
||||
'· 自己用物品:use_item(name)。',
|
||||
'· 自己用物品:**必须调用** use_item(name);不能只在正文写“我喝下了/我用了”,没调用背包数量不会变。',
|
||||
'· 对别人用:use_item_on(name, targets=[...]) —— **只对 target 类物品有效**'
|
||||
'(刀剑/飞刀/毒药这种"对别人用"的东西,同一地点才行)。',
|
||||
'· 送人:give_item(name, target, count?)(**只能送你背包里现有的**,没有/不够会报错;'
|
||||
'· 送人:**必须调用** give_item(name, target, count?)(**只能送你背包里现有的**,没有/不够会报错;'
|
||||
'同局成员或用户角色都能收,target 写名字或「用户」)。',
|
||||
'· 丢物品:drop_item(name, count?);数量会真的变,别虚报。',
|
||||
'· 丢物品:**必须调用** drop_item(name, count?);数量会真的变,别虚报。',
|
||||
' · 血瓶/回春丹/护身符这类是 **passive(被动)** 物品:**只能自己用**;'
|
||||
'不能 use_item_on 对别人使用(会报错,别硬编"我给谁喂了药")。',
|
||||
' · 物品是 active/passive/target/plain 哪一类,看「items」段里的 kind / 描述;'
|
||||
|
||||
BIN
豆鲍/docs/screenshots/v343-game-rail.png
Normal file
BIN
豆鲍/docs/screenshots/v343-game-rail.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 590 KiB |
BIN
豆鲍/docs/screenshots/v343-longpress-menu.png
Normal file
BIN
豆鲍/docs/screenshots/v343-longpress-menu.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 334 KiB |
BIN
豆鲍/docs/screenshots/v345-tool-call.png
Normal file
BIN
豆鲍/docs/screenshots/v345-tool-call.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 781 KiB |
@@ -4,7 +4,7 @@
|
||||
> **介绍网页**、**商店商品页**、宣传文案、FAQ。
|
||||
> 本文只写**已经实现并验收过**的功能 —— 宣传页里不要写这里没有的东西。
|
||||
>
|
||||
> 版本:App **2.0.166**(versionCode 366)· Python 内核 **v3.42** · 资料包生成于 2026-10-23。
|
||||
> 版本:App **2.0.170**(versionCode 370)· Python 内核 **v3.46** · 资料包生成于 2026-10-23。
|
||||
> 完整安装使用教程见 [`docs/小人间-完整教程.md`](docs/小人间-完整教程.md),
|
||||
> 界面清单见 [`docs/界面总览.md`](docs/界面总览.md),脚本 API 见 [`docs/world-script-api/`](docs/world-script-api/)。
|
||||
|
||||
@@ -564,7 +564,7 @@ AI 可以**调用工具**来交互,用户可以在界面上点菜单;两边
|
||||
|
||||
---
|
||||
|
||||
### 4.26 游戏界面 HTML 自定义(v3.36 聊天页 / v3.37 地图·决斗·背包·编辑器 / v3.38 UI 包独立 / v3.39 任意页面 / v3.40 API 教程 / v3.41 月影默认皮肤 / v3.42 长按@决斗)
|
||||
### 4.26 游戏界面 HTML 自定义(v3.36 聊天页 / v3.37 地图·决斗·背包·编辑器 / v3.38 UI 包独立 / v3.39 任意页面 / v3.40 API 教程 / v3.41 月影默认皮肤 / v3.42 长按@决斗 / v3.43 @收进侧栏 + 可折叠底栏)
|
||||
|
||||
用户原话:「除了侧边栏里的界面(会议,容器等),其他都要自定义。先讨论」→
|
||||
「按你推荐的来。做个自定义ui包……把风格改成像图片那样的 galgame 风格」→「继续,一次性做完」。
|
||||
@@ -575,6 +575,21 @@ AI 可以**调用工具**来交互,用户可以在界面上点菜单;两边
|
||||
深色玻璃对白窗 + 香槟细线、左侧 HUD rail(当前位置 / 数值状态 / 在场成员 / 地图 /
|
||||
背包 / 决斗 / 常驻)。不再是厚奶油纸 + 金边 + 大圆头像;默认角色用内置全身立绘。
|
||||
同时去掉大面积模糊/阴影滤镜,输入法弹出时只收起大图层,手机打字不再卡。
|
||||
- **@ 收进侧栏 / 底栏可折叠 / 对白窗定高(v3.43)**:左侧 `在场 / @` 下直接是 `@豆包`
|
||||
(点=@,长按=私聊/决斗/信息);底部 8 个功能(存档/信息/读档/跳过/记录/设置/朗读/新话题)
|
||||
可点最左 `⌄` 收起,收起后只留「功能 ⌃」。左侧 rail 高度由 `fitRail()` 跟着对白窗实时算,
|
||||
小屏自动紧凑;对白窗定高 150/180px,文字内部滚动,不再撑出大块空白。
|
||||
- **工具行动铁律(v3.46)**:弱模型/小模型经常只在正文说「我走向商店 / 我用了药」,
|
||||
实际没调 `move_to` / `use_item`。现在 system prompt 末尾强制映射「移动→move_to、
|
||||
用物品→use_item、给物品→give_item…」,BUILTIN_SKILL 第一段就是行动必须落成工具;
|
||||
降级模式(noTools)的 `doubao-call` 提示也补全了 move_to/use_item 等动作工具。
|
||||
用户不需要再喊「调用 move_to」。
|
||||
- **工具调用看得见(v3.45)**:AI 调工具时,默认聊天界面对话框上方浮一条动效胶囊,
|
||||
实时写「AI 正在调用 · 搜索记忆」→「✓ AI 调用了 · 搜索记忆」,失败显示「工具失败」。
|
||||
之前 HTML UI 只显示正文,工具调用过程完全看不见。
|
||||
- **导出修复(v3.44)**:带立绘(五档 front)的智能体/世界观导出不再 500;
|
||||
智能体包现在会把五档立绘按 `front-档位.png` 打进 zip,`smartInfo.json.image.front`
|
||||
保持档位字典,导入后立绘不丢。UI 包在设置页每个包右侧直接有「导出」。
|
||||
- **旧皮肤保留在历史版本里**:想回旧版可在设置里用旧 UI 包,或恢复内置后导入旧 zip。
|
||||
默认包 id 仍是 `galgame`,名称改为「月影 · Galgame」。
|
||||
- **旧版「恋爱冒险 · Galgame」描述(v3.36)**:整屏深酒红房间背景、角色立绘(没有立绘时显示头像徽章)、
|
||||
@@ -601,8 +616,8 @@ AI 可以**调用工具**来交互,用户可以在界面上点菜单;两边
|
||||
(完整记录)和 `settings.html`(配色/字号/文字速度)就是两个独立系统页。
|
||||
- **成员按地点过滤(v3.39)**:地点对话的成员条 / @ 快捷条只显示当前 `placeId` 在场的人,
|
||||
和原生聊天页同一语义;普通对话或没有位置数据时不过滤。
|
||||
- **长按 @ 决斗(v3.42)**:HTML 聊天页的在场成员 / 快捷 @ 片,**点=@,长按=弹「开始决斗」**;
|
||||
确认后调 `GameUI.startDuel` 并打开决斗页,没武器会提示。
|
||||
- **长按 @ 菜单(v3.43)**:HTML 聊天页的在场成员 / 快捷 @ 片,**点=@,长按=「私聊 / 决斗 / 信息」**;
|
||||
私聊消息带 `privateTo`,只有目标角色能看到。
|
||||
- **编辑器更好改(v3.39)**:界面包编辑器可新建任意页面/文件、直接预览 HTML;保存后下方
|
||||
聊天页自动重载,不用杀 App。
|
||||
- **SDK 能力**:聊天(send/stop/events)、地图(placesData/moveMember)、决斗(currentDuel/
|
||||
@@ -646,7 +661,11 @@ AI 可以**调用工具**来交互,用户可以在界面上点菜单;两边
|
||||
| **v3.40** | **UI API 教程**:完整 `GameUI` API 文档(状态/事件/聊天/任意页面/地图/背包/决斗/朗读/原生桥/资源/debug);`openPage` 支持内联查询串 `detail.html?id=3` |
|
||||
| **v3.41** | **默认 UI 重做「月影」**:深靛蓝 + 全身立绘 + 深色玻璃对白窗 + 左侧 HUD rail(位置/数值/在场/地图/背包/决斗/常驻);去掉大面积模糊/阴影滤镜,输入法弹出收起大图层,修复打字卡顿;内置全身立绘资源 |
|
||||
| **v3.42** | **长按 @ 决斗**:HTML 成员条/快捷 @ 片支持长按弹「开始决斗」,调内核 startDuel 后打开决斗页;同时把 rail/名字牌在 360×640 的遮挡修掉 |
|
||||
| — | 当前 App 版本 **2.0.166**(Android APK 约 96 MB) |
|
||||
| **v3.43** | **@ 收进侧栏 + 可折叠底栏**:`@` 移到左侧「在场」;长按成员改「私聊/决斗/信息」;底部 8 功能可收起为「功能 ⌃」;rail 动态跟随对白窗 |
|
||||
| **v3.44** | **导出修复 + UI 包导出入口**:带五档立绘的智能体包不再导出 500(front dict 按档位打包);UI 包设置页每个包右侧直接「导出」 |
|
||||
| **v3.45** | **工具调用动效**:对话路上方实时显示「AI 正在调用 · 工具名」,完成/失败有状态,1.2s 消失 |
|
||||
| **v3.46** | **工具行动铁律**:system prompt 末尾强制「移动→move_to/用物品→use_item」;降级模式提示补全动作工具;弱模型不再只用嘴说 |
|
||||
| — | 当前 App 版本 **2.0.167**(Android APK 约 96 MB) |
|
||||
|
||||
---
|
||||
|
||||
@@ -790,7 +809,7 @@ AI 可以**调用工具**来交互,用户可以在界面上点菜单;两边
|
||||
| `docs/screenshots/*.png` | 精选截图(App / 网页 / 世界包 / 常驻角色 / 地图 / 决斗 / 死亡 / 语音) |
|
||||
| `docs/assets/my-role/*.png` | 「我的角色」页截图 |
|
||||
| `docs/assets/v3.20/*.png` | 战斗/死亡/地图/语音等功能细节截图 |
|
||||
| **`宣传图/01~58-*.png`** | **宣传用截图(中文名,直接取用;每张说明见 `宣传图/00-素材说明.md`)** |
|
||||
| **`宣传图/01~59-*.png`** | **宣传用截图(中文名,直接取用;每张说明见 `宣传图/00-素材说明.md`)** |
|
||||
| `worlds/旧都市.zip` | 示例世界包(完整可玩,当前版本) |
|
||||
| `worlds/全能测试世界.zip` | 功能测试世界包 |
|
||||
| `编辑器-豆鲍编辑器-README.md` | 配套编辑器说明 |
|
||||
@@ -836,6 +855,8 @@ AI 可以**调用工具**来交互,用户可以在界面上点菜单;两边
|
||||
| `v339-game-place-filter.png` | 地点对话成员条只显示在场角色(另一个角色被移到后院) | 地点过滤卖点 |
|
||||
| `v341-game-moonlit.png` | 默认「月影」UI:深靛蓝背景 + 全身立绘 + 玻璃对白窗 + 左侧 HUD rail(位置/数值/在场/地图/背包) | **默认 UI / 宣传主图** |
|
||||
| `v342-longpress-duel.png` | 长按在场 @ 成员弹出「开始决斗」(带武器说明),点确认才真正发起 | 长按@决斗 |
|
||||
| `v343-game-rail.png` | v3.43:@ 收进左侧「在场」,底部 8 功能可折叠,对白窗不再撑高 | **默认 UI / 宣传主图** |
|
||||
| `v343-longpress-menu.png` | 长按 @ 成员弹「私聊 / 决斗 / 信息」 | 长按菜单 |
|
||||
| `v336-galgame-log.png` | 游戏界面的「记录」面板(全部消息、重要标记) | 界面细节 |
|
||||
| `v336-galgame-settings.png` | 设置 →「游戏界面(HTML)」:开关 + 界面包 + 恢复内置 | **功能入口 / 宣传图** |
|
||||
| `v332-slot-context.png` | 上下文查看器:槽位提示词进 `<slot>`、用户槽位进 `<user>`、槽位物品进背包 | 角色槽位 / 世界 Skill 卖点 |
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# 游戏界面 · HTML 自定义(v3.42)
|
||||
# 游戏界面 · HTML 自定义(v3.45)
|
||||
|
||||
> 一句话:**游戏内界面**(聊天、地图、决斗、我的角色/背包)整个交给一套 HTML 页面,
|
||||
> 你可以像做网页一样改布局、配色、字体、按钮和交互;**侧边栏 / 会议 / 容器 / 设置 /
|
||||
@@ -191,12 +191,33 @@ GameUI.openPage('backlog.html?tab=all'); // 也可以直接写查询串
|
||||
- **左侧 HUD rail**:当前位置、数值/状态(`HUD`)、在场成员(按地点过滤)、
|
||||
地图 / 背包 / 决斗 / 常驻四个入口 —— 这是把「数值 / @ / 地图 / 位置 / 背包」
|
||||
都放进主界面,而不是藏进设置。
|
||||
- **长按 @ 成员 / 快捷 @ 片 = 决斗**(v3.42):点=插入 `@名字`,长按=弹「开始决斗」
|
||||
确认,走 `GameUI.startDuel` 后打开决斗页;没有武器会提示,判定仍在内核。
|
||||
- **@ 移进左侧 rail(v3.43)**:`在场 / @` 下面的 `@豆包` 就是 @ 功能;点=插入 `@名字`,
|
||||
底部不再有单独的一行 @ 快捷条。长按成员弹「私聊 / 决斗 / 信息」三选一
|
||||
(v3.42 是直接决斗,v3.43 改成菜单);决斗走 `GameUI.startDuel` 后打开决斗页,
|
||||
没有武器会提示,判定仍在内核。
|
||||
- **默认角色立绘**:`assets/avatars/default-body.png`(从 App 内置的
|
||||
`agent_default_character.png` 转成透明 PNG)。豆包没有自定义立绘时优先显示全身像;
|
||||
其他角色仍回退头像。
|
||||
- `style.css`:深靛蓝 + 月白 + 香槟金;**不用 `vh`**(安卓 WebView 会算成 0)。
|
||||
- **工具调用动效(v3.45)**:内核每调一次工具,对话框上方浮一条小胶囊:
|
||||
「AI 正在调用 · 搜索记忆」→ 完成变「✓ AI 调用了 · 搜索记忆」,1.2 秒消失;
|
||||
失败显示「工具失败」。监听 SDK 的 `event`,判断 `ev.type === 'tool_call' / 'tool_result'`;
|
||||
工具 id 在 `TOOL_LABELS` 里映射成中文,未知工具直接显示 id。
|
||||
- **导出 UI 包(v3.44)**:设置 →「游戏界面(HTML)」→ 每个包右侧现在直接有「导出」,
|
||||
选中「编辑」后右上角也有「导出」;导出的 zip 就是完整 UI 包(html/css/js/图片),
|
||||
对方在同一个设置页「导入」即可。
|
||||
- **底栏可折叠(v3.43)**:底部 8 个功能(存档/信息/读档/跳过/记录/设置/朗读/新话题),
|
||||
最左 `⌄` 收起;收起后底部只留「功能 ⌃」小钮,再点展开。状态记在
|
||||
`localStorage['galgame:actionsCollapsed']`,重进保持。这样功能不再“消失”,
|
||||
也不会长期占着屏幕。
|
||||
- **左侧 rail 动态高度(v3.43)**:`fitRail()` 用 `.dialogue` 的 top 实时把 rail 底边
|
||||
收到名字牌/对白窗上方 10px,转屏/对白变长/底栏收起都会重算;不再写死 `57%`。
|
||||
空间不足(可用高 < 240px)时自动加 `rail-compact`:隐藏 section 标签、成员竖排收窄、
|
||||
nav 缩高,保证 @ / 地图 / 背包 / 决斗 / 常驻都能看见。
|
||||
- **对白窗固定高度(v3.43)**:`.box` 小屏 150px、大屏 180px(`@media min-height:760px`),
|
||||
文字放在 `.text` 自己的滚动层里;**不要**再用 `min-height + max-height:百分比` 让 box
|
||||
自己撑高(会把 `dialogue` 撑出 100px 空区,用户反馈「这个咋那么高」)。名字牌放 box 外,
|
||||
始终可见。
|
||||
- **性能(v3.41)**:去掉大面积 `backdrop-filter`、全屏 `filter: blur`、立绘
|
||||
`drop-shadow` 和键盘 `paddingBottom` 每帧计算;键盘弹起只切 `body.keyboard-open`
|
||||
并收起大图层。手机输入法弹出时不再卡。
|
||||
|
||||
@@ -226,6 +226,7 @@ await GameUI.send('你好');
|
||||
```js
|
||||
await GameUI.send('看这个', {
|
||||
agentId: 'a_doubao', // 指定回应者(可选)
|
||||
privateTo: 'a_doubao', // 私聊:只有 TA 能看到(v3.43)
|
||||
attachments: [{ name: 'x.txt', path: '...' }] // 附件(内核支持时)
|
||||
});
|
||||
```
|
||||
@@ -607,7 +608,7 @@ GameUI.openPage('character.html');
|
||||
|
||||
| API | 说明 |
|
||||
|---|---|
|
||||
| `GameUI.send(text, opts?)` | 发消息 + 轮询增量;`opts.agentId/attachments` |
|
||||
| `GameUI.send(text, opts?)` | 发消息 + 轮询增量;`opts.agentId/attachments/privateTo` |
|
||||
| `GameUI.stop()` | 停止当前生成 |
|
||||
| `GameUI.markImportant(msgOrIndex)` | 标为重要 |
|
||||
| `GameUI.userProfile()` | 用户角色档案 |
|
||||
|
||||
@@ -83,8 +83,9 @@ python scripts/audit-ui-tree.py # 校验这份文档和代码一致
|
||||
│ ├─ 全屏 WebView 加载 `/ui-packs/<包>/index.html`(同源,页面可直接 fetch 内核接口)
|
||||
│ ├─ 默认 galgame 包:深靛蓝夜海 / 全身立绘 / 名字牌 / 深色玻璃对话框 / 打字机 /
|
||||
│ │ 暂停 / 2× / HP 条 / 输入框 / 快捷 @(按地点过滤)
|
||||
│ ├─ 左侧 HUD rail:当前位置 / 数值状态 / 在场成员 / 地图 / 背包 / 决斗 / 常驻
|
||||
│ ├─ 底栏:存档 / 信息 / 读档 / 跳过 / 记录 / 设置;键盘弹起时自动收起大图层
|
||||
│ ├─ 左侧 HUD rail:当前位置 / 数值 / 在场@(点=@,长按=私聊/决斗/信息)/
|
||||
│ │ 地图 / 背包 / 决斗 / 常驻;空间不足自动 compact
|
||||
│ ├─ 底栏:存档 / 信息 / 读档 / 跳过 / 记录 / 设置 / 朗读 / 新话题,可折叠为「功能 ⌃」
|
||||
│ ├─ 打开侧边栏(菜单按钮)、原生管理页(我的角色 / 地图 / 上下文)走 JS 桥白名单
|
||||
│ ├─ 快捷入口:地图 / 我的角色 / 决斗 / 常驻 / 朗读 / 新话题
|
||||
│ ├─ 地图 → [游戏界面·地图];决斗 → [游戏界面·决斗];我的角色 → [游戏界面·背包]
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
│ └─ v3.20/ ← 决斗/死亡/地图/语音细节截图
|
||||
├─ 宣传图/ ← ★ 宣传用截图(用户要求:宣传图直接用真实截图)
|
||||
│ ├─ 00-素材说明.md ← 每张图是什么、建议用在哪(01~39)
|
||||
│ └─ 01~58-*.png ← 中文名整理好的 App/网页/Windows 截图
|
||||
│ └─ 01~59-*.png ← 中文名整理好的 App/网页/Windows 截图
|
||||
├─ worlds/
|
||||
│ ├─ 旧都市.zip ← 示例世界包(完整可玩,当前版本)
|
||||
│ └─ 全能测试世界.zip ← 功能测试世界包
|
||||
|
||||
@@ -55,6 +55,9 @@ SHOT_FILES = [
|
||||
# v3.41 月影默认 UI
|
||||
'v341-game-moonlit.png',
|
||||
'v342-longpress-duel.png',
|
||||
'v343-game-rail.png',
|
||||
'v343-longpress-menu.png',
|
||||
'v345-tool-call.png',
|
||||
# 换地点不失忆(v3.34)
|
||||
'v334-cross-place-memory.png',
|
||||
'v334-context-retention.png',
|
||||
@@ -255,7 +258,10 @@ PROMO_ITEMS = [
|
||||
('screenshots/v339-game-place-filter.png', '57-App-成员按地点过滤.png',
|
||||
'地点对话成员条只显示在场角色(另一角色被移到后院)',
|
||||
'地点过滤卖点'),
|
||||
('screenshots/v341-game-moonlit.png', '58-App-默认月影UI.png',
|
||||
('screenshots/v343-game-rail.png', '58-App-默认月影UI.png',
|
||||
'v3.43 默认 UI:@ 收进左侧 rail,底部 8 功能可折叠,对白窗定高',
|
||||
'默认 UI / 宣传主图'),
|
||||
('screenshots/v341-game-moonlit.png', '59-App-月影初始版.png',
|
||||
'默认「月影」UI:深靛蓝夜海 + 全身立绘 + 深色玻璃对白窗 + 左侧 HUD rail',
|
||||
'默认 UI / 宣传主图'),
|
||||
]
|
||||
|
||||
@@ -25,12 +25,14 @@
|
||||
用法:
|
||||
python scripts/probe-agent-system.py
|
||||
"""
|
||||
import base64
|
||||
import io
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
import zipfile
|
||||
|
||||
try:
|
||||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||||
@@ -62,6 +64,7 @@ def section(title):
|
||||
|
||||
|
||||
import agent_context # noqa: E402
|
||||
import agent_loop # noqa: E402
|
||||
import agent_tools # noqa: E402
|
||||
import agentdb # noqa: E402
|
||||
import defaults # noqa: E402
|
||||
@@ -346,9 +349,29 @@ def main():
|
||||
|
||||
# ---------------------------------------------------------------- 9
|
||||
section("9. 智能体包导出 / 导入")
|
||||
# ★ 带立绘的智能体:front 是五档 dict,旧导出对 dict 调 os.path.isfile
|
||||
# 会 TypeError → 整个导出 500(用户反馈「为什么带立绘的角色导出不了」)。
|
||||
png = base64.b64decode(
|
||||
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII="
|
||||
)
|
||||
r = h.call(f"/api/agents/{a1['id']}/asset", "POST", {
|
||||
"key": "front:平常", "data": base64.b64encode(png).decode("ascii"),
|
||||
})
|
||||
check("设置立绘(五档 front:平常)", r.get("ok") is True, str(r.get("error")))
|
||||
r = h.call(f"/api/agents/{a1['id']}/package", "GET")
|
||||
check("导出拿到 base64 zip", bool(r.get("data")), str(r.get("error")))
|
||||
blob = r.get("data")
|
||||
if blob:
|
||||
try:
|
||||
zf = zipfile.ZipFile(io.BytesIO(base64.b64decode(blob)))
|
||||
names = zf.namelist()
|
||||
zinfo = json.loads(zf.read("smartInfo.json").decode("utf-8"))
|
||||
front = (zinfo.get("image") or {}).get("front")
|
||||
check("带立绘导出包含 front 文件", any(n.startswith("front-") for n in names), str(names))
|
||||
check("smartInfo.image.front 是五档 dict", isinstance(front, dict) and "平常" in front,
|
||||
str(front))
|
||||
except Exception as exc: # noqa: BLE001
|
||||
check("带立绘导出 zip 可解析", False, str(exc))
|
||||
r = h.call("/api/agents/import", "POST", {"data": blob})
|
||||
imported = r.get("agent") or {}
|
||||
check("导入成功", bool(imported.get("id")), str(r.get("error")))
|
||||
@@ -356,6 +379,8 @@ def main():
|
||||
check("名字带过来了", imported.get("name") == "玄辰")
|
||||
check("提示词带过来了", imported.get("systemPrompt") == "你是玄辰。")
|
||||
check("描述带过来了", imported.get("description") == "仙门大师兄")
|
||||
check("立绘带过来了", isinstance((imported.get("image") or {}).get("front"), dict),
|
||||
str(imported.get("image")))
|
||||
check("**模型引用没带过来**(需求 2.5 的边界)", not imported.get("modelId"))
|
||||
check("**世界观绑定没带过来**", not imported.get("worldviewId"))
|
||||
check("**限额没带过来**", not imported.get("tokenLimit"))
|
||||
@@ -523,7 +548,24 @@ def main():
|
||||
store.write_settings({"memoryWindow": 50})
|
||||
|
||||
# ---------------------------------------------------------------- 16
|
||||
section("16. 语音:智能体自己的音色要真的生效(用户报的「语音没生效」)")
|
||||
section("16. 工具行动铁律(弱模型只说不做)")
|
||||
prompt = agent_context.build_system_prompt(store.read_settings(), a1)
|
||||
check("system prompt 末尾有行动校验", "本轮行动校验" in prompt, prompt[-300:])
|
||||
check("明确 move_to / use_item", "move_to" in prompt and "use_item" in prompt)
|
||||
check("BUILTIN_SKILL 第一段就是行动必须调用工具",
|
||||
"行动必须调用工具" in defaults.BUILTIN_SKILL[:120], defaults.BUILTIN_SKILL[:120])
|
||||
check("move_to 描述写明必须调用",
|
||||
"必须调用本工具" in agent_tools.MOVE_TO["description"])
|
||||
check("use_item 描述写明必须调用",
|
||||
"必须调用本工具" in agent_tools.USE_ITEM["description"])
|
||||
check("降级提示包含 move_to/use_item",
|
||||
"move_to" in agent_loop.DEGRADED_HINT and "use_item" in agent_loop.DEGRADED_HINT)
|
||||
check("行动句能触发本轮提醒",
|
||||
bool(agent_loop.action_turn_hint([{"role": "user", "content": "我去商店买面包"}])))
|
||||
check("纯闲聊不硬塞工具提醒",
|
||||
agent_loop.action_turn_hint([{"role": "user", "content": "今天天气怎么样"}]) == "")
|
||||
|
||||
section("17. 语音:智能体自己的音色要真的生效(用户报的「语音没生效」)")
|
||||
#
|
||||
# 内核这边一直是对的(`voice_for` 做"智能体 > 全局"),
|
||||
# 真正漏的是**界面朗读时不传 agentId** —— 于是内核拿不到人,
|
||||
@@ -1194,9 +1236,6 @@ def main():
|
||||
str((store.get_agent(a1["id"]) or {}).get("worldviewId")))
|
||||
|
||||
# ---- B3:带五档立绘的世界观能导出 + 能再导入(v2 导出会 500)----
|
||||
import base64 # noqa: E402
|
||||
import zipfile # noqa: E402
|
||||
|
||||
png = base64.b64decode(
|
||||
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==")
|
||||
img_dir = os.path.join(DATA, "p0-assets")
|
||||
|
||||
@@ -143,6 +143,16 @@ def main():
|
||||
check("CSS 不用 vh(安卓 WebView 会算成 0)", not re.search(r"\dvh", css_text))
|
||||
check("CSS 没有 backdrop-filter(键盘/滚动性能)", "backdrop-filter" not in css_text)
|
||||
check("CSS 没有全屏 filter: blur(性能)", not re.search(r"filter:\s*blur", css_text))
|
||||
for nd in ["privateBar", "actions-fold", "actionsToggle", 'data-act="speak"',
|
||||
'data-act="newtopic"', "openMemberMenu", "fitRail", "rail-compact"]:
|
||||
check(f"v3.43 有 {nd}", nd in (text + game_text + css_text))
|
||||
check("v3.43 底栏不再有 quick @ 条", 'id="quick"' not in text)
|
||||
for nd in ["toolToast", "showToolCall", "tool_result", "TOOL_LABELS"]:
|
||||
check(f"v3.45 工具动效有 {nd}", nd in (text + game_text + css_text))
|
||||
check("v3.45 CSS 有 toolSpin 动效", "toolSpin" in css_text)
|
||||
status, sdk_private = request(base, "/ui-packs/ui-sdk/sdk.js")
|
||||
sdk_private_text = sdk_private.decode("utf-8", "replace") if isinstance(sdk_private, bytes) else ""
|
||||
check("SDK 支持 privateTo", "options.privateTo" in sdk_private_text)
|
||||
status, gamejs2 = request(base, "/ui-packs/galgame/game.js")
|
||||
game_text2 = gamejs2.decode("utf-8", "replace") if isinstance(gamejs2, bytes) else ""
|
||||
for nd in ["default-body.png", "keyboard-open", "bindMemberActions", "openDuelPrompt"]:
|
||||
|
||||
Reference in New Issue
Block a user