mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 08:20:14 +01:00
🔊 fix: Missing Proxy config in TTS and STT Services (#10852)
* Fix TTS STT proxy * Add STT proxy env var * Add TTS proxy env var * chore: import order * chore: import order --------- Co-authored-by: Danny Avila <danacordially@gmail.com>
This commit is contained in:
parent
a07cc11cd6
commit
b4892d81d3
2 changed files with 13 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ const FormData = require('form-data');
|
||||||
const { Readable } = require('stream');
|
const { Readable } = require('stream');
|
||||||
const { logger } = require('@librechat/data-schemas');
|
const { logger } = require('@librechat/data-schemas');
|
||||||
const { genAzureEndpoint } = require('@librechat/api');
|
const { genAzureEndpoint } = require('@librechat/api');
|
||||||
|
const { HttpsProxyAgent } = require('https-proxy-agent');
|
||||||
const { extractEnvVariable, STTProviders } = require('librechat-data-provider');
|
const { extractEnvVariable, STTProviders } = require('librechat-data-provider');
|
||||||
const { getAppConfig } = require('~/server/services/Config');
|
const { getAppConfig } = require('~/server/services/Config');
|
||||||
|
|
||||||
|
|
@ -266,8 +267,14 @@ class STTService {
|
||||||
language,
|
language,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const options = { headers };
|
||||||
|
|
||||||
|
if (process.env.PROXY) {
|
||||||
|
options.httpsAgent = new HttpsProxyAgent(process.env.PROXY);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await axios.post(url, data, { headers });
|
const response = await axios.post(url, data, options);
|
||||||
|
|
||||||
if (response.status !== 200) {
|
if (response.status !== 200) {
|
||||||
throw new Error('Invalid response from the STT API');
|
throw new Error('Invalid response from the STT API');
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
const axios = require('axios');
|
const axios = require('axios');
|
||||||
const { logger } = require('@librechat/data-schemas');
|
const { logger } = require('@librechat/data-schemas');
|
||||||
const { genAzureEndpoint } = require('@librechat/api');
|
const { genAzureEndpoint } = require('@librechat/api');
|
||||||
|
const { HttpsProxyAgent } = require('https-proxy-agent');
|
||||||
const { extractEnvVariable, TTSProviders } = require('librechat-data-provider');
|
const { extractEnvVariable, TTSProviders } = require('librechat-data-provider');
|
||||||
const { getRandomVoiceId, createChunkProcessor, splitTextIntoChunks } = require('./streamAudio');
|
const { getRandomVoiceId, createChunkProcessor, splitTextIntoChunks } = require('./streamAudio');
|
||||||
const { getAppConfig } = require('~/server/services/Config');
|
const { getAppConfig } = require('~/server/services/Config');
|
||||||
|
|
@ -266,6 +267,10 @@ class TTSService {
|
||||||
|
|
||||||
const options = { headers, responseType: stream ? 'stream' : 'arraybuffer' };
|
const options = { headers, responseType: stream ? 'stream' : 'arraybuffer' };
|
||||||
|
|
||||||
|
if (process.env.PROXY) {
|
||||||
|
options.httpsAgent = new HttpsProxyAgent(process.env.PROXY);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return await axios.post(url, data, options);
|
return await axios.post(url, data, options);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue