Refactor API structure: move chat functionality to v1 router, implement dependency injection for OpenAI client, and set up application state management
Build and Push Agent API / build (push) Successful in 6s
Build and Push Agent API / build (push) Successful in 6s
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
from fastapi import Request
|
||||
from openai import OpenAI
|
||||
|
||||
|
||||
def get_llm_client(request: Request) -> OpenAI:
|
||||
"""FastAPI dependency – returns the singleton OpenAI client from app.state."""
|
||||
return request.app.state.llm_client
|
||||
Reference in New Issue
Block a user