# dsh-web-search-chain
#
# dsh bundle patch: make Tavily the first web-search backend and fall back to
# the DeepSeek Search API. The plugin registers `tavily` and `tavily-first`
# with ctx.web; `tavily-first` runs the configured `order` chain.
#
# Keys are resolved per search from $DSH_HOME/.credentials.yaml:
#   DSH_WEB_SEARCH_TAVILY_API_KEY
#   DSH_WEB_SEARCH_DEEPSEEK_API_KEY
#
# Override any value in $DSH_HOME/profiles/<profile>/cordis.patch.yml.

- id: web
  config:
    searchProvider: tavily-first
    fetchProvider: http

# Keep the two built-in DeepSeek search providers on the same key reference,
# so the Web search settings page reads and writes the key the fallback uses.
- id: web-search-deepseek
  config:
    apiKeyEnv: DSH_WEB_SEARCH_DEEPSEEK_API_KEY

- id: web-deepseek-api
  config:
    apiKeyEnv: DSH_WEB_SEARCH_DEEPSEEK_API_KEY

- insert:
    - id: web-search-chain
      name: dsh-web-search-chain
      config:
        order:
          - tavily
          - deepseek
        fallbackOnEmpty: true
        snippetMaxChars: 800
        tavily:
          baseURL: https://tavily.fuhuagoogle.top/api/tavily
          apiKeyEnv: DSH_WEB_SEARCH_TAVILY_API_KEY
          searchDepth: basic
          includeAnswer: false
          maxResults: 8
          timeoutMs: 25000
        deepseek:
          baseURL: https://api.deepseek.com/v1/tools
          apiKeyEnv: DSH_WEB_SEARCH_DEEPSEEK_API_KEY
          count: 10
          timeoutMs: 25000
