fix strange error where env variables are not read but somehow cashed. fixed by renaming the .env variable.
addind auto-detect of tts language
This commit is contained in:
22
web/.env
Normal file
22
web/.env
Normal file
@ -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/
|
@ -61,6 +61,11 @@
|
||||
onclick="copyToClipboard('transcription')">
|
||||
Copy
|
||||
</button>
|
||||
<button id="clearButton"
|
||||
class="absolute top-0 right-20 px-2 py-1 text-sm font-medium text-gray-700 bg-gray-200 hover:bg-gray-300 rounded-br-lg focus:outline-none"
|
||||
onclick="transcription.value = ''">
|
||||
Clear
|
||||
</button>
|
||||
</div>
|
||||
<canvas id="canvas" class="w-full"></canvas>
|
||||
<script>
|
||||
|
@ -1,6 +1,7 @@
|
||||
//load .env file
|
||||
if (require('dotenv')) {
|
||||
require('dotenv').config()
|
||||
const envFile =process.env.NODE_ENV === 'development' ? '.env.development' : '.env';
|
||||
require('dotenv').config({ path: envFile });
|
||||
}
|
||||
|
||||
console.log('Starting ws server on port ' + process.env.SERVER_PORT_WS);
|
||||
@ -9,8 +10,9 @@ const wss = new WebSocket.Server({ port: process.env.SERVER_PORT_WS });
|
||||
|
||||
|
||||
// console.log("ENV="+process.env)
|
||||
console.log("TTS_BACKEND_URL=" + process.env.TTS_BACKEND_URL)
|
||||
console.log("TTS_API_URL=" + process.env.TTS_API_URL)
|
||||
console.log("WS_URL=" + process.env.WS_URL)
|
||||
console.log("ENV_NAME=" + process.env.ENV_NAME)
|
||||
|
||||
let language = "en";
|
||||
let storeRecordings = false;
|
||||
@ -54,7 +56,7 @@ wss.on('connection', (ws, req) => {
|
||||
console.log('(queue ' + queueCounter + ') Received ' + (data.length / 1024 / 1024).toFixed(3) + ' MB audio from client. Crrent language: ' + language, 'task: ' + task);
|
||||
var request = require('request');
|
||||
|
||||
var endpoint = process.env.TTS_BACKEND_URL;
|
||||
var endpoint = process.env.TTS_API_URL;
|
||||
var formData = {
|
||||
task: task,
|
||||
language: language,
|
||||
@ -113,7 +115,7 @@ wss.on('connection', (ws, req) => {
|
||||
//record start time
|
||||
var start = new Date().getTime();
|
||||
queueCounter++;
|
||||
request.post({ url: process.env.TTS_BACKEND_URL, formData: formData }, function optionalCallback(err, httpResponse, body) {
|
||||
request.post({ url: process.env.TTS_API_URL, formData: formData }, function optionalCallback(err, httpResponse, body) {
|
||||
queueCounter--;
|
||||
if (err) {
|
||||
return console.error('upload failed:', err);
|
||||
@ -239,14 +241,14 @@ app.get('/test_ocr', (req, res) => {
|
||||
formData.language = req.query.language;
|
||||
}
|
||||
|
||||
var tts_url = process.env.TTS_BACKEND_URL;
|
||||
var tts_url = process.env.TTS_API_URL;
|
||||
if (req.query.ttsID != undefined) {
|
||||
//1: TTS_BACKEND_URL
|
||||
//2: TTS_BACKEND_URL2
|
||||
//3: TTS_BACKEND_URL3
|
||||
//4: TTS_BACKEND_URL4
|
||||
//1: TTS_API_URL
|
||||
//2: TTS_API_URL2
|
||||
//3: TTS_API_URL3
|
||||
//4: TTS_API_URL4
|
||||
if (req.query.ttsID !== '1') {
|
||||
tts_url = process.env['TTS_BACKEND_URL' + req.query.ttsID];
|
||||
tts_url = process.env['TTS_API_URL' + req.query.ttsID];
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user