From 36ca40a335d3dc39e859cbed10d7495a3f19bfe9 Mon Sep 17 00:00:00 2001 From: "DESKTOP-RTLN3BA\\$punk" Date: Tue, 8 Oct 2024 02:08:11 -0700 Subject: [PATCH] Okay!!!!!!!! --- README.md | 1 + backend/.env.example | 3 +++ backend/server.py | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 061b2f8..f1860c3 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ Now lets setup the SurfSense BackEnd |ENV VARIABLE|Description | |--|--| | IS_LOCAL_SETUP | 'true' for Ollama mistral-nemo or 'false' from OpenAI gpt-4o-mini| +| UNSTRUCTURED_API_KEY | Your Unstructured IO API Key. Use any value if running a local instance or file upload support isn't needed.| | POSTGRES_DATABASE_URL | postgresql+psycopg2://user:pass@host:5432/database| | API_SECRET_KEY | Can be any Random String value. Make Sure to remember it for as you need to send it in user registration request to Backend for security purposes.| diff --git a/backend/.env.example b/backend/.env.example index d7e2a8f..503b248 100644 --- a/backend/.env.example +++ b/backend/.env.example @@ -1,6 +1,9 @@ #true if you wana run local setup with Ollama IS_LOCAL_SETUP = 'false' +#Your Unstructured IO API Key. Use any value if running a local instance or file upload support isn't needed. +UNSTRUCTURED_API_KEY = "" + #POSTGRES DB TO TRACK USERS POSTGRES_DATABASE_URL = "postgresql+psycopg2://postgres:postgres@localhost:5432/surfsense" diff --git a/backend/server.py b/backend/server.py index 2ab43e5..7d2ec57 100644 --- a/backend/server.py +++ b/backend/server.py @@ -36,6 +36,7 @@ ACCESS_TOKEN_EXPIRE_MINUTES = int(os.environ.get("ACCESS_TOKEN_EXPIRE_MINUTES")) ALGORITHM = os.environ.get("ALGORITHM") API_SECRET_KEY = os.environ.get("API_SECRET_KEY") SECRET_KEY = os.environ.get("SECRET_KEY") +UNSTRUCTURED_API_KEY = os.environ.get("UNSTRUCTURED_API_KEY") app = FastAPI() @@ -65,7 +66,7 @@ async def upload_files(files: list[UploadFile], token: str = Depends(oauth2_sche loader = UnstructuredLoader( file=file.file, - api_key="nWDzKHygqnQzbb1pBsxYnMoQ3nQBja", + api_key=UNSTRUCTURED_API_KEY, partition_via_api=True, chunking_strategy="basic", max_characters=90000,