feat: add topic AI chat - #405
Open
jo32 wants to merge 3 commits into
Open
Conversation
Author
jo32
marked this pull request as ready for review
August 8, 2026 16:10
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.

功能概述
设计原因
NGA 的长帖通常包含大量楼层,适合通过交互式总结和追问来阅读。将聊天传输、流式解析和工具循环整理为独立 ChatSDK,可以让这套能力在后续其他页面复用;帖子聊天层只负责提供当前帖子的领域上下文与只读工具。
连接验证门禁可以避免在服务尚不可用时展示无法工作的入口。API Key 始终存储在钥匙串中,连接测试日志会对敏感内容进行脱敏。
用户体验
用户可以在设置中填写任意 OpenAI 兼容接口并发送一个小请求进行验证。验证并保存成功后,帖子页面会显示 AI 聊天入口。助手首先使用当前已加载楼层作为上下文,必要时可通过带有可见调用痕迹的只读工具查询更多公开 MNGA 数据。
聊天以可调整高度的 Action Sheet 呈现;会话在同一帖子详情生命周期内保留,切换帖子后清空。回复支持流式 Markdown,工具调用可展开查看参数、结果、状态、耗时和复用次数。
安全与边界
验证
make tuistmake logic-simxcodebuild -workspace app/MNGA.xcworkspace -scheme MNGA -configuration Debug -destination "platform=iOS Simulator,id=57E8D85B-28E1-4E28-BA6B-F9406FBFE511" ONLY_ACTIVE_ARCH=YES CODE_SIGNING_ALLOWED=NO buildplutil -lint app/Shared/Localization/zh-Hans.lproj/Localizable.strings已执行
make swiftformat,但当前本地环境未安装 SwiftFormat,因此该步骤由项目脚本自动跳过。