Skip to content

feat(maaend): 一系列功能加强 - #342

Open
HarcoChen wants to merge 9 commits into
AUTO-MAS-Project:devfrom
HarcoChen:refactor/dynamicMaaEnd
Open

feat(maaend): 一系列功能加强#342
HarcoChen wants to merge 9 commits into
AUTO-MAS-Project:devfrom
HarcoChen:refactor/dynamicMaaEnd

Conversation

@HarcoChen

@HarcoChen HarcoChen commented Aug 8, 2026

Copy link
Copy Markdown
Contributor
  • 支持一键导出符合 Issues 要求的问题诊断包",
  • 颜色检查报错提示单独分支处理",
  • 动态的读取控制器和基质刷取选项
  • 缓存动态选项与任务名称解析结果,资源文件变化后自动刷新

Summary by Sourcery

改进 MaaEnd 集成能力,引入动态选项、统一的问题报告导出,以及在后端和前端实现更健壮的控制器与错误处理。

New Features:

  • 添加统一的 MaaEnd 问题报告导出流程,将日志、诊断信息、脱敏后的配置以及版本元数据打包为 ZIP,用于问题提交。
  • 通过后端 API 暴露 MaaEnd 动态选项(控制器、控制器协议以及 Essence 位置),并在脚本和用户配置界面中展示这些选项。
  • 在任务失败或相关配置与日志视图中,引入导出 MaaEnd 问题报告的模态指引与应用内提示。

Bug Fixes:

  • 当 MaaEnd 检测到分辨率无效或颜色识别失败时,避免不必要的游戏重启和重复尝试。
  • 在启动 MaaEnd 任务前确保 ADB 设备已完全可连接,降低与连接相关的失败。
  • 在执行前校验控制器协议及路径配置,防止在控制器协议缺失或不支持的情况下运行 MaaEnd。

Enhancements:

  • 优化 MaaEnd 控制器配置逻辑,将控制器类型与协议拆分,并根据协议驱动模拟器/游戏路径。
  • 使 MaaEnd 资源加载(任务 i18n、控制器与 Essence 选项)更加健壮并支持缓存,在底层文件变更时自动刷新。
  • 简化 MaaEnd 快速配置任务处理流程,包括动态 Essence 位置选项和更安全的用户配置批量字段保存。
  • 统一 QQ 群链接,并为遇到 MaaEnd 问题的用户添加上下文提醒与指引。
  • 放宽 MaaEnd 控制器类型和 Essence 位置的配置 schema,以便从 MaaEnd 资源中接收动态值。

Build:

  • 在 Electron 侧添加 MaaEnd 问题报告服务及 IPC 接线,从应用和 MaaEnd 数据目录生成问题 ZIP 包。

Documentation:

  • 更新高级设置和 MaaEnd 脚本设置说明,解释新的问题报告打包流程以及提交生成 ZIP 文件的入口。

Chores:

  • 将应用和前端版本从 v5.4.0-beta.4 升级到 v5.4.0-beta.5。
Original summary in English

Summary by Sourcery

Improve MaaEnd integration with dynamic options, unified issue report export, and more robust controller and error handling across backend and frontend.

New Features:

  • Add unified MaaEnd issue report export flow that collects logs, diagnostics, sanitized configs, and version metadata into a ZIP for issue submission.
  • Expose MaaEnd dynamic options (controllers, controller protocols, and essence locations) via a backend API and surface them in script and user configuration UIs.
  • Introduce modal guidance and in-app prompts for exporting MaaEnd issue reports when tasks fail or from relevant configuration and log views.

Bug Fixes:

  • Avoid unnecessary game restarts and retries when MaaEnd detects invalid resolution or color recognition failures.
  • Ensure ADB devices are fully connectable before starting MaaEnd tasks to reduce connection-related failures.
  • Prevent MaaEnd runs with missing or unsupported controller protocol configuration by validating protocol and paths before execution.

Enhancements:

  • Refine MaaEnd controller configuration to separate controller type from protocol and drive emulator/game paths based on protocol.
  • Make MaaEnd resource loading (task i18n, controller and essence options) resilient and cached, refreshing when underlying files change.
  • Streamline MaaEnd quick-config task handling, including dynamic essence location options and safer batched field saving for user configs.
  • Unify QQ group URLs and add contextual alerts and guidance for users encountering MaaEnd issues.
  • Relax config schema for MaaEnd controller type and essence location to allow dynamic values from MaaEnd resources.

Build:

  • Add Electron-side MaaEnd issue report service and IPC wiring to generate issue ZIPs from application and MaaEnd data directories.

Documentation:

  • Update advanced and MaaEnd script settings descriptions to explain the new issue report package flow and where to submit generated ZIP files.

Chores:

  • Bump application and frontend version from v5.4.0-beta.4 to v5.4.0-beta.5.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry @HarcoChen, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@sourcery-ai

sourcery-ai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Reviewer's Guide

此 PR 加强了 MaaEnd 集成:新增引导式问题包导出功能;引入从已安装 MaaEnd 资源动态加载的 MaaEnd 选项(控制器、精粹位置);优化错误处理;更新配置模型以支持控制器协议和灵活的精粹位置;并将问题包逻辑集中到可复用的 Vue composable 和后端服务中。

MaaEnd 问题包导出流程时序图

sequenceDiagram
  actor User
  participant VueComponent as VueComponent(TabAdvanced/Logs/ScriptEdit)
  participant useMaaEndIssueReport
  participant ElectronPreload as electronAPI
  participant ElectronMain as ipcMain
  participant IssueReportService as createMaaEndIssueReport

  User->>VueComponent: click 导出MaaEnd问题包
  VueComponent->>useMaaEndIssueReport: exportMaaEndIssueReport()
  useMaaEndIssueReport->>ElectronPreload: exportMaaEndIssueReport()
  ElectronPreload->>ElectronMain: invoke maaend:exportIssueReport
  ElectronMain->>IssueReportService: createMaaEndIssueReport(appRoot, filePath)
  IssueReportService-->>ElectronMain: { success, message, zipPath, error }
  ElectronMain-->>ElectronPreload: result
  ElectronPreload-->>useMaaEndIssueReport: result
  useMaaEndIssueReport->>VueComponent: show success/error, showItemInFolder()
  useMaaEndIssueReport->>VueComponent: showMaaEndIssueReportGuide(zipPath)
Loading

File-Level Changes

Change Details Files
从 MaaEnd 资源中引入动态控制器和精粹位置选项,并将其接入脚本和用户编辑界面。
  • 新增后端 API /api/scripts/maaend/options,读取 MaaEnd 配置/接口资源,解析控制器选项、协议以及 AutoEssence 位置,并在资源变更时通过缓存自动刷新。
  • 添加 Config.get_maaend_optionsresource_loader 辅助方法,用于从 MaaEnd 文件加载控制器选项、精粹位置选项以及任务 i18n。
  • 更新 MaaEnd Game 配置和 schema 模型,以支持字符串类型的 ControllerTypeControllerProtocol,移除硬编码枚举和默认值。
  • MaaEndScriptEdit 中,用动态 ComboBoxItem 选项替换静态控制器选项,跟踪 controllerProtocols,并更新控制器类型变更处理逻辑,包括在选项加载期间禁用相关控件。
  • MaaEndUserEditTaskConfigSection 中,从后端加载 essenceLocationOptions,通过 props 传递下去,并更新 AutoEssenceSpecifiedLocation 的处理逻辑,使其使用动态选项和字符串类型。
app/api/scripts.py
app/core/config.py
app/models/config.py
app/models/schema.py
app/task/MaaEnd/resource_loader.py
app/task/MaaEnd/ScriptConfig.py
app/task/MaaEnd/manager.py
frontend/src/composables/useScriptApi.ts
frontend/src/api/services/GetService.ts
frontend/src/api/services/Service.ts
frontend/src/api/index.ts
frontend/src/api/models/MaaEndOptionsOut.ts
frontend/src/api/models/MaaEndConfig_Game.ts
frontend/src/api/models/MaaEndUserConfig_Task.ts
frontend/src/utils/maaEndProtocolSpace.ts
frontend/src/views/EditView/Script/MaaEndScriptEdit.vue
frontend/src/views/EditView/User/MaaEndUserEdit.vue
frontend/src/views/MaaEndUserEdit/TaskConfigSection.vue
app/utils/constants.py
通过新的 Electron 服务和 Vue composable,将 MaaEnd 问题包导出(日志 + 诊断信息 + 配置)集中化,并接入多个界面入口和调度错误流程。
  • 在 Electron 端新增 createMaaEndIssueReport 服务,用于收集应用/前端日志、MaaEnd debug/on_error 文件夹以及脱敏后的 MaaEnd 配置,并加入大小限制、元数据 manifest 和问题模板。
  • 暴露新的 ipcMain.handle('maaend:exportIssueReport') 以及在 window.electronAPI 上的 preload 桥 exportMaaEndIssueReport
  • 创建 useMaaEndIssueReport composable,用于调用 IPC handler,展示成功/错误消息,打开文件夹,并通过 showMaaEndIssueReportGuide 显示引导弹窗。
  • 新增 maaEndIssueReport 工具方法和 MAS_QQ_GROUP_URL 常量,用于驱动后续引导弹窗和 QQ 群链接。
  • 将 TabAdvanced 和 Logs 视图中之前的通用日志导出流程替换为 MaaEnd 问题包导出,并更新按钮文案和说明文案以匹配问题反馈需求。
  • MaaEndScriptEdit 的头部添加 MaaEnd 问题包导出按钮,并增加信息提示,引导用户使用顶层导出按钮。
  • 将调度器错误处理逻辑与 MaaEnd 问题包集成:检测 MaaEnd 相关错误,并弹出弹窗,提供立即导出问题包的选项,而不仅仅是简单通知。
frontend/electron/main.ts
frontend/electron/preload.ts
frontend/electron/services/maaEndIssueReportService.ts
frontend/src/composables/useMaaEndIssueReport.ts
frontend/src/utils/maaEndIssueReport.ts
frontend/src/utils/openExternal.ts
frontend/src/views/setting/TabAdvanced.vue
frontend/src/views/Logs.vue
frontend/src/views/EditView/Script/MaaEndScriptEdit.vue
frontend/src/views/scheduler/useSchedulerLogic.ts
frontend/src/views/setting/TabOthers.vue
frontend/src/types/electron.d.ts
改进 MaaEnd 运行时行为和错误处理,包括控制器协议识别、ADB 就绪检查,以及更精确的游戏参数错误状态。
  • 修改 MaaEnd AutoProxy:只要存在任意运行中的 Endfield.exe 即视为游戏已启动,从而跳过重复启动;并将分辨率或颜色识别失败视为不可重试的游戏参数错误。
  • 为 MaaEnd 日志检查器添加颜色识别失败的状态映射,并泛化关于分辨率/颜色问题的提示信息。
  • 更新 MaaEnd manager,以从配置中跟踪 controller_protocol,校验 ADB 模拟器配置和 Win32 游戏路径是否存在,并在协议缺失或不支持时直接失败。
  • 调整 MaaEnd AutoProxy,使其使用 MaaFWManager.ensure_adb_connectable 等待 ADB 设备进入就绪状态后再使用,同时更新 savedDevice 的格式。
  • 重构 MaaFWManager:新增 ensure_adb_connectable,使用 ProcessRunneradb get-state 的超时循环,并通过 asyncio 线程调用 Toolkit.find_adb_devices
  • ScriptConfigManualReview 中统一使用新的 normalize_maaend_configfallback_set 语义,移除旧的磁盘模板配置,改为将现有 MaaEnd set 复制到配置中。
  • 引入 load_maaend_task_i18n,从语言包和任务定义中重建 MaaEnd 任务名到标签的映射,替换之前在 AutoProxy 中的内联 json5 解析,并按根路径和语言进行缓存。
app/task/MaaEnd/AutoProxy.py
app/task/MaaEnd/manager.py
app/task/MaaEnd/ScriptConfig.py
app/task/MaaEnd/ManualReview.py
app/task/MaaEnd/resource_loader.py
app/core/maa_manager.py
app/utils/constants.py
调整 MaaEnd 理智任务默认值和 UI 行为,以适配 Essence 任务和奖励选项,对齐前后端模型并减少脆弱假设。
  • 将后端 AutoEssenceSpecifiedLocation 默认值改为空字符串,并允许任意字符串值,移除原先强制固定精粹位置集合的常量和校验器。
  • 对齐前端 MaaEnd 理智配置默认值和展示辅助方法,使其适配新的字符串型 AutoEssenceSpecifiedLocation,移除静态标签映射,改用原始字符串展示。
  • 更新 TaskConfigSection,根据 SanityTaskType 动态计算保存键,确保 currentTaskValue 归一化返回 FieldChange,并监听 loading/选项变更以重新归一化任务值和奖励分组状态。
  • optionsLoading 传入 TaskConfigSection,在任务选项选择器上用于禁用状态和加载指示,尤其是依赖动态选项的 Essence 任务。
  • MaaEndUserEdit 中的逐字段保存逻辑中,通过 Map 和单个 Promise 批量合并待保存的字段,减少冗余的 updateUser 调用并避免保存请求重叠。
app/models/config.py
app/models/schema.py
app/utils/constants.py
frontend/src/utils/maaEndProtocolSpace.ts
frontend/src/views/MaaEndUserEdit/TaskConfigSection.vue
frontend/src/views/EditView/User/MaaEndUserEdit.vue
frontend/src/composables/useScriptApi.ts
更新与 MaaEnd 和 MAS QQ 群链接相关的版本号及小的 UX 细节。
  • AppConfig.VERSION 和前端 package.json 版本从 v5.4.0-beta.4 提升到 v5.4.0-beta.5
  • MAS_QQ_GROUP_URL 常量替换 MaaEndScriptEdit 提示和 TabOthers 用户群区域中硬编码的 QQ 群链接,以保持一致性。
  • openExternal 中导出 MAS_QQ_GROUP_URL,并在新的 MaaEnd 问题包引导工具中复用该常量。
app/core/config.py
frontend/package.json
frontend/src/views/EditView/Script/MaaEndScriptEdit.vue
frontend/src/views/setting/TabOthers.vue
frontend/src/utils/openExternal.ts
res/version.json

Tips and commands

Interacting with Sourcery

  • 触发新评审: 在 Pull Request 中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的评审评论。
  • 从评审评论生成 GitHub issue: 回复 Sourcery 的评审评论,请其从该评论创建一个 issue。也可以直接回复评审评论 @sourcery-ai issue 来生成 issue。
  • 生成 Pull Request 标题: 在 Pull Request 标题中任意位置写上 @sourcery-ai,即可随时生成标题。也可以在 Pull Request 中评论 @sourcery-ai title 来(重新)生成标题。
  • 生成 Pull Request 总结: 在 Pull Request 正文任意位置写上 @sourcery-ai summary,即可在指定位置生成 PR 总结。也可以在 Pull Request 中评论 @sourcery-ai summary 来(重新)生成总结。
  • 生成评审指南: 在 Pull Request 中评论 @sourcery-ai guide,即可随时(重新)生成评审指南。
  • 批量解决所有 Sourcery 评论: 在 Pull Request 中评论 @sourcery-ai resolve,可将所有 Sourcery 评论标记为已解决。适用于你已经处理完所有评论且不再希望看到它们的情况。
  • 关闭所有 Sourcery 评审: 在 Pull Request 中评论 @sourcery-ai dismiss,可关闭所有现有 Sourcery 评审。特别适用于你希望从头开始新的评审——别忘了再评论 @sourcery-ai review 来触发新评审!

