mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-02 03:55:55 +00:00
fix: 4355f0fa78 ruff lint
This commit is contained in:
@@ -562,9 +562,7 @@ class RuntimeConnectionHandler(handler.Handler):
|
||||
limit = data.get('limit', 20)
|
||||
offset = data.get('offset', 0)
|
||||
try:
|
||||
items, total = await self.ap.rag_runtime_service.vector_list(
|
||||
collection_id, filters, limit, offset
|
||||
)
|
||||
items, total = await self.ap.rag_runtime_service.vector_list(collection_id, filters, limit, offset)
|
||||
return handler.ActionResponse.success(data={'items': items, 'total': total})
|
||||
except Exception as e:
|
||||
return _make_rag_error_response(e, 'VectorStoreError', collection_id=collection_id)
|
||||
|
||||
@@ -244,11 +244,13 @@ class ChromaVectorDatabase(VectorDatabase):
|
||||
|
||||
items = []
|
||||
for i, vid in enumerate(ids):
|
||||
items.append({
|
||||
items.append(
|
||||
{
|
||||
'id': vid,
|
||||
'document': documents[i] if i < len(documents) else None,
|
||||
'metadata': metadatas[i] if i < len(metadatas) else {},
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
# Chroma col.count() gives total in collection; filtered count not available
|
||||
total = await asyncio.to_thread(col.count) if not filter else -1
|
||||
|
||||
@@ -368,7 +368,8 @@ class MilvusVectorDatabase(VectorDatabase):
|
||||
|
||||
items = []
|
||||
for row in results:
|
||||
items.append({
|
||||
items.append(
|
||||
{
|
||||
'id': row.get('id', ''),
|
||||
'document': row.get('text'),
|
||||
'metadata': {
|
||||
@@ -376,7 +377,8 @@ class MilvusVectorDatabase(VectorDatabase):
|
||||
'file_id': row.get('file_id', ''),
|
||||
'uuid': row.get('chunk_uuid', ''),
|
||||
},
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
# Milvus query with count(*)
|
||||
total = -1
|
||||
|
||||
@@ -338,9 +338,7 @@ class PgVectorDatabase(VectorDatabase):
|
||||
)
|
||||
|
||||
count_stmt = (
|
||||
select(func.count())
|
||||
.select_from(PgVectorEntry)
|
||||
.filter(PgVectorEntry.collection == collection)
|
||||
select(func.count()).select_from(PgVectorEntry).filter(PgVectorEntry.collection == collection)
|
||||
)
|
||||
|
||||
if filter:
|
||||
@@ -356,7 +354,8 @@ class PgVectorDatabase(VectorDatabase):
|
||||
|
||||
items = []
|
||||
for row in rows:
|
||||
items.append({
|
||||
items.append(
|
||||
{
|
||||
'id': row.id,
|
||||
'document': row.text or '',
|
||||
'metadata': {
|
||||
@@ -364,7 +363,8 @@ class PgVectorDatabase(VectorDatabase):
|
||||
'file_id': row.file_id or '',
|
||||
'uuid': row.chunk_uuid or '',
|
||||
},
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
return items, total
|
||||
except Exception as e:
|
||||
|
||||
@@ -196,11 +196,13 @@ class QdrantVectorDatabase(VectorDatabase):
|
||||
break
|
||||
# Re-fetch payload if we skipped it during the skip phase
|
||||
payload = point.payload or {}
|
||||
collected.append({
|
||||
collected.append(
|
||||
{
|
||||
'id': str(point.id),
|
||||
'document': payload.get('text') or payload.get('document'),
|
||||
'metadata': payload,
|
||||
})
|
||||
}
|
||||
)
|
||||
remaining_to_collect -= 1
|
||||
|
||||
if next_cursor is None:
|
||||
|
||||
@@ -373,11 +373,13 @@ class SeekDBVectorDatabase(VectorDatabase):
|
||||
|
||||
items = []
|
||||
for i, vid in enumerate(ids):
|
||||
items.append({
|
||||
items.append(
|
||||
{
|
||||
'id': vid,
|
||||
'document': documents[i] if i < len(documents) else None,
|
||||
'metadata': metadatas[i] if i < len(metadatas) else {},
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
total = await asyncio.to_thread(coll.count) if not filter else -1
|
||||
return items, total
|
||||
|
||||
Reference in New Issue
Block a user