fix(similarity): address code review - column-only queries, configurable batch size, WCAG touch targets
- Use column-only query in embeddings overview to reduce memory for 100K+ files - Add embedding_backfill_batch_size config setting (default 50) - Fix WCAG touch target on backfill button (min-height/min-width 44px) - Add inline comment explaining 3 chars/token truncation estimate - Import settings in compute_embedding task for configurable batch size Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
@@ -59,8 +59,8 @@ def generate_embedding(text: str, model: str | None = None) -> list[float]:
|
||||
model = settings.embedding_model
|
||||
|
||||
# Truncate to stay within the model's context window.
|
||||
# Use a conservative estimate of ~3 characters per token so that the
|
||||
# resulting text fits comfortably within ``embedding_max_tokens``.
|
||||
# Conservative 3 chars/token estimate (actual ratio varies by language;
|
||||
# English averages ~4 chars/token but 3 gives a safety margin).
|
||||
max_chars = settings.embedding_max_tokens * 3
|
||||
if len(text) > max_chars:
|
||||
logger.debug(
|
||||
|
||||
Reference in New Issue
Block a user