refactor: extract runtime response guards into utils runtime module

This commit is contained in:
Xubin Ren
2026-04-02 13:54:40 +00:00
parent 714a4c7bb6
commit e4b335ce81
7 changed files with 449 additions and 44 deletions
+3 -1
View File
@@ -14,6 +14,8 @@ from typing import Any
from aiohttp import web
from loguru import logger
from nanobot.utils.runtime import EMPTY_FINAL_RESPONSE_MESSAGE
API_SESSION_KEY = "api:default"
API_CHAT_ID = "default"
@@ -98,7 +100,7 @@ async def handle_chat_completions(request: web.Request) -> web.Response:
logger.info("API request session_key={} content={}", session_key, user_content[:80])
_FALLBACK = "I've completed processing but have no response to give."
_FALLBACK = EMPTY_FINAL_RESPONSE_MESSAGE
try:
async with session_lock: