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:
2026-03-11 19:46:08 -04:00
parent ae3dff0952
commit 42b0d8c4ac
3 changed files with 67 additions and 4 deletions
+6 -3
View File
@@ -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(),