mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-27 13:48:51 +01:00
🏞️ feat: Modifiable OpenAI Image Gen Model Environment Variable (#11082)
This commit is contained in:
parent
6ffb176056
commit
b7ea340769
3 changed files with 167 additions and 2 deletions
|
|
@ -78,6 +78,8 @@ function createOpenAIImageTools(fields = {}) {
|
|||
let apiKey = fields.IMAGE_GEN_OAI_API_KEY ?? getApiKey();
|
||||
const closureConfig = { apiKey };
|
||||
|
||||
const imageModel = process.env.IMAGE_GEN_OAI_MODEL || 'gpt-image-1';
|
||||
|
||||
let baseURL = 'https://api.openai.com/v1/';
|
||||
if (!override && process.env.IMAGE_GEN_OAI_BASEURL) {
|
||||
baseURL = extractBaseURL(process.env.IMAGE_GEN_OAI_BASEURL);
|
||||
|
|
@ -157,7 +159,7 @@ function createOpenAIImageTools(fields = {}) {
|
|||
|
||||
resp = await openai.images.generate(
|
||||
{
|
||||
model: 'gpt-image-1',
|
||||
model: imageModel,
|
||||
prompt: replaceUnwantedChars(prompt),
|
||||
n: Math.min(Math.max(1, n), 10),
|
||||
background,
|
||||
|
|
@ -239,7 +241,7 @@ Error Message: ${error.message}`);
|
|||
}
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('model', 'gpt-image-1');
|
||||
formData.append('model', imageModel);
|
||||
formData.append('prompt', replaceUnwantedChars(prompt));
|
||||
// TODO: `mask` support
|
||||
// TODO: more than 1 image support
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue