Skip to content

feat: Web UI 交互主线 — 文件面板、模型切换、Transcript 安全修复#583

Merged
pionxe merged 10 commits into1024XEngineer:mainfrom
Yumiue:html_progress
May 8, 2026
Merged

feat: Web UI 交互主线 — 文件面板、模型切换、Transcript 安全修复#583
pionxe merged 10 commits into1024XEngineer:mainfrom
Yumiue:html_progress

Conversation

@Yumiue
Copy link
Copy Markdown
Collaborator

@Yumiue Yumiue commented May 8, 2026

概述

本 PR 完成 Web UI 核心交互主线,包含三个代码预览与 Git Diff 面板、
模型选择器全局切换、以及 Runtime 层 transcript 安全加固。

变更内容

Web 前端

  • 新增 FileChangePanel / FileTreePanel / GitDiffPreviewEditor 面板:支持文件变更预览、目录树浏览与 Git Diff 差异对比,面板间状态联动
  • 移植新版侧边栏布局:优化工作区管理和会话切换体验
  • 重构 ModelSelector:将单会话模型切换升级为全局 selectProviderModel 路径,生成中缓存请求,结束后一次性应用

Gateway 层

  • 收敛 RPC 契约,统一多工作区运行时校验逻辑
  • Provider/Model 切换时同步广播所有工作区会话元数据,消除滞留旧值

Runtime 层

  • 新增 transcript 修复工具:加载会话时自动检测并裁掉未闭合的 tool_calls 尾部,避免向 provider 发送非法消息链
  • SQLite 持久层消息裁剪改用安全版本,保证不切断 tool span 边界
  • 所有内部调用方统一走 Service.LoadSession,确保修复路径全覆盖

Repository 层

  • 新增 Git Diff 领域模型与结构化解析能力

修复

  • Provider/Section 配置优化
  • Web 端聊天交互与模型权限行为对齐
  • 工作区相关问题修复

文件统计

71 files changed, 7,444 insertions(+), 3,009 deletions(-)

Yumiue added 10 commits May 8, 2026 18:50
新增 transcript 工具函数:RepairIncompleteToolCallTail 检测并截断未闭合的
assistant tool_calls 尾部,TrimMessagesToLimitPreservingToolSpans /
TrimPrefixCountPreservingToolSpans 保证裁剪不会从 tool span 中间切断。
runtime 层 LoadSession 统一走修复路径,所有内部调用方从直接调用
sessionStore.LoadSession 改为走 Service.LoadSession,确保任何加载入口
都会修复残缺消息链。SQLite 持久层的消息裁剪同步改为安全版本。
在 SelectProviderModel / CreateProvider 调用链中,选择完成后同步
广播到当前所有已加载工作区,将其会话 Head 中的 Provider/Model
元数据更新为新值,避免非管理端口对应工作区的会话滞留旧值,
导致后续 listModels 解析到过期 provider/model。
ModelSelector: 将单会话模型切换改为全局 selectProviderModel 路径,
生成中缓存待切换请求,生成结束后一次性生效。
Sidebar: 新增单元测试覆盖。
FileChangePanel / FileTreePanel / GitDiffPreviewEditor: 强化交互联动
与视觉一致性。
index.css: 补充布局与过渡样式。
useWorkspaceStore: 补全状态联动字段。
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

Copy link
Copy Markdown

@fennoai fennoai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found 3 issues worth addressing.

@@ -214,6 +224,29 @@ export default function FileTreePanel() {
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loadRoot and the surrounding state here are only keyed off gatewayAPI, so after switchWorkspace() the mounted file tree keeps the previous workspace's rootNodes/dirCache. The preview tabs are reset on workspace switch, but the tree itself is not, which means the panel can keep showing files from the old workspace until it is remounted or manually refreshed.

Comment thread web/src/utils/format.ts
const now = Date.now()
const diff = now - d.getTime()
const sec = Math.floor(diff / 1000)
if (sec < 60) return '鍒氬垰'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This introduces mojibake into a user-facing label: the function now returns 鍒氬垰 instead of 刚刚, and the new comment on relativeTime is also garbled. Since Sidebar renders this helper directly, users will see broken text in the session list.

return gateway.ProviderSelectionResult{}, err
}
}
if err := b.SyncSessionsProviderModel(ctx, selection.ProviderID, selection.ModelID); err != nil {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point the global provider/model selection has already been persisted, so any failure inside SyncSessionsProviderModel turns the RPC into an error after the config changed. That leaves the frontend thinking the switch failed while the backend has partially applied it, and a single unreadable/stale session can block future switches. This fan-out needs rollback or best-effort handling instead of failing the whole request after the mutation.

@pionxe pionxe merged commit 6a25bb2 into 1024XEngineer:main May 8, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants