Skip to content

Conversation

@Futureppo
Copy link
Contributor

@Futureppo Futureppo commented Oct 2, 2025

fixes #XYZ


Motivation / 动机

  • 为插件市场的搜索增加拼音与首字母搜索功能。

Modifications / 改动点

  • 修改文件
    • dashboard/src/views/ExtensionPage.vue:
      • 引入 pinyin-pro
      • 新增工具函数:normalizeStrtoPinyinTexttoInitials
      • 新增 marketCustomFilter,对名称/简称/描述/作者进行拼音与首字母匹配
      • 在市场表格 v-data-table 绑定 :custom-filter="marketCustomFilter"
    • dashboard/package.json:
      • 依赖新增 "pinyin-pro": "^3.26.0"
  • 实现结果:市场搜索框支持中文直搜、全拼、首字母等。

Verification Steps / 验证步骤

  1. 进入前端目录 dashboard 执行:
    • npm i
    • npm run dev
  2. 打开面板进入 插件市场 页面。
  3. 在搜索框验证以下案例:
    • 名称匹配:输入“zhineng”或“zn”应能匹配包含“智能”的项
    • 首字母匹配:输入“fs”应能匹配“飞书”
  4. 验证原有中文/英文关键词搜索仍然有效。

Screenshots or Test Results / 运行截图或测试结果

image

Compatibility & Breaking Changes / 兼容性与破坏性变更

  • 仅前端改动;引入新前端依赖,对后端和数据无影响;无需迁移。
  • 这不是一个破坏性变更。/ This is NOT a breaking change.

Checklist / 检查清单

  • 😊 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。/ If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
  • 👀 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。/ My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
  • 🤓 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到了 requirements.txtpyproject.toml 文件相应位置。/ I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in requirements.txt and pyproject.toml.
  • 😮 我的更改没有引入恶意代码。/ My changes do not introduce malicious code.

Sourcery 总结

在插件市场中启用拼音和首字母搜索,并引入一个新的机器人命令来激活所有功能工具。

新功能:

  • 在插件市场搜索中支持汉字、全拼和首字母匹配
  • 添加 "on_all" 机器人命令以启用所有可用的功能工具

改进:

  • 添加 pinyin-pro 作为前端依赖
Original summary in English

Summary by Sourcery

Enable pinyin and initials search in the plugin marketplace and introduce a new bot command to activate all function tools.

New Features:

  • Support Chinese character, full pinyin, and initials matching in the plugin marketplace search
  • Add "on_all" bot command to enable all available function tools

Enhancements:

  • Add pinyin-pro as a frontend dependency

Sourcery 总结

集成 pinyin-pro 并在市场表格上实现一个自定义筛选器,以支持在插件名称、别名、描述和作者中进行拼音、首字母和标准关键词搜索。

新功能:

  • 在插件市场搜索中支持汉字、全拼和首字母匹配

增强功能:

  • 添加 pinyin-pro 依赖,以支持拼音和首字母转换
Original summary in English

Summary by Sourcery

Integrate pinyin-pro and implement a custom filter on the marketplace table to enable pinyin, initials, and standard keyword search across plugin names, aliases, descriptions, and authors.

New Features:

  • Support Chinese character, full-pinyin, and initials matching in plugin marketplace search

Enhancements:

  • Add pinyin-pro dependency to enable pinyin and initials conversion

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

你好 - 我已审阅了你的更改 - 以下是一些反馈意见:

  • 考虑在加载时缓存或预计算每个插件条目的拼音和首字母,这样 marketCustomFilter 就不会在每次按键时都调用拼音转换,这可能会影响性能。
  • 对搜索输入或过滤函数进行防抖处理,以减少用户快速输入时拼音转换的频率。
  • 将标准化和拼音相关的辅助函数提取到单独的实用程序模块中,以使组件代码更清晰、更易于测试。
供AI代理使用的提示
请处理此代码审查中的评论:

## 总体评论
- 考虑在加载时缓存或预计算每个插件条目的拼音和首字母,这样 marketCustomFilter 就不会在每次按键时都调用拼音转换,这可能会影响性能。
- 对搜索输入或过滤函数进行防抖处理,以减少用户快速输入时拼音转换的频率。
- 将标准化和拼音相关的辅助函数提取到单独的实用程序模块中,以使组件代码更清晰、更易于测试。

Sourcery 对开源项目免费 - 如果你喜欢我们的审查,请考虑分享它们 ✨
帮助我更有用!请点击每个评论上的 👍 或 👎,我将使用这些反馈来改进你的审查。
Original comment in English

Hey there - I've reviewed your changes - here's some feedback:

  • Consider caching or precomputing the pinyin and initials for each plugin entry on load so marketCustomFilter isn't invoking pinyin conversion on every keystroke, which could impact performance.
  • Debounce the search input or filter function to reduce the frequency of pinyin conversions when users type quickly.
  • Extract the normalization and pinyin-related helper functions into a separate utility module to keep the component code cleaner and more testable.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider caching or precomputing the pinyin and initials for each plugin entry on load so marketCustomFilter isn't invoking pinyin conversion on every keystroke, which could impact performance.
- Debounce the search input or filter function to reduce the frequency of pinyin conversions when users type quickly.
- Extract the normalization and pinyin-related helper functions into a separate utility module to keep the component code cleaner and more testable.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Soulter Soulter changed the title 为插件市场的搜索增加拼音与首字母搜索功能 feat: 为插件市场的搜索增加拼音与首字母搜索功能 Oct 3, 2025
@Soulter
Copy link
Member

Soulter commented Oct 3, 2025

lgtm,后期可以优化一下,加一下防抖函数

@Soulter Soulter merged commit cafeda4 into AstrBotDevs:master Oct 3, 2025
5 checks passed
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