二个小bug修正, 以及显示的一个小建议改进#177
Closed
lordquest wants to merge 2 commits into
Closed
Conversation
lordquest
commented
Jul 14, 2026
Contributor
- fix: Web 面板回显的访问 IP 选错网卡(169.254.x.x / 虚拟网卡)
- fix: /provider 切换供应商后 Web 面板模型名未同步
- CLI TUI 对话历史与输入区之间加红色水平分隔线区分
根因:localIP() 只过滤回环地址就返回第一个非回环 IPv4,而 net.InterfaceAddrs()
枚举顺序下,排在前面的常是 169.254.x.x 链路本地(APIPA,虚拟网卡 / 无 DHCP 自动分配)
或 Docker/WSL 虚拟网卡,导致面板 URL 回显成点不开的地址。
修复:
1. 优先用默认路由出口探测 —— net.Dial("udp","8.8.8.8:80")(不发真实流量,
仅触发内核路由查找)取 LocalAddr,即默认路由那张真实网卡的 IP;多张真实网卡时
取到的是 LAN 设备访问本机该用的地址。探测失败再退用枚举挑选法。
2. 枚举挑选法 selectHostIP 跳过链路本地(169.254.0.0/16),优先非链路本地地址;
全是链路本地才退用它,避免直接回退 127.0.0.1 让用户连不上。
3. 出口 IP 即便为链路本地也信任(说明默认路由真在那张卡上),不再二次过滤。
测试:新增 web/server_ip_test.go,用注入 dial 的桩覆盖 outboundIP 三态、
selectHostIP 多网卡挑选;原 web 包测试无回归。
根因:Hub 的 Models 在 tui/run.go 启动时初始化一次,之后 /provider 切换供应商只更新了 TUI 侧的 m.models,没有同步到 Hub 快照,导致 Web 右栏仍显示旧模型名。 修复: - 后端:Event 加 Flash/Pro 字段;Hub 新增 SetModels(flash,pro,activeRole)方法 (线程安全,直接更新 snap.Models + 广播 models 事件); applyProvider 末尾调用 m.hub.SetModels 同步 Web 侧。 - 前端(web/static/app.js):reducer 新增 case 'models',更新 this.models.flash/pro/activeRole。
Owner
|
@lordquest 第三条不建议合并,首先是高度计算有问题,其次是样式和当前风格不协调 |
Contributor
Author
deepx确实省token, 很好用. 这二天我都在尝试. 输入区我觉得需要改进的还有一些, |
Owner
|
@lordquest 类似粘贴图像的引用,这个回头可以优化。上下键的,一开始用于滚动聊天内容,后面又改为移动输入区光标位置,每个人都有想法,所以低频的东西,我想先放一放。 |
Contributor
Author
我觉得这一点后面可以参考claude code的作法, 上下键, 在输入区有多行时, 做为移动输入区光标位置; 当移动到最顶行时再上翻就会翻到上一条输入记录; 同理, 移动到最底行时再下翻就会翻到下一条记录. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.