fix(botops): v1.2 - 彻底修复思考区域与正式回答顺序问题
问题根因:之前预创建空 AI widget,思考 widget 挂载在其后,即使动态重排也可能因 Textual 组件树更新时序导致顺序不稳定。 修复方案: - 移除 prefab 空 AI widget 预创建逻辑 - start_ai() 仅标记状态,不创建任何 widget - _ensure_ai_widget() 延迟到第一次 chunk 到来时才创建 AI widget - 按消息到达顺序自然挂载:reasoning_start → reasoning → chunk → end_reasoning/finish_ai - 思考 widget 必然先于 AI widget 挂载,顺序天然正确 同时: - 简化 app.py 发送失败处理,不再需要移除空 widget - 更新 README v1.2 说明
This commit is contained in:
1 parent
9815ff44af
commit
bf2b5d31f7
3 files changed
+38
-54
No files matched your search
+2
-2
@@ -147,9 +147,9 @@ class BotOpsApp(App):
|
||||
await self.notify_system("未连接到服务器,先 /connect", level="error")
|
||||
return
|
||||
await self.chat.add_user(text)
|
||||
await self.chat.start_ai() # 预建 AI 消息框,即时反馈
|
||||
await self.chat.start_ai() # 标记AI回复开始状态(不预创建空widget)
|
||||
if not await self.ws.send_message(text):
|
||||
await self.chat.finish_ai("") # 发送失败:移除预建的空消息框
|
||||
await self.chat.finish_ai("") # 发送失败:重置AI状态
|
||||
await self.notify_system("❌ 发送失败:连接已断开,请 /connect 重连", level="error")
|
||||
|
||||
# ── 快捷键 ────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in new issue
Block a user