Custom header for custom Endpoint and HF /embed endpoint#504
Open
Patrick-DE wants to merge 85 commits into
Open
Custom header for custom Endpoint and HF /embed endpoint#504Patrick-DE wants to merge 85 commits into
Patrick-DE wants to merge 85 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds configurability for advanced gateway setups by letting users specify extra HTTP headers for custom LLM endpoints, and expands the embedding pipeline to understand Hugging Face TEI /embed endpoints.
Changes:
- Extend LLM config/presets to carry
customHeaders, and merge them into requests for thecustomprovider. - Add TEI
/embedrequest/response handling infetchEmbedding. - Factor header text parsing/formatting into a shared
http-headersutility and reuse it in settings UI.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/stores/wiki-store.ts | Adds customHeaders fields to config/override types for persistence and typing. |
| src/lib/llm-providers.ts | Merges customHeaders into outgoing headers for custom LLM endpoints (Anthropic + OpenAI-compatible modes). |
| src/lib/http-headers.ts | New shared helper to parse/render user-entered header text. |
| src/lib/embedding.ts | Adds TEI /embed detection + request/response shape handling. |
| src/components/settings/sections/llm-provider-section.tsx | Adds a textarea for custom headers on custom LLM presets. |
| src/components/settings/sections/embedding-section.tsx | Refactors embedding header textarea to use the shared helper. |
| src/components/settings/preset-resolver.ts | Wires customHeaders through resolveConfig() for custom presets. |
| src/components/settings/llm-presets.ts | Extends preset type to support customHeaders. |
| package-lock.json | Updates lockfile (includes changes beyond the two described features). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const [testState, setTestState] = useState<ProviderTestState>({ kind: "idle" }) | ||
| const hasConfig = !!apiKey || !!ov.baseUrl || !!ov.model || !!ov.azureApiVersion || !!ov.azureModelFamily | ||
| const [headersText, setHeadersText] = useState<string>(() => headersToText(ov.customHeaders ?? preset.customHeaders ?? {})) | ||
| const hasConfig = !!apiKey || !!ov.baseUrl || !!ov.model || !!ov.azureApiVersion || !!ov.azureModelFamily || !!ov.customHeaders |
Comment on lines
+1
to
+7
| export const RESERVED_HEADER_NAMES = new Set([ | ||
| "authorization", | ||
| "content-type", | ||
| "host", | ||
| "content-length", | ||
| "x-goog-api-key", | ||
| ]) |
Comment on lines
+251
to
+253
| function isTeiEmbeddingConfig(cfg: EmbeddingConfig): boolean { | ||
| return cfg.endpoint.replace(/\/+$/, "").toLowerCase().endsWith("/embed") | ||
| } |
Comment on lines
151
to
+157
| isGoogleNative | ||
| ? googleEmbeddingBody(cfg.model, current, cfg.outputDimensionality) | ||
| : isDoubaoMultimodal | ||
| ? doubaoMultimodalEmbeddingBody(cfg.model, current) | ||
| : { model: cfg.model, input: current }, | ||
| : isTei | ||
| ? { inputs: current } | ||
| : { model: cfg.model, input: current }, |
Comment on lines
934
to
939
| if (mode === "anthropic_messages") { | ||
| const url = buildAnthropicUrl(customEndpoint) | ||
| return { | ||
| url, | ||
| headers: buildAnthropicHeaders(apiKey, url), | ||
| headers: { ...buildAnthropicHeaders(apiKey, url), ...(config.customHeaders ?? {}) }, | ||
| buildBody: (messages, overrides) => { |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
The resolver path index was built from a single full-project scan with `includeHidden` off, so dot-prefixed folders (`.claude`, `.codex`) under `raw/sources` never entered the index. Any `sources:` entry backed by a file in such a folder — e.g. `.claude/projects/.../MEMORY.md` — resolved to null and rendered as a "Source not found" card in the frontmatter panel, even though the file existed on disk. Rescan `raw/sources` with `includeHidden` (best-effort) and merge it into the index, mirroring the existing dotfolder handling in the Raw Sources tree and chat file tools. Guard the index builder against duplicate paths so the overlapping scans don't inflate the `filesByName` buckets.
Add Czech (čeština) as a selectable AI output language. The language detector already returns "Czech" for auto-detected Czech text, but the value was missing from the OutputLanguage union and the settings dropdown, so users could not select it explicitly. - add "Czech" to the OutputLanguage union in wiki-store - add Čeština (Czech) option to OUTPUT_LANGUAGE_OPTIONS - add explicit language metadata (htmlLang "cs", latin script) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add an optional "local" parsing backend next to the existing MinerU
cloud API. A self-hosted MinerU service (e.g. mineru CLI wrapped in a
small FastAPI server) exposes /parse, /tasks/{id}, /results/{id} and
/health endpoints on http://127.0.0.1:8790; documents are parsed fully
offline and no API token is required.
- MineruConfig: new optional backend field ("cloud" | "local",
defaults to cloud so existing configs are unaffected)
- parseWithMineruResult routes to the local service when
backend === "local" (JSON base64 upload + status polling)
- testMineruConnection checks the local /health endpoint in local
mode instead of submitting a cloud task
- Settings UI: backend radio selector; token input is only shown for
the cloud backend, local mode shows an info notice instead
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Wiki pages occasionally carry an http(s) URL in their `sources:` frontmatter (e.g. an LLM-emitted web citation). The frontmatter panel resolved every source against raw/sources/ and flagged any non-file entry with a "Source not found" warning — but a URL is not a missing local file, so the amber warning was misleading. Add `resolveSourceReference()` that classifies a source as external (http/https via URL parsing), local, or missing, and render external sources as clickable cards opened through the system browser (tauri-plugin-opener) instead of not-found warnings. Non-http URL-like values (e.g. `javascript:`) stay classified as missing.
…existing-entity fix(lint): drop missing-page findings for pages that already exist
…ode-fence fix: strip code fences around generated frontmatter
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.
Hi,
I just added two features so support my usage.
If you like the additions you can merge my pull request.
Changes: