Skip to content

fix(embedding): treat the built-in local backend as available - #56

Merged
mrsibe merged 1 commit into
mainfrom
fix/embedding-availability-gate
Sep 24, 2026
Merged

mrsibe merged 1 commit into
mainfrom
fix/embedding-availability-gate

Conversation

@mrsibe

@mrsibe mrsibe commented Sep 24, 2026

Copy link
Copy Markdown
Owner

What does this PR do?

Makes the Knowledge Base panel treat the built-in local embedding backend as configured, instead of showing "Please configure a default embedding model in settings first" and disabling Add Source.

Why?

SourcePanel computed hasEmbeddingModel from connections.embedding:

const connections = await window.api.connections.getAll()
setHasEmbeddingModel(Boolean(connections.embedding))

Selecting the built-in local backend clears that connection (that is the point of the local mode), so the check was always false for the default configuration. The result:

  • the "configure a default embedding model" empty state was shown,
  • Add Source was disabled,
  • file / URL / paste / note import were blocked by alerts.

Since #54, embedding is infrastructure: EmbeddingService.resolveBackend() falls back to the built-in local model when no remote connection exists, and ensureReady() downloads the weights on first RAG use. Availability therefore has to come from the real backend, not from the presence of a connection.

Related issue

No open issue; reported from manual testing. Related to #54.

What changed?

  • SourcePanel now reads window.api.embedding.getStatus() and sets hasEmbeddingModel when activeBackend === 'local' or a remote connection is configured.
  • Refreshes on connections.onChanged (local ↔ custom switch) and on embedding.onDownloadProgress (install state changes).

How was this tested?

Verified with Electron CDP against npm run dev, with no embedding connection configured (i.e. built-in local backend active):

  • Before: Knowledge Base / Please configure a default embedding model in settings first, and Add Source was disabled=true.
  • After: the empty state is gone and Add Source is disabled=false, so documents can be added and the local model downloads on first use.

Also checked:

  • npm run typecheck:web passes.
  • npm test passes (49/49).
  • npx prettier --check src/renderer/src/components/notebook/SourcePanel.tsx passes.

Screenshots / recordings

Not captured (text/state change only).

Checklist

  • I have reviewed my own changes.
  • npm run typecheck passes.
  • npm run build passes.
  • I have tested the affected user workflow.
  • I have not included unrelated changes.
  • I have updated documentation when necessary.

Desktop / build changes

  • Not applicable

SourcePanel decided whether the notebook could take documents by
checking connections.embedding. Selecting the built-in local backend
removes that connection, so the panel claimed embedding was not
configured, disabled Add Source and blocked file/URL/paste/note import.

Embedding is infrastructure now: EmbeddingService falls back to the
built-in local model when no remote connection exists and downloads it
on first RAG use. Read the real backend state from embedding:get-status
instead and refresh it on connection and download changes.
@github-actions github-actions Bot added the bug Something isn't working label Sep 24, 2026
@mrsibe
mrsibe merged commit 214b4fe into main Sep 24, 2026
1 check passed
@mrsibe
mrsibe deleted the fix/embedding-availability-gate branch September 24, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant