修复4.6.9问题 (#976)

* Fixbranch (#43)

* move components to web package (#37)

* move components

* fix

* openapi config

* fix team share bug

---------

Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
Co-authored-by: archer <545436317@qq.com>

* fix: http variable and ai base url

* remove log

---------

Co-authored-by: yst <77910600+yu-and-liu@users.noreply.github.com>
Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
This commit is contained in:
Archer
2024-03-11 20:12:55 +08:00
committed by GitHub
parent 64492b8b33
commit 753b164ea2
3 changed files with 17 additions and 17 deletions

View File

@@ -2,9 +2,6 @@ import type { UserModelSchema } from '@fastgpt/global/support/user/type';
import OpenAI from '@fastgpt/global/core/ai';
export const openaiBaseUrl = process.env.OPENAI_BASE_URL || 'https://api.openai.com/v1';
export const baseUrl = global?.systemEnv?.oneapiUrl || process.env.ONEAPI_URL || openaiBaseUrl;
export const systemAIChatKey = global?.systemEnv?.chatApiKey || process.env.CHAT_API_KEY || '';
export const getAIApi = (props?: {
userKey?: UserModelSchema['openaiAccount'];
@@ -12,9 +9,13 @@ export const getAIApi = (props?: {
}) => {
const { userKey, timeout } = props || {};
const baseUrl =
userKey?.baseUrl || global?.systemEnv?.oneapiUrl || process.env.ONEAPI_URL || openaiBaseUrl;
const apiKey = userKey?.key || global?.systemEnv?.chatApiKey || process.env.CHAT_API_KEY || '';
return new OpenAI({
apiKey: userKey?.key || systemAIChatKey,
baseURL: userKey?.baseUrl || baseUrl,
baseURL: baseUrl,
apiKey,
httpAgent: global.httpsAgent,
timeout,
maxRetries: 2