Feature: Ollama Web Search Integration — API Key Free Search#210
Merged
Conversation
- Add 'ollama' as a new SearchProvider type in wiki-store.ts - Add ollamaUrl field to SearchApiConfig and SearchProviderOverride - Update SearchProviderConfigs to include 'ollama' - Implement ollamaSearch() function in web-search.ts using GET /api/experimental/web_search endpoint - Add ollama as first provider in web-search-section.tsx UI - Add i18n translations for ollamaHint in en.json and zh.json Users can now do web search without API keys by using their local Ollama instance's built-in web search capabilities.
- research-panel.tsx: Check resolved config, allow 'ollama' as valid provider - review-view.tsx: Same fix for deep research validation - web-search.ts: Improve error message to mention other providers - web-search.test.ts: Add tests for Ollama search and auth error Fixes the 'Web Search not configured' popup when Ollama is selected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds Ollama as a new web search provider for Deep Research, enabling users to perform web searches without requiring external API keys (Tavily, SerpApi). Users simply need a local Ollama instance running with a web-search-capable model.
Motivation
Currently, llm_wiki's Deep Research feature requires users to configure a paid API key from Tavily or SerpApi to perform web searches. This creates a barrier for users who:
By leveraging Ollama's built-in
/api/experimental/web_searchendpoint, users can get started with web search immediately if they already use Ollama as their LLM provider.Changes
Type System (
src/stores/wiki-store.ts)"ollama"to theSearchProviderunion typeollamaUrl?: stringtoSearchApiConfiginterfaceollamaUrl?: stringtoSearchProviderOverrideinterfaceSearchProviderConfigsto include"ollama"in the record typeSearch Implementation (
src/lib/web-search.ts)ollamaSearch(query, ollamaUrl, maxResults)— calls Ollama's/api/experimental/web_searchendpointhasConfiguredSearchProvider()— utility to check if any valid search provider is configured, now includes Ollama in the checkresolveSearchConfig()— properly resolves ollama-specific URL configuration with sensible defaultswebSearch()switch — addedcase "ollama"to route searches to the new implementationgetHttpFetch()) for consistent error handling across all providersollama signinauthentication)UI Changes (
src/components/settings/sections/web-search-section.tsx)http://localhost:11434)isLocal: trueflag to distinguish local providers from cloud providers in the UIInternationalization (
src/i18n/en.json,src/i18n/zh.json)ollamaHinttranslation key explaining that:How It Works
http://localhost:11434(matching the Ollama LLM setting)webSearch()which routes toollamaSearch()ollamaSearch()POSTs to{ollamaUrl}/api/experimental/web_searchwith{ query, max_results }results: [{ title, url, content }]WebSearchResult[]formatRequirements
ollama signinin terminalAPI Reference
Ollama Web Search Endpoint:
Testing
Added new test cases in
src/lib/web-search.test.ts:calls Ollama web search and normalizes results— verifies correct API call and response parsingsurfaces Ollama auth errors— verifies 401 handling with actionable messageScreenshots
The new UI shows Ollama as the first (recommended) option:
Comparison with Existing Providers
Migration Notes
None — this is purely additive. Existing Tavily/SerpApi/SearXNG configurations continue to work unchanged.
Future Enhancements (Out of Scope)
webFetchintegration for fetching full page content