fix: 仓库材料识别不显示结果 - #86
Open
aaa1115910 wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Hey - 我在这里给出了一些总体反馈:
- 从
data解码 JSON 为[String: Int]的逻辑在contents、arkPlannerExportText和loliconExportText中都有重复;建议抽取成一个单独的辅助函数或计算属性,以避免重复并保持解码逻辑的一致性。 arkPlannerExportText和loliconExportText在任何解码/序列化错误时都会返回空字符串,而这个空字符串仍会被复制到剪贴板;建议改为返回可选的String或将错误向上抛出,这样 UI 就可以禁用按钮或显示失败状态,而不是静默复制一个空值。
给 AI Agent 的提示
Please address the comments from this code review:
## Overall Comments
- The JSON decoding from `data` into `[String: Int]` is duplicated in `contents`, `arkPlannerExportText`, and `loliconExportText`; consider extracting this into a single helper/computed property to avoid repetition and keep the decoding logic consistent.
- Both `arkPlannerExportText` and `loliconExportText` return an empty string on any decoding/serialization error, which will still be copied to the clipboard; consider returning an optional `String` or surfacing the error so the UI can disable the buttons or show a failure state instead of silently copying an empty value.帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的评审。
Original comment in English
Hey - I've left some high level feedback:
- The JSON decoding from
datainto[String: Int]is duplicated incontents,arkPlannerExportText, andloliconExportText; consider extracting this into a single helper/computed property to avoid repetition and keep the decoding logic consistent. - Both
arkPlannerExportTextandloliconExportTextreturn an empty string on any decoding/serialization error, which will still be copied to the clipboard; consider returning an optionalStringor surfacing the error so the UI can disable the buttons or show a failure state instead of silently copying an empty value.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The JSON decoding from `data` into `[String: Int]` is duplicated in `contents`, `arkPlannerExportText`, and `loliconExportText`; consider extracting this into a single helper/computed property to avoid repetition and keep the decoding logic consistent.
- Both `arkPlannerExportText` and `loliconExportText` return an empty string on any decoding/serialization error, which will still be copied to the clipboard; consider returning an optional `String` or surfacing the error so the UI can disable the buttons or show a failure state instead of silently copying an empty value.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
修复因 MaaAssistantArknights/MaaAssistantArknights#15358 仓库识别结构变更导致仓库材料识别不显示结果
fix #82
Summary by Sourcery
更新仓库(depot)模型和导出方式,以适配新的后端结构,并恢复材料识别输出。
Bug 修复:
增强内容:
MAADepot数据结构简化为扁平的 JSON 字符串,并在需要时从中派生arkplanner/lolicon导出数据。Original summary in English
Summary by Sourcery
Update depot model and exports to align with new backend structure and restore material recognition output.
Bug Fixes:
Enhancements: