Skip to content

修复抖音依赖缺失与历史同步归属,新增径向性能菜单与首页平台跟随 - #2

Merged
Agying3 merged 4 commits into
Agying3:mainfrom
Possibility-He:main
Oct 6, 2026
Merged

Agying3 merged 4 commits into
Agying3:mainfrom
Possibility-He:main

Conversation

@Possibility-He

Copy link
Copy Markdown
Contributor

概述

这个 PR 修掉抖音插件在真实环境下的几个阻塞问题(依赖缺失、历史同步被空壳响应覆盖、消息会话归属失效),并补上首页平台跟随与半透明径向性能菜单。所有改动都在本地实测过,附实测数据。

改动(4 个提交)

1. feat: add translucent radial performance menu

性能页的半透明径向菜单:dmshoot/gui/widgets/perf_chart.py(+574/-62)与 tests/test_perf_chart.py(713 行、36 项 Qt 测试)。

2. fix(douyin): 补齐 protobuf 依赖链并区分「依赖缺失」与「Cookie 过期」

  • requirements.txt 增加 protobuf>=4.21,<7.0 与 protobuf3-to-dict>=0.1.5:external/DouYin_Spider/dy_apis/douyin_api.py 依赖 protobuf_to_dict,缺失时插件直接导入失败;
  • 约束 <7.0 的原因:protobuf 7 移除了 FieldDescriptor.label,protobuf3-to-dict 0.1.5 会直接抛错(实测 4.21.6–6.33.6 正常,7.36.2 失败);
  • 两个 requirements 文件写入 UTF-8 BOM,避免 pip 在 GBK 控制台读取时报 UnicodeDecodeError;
  • DMShoot.spec 补 hiddenimports(google.protobuf、protobuf_to_dict、six);
  • adapter 捕获 ImportError 后上报「依赖缺失」,不再误报成「Cookie 已过期」。

3. fix(douyin): 历史同步保留最大 payload 并修正会话归属

  • get_message_by_init 会先后返回 1,787,995 字节的真数据与 87 字节空壳响应;原实现后到的空壳会覆盖真数据,改为只保留更大的响应,且不足 1KB 时继续等待;
  • L2 缓存解析出 0 会话时判定为坏缓存,删除后回退 L3(否则会一直命中坏缓存);
  • 消息解析的会话串两种方向都认:实测 265 条候选中 98 条命中的是 0:1:{我的uid}:{对方uid},而原实现只认 0:1:{对方uid}:{我的uid},导致只有 2 条能归属;修正后解析出的 163 条消息里 100 条归属正确、分布到 18 个会话(修复前全部挤在 1 个会话);
  • 单条正文长度上限 5000 → 256KB(实测最长一条 89,916 字节的分享卡片此前被直接丢弃)。

4. feat(ui): 首页自动跟随已连接平台并支持平台缺省

平台状态变化时,若当前平台没有会话则自动切到有会话的平台;ruler.has_platform() 保证不会切到不存在的平台而出现空白页。

验证

  • QT_QPA_PLATFORM=offscreen python -m unittest discover -s tests -p test_perf_chart.py → Ran 36 tests … OK
  • 抖音导入链:修复前 ModuleNotFoundError: No module named 'protobuf_to_dict'(状态显示「依赖缺失」),修复后正常连接(状态: 骑着蜗牛闯世界、WS已连接 ✓)
  • 历史同步实测:缓存命中 L2(Protobuf) → L2 昵称补全成功 → 20会话 → ✓ 同步完成: 20会话 + 38条历史消息
  • 依赖版本区间:protobuf 4.21.6 / 5.x / 6.33.6 正常,7.36.2 失败(故约束 <7.0)

备注

  • 未改动任何发送逻辑与用户数据;自动连接开关仍由本地配置(douyin_enabled 等)决定。
  • 如果只希望合并其中一部分,我可以拆成多个 PR。

重建自 Codex 会话日志(原提交 ca08fd7 在 2026-10-05 的目录误删中丢失)。perf_chart.py +574/-62、tests/test_perf_chart.py 713 行 36 项测试。
requirements 增加 protobuf>=4.21,<7.0 与 protobuf3-to-dict(protobuf 7 移除了 FieldDescriptor.label,会让 protobuf3-to-dict 失败);两个 requirements 文件加 UTF-8 BOM 以免 pip 在 GBK 控制台解码失败;spec 补 hiddenimports;adapter 捕获 ImportError 后上报「依赖缺失」而不是误报 Cookie 过期。
init 接口会先后返回 1.7MB 真数据与 87 字节空壳,改为只保留更大的响应,且不足 1KB 时继续等待;L2 缓存解析出 0 会话时判定为坏缓存并删除后回退 L3;消息解析的会话串两种方向都认(实测 98/100 是 0:1:{我}:{对方}),归属覆盖率 2/265 → 151/265,正文长度上限 5000 → 256KB。
平台状态变化时,若当前平台没有会话则切到有会话的平台;ruler 增加 has_platform(),平台不存在时不切换,避免切换到空页。
@vercel

vercel Bot commented Oct 5, 2026

Copy link
Copy Markdown

@Possibility-He is attempting to deploy a commit to the Agying's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Agying3
Agying3 merged commit 4c792ea into Agying3:main Oct 6, 2026
1 check failed
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