[GH-ISSUE #7628] [Issue]: Lorebook Vectorize ignores the connection's Embedding Connection override #4223

Closed
opened 2026-10-21 06:12:43 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @ylli-selmani on GitHub (Oct 14, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7628

Originally assigned to: @ylli-selmani on GitHub.

Summary

The lorebook Vectorize button builds its embedding request from the picked connection's own base URL and API key and ignores that connection's Embedding Connection setting. Chat-time queries do honor that setting, so the stored vectors and the query vectors can come from different endpoints and end up in different embedding spaces.

Expected behavior

Vectorizing a lorebook with a connection resolves the embedding source the same way chat-time semantic matching does: the Embedding Connection override supplies the key and base URL (and its own embedding model, if it has one), so entries and queries share one embedding space.

Actual behavior

POST /lorebooks/:id/vectorize (packages/server/src/routes/lorebooks.routes.ts) calls createLLMProvider with the picked connection's embeddingBaseUrl or baseUrl and its apiKey, and uses the model the client sent. It never reads embeddingConnectionId. Chat-time matching goes through resolveMemoryRecallEmbeddingSource (packages/server/src/services/memory-recall-embedding.ts), which does read it.

Because the base URL is part of the embedding space id, the two can disagree. Entries whose space id doesn't match the query's are then skipped in semantic matching, without an error.

Also, the Vectorize picker lists only connections whose own embedding model field is filled in. A connection that gets its model only from its Embedding Connection (empty model field, Embedding Connection set) doesn't appear in the picker at all.

Steps to reproduce

Found by reading the code on staging (c599d1ef2), not reproduced in the app yet.

  1. Create connection A with an embedding model and an Embedding Connection pointing at connection B, which has a different base URL (for example a local KoboldCpp or llama.cpp embedding server).
  2. Use connection A to vectorize a lorebook with Vectors on.
  3. Chat with connection A: semantic matching embeds the query through B, while the entries were embedded through A's own endpoint.

Environment

  • Marinara Engine version: 2.5.0 (staging at c599d1ef2)
  • Install type: source
  • OS + version: Windows 11
  • Browser or app shell: not applicable (server code path)

Logs, screenshots, or video

None yet; this came from code reading while scoping #7626.

Additional context

Found while scoping #7626 (default embedding model). Routing the vectorize route through resolveMemoryRecallEmbeddingSource would fix both this and the picker gap, and would let the new default apply to vectorizing too.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @ylli-selmani on GitHub (Oct 14, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7628 Originally assigned to: @ylli-selmani on GitHub. ## Summary The lorebook **Vectorize** button builds its embedding request from the picked connection's own base URL and API key and ignores that connection's **Embedding Connection** setting. Chat-time queries do honor that setting, so the stored vectors and the query vectors can come from different endpoints and end up in different embedding spaces. ## Expected behavior Vectorizing a lorebook with a connection resolves the embedding source the same way chat-time semantic matching does: the **Embedding Connection** override supplies the key and base URL (and its own embedding model, if it has one), so entries and queries share one embedding space. ## Actual behavior `POST /lorebooks/:id/vectorize` (`packages/server/src/routes/lorebooks.routes.ts`) calls `createLLMProvider` with the picked connection's `embeddingBaseUrl` or `baseUrl` and its `apiKey`, and uses the model the client sent. It never reads `embeddingConnectionId`. Chat-time matching goes through `resolveMemoryRecallEmbeddingSource` (`packages/server/src/services/memory-recall-embedding.ts`), which does read it. Because the base URL is part of the embedding space id, the two can disagree. Entries whose space id doesn't match the query's are then skipped in semantic matching, without an error. Also, the Vectorize picker lists only connections whose own embedding model field is filled in. A connection that gets its model only from its Embedding Connection (empty model field, Embedding Connection set) doesn't appear in the picker at all. ## Steps to reproduce Found by reading the code on `staging` (`c599d1ef2`), not reproduced in the app yet. 1. Create connection A with an embedding model and an **Embedding Connection** pointing at connection B, which has a different base URL (for example a local KoboldCpp or llama.cpp embedding server). 2. Use connection A to vectorize a lorebook with Vectors on. 3. Chat with connection A: semantic matching embeds the query through B, while the entries were embedded through A's own endpoint. ## Environment - Marinara Engine version: 2.5.0 (`staging` at `c599d1ef2`) - Install type: source - OS + version: Windows 11 - Browser or app shell: not applicable (server code path) ## Logs, screenshots, or video None yet; this came from code reading while scoping #7626. ## Additional context Found while scoping #7626 (default embedding model). Routing the vectorize route through `resolveMemoryRecallEmbeddingSource` would fix both this and the picker gap, and would let the new default apply to vectorizing too. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 06:12:43 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4223
No description provided.