Skip to content

fix: AI搜索不触发/无搜索结果时无交互提示#146

Merged
AmintaCCCP merged 3 commits into
AmintaCCCP:mainfrom
hych0317:fix-ai-search-api-trigger
May 17, 2026
Merged

fix: AI搜索不触发/无搜索结果时无交互提示#146
AmintaCCCP merged 3 commits into
AmintaCCCP:mainfrom
hych0317:fix-ai-search-api-trigger

Conversation

@hych0317
Copy link
Copy Markdown
Contributor

@hych0317 hych0317 commented May 16, 2026

修改内容

  • 修复Issue 0.5.7版本,搜索没有反应 #136 中点击“AI 搜索”时未实际调用已配置 AI 服务的问题。
  • 当搜索或过滤条件已激活且结果为空时,保留空结果状态,显示“未找到相关仓库”提示,而不是回退显示全部仓库。

已在本地验证实现正确,改动位于通用 React 前端逻辑,对 Windows/macOS/Linux 发布共用。

Summary by CodeRabbit

  • New Features

    • AI-driven semantic search added with an intelligent fallback to enhanced basic search.
    • Repository view now updates and displays results according to active search filters.
  • Bug Fixes / UX Improvements

    • AI summary panel no longer closes unexpectedly when switching categories or applying filters, preserving user display preference.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 64cd21ed-7a45-4029-bf0a-595ec76fa957

📥 Commits

Reviewing files that changed from the base of the PR and between 8fd3836 and 99580ae.

📒 Files selected for processing (2)
  • src/App.tsx
  • src/services/aiService.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/App.tsx
  • src/services/aiService.ts

📝 Walkthrough

Walkthrough

App makes RepositoriesView filter-aware (passes searchFilters and recomputes memoized view); aiService attempts AI semantic reranking and falls back to enhanced basic search on error or no content; RepositoryList only hides the AI summary when switching to a category that lacks analyzed repos.

Changes

Search Enhancement with AI Semantic Search

Layer / File(s) Summary
RepositoriesView with Search Filter Awareness
src/App.tsx, src/components/RepositoryList.tsx
Add hasActiveSearchFilters(filters) and convert RepositoriesView to a memoized component that picks searchResults only when filters are active; App reads searchFilters from store, passes them to RepositoriesView, and includes them in memo deps. RepositoryList now disables showAISummary only when the category actually changes and the new category has no analyzed (non-failed) repos.
AI Semantic Search with Fallback
src/services/aiService.ts
searchRepositoriesWithReranking now attempts an AI semantic search by calling requestText with a prompt and, when content is returned, parses AI-derived terms to call performEnhancedSearch. If the AI call errors or returns no content, it logs the fallback and runs performEnhancedBasicSearch instead.

Sequence Diagram(s)

sequenceDiagram
  participant App as App/Caller
  participant AI as AIModel
  participant Enhanced as performEnhancedSearch
  participant Basic as performEnhancedBasicSearch
  App->>AI: requestText(prompt with repository data)
  AI-->>App: content (parsed search terms) / no content
  alt AI returned search terms
    App->>Enhanced: performEnhancedSearch(parsed terms)
    Enhanced-->>App: rankedResults
  else AI failed or no content
    App->>Basic: performEnhancedBasicSearch(original query)
    Basic-->>App: basicResults
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

In burrows of code I nibbled through, 🐇
Filters bloom and AI whispers true,
If the mind of the model fades away,
A fallback hums to save the day,
I hop, I cheer — the search is new! 🎉

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The pull request title in Chinese translates to 'fix: AI search not triggered/no interactive prompt when there are no search results'. However, this is only partially related to the changeset. The changes address AI search triggering and displaying results when filters are active, but the title's phrasing about 'no interactive prompt' is vague and doesn't clearly convey the main improvements to search filter handling and AI service integration. Consider using a clearer English title that explicitly describes the main fix, such as 'fix: Trigger AI search and preserve filtered results state' or provide more context in English for international teams.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Hermes Agent added 2 commits May 17, 2026 19:31
…ummary reset during search

- Extract hasActiveSearchFilters as utility function with sortBy/sortOrder checks
  (defaults: stars/desc). Fixes sorting being ignored when no other filters active.
- Only reset showAISummary on category change, not during search/filter updates.
  Prevents AI analysis display from being incorrectly turned off during AI search.
…thReranking

Addresses CodeRabbit docstring coverage warning (50% -> meets threshold).
@AmintaCCCP AmintaCCCP merged commit 7672bf4 into AmintaCCCP:main May 17, 2026
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