feat: transparent openai responses api integration
This commit is contained in:
parent
e7407b86b3
commit
b28f175b61
7 changed files with 1674 additions and 86 deletions
|
|
@ -290,6 +290,8 @@ from api.management import router as management_router
|
|||
app.include_router(management_router)
|
||||
from api.openai import router as openai_router
|
||||
app.include_router(openai_router)
|
||||
from api.responses import router as responses_router
|
||||
app.include_router(responses_router)
|
||||
from api.ollama import router as ollama_router
|
||||
app.include_router(ollama_router)
|
||||
|
||||
|
|
@ -322,6 +324,13 @@ async def startup_event() -> None:
|
|||
db = TokenDatabase(config.db_path)
|
||||
await db.init_db()
|
||||
|
||||
# Reconcile Responses-API background tasks lost across a restart: their
|
||||
# in-memory asyncio task is gone but the DB row may still read queued /
|
||||
# in_progress, so mark those failed to give polling clients a terminal state.
|
||||
_orphaned = await db.fail_orphaned_responses()
|
||||
if _orphaned:
|
||||
print(f"[startup] Marked {_orphaned} orphaned background response(s) as failed.")
|
||||
|
||||
# Load existing token counts from database
|
||||
async for count_entry in db.load_token_counts():
|
||||
endpoint = count_entry['endpoint']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue