mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-22 21:28:12 +02:00
fix(chunks): set position on remaining chunk insert paths
document_converters, the github size-fallback chunker, revert_service restores, and the kb-persistence middleware now write explicit positions (the middleware read path also orders by position).
This commit is contained in:
parent
7d55aaf2c1
commit
5a71769dba
4 changed files with 43 additions and 12 deletions
|
|
@ -188,8 +188,10 @@ async def create_document_chunks(content: str) -> list[Chunk]:
|
|||
chunk_texts = [c.text for c in config.chunker_instance.chunk(content)]
|
||||
chunk_embeddings = await asyncio.to_thread(embed_texts, chunk_texts)
|
||||
return [
|
||||
Chunk(content=text, embedding=emb)
|
||||
for text, emb in zip(chunk_texts, chunk_embeddings, strict=False)
|
||||
Chunk(content=text, embedding=emb, position=i)
|
||||
for i, (text, emb) in enumerate(
|
||||
zip(chunk_texts, chunk_embeddings, strict=False)
|
||||
)
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue