release: v6.1.0 - TUI 体验全面升级 + 背景自定义

TUI 界面改进:
- 全面中文化: CommandPalette/HelpPanel/Footer/Chatbox 边框标题等所有用户可见英文汉化
- 辅助中心 (Ctrl+P/F9): 原"设置"重命名, 含 6 项可切换设置
- 独立帮助浮层 (? 键): 重写帮助页面逻辑, 全中文, 带滑入淡入动画
- 背景切换: 辅助中心 [5] 预设背景, [6] 自定义背景; 新增 /bg 命令支持图片提取主色调
- 换行修复: Ctrl+J 作为主推换行键 (Windows 终端不区分 Shift+Enter)
- 引擎切换修复: 解决 call_from_thread 在主线程崩溃的 RuntimeError

技术改进:
- 文本工具调用解析: 检测模型用 <tool_call> 标签返回的工具调用
- 网络工具优化: network_tools.py 和 ai_search.py 改进请求头/重试/编码
- 流式输出修复: append_chunk 的 refresh 改为 layout=True
- 取消响应修复: 引擎层 _cancelled 标志 + TUI 层 worker 身份跟踪

融合 v6.0.0 工作:
- 保留 terminal 模拟器/operit 桥接/深度思考/工作模式/记忆模式等 v6.0.0 全部功能
- 在此基础上叠加本会话的 TUI 改进
This commit is contained in:
shuiyu1123 committed 2026-06-29 13:00:19 +08:00
1 parent b5f638cffc
commit de15b54b19
30 files changed
+3267 -934

No files matched your search

+25 -29
View File
@@ -319,18 +319,29 @@ class Liugin:
return None
def _find_agent(self, agent_id: str):
"""线程安全地查找 Agent(精确匹配 + 模糊匹配)"""
with self._lock:
agent = self.agents.get(agent_id)
if not agent:
matches = [a for a in self.agents.values() if agent_id in a.id or agent_id == a.name]
if matches:
agent = matches[0]
return agent
def _list(self, args: str) -> str:
"""列出所有子 Agent"""
with self._lock:
if not self.agents:
return "没有子 Agent"
agents_list = list(self.agents.values())
result = [f"子 Agent 列表 ({len(self.agents)} 个):\n"]
result = [f"子 Agent 列表 ({len(agents_list)} 个):\n"]
# 按状态分组
running = [a for a in self.agents.values() if a.status == "running"]
done = [a for a in self.agents.values() if a.status == "done"]
failed = [a for a in self.agents.values() if a.status == "failed"]
running = [a for a in agents_list if a.status == "running"]
done = [a for a in agents_list if a.status == "done"]
failed = [a for a in agents_list if a.status == "failed"]
if running:
result.append(f" 运行中 ({len(running)}):")
@@ -355,14 +366,9 @@ class Liugin:
if not agent_id:
return "错误:请提供 Agent ID"
agent = self.agents.get(agent_id)
agent = self._find_agent(agent_id)
if not agent:
# 模糊匹配
matches = [a for a in self.agents.values() if agent_id in a.id or agent_id == a.name]
if matches:
agent = matches[0]
else:
return f"错误:未找到 Agent '{agent_id}'"
return f"错误:未找到 Agent '{agent_id}'"
lines = [
f"Agent: {agent.id}",
@@ -386,13 +392,9 @@ class Liugin:
if not agent_id:
return "错误:请提供 Agent ID"
agent = self.agents.get(agent_id)
agent = self._find_agent(agent_id)
if not agent:
matches = [a for a in self.agents.values() if agent_id in a.id or agent_id == a.name]
if matches:
agent = matches[0]
else:
return f"错误:未找到 Agent '{agent_id}'"
return f"错误:未找到 Agent '{agent_id}'"
if agent.status == "running":
return f"Agent {agent.id} 仍在运行中 (步骤 {agent.steps})"
@@ -417,13 +419,9 @@ class Liugin:
agent_id = parts[0]
message = parts[1]
agent = self.agents.get(agent_id)
agent = self._find_agent(agent_id)
if not agent:
matches = [a for a in self.agents.values() if agent_id in a.id or agent_id == a.name]
if matches:
agent = matches[0]
else:
return f"错误:未找到 Agent '{agent_id}'"
return f"错误:未找到 Agent '{agent_id}'"
if agent.status != "running":
return f"Agent {agent.id} 未在运行 (状态: {agent.status})"
@@ -467,17 +465,15 @@ class Liugin:
except Exception as e:
agent.error = str(e)
agent.status = "failed"
agent.finished_at = datetime.now().strftime("%H:%M:%S")
def _kill(self, args: str) -> str:
"""终止子 Agent"""
agent_id = args.strip()
agent = self.agents.get(agent_id)
agent = self._find_agent(agent_id)
if not agent:
matches = [a for a in self.agents.values() if agent_id in a.id or agent_id == a.name]
if matches:
agent = matches[0]
else:
return f"错误:未找到 Agent '{agent_id}'"
return f"错误:未找到 Agent '{agent_id}'"
agent.status = "failed"
agent.error = "被主 Agent 终止"