From 11de0b27d28a721feb961b491a1b71841c487bba Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Mon, 10 Jun 2024 12:45:23 +0300 Subject: [PATCH] fix strange error where env variables are not read but somehow cashed. fixed by renaming the .env variable. addind auto-detect of tts language --- .env | 2 +- .env.demo | 8 ++++---- .env.development | 6 ++++++ .env.production | 2 +- .vscode/launch.json | 17 ++++++++++++++++- .vscode/tasks.json | 28 +++++++++++++++------------- docker-compose.yml | 2 +- package-lock.json | 11 +++++++---- package.json | 2 +- web/.env | 22 ++++++++++++++++++++++ web/client.html | 5 +++++ web/server.js | 22 ++++++++++++---------- 12 files changed, 91 insertions(+), 36 deletions(-) create mode 100644 .env.development create mode 100644 web/.env diff --git a/.env b/.env index cab7084..62d0e53 100644 --- a/.env +++ b/.env @@ -4,7 +4,7 @@ TTS_BACKEND_URL=https://api.tts.d-popov.com/ #TTS_BACKEND_URL=http://localhost:9001/asr #gpu 9002-cpu TTS_BACKEND_URL2=http://localhost:9002/asr TTS_BACKEND_URL3=http://192.168.0.10:9008/asr #gpu -TTS_BACKEND_URL4=http://192.168.0.10:9009/asr #cpu 9008-gpu +#! TTS_BACKEND_URL4=http://192.168.0.10:9009/asr #cpu 9008-gpu WS_URL=ws://localhost:8081 SERVER_PORT_WS=8081 SERVER_PORT_HTTP=3005 diff --git a/.env.demo b/.env.demo index 19023d3..33a5178 100644 --- a/.env.demo +++ b/.env.demo @@ -1,6 +1,6 @@ -TTS_BACKEND_URL=http://192.168.0.10:9008/asr -WS_URL=ws://192.168.0.10:9008:8081 -SERVER_PORT_WS=8081 -SERVER_PORT_HTTP=8080 \ No newline at end of file +# TTS_BACKEND_URL=http://192.168.0.10:9008/asr +# WS_URL=ws://192.168.0.10:9008 +# SERVER_PORT_WS=8081 +# SERVER_PORT_HTTP=8080 \ No newline at end of file diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..392ad57 --- /dev/null +++ b/.env.development @@ -0,0 +1,6 @@ + +ENV_NAME=development +TTS_API_URL=https://api.tts.d-popov.com/asr +WS_URL=ws://localhost:8081 +SERVER_PORT_WS=8081 +SERVER_PORT_HTTP=8080 diff --git a/.env.production b/.env.production index f3f5ef2..decab52 100644 --- a/.env.production +++ b/.env.production @@ -2,7 +2,7 @@ TTS_BACKEND_URL=http://localhost:9001/asr #gpu 9002-cpu TTS_BACKEND_URL2=http://localhost:9002/asr TTS_BACKEND_URL3=http://192.168.0.10:9008/asr #gpu -TTS_BACKEND_URL4=http://192.168.0.10:9009/asr #cpu 9008-gpu +#! TTS_BACKEND_URL4=http://192.168.0.10:9009/asr #cpu 9008-gpu WS_URL=ws://localhost:8081 SERVER_PORT_WS=8081 SERVER_PORT_HTTP=8080 diff --git a/.vscode/launch.json b/.vscode/launch.json index 2f20d3e..a4ddc9f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -30,11 +30,26 @@ "name": "node: Launch server.js", "type": "node", "request": "launch", - "program": "conda activate node && node web/server.js", + "program": "conda activate node && ${workspaceFolder}/web/server.js", + "console": "integratedTerminal", "skipFiles": [ "/**" ] }, + { + "name": "conda task: Launch server.js", + "type": "node", + "request": "launch", + "program": "${workspaceFolder}/web/server.js", + // "preLaunchTask": "conda-activate", + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen", + "env": { + "CONDA_ENV": "node", //? + //set env to dev + "NODE_ENV": "development" + } + }, { "name": "Python Debugger: Python File", "type": "debugpy", diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 6a0c2a1..e3c705c 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -86,17 +86,19 @@ "panel": "new" }, }, - { - "label": "conda-activate", - "type": "shell", - "command": "source ~/miniconda3/etc/profile.d/conda.sh && conda activate py && echo 'Activated Conda Environment (py)!'", - "problemMatcher": [], - "options": { - "shell": { - "executable": "/bin/bash", - "args": ["-c"] - } - } - } - ] + { + "label": "conda-activate", + "type": "shell", + "command": "source ~/miniconda3/etc/profile.d/conda.sh && conda activate ${input:condaEnv} && echo 'Activated Conda Environment (${input:condaEnv})!'", + "problemMatcher": [], + } + ], + "inputs": [ + { + "id": "condaEnv", + "type": "promptString", + "description": "Enter the Conda environment name", + "default": "py" + } + ] } \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 31c1a7e..f173c20 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,7 +9,7 @@ services: dockerfile: ./Dockerfile environment: NODE_ENV: production - TTS_BACKEND_URL: http://192.168.0.10:9009/asr + # TTS_BACKEND_URL: http://192.168.0.10:9009/asr WS_URL: ws://192.168.0.10:28081 SERVER_PORT_WS: 8081 SERVER_PORT_HTTP: 8080 diff --git a/package-lock.json b/package-lock.json index 572fe31..dc62bf8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "dependencies": { "body-parser": "^1.20.2", - "dotenv": "^16.0.3", + "dotenv": "^16.4.5", "express": "^4.18.2", "git": "^0.1.5", "node-persist": "^3.1.3", @@ -246,11 +246,14 @@ } }, "node_modules/dotenv": { - "version": "16.0.3", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", - "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==", + "version": "16.4.5", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", + "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", "engines": { "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" } }, "node_modules/ecc-jsbn": { diff --git a/package.json b/package.json index e86a2c5..4a57dac 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ }, "dependencies": { "body-parser": "^1.20.2", - "dotenv": "^16.0.3", + "dotenv": "^16.4.5", "express": "^4.18.2", "git": "^0.1.5", "node-persist": "^3.1.3", diff --git a/web/.env b/web/.env new file mode 100644 index 0000000..e1b2c90 --- /dev/null +++ b/web/.env @@ -0,0 +1,22 @@ + +TTS_BACKEND_URL=https://api.tts.d-popov.com/ +WS_URL=ws://localhost:8081 +SERVER_PORT_WS=8081 +SERVER_PORT_HTTP=3005 + +# aider +AIDER_MODEL= +AIDER_4=false +#AIDER_35TURBO= + +# OPENAI_API_KEY=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 +# OPENAI_API_BASE=https://api.deepseek.com/v1 +# OPENAI_API_KEY=sk-99df7736351f4536bd72cd64a416318a +# AIDER_MODEL=deepseek-coder #deepseek-coder, deepseek-chat + + +GROQ_API_KEY=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 +aider --model groq/llama3-70b-8192 + +# List models available from Groq +aider --models groq/ \ No newline at end of file diff --git a/web/client.html b/web/client.html index 466c6bd..90ac450 100644 --- a/web/client.html +++ b/web/client.html @@ -61,6 +61,11 @@ onclick="copyToClipboard('transcription')"> Copy +