Customizing Your Experience

进入你的 dashboard 以:

  • 启用或禁用评审功能,例如 Sourcery 自动生成的 Pull Request 总结、评审指南等。
  • 更改评审语言。
  • 添加、删除或编辑自定义评审说明。
  • 调整其他评审设置。

Getting Help

Original review guide in English

Reviewer's Guide

This PR enhances MaaEnd integration by adding guided issue-report export, introducing dynamic MaaEnd options (controllers, essence locations) loaded from the installed MaaEnd resources, refining error handling, and updating the configuration model to support controller protocols and flexible essence locations, while centralizing issue-report logic in a reusable composable and backend service.

Sequence diagram for MaaEnd issue-report export flow

sequenceDiagram
  actor User
  participant VueComponent as VueComponent(TabAdvanced/Logs/ScriptEdit)
  participant useMaaEndIssueReport
  participant ElectronPreload as electronAPI
  participant ElectronMain as ipcMain
  participant IssueReportService as createMaaEndIssueReport

  User->>VueComponent: click 导出MaaEnd问题包
  VueComponent->>useMaaEndIssueReport: exportMaaEndIssueReport()
  useMaaEndIssueReport->>ElectronPreload: exportMaaEndIssueReport()
  ElectronPreload->>ElectronMain: invoke maaend:exportIssueReport
  ElectronMain->>IssueReportService: createMaaEndIssueReport(appRoot, filePath)
  IssueReportService-->>ElectronMain: { success, message, zipPath, error }
  ElectronMain-->>ElectronPreload: result
  ElectronPreload-->>useMaaEndIssueReport: result
  useMaaEndIssueReport->>VueComponent: show success/error, showItemInFolder()
  useMaaEndIssueReport->>VueComponent: showMaaEndIssueReportGuide(zipPath)
Loading

File-Level Changes

Change Details Files
Add dynamic MaaEnd controller and essence-location options sourced from MaaEnd resources, and wire them into script and user edit UIs.
  • Introduce backend API /api/scripts/maaend/options that reads MaaEnd config/interface resources, resolves controller options, protocols, and AutoEssence locations, with caching to auto-refresh on resource changes.
  • Add Config.get_maaend_options and resource_loader helpers to load controller and essence location options and task i18n from MaaEnd files.
  • Update MaaEnd Game config and schema models to support string ControllerType and ControllerProtocol, removing hardcoded enums and defaults.
  • In MaaEndScriptEdit, replace static controller options with dynamic ComboBoxItem options, track controllerProtocols, and update controller-type change handling, including disabling controls while options load.
  • In MaaEndUserEdit and TaskConfigSection, load essenceLocationOptions from backend, pass them down as props, and update AutoEssenceSpecifiedLocation handling to use dynamic options and string type.
app/api/scripts.py
app/core/config.py
app/models/config.py
app/models/schema.py
app/task/MaaEnd/resource_loader.py
app/task/MaaEnd/ScriptConfig.py
app/task/MaaEnd/manager.py
frontend/src/composables/useScriptApi.ts
frontend/src/api/services/GetService.ts
frontend/src/api/services/Service.ts
frontend/src/api/index.ts
frontend/src/api/models/MaaEndOptionsOut.ts
frontend/src/api/models/MaaEndConfig_Game.ts
frontend/src/api/models/MaaEndUserConfig_Task.ts
frontend/src/utils/maaEndProtocolSpace.ts
frontend/src/views/EditView/Script/MaaEndScriptEdit.vue
frontend/src/views/EditView/User/MaaEndUserEdit.vue
frontend/src/views/MaaEndUserEdit/TaskConfigSection.vue
app/utils/constants.py
Centralize MaaEnd issue-report export (logs + diagnostics + config) via a new Electron service and Vue composable, and hook it into multiple UI entry points and scheduler error flow.
  • Add Electron-side createMaaEndIssueReport service that collects app/frontend logs, MaaEnd debug/on_error folders, and sanitized MaaEnd config, with size limits, metadata manifest, and issue template.
  • Expose new ipcMain handle maaend:exportIssueReport and preload bridge exportMaaEndIssueReport on window.electronAPI.
  • Create useMaaEndIssueReport composable to call the IPC handler, show success/error messages, reveal folder, and display guidance modal via showMaaEndIssueReportGuide.
  • Add maaEndIssueReport utilities and MAS_QQ_GROUP_URL constant to drive the follow-up guidance modal and group link.
  • Replace previous generic log-export flows in TabAdvanced and Logs views with MaaEnd issue-report export, updating button text and copy to align with Issue requirements.
  • Add MaaEnd issue-report export button to MaaEndScriptEdit header and an info alert that points users to the top-level export button.
  • Integrate scheduler error handling with MaaEnd issue-report: detect MaaEnd-related errors and show a modal that offers immediate problem-pack export instead of a simple notification.
frontend/electron/main.ts
frontend/electron/preload.ts
frontend/electron/services/maaEndIssueReportService.ts
frontend/src/composables/useMaaEndIssueReport.ts
frontend/src/utils/maaEndIssueReport.ts
frontend/src/utils/openExternal.ts
frontend/src/views/setting/TabAdvanced.vue
frontend/src/views/Logs.vue
frontend/src/views/EditView/Script/MaaEndScriptEdit.vue
frontend/src/views/scheduler/useSchedulerLogic.ts
frontend/src/views/setting/TabOthers.vue
frontend/src/types/electron.d.ts
Improve MaaEnd runtime behavior and error handling, including controller protocol awareness, ADB readiness checks, and more precise game-parameter error statuses.
  • Modify MaaEnd AutoProxy to treat any running Endfield.exe as sufficient to skip redundant game start, and to treat resolution or color-identification failures as non-retryable game-parameter errors.
  • Add MaaEnd log checker mapping for color recognition failures to a specific status message, and generalize messages around resolution / color issues.
  • Update MaaEnd manager to track controller_protocol from config, validate ADB emulator configuration, Win32 game path presence, and fail when protocol is missing or unsupported.
  • Adjust MaaEnd AutoProxy to use MaaFWManager.ensure_adb_connectable to wait for ADB devices to reach a ready state before using them, and update savedDevice format accordingly.
  • Refactor MaaFWManager to add ensure_adb_connectable, using ProcessRunner and adb get-state with a timeout loop, and to call Toolkit.find_adb_devices via asyncio threads.
  • Use new normalize_maaend_config fallback_set semantics consistently (ScriptConfig, ManualReview) and remove the old on-disk template config, copying existing MaaEnd set into config instead.
  • Introduce load_maaend_task_i18n to rebuild MaaEnd taskname->label mapping from locales and task definitions, replacing inline json5 parsing previously in AutoProxy, and cache results keyed by root path and language.
app/task/MaaEnd/AutoProxy.py
app/task/MaaEnd/manager.py
app/task/MaaEnd/ScriptConfig.py
app/task/MaaEnd/ManualReview.py
app/task/MaaEnd/resource_loader.py
app/core/maa_manager.py
app/utils/constants.py
Adjust MaaEnd sanity-task defaults and UI behavior for Essence tasks and reward options, aligning frontend and backend models and reducing brittle assumptions.
  • Change backend default AutoEssenceSpecifiedLocation to an empty string and allow arbitrary string values, removing constants and validators that enforced a fixed set of essence locations.
  • Align frontend MaaEnd sanity config defaults and display helpers with the new string-based AutoEssenceSpecifiedLocation, dropping static label maps and using raw string display.
  • Update TaskConfigSection to compute the save key dynamically based on SanityTaskType, to ensure currentTaskValue normalization returns a FieldChange, and to watch loading/options changes to re-normalize task values and reward group state.
  • Pass optionsLoading to TaskConfigSection and use it in disabled state and loading indicators for the task option selector, particularly for Essence tasks that rely on dynamic options.
  • Ensure per-field save logic in MaaEndUserEdit batches and coalesces pending field saves via a Map and a single promise, reducing redundant updateUser calls and avoiding overlapping saves.
app/models/config.py
app/models/schema.py
app/utils/constants.py
frontend/src/utils/maaEndProtocolSpace.ts
frontend/src/views/MaaEndUserEdit/TaskConfigSection.vue
frontend/src/views/EditView/User/MaaEndUserEdit.vue
frontend/src/composables/useScriptApi.ts
Update versions and minor UX details related to MaaEnd and MAS QQ group links.
  • Bump AppConfig.VERSION and frontend package.json version from v5.4.0-beta.4 to v5.4.0-beta.5.
  • Replace hardcoded QQ group URLs in MaaEndScriptEdit notice and TabOthers user group section with MAS_QQ_GROUP_URL constant for consistency.
  • Add MAS_QQ_GROUP_URL export to openExternal and reuse it in new MaaEnd issue-report guidance utilities.
app/core/config.py
frontend/package.json
frontend/src/views/EditView/Script/MaaEndScriptEdit.vue
frontend/src/views/setting/TabOthers.vue
frontend/src/utils/openExternal.ts
res/version.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@HarcoChen
HarcoChen requested a balanced review from Copilot August 8, 2026 07:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 34 out of 35 changed files in this pull request and generated no new comments.

Suppressed comments (5)

frontend/src/views/EditView/Script/MaaEndScriptEdit.vue:624

  • 这里通过 unknown 强转读取 controllerTypes,说明前端生成的 MaaEndOptionsOut 类型与后端响应字段不一致(controllerTypes 缺失),会导致类型不安全且容易在后端字段调整时静默出错。建议同步 OpenAPI 并重新生成前端 API 类型;在此处也至少用更明确的交叉类型并提供空对象回落。
    controllerOptions.value = response.controllers
    controllerProtocols.value = (
      response as unknown as { controllerTypes: Record<string, string> }
    ).controllerTypes

frontend/src/api/models/MaaEndOptionsOut.ts:27

  • 该 OpenAPI 生成的 MaaEndOptionsOut 缺少后端已返回/已在后端 schema 声明的 controllerTypes 字段,导致上层代码不得不使用 unknown/强转读取字段。请以更新后的 OpenAPI 重新生成前端 API(而不是手改生成文件),确保契约一致。
     * MaaEnd 控制器选项
     */
    controllers: Array<ComboBoxItem>;
    /**
     * MaaEnd 基质刷取地点选项
     */
    essenceLocations: Array<ComboBoxItem>;
};

app/task/MaaEnd/ScriptConfig.py:36

  • load_maaend_options 在本文件中未被直接使用,容易触发 lint 的 unused import;如果这是为了给 app.core.config 做 re-export,建议显式标注并加上 noqa 注释,避免后续误删。
from app.utils import get_logger, ProcessManager
from .resource_loader import load_maaend_options

app/core/config.py:685

  • get_maaend_options 的返回类型标注为 dict[str, list[dict[str, str]]],但实际返回数据包含 controllerTypes: dict[str, str](非 list),类型注解不准确会误导调用方与静态检查。建议将返回类型放宽为 dict[str, Any] 或定义明确的 TypedDict。
    async def get_maaend_options(
        self, script_id: str
    ) -> dict[str, list[dict[str, str]]]:
        """读取指定 MaaEnd 安装目录中的动态选项。"""

app/models/config.py:986

  • 当理智任务为 Essence 且 AutoEssenceSpecifiedLocation 为空字符串(本 PR 已将默认值改为空)时,这里的 详细任务 标签会生成空内容(详细任务:),对用户没有信息量。建议至少在空值时展示占位文本(例如“未配置”)。
            detail_label = (
                detail_key
                if sanity_task_type == "Essence"
                else MAAEND_SANITY_TASK_DETAIL_LABELS[detail_key]
            )

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