diff --git a/api/handler.py b/api/handler.py index b0f852d..b829da6 100644 --- a/api/handler.py +++ b/api/handler.py @@ -9,7 +9,7 @@ import fastapi from dotenv import load_dotenv -import streaming +import responder import moderation from rich import print @@ -143,7 +143,7 @@ async def handle(incoming_request: fastapi.Request): media_type = 'text/event-stream' if payload.get('stream', False) else 'application/json' return fastapi.responses.StreamingResponse( - content=streaming.stream( + content=responder.respond( user=user, path=path, payload=payload, diff --git a/api/streaming.py b/api/responder.py similarity index 98% rename from api/streaming.py rename to api/responder.py index 117fea9..961c16f 100644 --- a/api/streaming.py +++ b/api/responder.py @@ -39,7 +39,7 @@ DEMO_PAYLOAD = { ] } -async def stream( +async def respond( path: str='/v1/chat/completions', user: dict=None, payload: dict=None, @@ -185,6 +185,3 @@ async def stream( ) print(f'[+] {path} -> {model or ""}') - -if __name__ == '__main__': - asyncio.run(stream()) diff --git a/api/types/user.py b/api/types/user.py deleted file mode 100644 index 339f360..0000000 --- a/api/types/user.py +++ /dev/null @@ -1 +0,0 @@ -## TODO: Create user type out of JSON object. \ No newline at end of file