mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-09-29 23:30:11 +03:00
fix(typing): resolve mypy errors in agent.gns3_copilot.chat_sessions_repository
This commit is contained in:
parent
07560b0026
commit
9882eba088
@ -125,7 +125,7 @@ class ChatSessionsRepository:
|
||||
project_id: str,
|
||||
title: str = "New Conversation",
|
||||
copilot_mode: Optional[str] = None,
|
||||
) -> ChatSession:
|
||||
) -> Optional[ChatSession]:
|
||||
"""
|
||||
Create a new chat session.
|
||||
|
||||
@ -158,6 +158,8 @@ class ChatSessionsRepository:
|
||||
session_id = cursor.lastrowid
|
||||
log.info("Created chat session: id=%s, thread_id=%s, copilot_mode=%s", session_id, thread_id, copilot_mode)
|
||||
|
||||
if session_id is None:
|
||||
return None
|
||||
return await self.get_session_by_id(session_id)
|
||||
|
||||
async def get_session_by_id(self, session_id: int) -> Optional[ChatSession]:
|
||||
@ -214,7 +216,7 @@ class ChatSessionsRepository:
|
||||
List of ChatSession
|
||||
"""
|
||||
query = "SELECT * FROM chat_sessions"
|
||||
params = []
|
||||
params: List[Any] = []
|
||||
|
||||
conditions = []
|
||||
if user_id:
|
||||
@ -268,7 +270,7 @@ class ChatSessionsRepository:
|
||||
Updated ChatSession or None
|
||||
"""
|
||||
updates = []
|
||||
params = []
|
||||
params: List[Any] = []
|
||||
|
||||
now = datetime.utcnow().isoformat()
|
||||
|
||||
|
||||
@ -296,7 +296,6 @@ enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
|
||||
module = [
|
||||
"gns3server.agent.gns3_copilot.agent.context_manager", # 5
|
||||
"gns3server.agent.gns3_copilot.agent.model_factory", # 4
|
||||
"gns3server.agent.gns3_copilot.chat_sessions_repository", # 8
|
||||
"gns3server.agent.gns3_copilot.gns3_client.api_handlers", # 10
|
||||
"gns3server.agent.gns3_copilot.gns3_client.connector_factory", # 1
|
||||
"gns3server.agent.gns3_copilot.gns3_client.project_inventory", # 2
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user