Spaces:
Sleeping
Sleeping
Update chat_fast_api.py
Browse files- chat_fast_api.py +8 -0
chat_fast_api.py
CHANGED
|
@@ -6,6 +6,9 @@ import logging
|
|
| 6 |
#from dotenv import load_dotenv
|
| 7 |
#load_dotenv()
|
| 8 |
|
|
|
|
|
|
|
|
|
|
| 9 |
# Initialize the FastAPI app
|
| 10 |
app = FastAPI()
|
| 11 |
|
|
@@ -27,6 +30,11 @@ class ChatRequest(BaseModel):
|
|
| 27 |
message: str
|
| 28 |
history: list
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
# FastAPI chat endpoint
|
| 31 |
@app.post("/chat")
|
| 32 |
def chat(request: ChatRequest):
|
|
|
|
| 6 |
#from dotenv import load_dotenv
|
| 7 |
#load_dotenv()
|
| 8 |
|
| 9 |
+
logging.basicConfig(level=logging.INFO)
|
| 10 |
+
logger = logging.getLogger("uvicorn")
|
| 11 |
+
|
| 12 |
# Initialize the FastAPI app
|
| 13 |
app = FastAPI()
|
| 14 |
|
|
|
|
| 30 |
message: str
|
| 31 |
history: list
|
| 32 |
|
| 33 |
+
@app.get("/.")
|
| 34 |
+
def read_root():
|
| 35 |
+
return {"message": "FastAPI is running!"}
|
| 36 |
+
|
| 37 |
+
|
| 38 |
# FastAPI chat endpoint
|
| 39 |
@app.post("/chat")
|
| 40 |
def chat(request: ChatRequest):
|