I forgor 💀

This commit is contained in:
nsde 2023-09-11 02:47:21 +02:00
parent c23bc7a5d3
commit 98b5614345
3 changed files with 3 additions and 7 deletions

View file

@ -9,7 +9,7 @@ import fastapi
from dotenv import load_dotenv from dotenv import load_dotenv
import streaming import responder
import moderation import moderation
from rich import print 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' media_type = 'text/event-stream' if payload.get('stream', False) else 'application/json'
return fastapi.responses.StreamingResponse( return fastapi.responses.StreamingResponse(
content=streaming.stream( content=responder.respond(
user=user, user=user,
path=path, path=path,
payload=payload, payload=payload,

View file

@ -39,7 +39,7 @@ DEMO_PAYLOAD = {
] ]
} }
async def stream( async def respond(
path: str='/v1/chat/completions', path: str='/v1/chat/completions',
user: dict=None, user: dict=None,
payload: dict=None, payload: dict=None,
@ -185,6 +185,3 @@ async def stream(
) )
print(f'[+] {path} -> {model or ""}') print(f'[+] {path} -> {model or ""}')
if __name__ == '__main__':
asyncio.run(stream())

View file

@ -1 +0,0 @@
## TODO: Create user type out of JSON object.