mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-30 14:25:19 +01:00
fix(titleConvo): use openAIApiKey and azure config from route handler (#637)
* fix(titleConvo): use openAIApiKey from route handler, handle azure conditional from route * chore: remove comment
This commit is contained in:
parent
3e5c5a828d
commit
1b999108e4
3 changed files with 24 additions and 14 deletions
|
|
@ -2,7 +2,7 @@
|
|||
const _ = require('lodash');
|
||||
const { genAzureChatCompletion, getAzureCredentials } = require('../utils/');
|
||||
|
||||
const titleConvo = async ({ text, response, oaiApiKey }) => {
|
||||
const titleConvo = async ({ text, response, openAIApiKey, azure = false }) => {
|
||||
let title = 'New Chat';
|
||||
const ChatGPTClient = (await import('@waylaidwanderer/chatgpt-api')).default;
|
||||
|
||||
|
|
@ -19,7 +19,6 @@ const titleConvo = async ({ text, response, oaiApiKey }) => {
|
|||
||>Title:`
|
||||
};
|
||||
|
||||
const azure = process.env.AZURE_API_KEY ? true : false;
|
||||
const options = {
|
||||
azure,
|
||||
reverseProxyUrl: process.env.OPENAI_REVERSE_PROXY || null,
|
||||
|
|
@ -35,7 +34,9 @@ const titleConvo = async ({ text, response, oaiApiKey }) => {
|
|||
frequency_penalty: 0
|
||||
};
|
||||
|
||||
let apiKey = oaiApiKey || process.env.OPENAI_API_KEY;
|
||||
let apiKey = openAIApiKey ?? process.env.OPENAI_API_KEY;
|
||||
|
||||
console.log('title api key', apiKey);
|
||||
|
||||
if (azure) {
|
||||
apiKey = process.env.AZURE_API_KEY;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue