feat: filter chat conversations by type; add get_weather and get_rss_items LLM tools
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -46,12 +46,13 @@ async def get_conversation(
|
||||
|
||||
|
||||
async def list_conversations(
|
||||
user_id: int, limit: int = 50, offset: int = 0
|
||||
user_id: int, limit: int = 50, offset: int = 0, conv_type: str = "chat"
|
||||
) -> tuple[list[dict], int]:
|
||||
async with async_session() as session:
|
||||
total = await session.scalar(
|
||||
select(func.count(Conversation.id)).where(
|
||||
Conversation.user_id == user_id
|
||||
Conversation.user_id == user_id,
|
||||
Conversation.conversation_type == conv_type,
|
||||
)
|
||||
) or 0
|
||||
|
||||
@@ -65,7 +66,7 @@ async def list_conversations(
|
||||
|
||||
result = await session.execute(
|
||||
select(Conversation, msg_count.label("message_count"))
|
||||
.where(Conversation.user_id == user_id)
|
||||
.where(Conversation.user_id == user_id, Conversation.conversation_type == conv_type)
|
||||
.order_by(Conversation.updated_at.desc())
|
||||
.limit(limit)
|
||||
.offset(offset)
|
||||
@@ -78,6 +79,8 @@ async def list_conversations(
|
||||
"id": conv.id,
|
||||
"title": conv.title,
|
||||
"model": conv.model,
|
||||
"conversation_type": conv.conversation_type,
|
||||
"briefing_date": conv.briefing_date.isoformat() if conv.briefing_date else None,
|
||||
"message_count": row[1],
|
||||
"created_at": conv.created_at.isoformat(),
|
||||
"updated_at": conv.updated_at.isoformat(),
|
||||
|
||||
Reference in New Issue
Block a user