Skip to content

feat(backend): wire interceptFetch into the chat pipeline (Phases 3-4 of #3384) #7339

Description

@thomasmaerz

Summary

This tracks the deferred Phases 3-4 from #3384 / PR #6814: wiring interceptFetch into the SSE chat pipeline and adding the dashboard toggle.

What exists already

Phase 1-2 (shipped in #6814, release/v3.8.47):

  • src/lib/db/interceptionRules.ts — DB CRUD for interception_rules (key_value namespace), with fields for both interceptSearch and interceptFetch
  • resolveInterceptSearch(provider, model) — fully implemented
  • prepareWebSearchFallbackBody() wired in chatCore.ts with the search override

The DB types already include: interceptFetch, fetchBackend, fetchProxyUrl at both provider and per-model level — so no schema changes are needed.

What's missing (Phases 3-4)

  1. resolveInterceptFetch(provider, model) — analogous to resolveInterceptSearch, returning boolean | undefined with the same provider to model precedence.

  2. Call site in the chat pipeline — when interceptFetch === true, route the provider-native web_fetch tool call through OmniRoute's /v1/web/fetch instead of letting it pass through to the provider. This mirrors how interceptSearch routes to /v1/search in webSearchFallback.ts.

  3. Dashboard UI toggle — a per-model / per-provider toggle in the dashboard settings UI (the PR description explicitly deferred this).

Implementation guidance

  • Follow the exact pattern of resolveInterceptSearch / webSearchFallback.ts — the search and fetch paths are structurally parallel.
  • /v1/web/fetch already exists (src/app/api/v1/web/fetch/route.ts, backed by open-sse/handlers/webFetch.ts), so the interceptor just needs to route to it.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    apibackendbacklogTracked for future work; not blockingenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions