mirror of
https://github.com/NovaOSS/nova-api.git
synced 2024-11-25 16:43:58 +01:00
I forgor 💀
This commit is contained in:
parent
c23bc7a5d3
commit
98b5614345
|
@ -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,
|
||||||
|
|
|
@ -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())
|
|
|
@ -1 +0,0 @@
|
||||||
## TODO: Create user type out of JSON object.
|
|
Loading…
Reference in a new issue