diff --git a/app/entrypoints/web.py b/app/entrypoints/web.py index 0c62a76..f815d92 100644 --- a/app/entrypoints/web.py +++ b/app/entrypoints/web.py @@ -841,7 +841,7 @@ async def get_skill_history( select(ChatMessageTable) .where( ChatMessageTable.agent_id == aid, - ChatMessageTable.author_type == AuthorType.SKILL + ChatMessageTable.author_type == AuthorType.SKILL, ) .order_by(desc(ChatMessageTable.created_at)) .limit(50) diff --git a/models/chat.py b/models/chat.py index f494424..6b27dca 100644 --- a/models/chat.py +++ b/models/chat.py @@ -1,6 +1,6 @@ from datetime import datetime, timezone from enum import Enum -from typing import Annotated, List, NotRequired, Optional, TypedDict, Dict, Any +from typing import Annotated, List, NotRequired, Optional, TypedDict from epyxid import XID from pydantic import BaseModel, ConfigDict, Field @@ -53,7 +53,7 @@ class ChatMessageAttachment(TypedDict): ..., description="Type of the attachment (link, image, or file)", examples=["link"], - ) + ), ] url: Annotated[ str, @@ -61,7 +61,7 @@ class ChatMessageAttachment(TypedDict): ..., description="URL of the attachment", examples=["https://example.com/image.jpg"], - ) + ), ] @@ -92,7 +92,7 @@ class ChatMessageRequest(BaseModel): description="Unique identifier for the chat thread", examples=["chat-123"], min_length=1, - ) + ), ] user_id: Annotated[ str, @@ -101,7 +101,7 @@ class ChatMessageRequest(BaseModel): description="Unique identifier of the user sending the message", examples=["user-456"], min_length=1, - ) + ), ] message: Annotated[ str, @@ -110,7 +110,7 @@ class ChatMessageRequest(BaseModel): description="Content of the message", examples=["Hello, how can you help me today?"], min_length=1, - ) + ), ] attachments: Annotated[ Optional[List[ChatMessageAttachment]], @@ -118,7 +118,7 @@ class ChatMessageRequest(BaseModel): None, description="Optional list of attachments (links, images, or files)", examples=[[{"type": "link", "url": "https://example.com"}]], - ) + ), ] model_config = ConfigDict( @@ -135,7 +135,7 @@ class ChatMessageRequest(BaseModel): } ], } - } + }, ) diff --git a/models/db.py b/models/db.py index 195caba..be53de9 100644 --- a/models/db.py +++ b/models/db.py @@ -1,10 +1,10 @@ from contextlib import asynccontextmanager -from typing import AsyncGenerator, Annotated -from pydantic import Field +from typing import Annotated, AsyncGenerator from urllib.parse import quote_plus from langgraph.checkpoint.postgres.aio import AsyncPostgresSaver from psycopg_pool import AsyncConnectionPool +from pydantic import Field from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession, create_async_engine from models.db_mig import safe_migrate @@ -19,7 +19,9 @@ async def init_db( password: str, dbname: str, port: Annotated[str, Field(default="5432", description="Database port")], - auto_migrate: Annotated[bool, Field(default=True, description="Whether to run migrations automatically")], + auto_migrate: Annotated[ + bool, Field(default=True, description="Whether to run migrations automatically") + ], ) -> None: """Initialize the database and handle schema updates. diff --git a/models/db_mig.py b/models/db_mig.py index 646c184..b57f6ea 100644 --- a/models/db_mig.py +++ b/models/db_mig.py @@ -94,7 +94,7 @@ async def safe_migrate(engine) -> None: # We need a sync wrapper for the async update_table_schema async def update_table_wrapper(): await update_table_schema(conn, dialect, model_cls) - + await update_table_wrapper() except Exception as e: logger.error(f"Error updating database schema: {str(e)}") diff --git a/models/skill.py b/models/skill.py index 8dc9941..30fdb02 100644 --- a/models/skill.py +++ b/models/skill.py @@ -240,7 +240,17 @@ async def get(cls, thread_id: str, skill: str, key: str) -> Optional[dict]: return record.data if record else None @classmethod - async def clean_data(cls, agent_id: str, thread_id: Annotated[str, Field(default="", description="Optional ID of the thread. If provided, only cleans data for that thread.")]): + async def clean_data( + cls, + agent_id: str, + thread_id: Annotated[ + str, + Field( + default="", + description="Optional ID of the thread. If provided, only cleans data for that thread.", + ), + ], + ): """Clean all skill data for a thread or agent. Args: diff --git a/poetry.lock b/poetry.lock index bac696b..0473443 100644 --- a/poetry.lock +++ b/poetry.lock @@ -45,14 +45,14 @@ test = ["aresponses (>=2.1.6,<2.2.0)", "pycryptodomex (>=3.19.0,<3.20.0)", "pyte [[package]] name = "aiohappyeyeballs" -version = "2.4.6" +version = "2.4.8" description = "Happy Eyeballs for asyncio" optional = false python-versions = ">=3.9" groups = ["main"] files = [ - {file = "aiohappyeyeballs-2.4.6-py3-none-any.whl", hash = "sha256:147ec992cf873d74f5062644332c539fcd42956dc69453fe5204195e560517e1"}, - {file = "aiohappyeyeballs-2.4.6.tar.gz", hash = "sha256:9b05052f9042985d32ecbe4b59a77ae19c006a78f1344d7fdad69d28ded3d0b0"}, + {file = "aiohappyeyeballs-2.4.8-py3-none-any.whl", hash = "sha256:6cac4f5dd6e34a9644e69cf9021ef679e4394f54e58a183056d12009e42ea9e3"}, + {file = "aiohappyeyeballs-2.4.8.tar.gz", hash = "sha256:19728772cb12263077982d2f55453babd8bec6a052a926cd5c0c42796da8bf62"}, ] [[package]] @@ -578,14 +578,14 @@ files = [ [[package]] name = "botocore" -version = "1.37.4" +version = "1.37.5" description = "Low-level, data-driven core of boto 3." optional = false python-versions = ">=3.8" groups = ["main"] files = [ - {file = "botocore-1.37.4-py3-none-any.whl", hash = "sha256:89130998c82d53f875a42646b692da507c9871b580fd1aea0f861bf9da36e41a"}, - {file = "botocore-1.37.4.tar.gz", hash = "sha256:7e15cd487617440e9eac3144044b6a2bd833d7f3e2bed6a2865693cc11489cc3"}, + {file = "botocore-1.37.5-py3-none-any.whl", hash = "sha256:e5cfbb8026d5b4fadd9b3a18b61d238a41a8b8f620ab75873dc1467d456150d6"}, + {file = "botocore-1.37.5.tar.gz", hash = "sha256:f8f526d33ae74d242c577e0440b57b9ec7d53edd41db211155ec8087fe7a5a21"}, ] [package.dependencies]