Skip to content

Commit

Permalink
fix: lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
hyacinthus committed Mar 4, 2025
1 parent 3b6be9c commit 34bc1c3
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 20 deletions.
2 changes: 1 addition & 1 deletion app/entrypoints/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 8 additions & 8 deletions models/chat.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -53,15 +53,15 @@ class ChatMessageAttachment(TypedDict):
...,
description="Type of the attachment (link, image, or file)",
examples=["link"],
)
),
]
url: Annotated[
str,
Field(
...,
description="URL of the attachment",
examples=["https://example.com/image.jpg"],
)
),
]


Expand Down Expand Up @@ -92,7 +92,7 @@ class ChatMessageRequest(BaseModel):
description="Unique identifier for the chat thread",
examples=["chat-123"],
min_length=1,
)
),
]
user_id: Annotated[
str,
Expand All @@ -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,
Expand All @@ -110,15 +110,15 @@ class ChatMessageRequest(BaseModel):
description="Content of the message",
examples=["Hello, how can you help me today?"],
min_length=1,
)
),
]
attachments: Annotated[
Optional[List[ChatMessageAttachment]],
Field(
None,
description="Optional list of attachments (links, images, or files)",
examples=[[{"type": "link", "url": "https://example.com"}]],
)
),
]

model_config = ConfigDict(
Expand All @@ -135,7 +135,7 @@ class ChatMessageRequest(BaseModel):
}
],
}
}
},
)


Expand Down
8 changes: 5 additions & 3 deletions models/db.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion models/db_mig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)}")
Expand Down
12 changes: 11 additions & 1 deletion models/skill.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 6 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 34bc1c3

Please sign in to comment.