slide-narrator 0.2.2__py3-none-any.whl → 0.3.0__py3-none-any.whl
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.
Potentially problematic release.
This version of slide-narrator might be problematic. Click here for more details.
- narrator/__init__.py +1 -1
- narrator/database/storage_backend.py +7 -5
- narrator/database/thread_store.py +7 -5
- {slide_narrator-0.2.2.dist-info → slide_narrator-0.3.0.dist-info}/METADATA +1 -1
- {slide_narrator-0.2.2.dist-info → slide_narrator-0.3.0.dist-info}/RECORD +8 -8
- {slide_narrator-0.2.2.dist-info → slide_narrator-0.3.0.dist-info}/WHEEL +0 -0
- {slide_narrator-0.2.2.dist-info → slide_narrator-0.3.0.dist-info}/entry_points.txt +0 -0
- {slide_narrator-0.2.2.dist-info → slide_narrator-0.3.0.dist-info}/licenses/LICENSE +0 -0
narrator/__init__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Storage backend implementations for ThreadStore."""
|
|
2
2
|
from abc import ABC, abstractmethod
|
|
3
|
-
from typing import List, Optional, Dict, Any
|
|
3
|
+
from typing import List, Optional, Dict, Any, Union
|
|
4
4
|
from datetime import datetime, UTC
|
|
5
5
|
import json
|
|
6
6
|
import os
|
|
@@ -64,7 +64,7 @@ class StorageBackend(ABC):
|
|
|
64
64
|
pass
|
|
65
65
|
|
|
66
66
|
@abstractmethod
|
|
67
|
-
async def find_messages_by_attribute(self, path: str, value: Any) -> List[MessageRecord]:
|
|
67
|
+
async def find_messages_by_attribute(self, path: str, value: Any) -> Union[List[Message], List[MessageRecord]]:
|
|
68
68
|
"""
|
|
69
69
|
Find messages that have a specific attribute at a given JSON path.
|
|
70
70
|
Uses efficient SQL JSON path queries for PostgreSQL and falls back to
|
|
@@ -138,7 +138,7 @@ class MemoryBackend(StorageBackend):
|
|
|
138
138
|
threads = threads[:limit]
|
|
139
139
|
return threads
|
|
140
140
|
|
|
141
|
-
async def find_messages_by_attribute(self, path: str, value: Any) -> List[
|
|
141
|
+
async def find_messages_by_attribute(self, path: str, value: Any) -> List[Message]:
|
|
142
142
|
"""
|
|
143
143
|
Check if any messages exist with a specific attribute at a given JSON path.
|
|
144
144
|
|
|
@@ -147,7 +147,7 @@ class MemoryBackend(StorageBackend):
|
|
|
147
147
|
value: The value to search for
|
|
148
148
|
|
|
149
149
|
Returns:
|
|
150
|
-
|
|
150
|
+
List of messages matching the criteria (possibly empty)
|
|
151
151
|
"""
|
|
152
152
|
# Traverse all threads and messages
|
|
153
153
|
for thread in self._threads.values():
|
|
@@ -166,7 +166,9 @@ class MemoryBackend(StorageBackend):
|
|
|
166
166
|
|
|
167
167
|
# Check if we found a match
|
|
168
168
|
if current == value:
|
|
169
|
-
|
|
169
|
+
# For MemoryBackend, we can't return MessageRecord objects
|
|
170
|
+
# Return a list containing the message data that the ThreadStore can handle
|
|
171
|
+
return [message]
|
|
170
172
|
|
|
171
173
|
return []
|
|
172
174
|
|
|
@@ -190,13 +190,15 @@ class ThreadStore:
|
|
|
190
190
|
"""
|
|
191
191
|
await self._ensure_initialized()
|
|
192
192
|
if hasattr(self._backend, 'find_messages_by_attribute'):
|
|
193
|
-
|
|
193
|
+
results = await self._backend.find_messages_by_attribute(path, value)
|
|
194
194
|
|
|
195
|
-
#
|
|
195
|
+
# Handle different return types from different backends
|
|
196
196
|
messages = []
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
197
|
+
for item in results:
|
|
198
|
+
if hasattr(item, 'model_dump'): # It's a Message object (from MemoryBackend)
|
|
199
|
+
messages.append(item)
|
|
200
|
+
elif hasattr(self._backend, '_create_message_from_record'): # It's a MessageRecord (from SQLBackend)
|
|
201
|
+
message = self._backend._create_message_from_record(item)
|
|
200
202
|
messages.append(message)
|
|
201
203
|
|
|
202
204
|
return messages
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: slide-narrator
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Thread and file storage components for conversational AI - the companion to Tyler AI framework
|
|
5
5
|
Project-URL: Homepage, https://github.com/adamwdraper/slide
|
|
6
6
|
Project-URL: Repository, https://github.com/adamwdraper/slide
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
narrator/__init__.py,sha256=
|
|
1
|
+
narrator/__init__.py,sha256=4nmJ9jvPYfcokkI4Ne76WA6CRAaKSiC0PzosSVX7Rhs,403
|
|
2
2
|
narrator/database/__init__.py,sha256=UngOnFqImCeJiMZlMasm72mC4-UnJDDvfu1MNQLkRA8,189
|
|
3
3
|
narrator/database/cli.py,sha256=Wi5kSXWFTkWBjZS1N9AuGEmTUrYjafUOTZUSO9cGfTM,1954
|
|
4
4
|
narrator/database/models.py,sha256=wsG_5GrPo41hAcojjZTZmSx6bijea-Skan-DwzHs8os,2607
|
|
5
|
-
narrator/database/storage_backend.py,sha256=
|
|
6
|
-
narrator/database/thread_store.py,sha256=
|
|
5
|
+
narrator/database/storage_backend.py,sha256=UeMgxW8h3ZNWORZNH_f-jZuHNjHpREBaOOAFPeEPlvA,25444
|
|
6
|
+
narrator/database/thread_store.py,sha256=vMIPDdwuSpTyPogEUmxGcILxM_r1wxoQBUOn8XJpdqM,11301
|
|
7
7
|
narrator/database/migrations/__init__.py,sha256=IqoSL8eCcbcOtn96u2_TTrNG0KN1Jn1yreDZEO4RsnM,173
|
|
8
8
|
narrator/models/__init__.py,sha256=J8Rsv2lmfGR5QmUjoAPEFTSQt5TGtyrBynnp17HdZnU,179
|
|
9
9
|
narrator/models/attachment.py,sha256=6fZnGla_Ahgc4Kro2bHBTWoF_Kr-mUBHzONizVH73oc,16129
|
|
@@ -13,8 +13,8 @@ narrator/storage/__init__.py,sha256=K4cxGITSQoQiw32QOWZsCBm11fwDTbsyzHGeAqcL6yY,
|
|
|
13
13
|
narrator/storage/file_store.py,sha256=-k1ZYzKYioCMiP7KfWuuCmCeAzDqRv38ndpuM75yISY,20047
|
|
14
14
|
narrator/utils/__init__.py,sha256=P4BhLvBJbBvb8qha2tTZPlYbjCRXth_K97f4vNc77UI,109
|
|
15
15
|
narrator/utils/logging.py,sha256=K9EWI7lP4CNQpPwggiqzMex7oF6oyL3wIVLik2iuXd4,1983
|
|
16
|
-
slide_narrator-0.
|
|
17
|
-
slide_narrator-0.
|
|
18
|
-
slide_narrator-0.
|
|
19
|
-
slide_narrator-0.
|
|
20
|
-
slide_narrator-0.
|
|
16
|
+
slide_narrator-0.3.0.dist-info/METADATA,sha256=G-E5PNy_NKWfT_Xrht5179aUIZTpuIXRzMbQMsMnals,15435
|
|
17
|
+
slide_narrator-0.3.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
18
|
+
slide_narrator-0.3.0.dist-info/entry_points.txt,sha256=EaFuawrdPNFByqzAb17gkkDyj4FgelJqmII6ioD-i_I,59
|
|
19
|
+
slide_narrator-0.3.0.dist-info/licenses/LICENSE,sha256=g6cGasroU9sqSOjThWg14w0BMlwZhgmOQQVTiu036ks,1068
|
|
20
|
+
slide_narrator-0.3.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|