updated app.py
Browse files
main.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
import os
|
2 |
import secrets
|
3 |
-
from
|
4 |
-
from fastapi import FastAPI, HTTPException, Request
|
5 |
from fastapi.staticfiles import StaticFiles
|
6 |
from sse_starlette.sse import EventSourceResponse
|
7 |
from openai import AsyncOpenAI
|
@@ -14,8 +13,6 @@ from script import script
|
|
14 |
from fasthtml_hf import setup_hf_backup
|
15 |
import bleach
|
16 |
|
17 |
-
load_dotenv()
|
18 |
-
|
19 |
def get_or_create_secret_key(file_path=".sesskey"):
|
20 |
if os.path.exists(file_path):
|
21 |
with open(file_path, "r") as f:
|
@@ -160,4 +157,4 @@ async def stream_response(request: Request, message: str, session_id: str = None
|
|
160 |
def reset_conversation(session_id: str):
|
161 |
if session_id in conversations:
|
162 |
del conversations[session_id]
|
163 |
-
return {"message": "Conversation reset."}
|
|
|
1 |
import os
|
2 |
import secrets
|
3 |
+
from fastapi import HTTPException, Request
|
|
|
4 |
from fastapi.staticfiles import StaticFiles
|
5 |
from sse_starlette.sse import EventSourceResponse
|
6 |
from openai import AsyncOpenAI
|
|
|
13 |
from fasthtml_hf import setup_hf_backup
|
14 |
import bleach
|
15 |
|
|
|
|
|
16 |
def get_or_create_secret_key(file_path=".sesskey"):
|
17 |
if os.path.exists(file_path):
|
18 |
with open(file_path, "r") as f:
|
|
|
157 |
def reset_conversation(session_id: str):
|
158 |
if session_id in conversations:
|
159 |
del conversations[session_id]
|
160 |
+
return {"message": "Conversation reset."}
|