mirror of
https://github.com/SillyTavern/Extension-WebLLM.git
synced 2026-10-15 13:31:50 +00:00
[PR #9] [MERGED] fix embedding sort comparator in generateEmbedding #10
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
SillyTavern/Extension-WebLLM#10
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?
📋 Pull Request Information
Original PR: https://github.com/SillyTavern/Extension-WebLLM/pull/9
Author: @Reithan
Created: 4/13/2026
Status: ✅ Merged
Merged: 4/19/2026
Merged by: @Cohee1207
Base:
main← Head:fix-embedding-sort-comparator📝 Commits (1)
772ff0ffix embedding sort comparator in generateEmbedding📊 Changes
2 files changed (+2 additions, -2 deletions)
View changed files
📝
dist/index.js(+1 -1)📝
src/index.js(+1 -1)📄 Description
Summary
generateEmbeddingused.sort(x => x.index)as the comparator, which is a single-argument function. JavaScript'sArray.prototype.sortexpects a two-argument comparator(a, b) => number; passing a single-argument function causes V8 to usea.indexas the comparison value while ignoringb, producing non-deterministic (but in practice consistently wrong) reordering of the embeddings array for batches larger than 1..sort((a, b) => a.index - b.index).Test plan
batchSize = 5produces at least one full batch)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.