Skip to content

feat(report): add AI stream session summaries#55

Merged
qiin2333 merged 1 commit into
masterfrom
codex/ai-stream-report-summary
Jun 30, 2026
Merged

feat(report): add AI stream session summaries#55
qiin2333 merged 1 commit into
masterfrom
codex/ai-stream-report-summary

Conversation

@qiin2333

@qiin2333 qiin2333 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

改了啥呀

  • 给串流结束战报加了 AI 状态徽标,能显示“AI 复盘中 / AI 已复盘”。
  • 新增 StreamReportAiService,复用 Sunshine 的 /ai/completions 生成更活一点的标题、总结、时长吐槽和调参建议。
  • 结束串流时先展示本地战报;LLM 可用才异步刷新,没接 AI 的杂鱼场景继续稳稳回退本地模板。

为啥要改

本地规则战报数据和话术都比较固定,接了 LLM 后可以让复盘更像真的看过这局数据,同时不阻塞断开流程。

验证

  • git diff --check
  • DEVECO_SDK_HOME=/Applications/DevEco-Studio.app/Contents/sdk bash hvigorw assembleHap --no-daemon --stacktrace 进入构建流程,但被既有 native 依赖挡住:nativelib/src/main/cpp/aubio/src/fvec.c 缺失,nativelib:default@BuildNativeWithCmake 失败。entry 侧 PreBuild / metadata / syscap / profile 任务已通过。

Summary by CodeRabbit

  • 新功能

    • 串流战报新增 AI 复盘内容,结束后可自动生成更完整的中文总结与建议。
    • 战报页面新增 AI 状态徽标,显示当前是否已完成生成。
  • 改进

    • 战报生成过程更稳定,支持异步更新,减少旧内容覆盖当前结果的情况。
    • 复盘展示中增加了对建议数量与文本长度的控制,内容更简洁易读。

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@qiin2333, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 34 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4d7d70c0-c486-4984-8bd5-6f0ac2bea99e

📥 Commits

Reviewing files that changed from the base of the PR and between 330b365 and 7407366.

📒 Files selected for processing (3)
  • entry/src/main/ets/components/StreamSessionReport.ets
  • entry/src/main/ets/pages/StreamPage.ets
  • entry/src/main/ets/service/StreamReportAiService.ets
📝 Walkthrough

Walkthrough

为串流战报新增 AI 复盘总结能力:StreamReportData 接口扩展 aiStatus/aiBadgeText 字段;新增 StreamReportAiService 调用 OpenAI 兼容接口生成中文复盘文案;StreamPage 重构战报构建流程,引入 BuiltStreamReportenrichStreamReportWithAi,通过 streamReportAiRequestId 防并发覆盖;UI 层条件渲染 AI 状态徽标。

Changes

战报 AI 复盘总结

Layer / File(s) Summary
StreamReportData 接口与辅助函数扩展
entry/src/main/ets/components/StreamSessionReport.ets
StreamReportData 新增 aiStatus/aiBadgeText 字段;createEmptyStreamReportcloneStreamReportData 补充默认值与拷贝;markStreamReportAiLoading 设置加载态;buildStreamReportData 初始化新字段。
StreamReportAiService 实现
entry/src/main/ets/service/StreamReportAiService.ets
新增服务类:构建 system/user 提示词,调用 nvHttp.aiCompletion,从响应中移除 <think> 并提取 JSON,对字段做长度裁剪,将解析结果写回 StreamReportData 后以 Promise<StreamReportData> 返回。
StreamPage 战报构建与 AI 异步富化
entry/src/main/ets/pages/StreamPage.ets
新增 BuiltStreamReportbuildCurrentStreamReport 改为返回该结构;新增 enrichStreamReportWithAi 含 requestId 过期保护;stopStreaming/quitGameAndReturn 触发战报时调用 AI 富化;生命周期回调管理服务实例与 requestId 递增。
调教建议标题行 AI 徽标渲染
entry/src/main/ets/components/StreamSessionReport.ets
标题行条件渲染 aiBadgeText 徽标,依据 aiStatus === 'ready' 切换配色。

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了本次变更:为串流战报新增 AI 会话总结能力。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/ai-stream-report-summary

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qiin2333 qiin2333 force-pushed the codex/ai-stream-report-summary branch from 330b365 to 109946c Compare June 30, 2026 03:35

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@entry/src/main/ets/pages/StreamPage.ets`:
- Around line 96-100: `buildCurrentStreamReport()` is freezing the report input,
but `enrichStreamReportWithAi()` still reads `this.viewModel.streamConfig`
later, so the AI prompt can diverge from the captured report snapshot. Update
the report snapshot model in `BuiltStreamReport` and
`buildCurrentStreamReport()` to also capture `streamConfig` at freeze time, then
make `enrichStreamReportWithAi()` consume that snapshot instead of reading from
`this.viewModel`. Keep the prompt/content generation aligned with the same
frozen data used for `report.data.configLine`, and adjust any related
report-building helpers that reference the live config.

In `@entry/src/main/ets/service/StreamReportAiService.ets`:
- Around line 70-94: The prompt builder in buildReportPrompt should normalize
and guard stats values before formatting them, because direct toFixed() calls on
fields like globalAvgFps, networkLatency, packetLoss, and the other
latency/frames metrics can throw when the input is undefined or NaN. Update
buildReportPrompt to sanitize these values first (or add a safe formatting
helper used there) so the prompt always renders even when
buildStreamReportData() passes imperfect stats. Keep the existing output
structure intact while using the normalized values for the “原始stats” section.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7c24868b-bc2d-43e8-b208-f5e6d8c7e6a6

📥 Commits

Reviewing files that changed from the base of the PR and between 21f403a and 330b365.

📒 Files selected for processing (3)
  • entry/src/main/ets/components/StreamSessionReport.ets
  • entry/src/main/ets/pages/StreamPage.ets
  • entry/src/main/ets/service/StreamReportAiService.ets

Comment thread entry/src/main/ets/pages/StreamPage.ets
Comment thread entry/src/main/ets/service/StreamReportAiService.ets
@qiin2333 qiin2333 force-pushed the codex/ai-stream-report-summary branch from 109946c to d2561ac Compare June 30, 2026 03:47
@qiin2333 qiin2333 force-pushed the codex/ai-stream-report-summary branch from d2561ac to 7407366 Compare June 30, 2026 03:56
@qiin2333 qiin2333 merged commit 364a4dc into master Jun 30, 2026
2 checks passed
@qiin2333 qiin2333 deleted the codex/ai-stream-report-summary branch June 30, 2026 11:07
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.

1 participant