Skip to content

更新AGENTS.MD#835

Merged
imsyy merged 4 commits intodevfrom
dev-fix-01
Feb 8, 2026
Merged

更新AGENTS.MD#835
imsyy merged 4 commits intodevfrom
dev-fix-01

Conversation

@kazukokawagawa
Copy link
Collaborator

No description provided.

- 重构时间解析函数,使用纯数学运算替代字符串操作以提高性能
- 移除全局正则表达式,改为在函数内局部使用避免状态污染
- 在解析过程中直接计算结束时间,消除二次遍历
- 优化歌词对齐算法,使用双指针实现 O(N) 复杂度
- 改进 QRC 格式解析,提前编译正则并优化 XML 内容提取
- 统一默认单词持续时间处理逻辑
- 在 DownloadManager 中添加 removeDownload 方法,支持从队列和 store 中移除任务
- 修复下载页面中播放全部按钮的逻辑,仅对已下载歌曲生效
- 优化下载中页面的封面显示逻辑,统一使用 getCover 方法
- 将 handleRemoveDownload 的参数类型扩展为 number | string 以支持多种 ID 类型
- 使用字符串补齐替代浮点数计算,避免时间解析的精度误差
- 将 alignLyrics 改为纯函数,不再修改输入数组
- 引入 XmlNode 辅助类重构 TTML 生成逻辑,提高可读性
- 优化 QRC 内容提取的正则表达式,增强健壮性
明确要求在提交代码前必须运行 `pnpm build` 和 `pnpm format` 并确保无误,以提升代码质量和一致性。
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @kazukokawagawa, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求主要围绕歌词解析、下载管理和开发流程规范进行了多项改进。通过重构歌词解析逻辑,提升了处理效率和时间戳精度,并引入了 XML 构建器来优化 TTML 格式的生成。同时,增强了下载管理器,允许用户移除下载任务,并更新了开发文档以确保代码提交前的质量检查。这些改动共同提升了应用程序的稳定性、用户体验和开发维护效率。

Highlights

  • 歌词解析优化: 显著提升了逐字歌词(LRC)和 QQ 音乐 QRC 格式歌词的解析效率和准确性,通过单次遍历算法和更精确的时间戳处理,减少了浮点数误差并优化了性能。
  • 下载管理功能增强: 新增了移除下载任务的功能,允许用户从下载队列和进行中的下载中删除指定任务。
  • TTML 生成重构: 引入了一个新的 XML 构建器辅助类,用于更结构化和健壮地生成 TTML 格式的歌词文件。
  • 开发规范更新: 在 AGENTS.md 文档中增加了提交代码前必须运行 pnpm buildpnpm format 的新要求,以确保代码质量和格式统一。
  • 下载页面交互调整: 优化了下载页面的“全部播放”功能,使其仅作用于已下载的歌曲列表,并统一了歌曲封面的获取逻辑。
Changelog
  • AGENTS.md
    • 新增了提交前必须运行 pnpm buildpnpm format 的开发规范。
  • src/core/resource/DownloadManager.ts
    • 新增 removeDownload(id: number | string) 方法,支持移除正在下载或排队的任务。
  • src/utils/lyric/lyricParser.ts
    • 引入 lodash-escloneDeep 方法。
    • 优化 parseTimeToMs 函数,通过字符串补齐处理,避免浮点数计算误差,提高毫秒时间解析的精度。
    • 移除全局正则表达式 WORD_BY_WORD_REGEXENHANCED_WORD_REGEX,改为在函数内部使用 matchAll 或局部正则表达式,避免状态问题。
    • 新增 QRC_LINE_PATTERNQRC_WORD_PATTERN 常量正则表达式。
    • 新增 DEFAULT_WORD_DURATIONALIGN_TOLERANCE_MS 常量。
    • 删除 fixLineEndTimes 函数,将行结束时间修正逻辑整合到逐字歌词解析的单次遍历中。
    • 重构 parseWordByWordLrcparseEnhancedLrc 函数,采用单次遍历计算字和行的结束时间,并修正上一行的结束时间。
    • 改进 alignLyrics 函数,使用双指针算法实现 O(N) 复杂度,并确保输入歌词的不可变性(通过 cloneDeep 返回新副本)。
    • 增强 parseQRCLyric 函数,使其能更健壮地从 QRC 内容中提取歌词,并使用新的 QRC 相关正则表达式和 matchAll
    • 新增 XmlNode 辅助类,用于更结构化地构建 XML,并重构 lyricLinesToTTML 函数以使用此构建器,简化 XML 生成逻辑并处理字符转义。
  • src/views/Download/downloading.vue
    • 引入 SongTypeCustomDownloadType 类型。
    • 新增 getCover 方法,统一处理歌曲封面的获取逻辑,优先使用 coverSize.s
    • 更新 handleRemoveDownload 方法的参数类型,以支持 number | string 类型的下载ID,与 DownloadManager.ts 的改动保持一致。
  • src/views/Download/layout.vue
    • 将“全部播放”按钮的点击事件从直接调用 player.updatePlayList 更改为 handlePlayAll 方法。
    • 移除 currentListData 计算属性。
    • handlePlayAll 方法现在仅在“已下载”标签页下播放歌曲列表,限制了“全部播放”的功能范围。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

gemini-code-assist[bot]

This comment was marked as outdated.

@kazukokawagawa kazukokawagawa marked this pull request as ready for review February 7, 2026 05:13
@imsyy imsyy merged commit 51c2993 into dev Feb 8, 2026
4 checks passed
@kazukokawagawa kazukokawagawa deleted the dev-fix-01 branch February 8, 2026 06:39
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