Skip to content

Commit

Permalink
fix: search
Browse files Browse the repository at this point in the history
  • Loading branch information
desaxce committed Dec 23, 2024
1 parent 8ae7f4b commit 698f000
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions backend/chainlit/data/chainlit_data_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ async def get_user(self, identifier: str) -> Optional[PersistedUser]:

return PersistedUser(
id=str(row.get("id")),
identifier=row.get("identifier"),
createdAt=row.get("createdAt").isoformat(),
identifier=str(row.get("identifier")),
createdAt=row.get("createdAt").isoformat(), # type: ignore
metadata=json.loads(row.get("metadata", "{}")),
)

Expand All @@ -104,8 +104,8 @@ async def create_user(self, user: User) -> Optional[PersistedUser]:

return PersistedUser(
id=str(row.get("id")),
identifier=row.get("identifier"),
createdAt=row.get("createdAt").isoformat(),
identifier=str(row.get("identifier")),
createdAt=row.get("createdAt").isoformat(), # type: ignore
metadata=json.loads(row.get("metadata", "{}")),
)

Expand Down Expand Up @@ -415,6 +415,11 @@ async def list_threads(
params = {}
param_count = 1

if filters.search:
query += f" AND t.name ILIKE ${param_count}"
params["name"] = f"%{filters.search}%"
param_count += 1

if filters.userId:
query += f' AND t."userId" = ${param_count}'
params["user_id"] = filters.userId
Expand Down
2 changes: 1 addition & 1 deletion backend/chainlit/data/storage_clients/gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from google.cloud import storage # type: ignore
from google.oauth2 import service_account

from chainlit import logger
from chainlit.data.storage_clients.base import BaseStorageClient
from chainlit.logger import logger


class GCSStorageClient(BaseStorageClient):
Expand Down

0 comments on commit 698f000

Please sign in to comment.