mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-08-27 20:40:13 +03:00
feat(agent): initialize checkpointer before chat session retrieval
Add initialization check for `_checkpointer_conn` in `AgentService` to ensure the checkpointer database connection exists before attempting to retrieve chat sessions. This prevents potential null reference errors when the checkpointer hasn't been initialized yet during agent operations.
This commit is contained in:
parent
03ab9cdf6c
commit
48e2793719
@ -11,7 +11,7 @@ import json
|
||||
import logging
|
||||
import os
|
||||
from datetime import datetime
|
||||
from typing import AsyncGenerator, Dict, Any, Optional
|
||||
from typing import AsyncGenerator, Dict, Any, Optional, List
|
||||
from uuid import uuid4
|
||||
|
||||
import aiosqlite
|
||||
@ -177,6 +177,10 @@ class AgentService:
|
||||
mode,
|
||||
)
|
||||
|
||||
# Ensure checkpointer is initialized
|
||||
if not self._checkpointer_conn:
|
||||
await self._get_checkpointer()
|
||||
|
||||
# Get or create chat session
|
||||
repo = ChatSessionsRepository(self._checkpointer_conn)
|
||||
session = await repo.get_session_by_thread(session_id)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user