Skip to content

[codex] fix embedding server URL configuration#38

Merged
stepandel merged 2 commits into
masterfrom
codex/embedding-server-url-config
Jun 27, 2026
Merged

[codex] fix embedding server URL configuration#38
stepandel merged 2 commits into
masterfrom
codex/embedding-server-url-config

Conversation

@stepandel

@stepandel stepandel commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #37 by making custom embedding server URLs configurable wherever users choose client-side embedding functions.

What changed

  • Added shared embedding function helpers for URL-backed providers, URL validation, labels, placeholders, and IPC override construction.
  • Added Server URL / URL inputs for HuggingFace Server and Ollama in both the document embedding override popover and the create/copy collection form.
  • Preserved provider URL metadata when copying collections and compared effective URL config when deciding whether embeddings must be regenerated.
  • Changed the collection dimension control into read-only informational text because Chroma infers/enforces dimensions from generated embeddings.
  • Added IPC contract coverage to ensure embedding function URL and account fields are preserved.

Root cause

The Electron service and IPC contract already accepted embeddingFunction.url, and HuggingFace Server requires it, but the renderer only submitted the static embedding preset value. For HuggingFace Server that preset URL was empty, and there was no UI to enter a custom URL.

Validation

  • pnpm typecheck
  • pnpm lint
  • pnpm test
  • pnpm check
  • pnpm test:smoke

Note: smoke build logs still include existing Sentry invalid-token upload warnings, but the build and Playwright smoke test completed successfully.

Summary by CodeRabbit

  • New Features

    • Added support for embedding-function URL overrides when creating or copying collections.
    • Collection setup now shows the selected embedding dimension as read-only and can handle different embedding sizes.
    • Added a new seeded test collection with larger-dimension fixture data.
  • Bug Fixes

    • Improved validation for embedding-function URLs, with clearer errors and disabled actions when the URL is invalid.
    • Copying or saving collections now preserves the configured embedding-function URL where applicable.
  • Documentation

    • Expanded seed-data docs to explain what local test database commands insert.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7e96efe6-4da6-4ed1-ab9e-75926ba5f63e

📥 Commits

Reviewing files that changed from the base of the PR and between f115329 and da373d4.

📒 Files selected for processing (7)
  • scripts/README.md
  • scripts/seed-test-db.mjs
  • src/components/collections/CollectionConfigView.tsx
  • src/components/documents/EmbeddingFunctionSelector.tsx
  • src/constants/embedding-functions.ts
  • src/context/DraftCollectionContext.tsx
  • tests/unit/ipc-contract.test.ts

📝 Walkthrough

Walkthrough

Adds URL-based embedding-function configuration across collection drafting, copying, document selection, IPC parsing, and seed fixtures, with validation helpers and updated README notes for mixed-dimension test data.

Changes

Embedding Function URL Support

Layer / File(s) Summary
URL helpers and parsing contract
src/constants/embedding-functions.ts, tests/unit/ipc-contract.test.ts
Adds URL capability checks, URL labels/placeholders, URL validation, override construction, and IPC parsing tests that preserve embedding-function URL and account fields.
Draft collection flow
src/context/DraftCollectionContext.tsx
Stores embeddingFunctionUrl in draft state, initializes and copies it from source collections, validates it on save, and builds create params from URL-based overrides.
Collection config URL UI
src/components/collections/CollectionConfigView.tsx
Reads and validates the draft URL, renders the URL input and dimension display, updates regeneration checks, and passes URL overrides through copy/create actions.
Embedding selector URL override
src/components/documents/EmbeddingFunctionSelector.tsx
Tracks a custom URL for URL-based embedding functions, validates it, and saves overrides through the selector popover.
Seed fixtures and docs
scripts/seed-test-db.mjs, scripts/README.md
Adds explicit collection dimensions, a huggingface_384d seed collection, and README notes describing the seeded collections and dimensions.

Sequence Diagram(s)

sequenceDiagram
  participant EmbeddingFunctionSelector
  participant validateEmbeddingFunctionUrl
  participant buildEmbeddingFunctionOverride
  EmbeddingFunctionSelector->>validateEmbeddingFunctionUrl: validate customUrl
  validateEmbeddingFunctionUrl-->>EmbeddingFunctionSelector: error text or null
  EmbeddingFunctionSelector->>buildEmbeddingFunctionOverride: build override with url
  buildEmbeddingFunctionOverride-->>EmbeddingFunctionSelector: EmbeddingFunctionOverride
  EmbeddingFunctionSelector->>EmbeddingFunctionSelector: onSave with override
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 I hopped through URLs, bright and new,
With 8D carrots and 384D too.
I sniffed the server, found the right string,
Then stamped my override with a bunny hop swing. 🐇

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/embedding-server-url-config

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@stepandel
stepandel marked this pull request as ready for review June 27, 2026 00:07
@stepandel
stepandel merged commit 61fd07e into master Jun 27, 2026
2 checks passed
@stepandel
stepandel deleted the codex/embedding-server-url-config branch June 27, 2026 00:07
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.

[Bug]: Custom Server URL not configurable

1 participant