fixes icon and get parameter logic
This commit is contained in:
parent
16f084bfcd
commit
66eaa56429
7 changed files with 53 additions and 23 deletions
12
app.py
12
app.py
|
|
@ -1,8 +1,11 @@
|
|||
from starlette.applications import Starlette
|
||||
from starlette.routing import Route
|
||||
from starlette.routing import Route, Mount
|
||||
from starlette.staticfiles import StaticFiles
|
||||
from starlette.responses import FileResponse
|
||||
from controllers import create_chat, post_message, chat_stream, history, get_models
|
||||
from starlette.middleware import Middleware
|
||||
from starlette.middleware.cors import CORSMiddleware
|
||||
import os
|
||||
|
||||
middleware = [
|
||||
Middleware(
|
||||
|
|
@ -14,12 +17,19 @@ middleware = [
|
|||
)
|
||||
]
|
||||
|
||||
async def serve_frontend(request):
|
||||
"""Serve the frontend index.html file"""
|
||||
return FileResponse(os.path.join("frontend", "dist", "index.html"))
|
||||
|
||||
routes = [
|
||||
Route("/", serve_frontend, methods=["GET"]),
|
||||
Route("/models", get_models, methods=["GET"]),
|
||||
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", chat_stream, methods=["GET"]),
|
||||
Mount("/assets", StaticFiles(directory=os.path.join("frontend", "dist", "assets")), name="assets"),
|
||||
Mount("/icon", StaticFiles(directory=os.path.join("frontend", "dist", "icon")), name="icon"),
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue