openvector_dev 0.1.28__tar.gz → 0.1.32__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {openvector_dev-0.1.28 → openvector_dev-0.1.32}/PKG-INFO +1 -1
- {openvector_dev-0.1.28 → openvector_dev-0.1.32}/pyproject.toml +1 -1
- {openvector_dev-0.1.28 → openvector_dev-0.1.32}/src/lein_vector/api/facade.py +3 -1
- {openvector_dev-0.1.28 → openvector_dev-0.1.32}/src/lein_vector/qdrant_adapter.py +17 -10
- {openvector_dev-0.1.28 → openvector_dev-0.1.32}/README.md +0 -0
- {openvector_dev-0.1.28 → openvector_dev-0.1.32}/src/lein_vector/__init__.py +0 -0
- {openvector_dev-0.1.28 → openvector_dev-0.1.32}/src/lein_vector/api/__init__.py +0 -0
- {openvector_dev-0.1.28 → openvector_dev-0.1.32}/src/lein_vector/bases/__init__.py +0 -0
- {openvector_dev-0.1.28 → openvector_dev-0.1.32}/src/lein_vector/bases/embeding_provider_abc.py +0 -0
- {openvector_dev-0.1.28 → openvector_dev-0.1.32}/src/lein_vector/bases/memory_manager_abc.py +0 -0
- {openvector_dev-0.1.28 → openvector_dev-0.1.32}/src/lein_vector/memory_manager_qdrant.py +0 -0
- {openvector_dev-0.1.28 → openvector_dev-0.1.32}/src/lein_vector/memory_manager_ram.py +0 -0
- {openvector_dev-0.1.28 → openvector_dev-0.1.32}/src/lein_vector/redis_short_term.py +0 -0
- {openvector_dev-0.1.28 → openvector_dev-0.1.32}/src/lein_vector/schemas/__init__.py +0 -0
- {openvector_dev-0.1.28 → openvector_dev-0.1.32}/src/lein_vector/schemas/chunk.py +0 -0
- {openvector_dev-0.1.28 → openvector_dev-0.1.32}/src/lein_vector/sentence_transformer.py +0 -0
|
@@ -145,7 +145,7 @@ class Memory:
|
|
|
145
145
|
log.info(curr_no % (block_size * self.merge_n))
|
|
146
146
|
if curr_no % (block_size * self.merge_n) == 0:
|
|
147
147
|
try:
|
|
148
|
-
log.
|
|
148
|
+
log.info(f'Summary requested {bot}:{user_id}')
|
|
149
149
|
merged_text, used_ids = await self.long.merge_old_chunks(
|
|
150
150
|
user_id=user_id, bot=bot, chunk_type="type0", n=self.merge_n
|
|
151
151
|
)
|
|
@@ -299,6 +299,8 @@ class Memory:
|
|
|
299
299
|
|
|
300
300
|
await self.long.delete_all(user_id, bot)
|
|
301
301
|
|
|
302
|
+
await self.r.delete(f"msg_no:{bot}:{user_id}")
|
|
303
|
+
|
|
302
304
|
self._msg_no.pop((user_id, bot), None)
|
|
303
305
|
self._gift_fail.pop((user_id, bot), None)
|
|
304
306
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
from datetime import datetime
|
|
2
3
|
from typing import Any
|
|
3
4
|
from uuid import UUID
|
|
4
5
|
|
|
@@ -140,27 +141,33 @@ class QdrantAdapter:
|
|
|
140
141
|
chunk_type: str,
|
|
141
142
|
n: int = 5,
|
|
142
143
|
) -> list[ChunkPayload]:
|
|
144
|
+
"""Вернуть n самых старых чанков данного типа для (user_id, bot)."""
|
|
145
|
+
|
|
143
146
|
flt = Filter(
|
|
144
147
|
must=[
|
|
145
|
-
FieldCondition(key="user_id", match=MatchValue(value=user_id)),
|
|
148
|
+
FieldCondition(key="user_id", match=MatchValue(value=int(user_id))),
|
|
146
149
|
FieldCondition(key="bot", match=MatchValue(value=bot)),
|
|
147
150
|
FieldCondition(key="chunk_type", match=MatchValue(value=chunk_type)),
|
|
148
151
|
]
|
|
149
152
|
)
|
|
150
153
|
|
|
151
|
-
#
|
|
154
|
+
# вытягиваем все подходящие точки
|
|
152
155
|
points, _ = await self.client.scroll(
|
|
153
156
|
collection_name=self.collection,
|
|
154
157
|
scroll_filter=flt,
|
|
155
158
|
with_payload=True,
|
|
156
159
|
with_vectors=False,
|
|
157
|
-
limit=
|
|
158
|
-
)
|
|
159
|
-
|
|
160
|
-
# сортируем по времени создания
|
|
161
|
-
sorted_points = sorted(
|
|
162
|
-
(ChunkPayload(**p.payload) for p in points),
|
|
163
|
-
key=lambda p: p.created_at,
|
|
160
|
+
limit=2048,
|
|
164
161
|
)
|
|
165
162
|
|
|
166
|
-
|
|
163
|
+
def _ts(p):
|
|
164
|
+
ts = p.payload.get("created_at")
|
|
165
|
+
if isinstance(ts, (int, float)):
|
|
166
|
+
return ts
|
|
167
|
+
try:
|
|
168
|
+
return datetime.fromisoformat(ts).timestamp()
|
|
169
|
+
except Exception:
|
|
170
|
+
return 0
|
|
171
|
+
|
|
172
|
+
oldest = sorted(points, key=_ts)[:n]
|
|
173
|
+
return [ChunkPayload(**p.payload) for p in oldest]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{openvector_dev-0.1.28 → openvector_dev-0.1.32}/src/lein_vector/bases/embeding_provider_abc.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|