feat(maaend): 一系列功能加强 - #342
Conversation
There was a problem hiding this comment.
Sorry @HarcoChen, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
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)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your Experience进入你的 dashboard 以:
Getting HelpOriginal review guide in EnglishReviewer's GuideThis 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 flowsequenceDiagram
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)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
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]
)
Summary by Sourcery
改进 MaaEnd 集成能力,引入动态选项、统一的问题报告导出,以及在后端和前端实现更健壮的控制器与错误处理。
New Features:
Bug Fixes:
Enhancements:
Build:
Documentation:
Chores:
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:
Bug Fixes:
Enhancements:
Build:
Documentation:
Chores: