Chat History and multi model
This commit is contained in:
parent
a9ffb48b4b
commit
44f391ef1e
13 changed files with 1072 additions and 839 deletions
9
app.py
9
app.py
|
|
@ -1,13 +1,13 @@
|
|||
from starlette.applications import Starlette
|
||||
from starlette.routing import Route
|
||||
from controllers import create_chat, post_message, stream_response
|
||||
from controllers import create_chat, post_message, chat_stream, history
|
||||
from starlette.middleware import Middleware
|
||||
from starlette.middleware.cors import CORSMiddleware
|
||||
|
||||
middleware = [
|
||||
Middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=["*"], # change to ["http://localhost:3000"] etc. in prod
|
||||
allow_origins=["*"],
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
|
|
@ -16,8 +16,9 @@ middleware = [
|
|||
|
||||
routes = [
|
||||
Route("/chats", create_chat, methods=["POST"]),
|
||||
Route("/chats/{chat_id:str}", history, methods=["GET"]),
|
||||
Route("/chats/{chat_id:str}/messages", post_message, methods=["POST"]),
|
||||
Route("/chats/{chat_id:str}/stream", stream_response, methods=["GET"]),
|
||||
Route("/chats/{chat_id:str}/stream", chat_stream, methods=["GET"]),
|
||||
]
|
||||
|
||||
|
||||
|
|
@ -26,4 +27,4 @@ application = Starlette(debug=True, routes=routes, middleware=middleware)
|
|||
# ----------------- Run -----------------
|
||||
if __name__ == "__main__":
|
||||
import uvicorn
|
||||
uvicorn.run(application, host="0.0.0.0", port=8000)
|
||||
uvicorn.run("app:application", host="0.0.0.0", port=8000, reload=True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue