Skip to content

add bocha web search tool#3475

Open
weijintaocode wants to merge 3 commits intochatboxai:mainfrom
weijintaocode:addbocha
Open

add bocha web search tool#3475
weijintaocode wants to merge 3 commits intochatboxai:mainfrom
weijintaocode:addbocha

Conversation

@weijintaocode
Copy link
Copy Markdown

Description

Add Bocha as a new web search provider to enhance Chatbox's real-time search capabilities.

Screenshots

image image

Contributor Agreement

By submitting this Pull Request, I confirm that I have read and agree to the following terms:

  • I agree to contribute all code submitted in this PR to the open-source community edition licensed under GPLv3 and the proprietary official edition without compensation.
  • I grant the official edition development team the rights to freely use, modify, and distribute this code, including for commercial purposes.
  • I confirm that this code is my original work, or I have obtained the appropriate authorization from the copyright holder to submit this code under these terms.
  • I understand that the submitted code will be publicly released under the GPLv3 license, and may also be used in the proprietary official edition.

Please check the box below to confirm:

[x] I have read and agree with the above statement.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 4, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Important

Action Needed: IP Allowlist Update

If your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:

  • 136.113.208.247/32 (new)
  • 34.170.211.100/32
  • 35.222.179.152/32

Reviews will stop working after February 8, 2026 if the new IP is not added to your allowlist.


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.

Copy link
Copy Markdown
Contributor

@themez themez left a comment

Choose a reason for hiding this comment

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

Thanks for contributing! Here's some feedback:

Issues to fix

1. Typo: bochaAvaliablebochaAvailable
Multiple occurrences in web-search.tsx.

2. Duplicated API call logic
bocha.ts and checkBoCha in web-search.tsx both implement the same API request independently. Please reuse the BoChaSearch class for the check function, consistent with how checkTavily works.

3. Import path in bocha.ts

// ❌ bare src/ path may not resolve at build time
import { SearchResult } from 'src/shared/types'
// ✅ use the project's path alias
import { SearchResult } from '@shared/types'

4. Silent error swallowing in bocha.ts

} catch (error) {
    return { results: [] }
}

This silently returns empty results for all errors (bad API key, network failure, quota exceeded). Users won't know what went wrong. Please throw a meaningful error instead of swallowing it — refer to how other providers handle errors.

5. Formatting

  • index.ts line 11: import { BoChaSearch} — missing space before }
  • constructor has a trailing comma and unnecessary line break

6. Response parsing

const results = response.data?.webPages?.value || []

No validation on the response structure. If the API format changes, this silently returns empty results. Consider adding basic validation or at least logging unexpected responses.

Minor suggestions (non-blocking)

  • { query: query }{ query }
  • requestBody variable can be inlined
  • Consider adding a link to BoCha's API key page in the settings UI (like Tavily does)

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