From 29bc38cc1a91936fd5dc2751c3fb5183df8823ac Mon Sep 17 00:00:00 2001 From: DHRUMIL PATEL Date: Thu, 29 Aug 2024 20:19:57 -0400 Subject: [PATCH] Backend --- README.md | 33 +++++++++++++++++++++++++++++++++ client/.env.example | 1 + client/.env.production | 1 - client/.gitignore | 3 ++- server/.env.example | 34 ++++++++++++++++++++++++++++++++++ server/.gitignore | 2 +- server/agents/tools.py | 2 +- server/app.py | 10 +++++++--- server/requirements.txt | Bin 1708 -> 4824 bytes 9 files changed, 79 insertions(+), 7 deletions(-) create mode 100644 client/.env.example delete mode 100644 client/.env.production create mode 100644 server/.env.example diff --git a/README.md b/README.md index 3bf97c8c..9e50e621 100644 --- a/README.md +++ b/README.md @@ -45,3 +45,36 @@ npm run build ``` npm run preview ``` + +## Install FFmpeg and Add FFmpeg to System PATH + +### Download and Extract FFmpeg Properly + +1. **Download FFmpeg Again:** + - Go to the [FFmpeg download page](https://ffmpeg.org/download.html). + - Click on the link for Windows builds provided by Gyan or BtbN (these are popular and reliable sources). This will redirect you to their respective pages where you can download the build. + - Choose a static build (which includes all necessary files in a single package) and download the zip file. + +2. **Extract the FFmpeg Zip File:** + - Once downloaded, right-click on the zip file and choose 'Extract All...' or use any preferred extraction tool like 7-Zip or WinRAR. + - Choose a location where you want to extract the files. You can extract them directly to `C:\FFmpeg` to keep things organized. + +3. **Verify the Contents:** + - Navigate to the folder where you extracted the files. + - You should see a `bin` folder inside this directory. Inside `bin`, there will be at least three files: `ffmpeg.exe`, `ffplay.exe`, and `ffprobe.exe`. + +### Add FFmpeg to System PATH + +If you've successfully located the `bin` folder now: + +1. **Edit the PATH Environment Variable:** + - Press `Windows key + R`, type `sysdm.cpl`, and press Enter. + - Go to the 'Advanced' tab and click on 'Environment Variables'. + - Under 'System Variables', scroll down to find the 'Path' variable and click on 'Edit'. + - Click 'New' and add the full path to the `bin` folder, e.g., `C:\FFmpeg\bin`. + - Click 'OK' to save your changes and close all remaining windows by clicking 'OK'. + +2. **Verify FFmpeg Installation:** + - Open a new command prompt or PowerShell window (make sure to open it after updating the PATH). + - Type `ffmpeg -version` and press Enter. This command should now return the version of FFmpeg, confirming it's installed correctly and recognized by the system. + diff --git a/client/.env.example b/client/.env.example new file mode 100644 index 00000000..3452b5c8 --- /dev/null +++ b/client/.env.example @@ -0,0 +1 @@ +VITE_API_URL= \ No newline at end of file diff --git a/client/.env.production b/client/.env.production deleted file mode 100644 index 78a72c85..00000000 --- a/client/.env.production +++ /dev/null @@ -1 +0,0 @@ -VITE_API_URL=https://earlent.thankfulpebble-55902899.westus2.azurecontainerapps.io/api \ No newline at end of file diff --git a/client/.gitignore b/client/.gitignore index bb91fe4d..477b991a 100644 --- a/client/.gitignore +++ b/client/.gitignore @@ -22,4 +22,5 @@ dist-ssr *.njsproj *.sln *.sw? -.env \ No newline at end of file +.env +.env.production \ No newline at end of file diff --git a/server/.env.example b/server/.env.example new file mode 100644 index 00000000..d69d13ce --- /dev/null +++ b/server/.env.example @@ -0,0 +1,34 @@ +DB_CONNECTION_STRING="mongodb+srv://cosmicworksadmin:@XXXXXXXX-mongo.mongocluster.cosmos.azure.com/?tls=true&authMechanism=SCRAM-SHA-256&retrywrites=false&maxIdleTimeMS=120000" +AOAI_ENDPOINT = "https://XXXXXXXX-openai.openai.azure.com/" +AOAI_KEY = + +EMBEDDINGS_DEPLOYMENT_NAME = "embeddings" +COMPLETIONS_DEPLOYMENT_NAME = "completions" + +FLASK_APP = app +FLASK_RUN_PORT=8000 +FLASK_RUN_HOST=127.0.0.1 +FLASK_ENV = dev + +TAVILY_API_KEY= "XXXXXXXX" +BING_SUBSCRIPTION_KEY= "XXXXXXXX" +BING_SEARCH_URL="https://api.bing.microsoft.com/v7.0/search" + +JWT_SECRET_KEY= "XXXXXXXX" +SPEECH_AI_KEY = "XXXXXXXX" +SERVICE_REGION = "eastus" + +AZURE_SUBSCRIPTION_ID="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" +AZURE_CLIENT_ID="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" +AZURE_TENANT_ID="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" +AZURE_MAPS_KEY="XXXXXXXX" + +VAPID_PRIVATE_KEY="XXXXXXXX-yLuaG3OM0M" +VAPID_PUBLIC_KEY= "XXXXXXXX" + +MAIL_USERNAME= +MAIL_PASSWORD= +MAIL_SERVER= +SECRET_KEY= +SECURITY_PASSWORD_SALT= +RESET_PASSWORD_BASE_URL= diff --git a/server/.gitignore b/server/.gitignore index bd662325..df8e3f24 100644 --- a/server/.gitignore +++ b/server/.gitignore @@ -3,6 +3,6 @@ __pycache__/ .ruff_cache venv/ .venv/ -.env* +.env mental_health_bot_env/ sandbox/ \ No newline at end of file diff --git a/server/agents/tools.py b/server/agents/tools.py index 5c361137..0f50cc30 100644 --- a/server/agents/tools.py +++ b/server/agents/tools.py @@ -3,7 +3,7 @@ # from azure.identity import DefaultAzureCredential # from azure.mgmt.maps import AzureMapsManagementClient -from langchain_community.tools import GooglePlacesTool +from langchain_google_community import GooglePlacesTool, GooglePlacesAPIWrapper from langchain_community.utilities import BingSearchAPIWrapper from langchain_community.tools.bing_search import BingSearchResults diff --git a/server/app.py b/server/app.py index 267700c6..696287f9 100644 --- a/server/app.py +++ b/server/app.py @@ -83,7 +83,11 @@ def setup_sub_db(app): app,mail, jwt = run_app() # DB pre-load -load_agent_facts_to_db() - -setup_sub_db(app) +if __name__ == '__main__': + HOST = os.getenv("FLASK_RUN_HOST") or "0.0.0.0" + PORT = os.getenv("FLASK_RUN_PORT") or 8000 + app, jwt, mail = run_app() + load_agent_facts_to_db() + setup_sub_db(app) + app.run(debug=True, host= HOST, port= PORT) diff --git a/server/requirements.txt b/server/requirements.txt index 1e68f5bbb1d6764ac21ff65e4f7d43506eea805f..b4af72d05b4844c79e7928fb41427f93dbe6ceb0 100644 GIT binary patch literal 4824 zcmaKwTW?!c5QX87=@hzuGj$PYnEHDU9U%o3o-$`m!I{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