Skip to content

Custom header for custom Endpoint and HF /embed endpoint#504

Open
Patrick-DE wants to merge 85 commits into
nashsu:mainfrom
Patrick-DE:main
Open

Custom header for custom Endpoint and HF /embed endpoint#504
Patrick-DE wants to merge 85 commits into
nashsu:mainfrom
Patrick-DE:main

Conversation

@Patrick-DE

Copy link
Copy Markdown

Hi,

I just added two features so support my usage.
If you like the additions you can merge my pull request.

Changes:

  • added support for custom headers in custom LLM endpoints (385fd41)
  • added support for Hugging Face TEI /embed endpoints (cc85b01)

Copilot AI review requested due to automatic review settings June 29, 2026 12:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 the custom provider.
  • Add TEI /embed request/response handling in fetchEmbedding.
  • Factor header text parsing/formatting into a shared http-headers utility 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.

Comment thread src/components/settings/sections/llm-provider-section.tsx Outdated
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 thread src/lib/http-headers.ts
Comment on lines +1 to +7
export const RESERVED_HEADER_NAMES = new Set([
"authorization",
"content-type",
"host",
"content-length",
"x-goog-api-key",
])
Comment thread src/lib/embedding.ts
Comment on lines +251 to +253
function isTeiEmbeddingConfig(cfg: EmbeddingConfig): boolean {
return cfg.endpoint.replace(/\/+$/, "").toLowerCase().endsWith("/embed")
}
Comment thread src/lib/embedding.ts
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 thread src/lib/llm-providers.ts
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) => {
Patrick-DE and others added 25 commits June 29, 2026 14:59
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.
nashsu and others added 30 commits July 15, 2026 17:34
…existing-entity

fix(lint): drop missing-page findings for pages that already exist
…ode-fence

fix: strip code fences around generated frontmatter
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.

5 participants