mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2285] [Issue]: Lorebook vectorization makes one serial embedding request per entry instead of batching #1123
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#1123
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Romuromylus on GitHub (Jun 5, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2285
Originally assigned to: @Romuromylus on GitHub.
Summary
The refactor's "vectorize lorebook" action issues one embedding HTTP request per entry in a serial loop. The web app batched entry texts (50 per request), so a large lorebook now takes N round-trips instead of ceil(N/50).
Expected behavior
Vectorizing a lorebook should batch entry texts into embedding requests (as main does with BATCH_SIZE 50), keeping this user-triggered action fast and reducing rate-limit exposure.
Actual behavior
vectorize_lorebookloops per entry and awaits a single-string embedding POST each, so a 200-entry lorebook makes ~200 sequential API calls where the web app made ~4 batched calls. Embeddings are functionally equivalent, so this is a wall-clock/rate-limit regression, not a correctness break.Steps to reproduce
Impact area
Regression notes
Worked better on main. Main batches:
packages/server/src/routes/lorebooks.routes.ts:809-814uses BATCH_SIZE 50 andprovider.embed(batchTexts, model)sends the whole array (base-provider.ts:615); the warmup path also batches up to 32 (embeddings.ts:90,memory-recall.ts:73). The refactor'svectorize_lorebookloops per entry awaitingembed_text(src-tauri/src/commands/storage/prompts.rs:233-256) andembed_openai_compatiblePOSTs a single string (prompts.rs:537-547). No batch embedding path exists anywhere in src-tauri (incl. crates/llm); the sidecar path also loops per input (http_server.rs:1055).Environment
5ddb9840(compared against main @b4ab97f)Template check
Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:
@Romuromylus commented on GitHub (Jun 6, 2026):
Fixed by #2398, merged into
refactor.