mirror of
https://github.com/PlatypusPus/MushroomEmpire.git
synced 2026-02-07 22:18:59 +00:00
fix: cors
This commit is contained in:
@@ -4,6 +4,19 @@ from pypdf import PdfReader
|
|||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
|
||||||
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
|
|
||||||
|
app = FastAPI()
|
||||||
|
|
||||||
|
app.add_middleware(
|
||||||
|
CORSMiddleware,
|
||||||
|
allow_origins=["*"], # or specify ["http://localhost:3000"]
|
||||||
|
allow_credentials=True,
|
||||||
|
allow_methods=["*"],
|
||||||
|
allow_headers=["*"],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
client = chromadb.Client()
|
client = chromadb.Client()
|
||||||
collection = client.create_collection(name="docs")
|
collection = client.create_collection(name="docs")
|
||||||
|
|
||||||
@@ -20,7 +33,6 @@ for i, chunk in enumerate(chunks):
|
|||||||
)
|
)
|
||||||
print("Embeddings done!")
|
print("Embeddings done!")
|
||||||
|
|
||||||
app = FastAPI()
|
|
||||||
|
|
||||||
@app.post("/chat")
|
@app.post("/chat")
|
||||||
async def chat_bot(prompt: str):
|
async def chat_bot(prompt: str):
|
||||||
|
|||||||
Reference in New Issue
Block a user