v0.11.1: Agent Loop稳定性增强 + 6个系统工具 + 搜索引擎替换
【Agent Loop 稳定性】 - P0-1: 工具消息硬限制40条,超出自动删旧 - P0-2: 截断周期从5轮缩短为3轮 - P1-1: 增量记忆提取改为fire-and-forget - P1-2: TOOLS_WITH_DATA_DEPS精简为仅web_fetch - P2: 重复检测改为注入警告而非强制终止 - Final Answer检测增强: >300字自动放行 + 收紧反过早停止 【新增工具】(40→44) - datetime: 系统精确时间(中文日期+时段+人性化) - calculator: 安全数学计算(递归下降解析器) - random: 随机数/随机选择(int/float/pick/string) - uuid: UUID v4生成(crypto.randomUUID) - json_format: JSON格式化+验证+键排序 - hash: MD5/SHA1/SHA256/SHA384/SHA512 【搜索引擎替换】 - Google+DuckDuckGo → 搜狗+360搜索 - 四引擎变为: Bing+百度+搜狗+360搜索 【删除】 - 联网搜索代理全部代码(search-proxy/ + 7文件代理逻辑) - https-proxy-agent依赖 【UI】 - 模型栏: 上下文总长(蓝色)+剩余上下文(绿色)实时显示 - 设置面板上下文长度移至模型栏 - SOUL.md/AGENT.md精简为纯抽象定义 【系统提示词】 - OS环境信息改为从preload同步获取真实值(os.homedir/os.arch/os.userInfo)
This commit is contained in:
+4
-15
@@ -17,6 +17,7 @@ import { initHeader, checkConnection } from './components/header.js';
|
||||
import { initModelBar, loadModels, setSelectedModel } from './components/model-bar.js';
|
||||
import { initChatArea, renderMessages, clearMessages, enableAutoScroll } from './components/chat-area.js';
|
||||
import { initInputArea } from './components/input-area.js';
|
||||
import { clearCtxRemain } from './components/input-area.js';
|
||||
import { initSettingsModal, closeSettingsModal } from './components/settings-modal.js';
|
||||
import { initHistoryModal, closeHistoryModal } from './components/history-modal.js';
|
||||
import { initMemoryModal } from './components/memory-modal.js';
|
||||
@@ -254,6 +255,9 @@ async function startNewSession(): Promise<void> {
|
||||
state.set(KEYS.CURRENT_SESSION, session);
|
||||
logInfo('新建会话');
|
||||
|
||||
// 清除剩余上下文显示
|
||||
clearCtxRemain();
|
||||
|
||||
// ── 强制中断正在进行的生成 ──
|
||||
const abortController = state.get<AbortController | null>(KEYS.ABORT_CONTROLLER);
|
||||
if (abortController) {
|
||||
@@ -394,21 +398,6 @@ async function init(): Promise<void> {
|
||||
(document.querySelector('#inputMCPTimeout') as HTMLInputElement).value = mcpTimeout >= 0 ? String(mcpTimeout) : '';
|
||||
logInit(`超时设置: HTTP=${httpTimeout>=0?httpTimeout:30}s 流式=${streamTimeout>=0?streamTimeout:300}s MCP=${mcpTimeout>=0?mcpTimeout:60}s`);
|
||||
|
||||
// ── 代理设置 ──
|
||||
const proxyUrl = await db.getSetting('proxyUrl', '');
|
||||
if (proxyUrl) {
|
||||
try {
|
||||
await fetch(proxyUrl, { method: 'HEAD', signal: AbortSignal.timeout(2000) });
|
||||
logInit(`代理: ${proxyUrl} ✓`);
|
||||
} catch { logInit(`代理: ${proxyUrl} (无法连接,但已设置)`); }
|
||||
state.set('proxyUrl', proxyUrl);
|
||||
// 通知主进程设置环境变量
|
||||
if (bridge?.tool?.setProxy) {
|
||||
await bridge.tool.setProxy(proxyUrl);
|
||||
}
|
||||
}
|
||||
(document.querySelector('#inputProxyUrl') as HTMLInputElement).value = proxyUrl;
|
||||
|
||||
// ── Tool Calling 设置(永久开启,不可关闭)──
|
||||
state.set('toolCallingEnabled', true);
|
||||
const runCommandMode = await db.getSetting('runCommandMode', 'confirm') as 'auto' | 'confirm' | 'disabled';
|
||||
|
||||
Reference in New Issue
Block a user