Skip to content

feat(Search): 增加了是否显示热搜的开关#1004

Merged
imsyy merged 1 commit intoimsyy:devfrom
MoYingJi:pr/nhs
Mar 19, 2026
Merged

feat(Search): 增加了是否显示热搜的开关#1004
imsyy merged 1 commit intoimsyy:devfrom
MoYingJi:pr/nhs

Conversation

@MoYingJi
Copy link
Collaborator

主要改动

  • 增加了 showHotSearch 的「显示热搜榜」设置项
  • SearchDefault 中根据设置决定是否获取热搜数据和显示热搜榜

同时也改了一些其它东西

  • settings.ts 中,将 showSearchHistory 移动到了与搜索框有关的设置一起
  • 需要「使用在线服务」才能显示「搜索关键词建议」和「显示热搜榜」的设置项
  • 修改「搜索关键词建议」的描述
  • 修复了「展示搜索历史」关闭且不展示热搜榜时,SearchDefault 仍会显示(一条小栏)

主要改动
 - 增加了 `showHotSearch` 的「显示热搜榜」设置项
 - 在 `SearchDefault` 中根据设置决定是否获取热搜数据和显示热搜榜

同时也改了一些其它东西
 - 在 `settings.ts` 中,将 `showSearchHistory` 移动到了与搜索框有关的设置一起
 - 需要「使用在线服务」才能显示「搜索关键词建议」和「显示热搜榜」的设置项
 - 修改「搜索关键词建议」的描述
 - 修复了「展示搜索历史」关闭且不展示热搜榜时,`SearchDefault` 仍会显示(一条小栏)
Copilot AI review requested due to automatic review settings March 17, 2026 15:12
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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!

此拉取请求主要引入了一个新的配置选项,允许用户控制是否在搜索框的默认视图中显示热门搜索列表。通过将搜索历史和热搜榜的显示逻辑与用户设置和在线服务状态紧密结合,提升了搜索功能的灵活性和用户体验。此外,还对相关设置项的组织和描述进行了优化,并修复了一个界面显示的小问题。

Highlights

  • 新增“显示热搜榜”开关: 引入了一个新的配置项 showHotSearch,允许用户控制是否在搜索框的默认内容中显示热门搜索列表。
  • SearchDefault 组件逻辑优化: 在 SearchDefault 组件中,搜索历史和热搜榜的显示逻辑现在根据用户设置和在线服务状态动态决定,并修复了当两者都关闭时可能出现的空栏问题。
  • 设置项组织与描述改进: 将 showSearchHistory 设置项移动到与搜索框相关的设置组中,并为“显示搜索历史”和“搜索关键词建议”添加或更新了描述。
  • 在线服务依赖性: “搜索关键词建议”和新增的“显示热搜榜”设置项现在仅在使用在线服务时可见,确保功能的一致性。
Changelog
  • src/components/Search/SearchDefault.vue
    • 重构了搜索历史和热搜榜的显示条件,引入了计算属性 isShowSearchHistoryisShowHotSearch
    • 更新了 isShow 计算属性的逻辑,使其依赖于新的显示条件。
    • 修改了获取热搜数据的逻辑,使其在“显示热搜榜”开关关闭时不再请求数据。
  • src/components/Setting/config/general.ts
    • 为“显示搜索历史”设置项添加了描述。
    • 新增了“显示热搜榜”的开关设置项,并设置了仅在使用在线服务时可见。
    • 为“搜索关键词建议”设置项添加了在线服务可见性条件,并更新了其描述。
  • src/stores/setting.ts
    • 调整了 SettingState 接口中 showSearchHistory 属性的位置,并新增了 showHotSearch 属性。
    • 更新了 useSettingStore 的默认状态,以包含 showHotSearch 并重新定位 showSearchHistory
Activity
  • 目前没有与此拉取请求相关的评论、审查或进展活动。
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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request refactors the display logic for search history and hot search in the SearchDefault.vue component by introducing dedicated computed properties (isShowSearchHistory, isShowHotSearch). It also adds a new user setting, showHotSearch, to control the visibility of the hot search list, and updates the showSearchHistory and enableSearchKeyword settings with descriptions and conditional visibility based on online service usage. The getSearchHotData function was also updated to respect the new showHotSearch setting.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

该 PR 为搜索默认面板增加了「是否显示热搜榜」的设置开关,并在搜索默认内容渲染/数据获取上根据设置与在线服务状态进行联动控制,以优化搜索默认面板在不同配置下的展示行为。

Changes:

  • 新增设置项 showHotSearch(显示热搜榜),并加入设置默认值与类型定义
  • 设置页「搜索设置」中增加「显示热搜榜」开关,并将其与「在线服务」状态绑定展示
  • SearchDefault 中按设置决定是否拉取热搜数据、是否展示热搜区域,并修复特定组合下仍显示空栏的问题

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/stores/setting.ts 增加 showHotSearch 设置字段并补齐默认值;调整 showSearchHistory 字段在设置结构中的位置
src/components/Setting/config/general.ts 在设置页新增「显示热搜榜」开关;将与在线服务强相关的设置项改为仅在启用在线服务时展示
src/components/Search/SearchDefault.vue 依据设置决定热搜榜区域显示与热搜数据拉取;修正默认面板的显示条件避免空栏

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 107 to 111
// 获取热搜数据
const getSearchHotData = async () => {
if (!settingStore.useOnlineService) return;
if (!settingStore.useOnlineService || !settingStore.showHotSearch) return;
const result = await getCacheData(searchHot, {
key: "searchHotData",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

聚焦搜索框是 SearchDefault 显示的必要条件,用户无法在 SearchDefault 打开时跑到设置去把 showHotSearch 打开,这个没有必要

@imsyy imsyy merged commit 405e01d into imsyy:dev Mar 19, 2026
4 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.

3 participants