mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-24 22:03:54 +00:00
fix: base url
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import axios, { Method, InternalAxiosRequestConfig, AxiosResponse } from 'axios';
|
import axios, { Method, InternalAxiosRequestConfig, AxiosResponse } from 'axios';
|
||||||
|
import { baseUrl } from '../../service/ai/openai';
|
||||||
|
|
||||||
interface ConfigType {
|
interface ConfigType {
|
||||||
headers?: { [key: string]: string };
|
headers?: { [key: string]: string };
|
||||||
@@ -60,7 +61,6 @@ function responseError(err: any) {
|
|||||||
|
|
||||||
/* 创建请求实例 */
|
/* 创建请求实例 */
|
||||||
const instance = axios.create({
|
const instance = axios.create({
|
||||||
baseURL: global.systemEnv.pluginBaseUrl,
|
|
||||||
timeout: 60000, // 超时时间
|
timeout: 60000, // 超时时间
|
||||||
headers: {
|
headers: {
|
||||||
'content-type': 'application/json'
|
'content-type': 'application/json'
|
||||||
@@ -73,8 +73,8 @@ instance.interceptors.request.use(requestStart, (err) => Promise.reject(err));
|
|||||||
instance.interceptors.response.use(responseSuccess, (err) => Promise.reject(err));
|
instance.interceptors.response.use(responseSuccess, (err) => Promise.reject(err));
|
||||||
|
|
||||||
export function request(url: string, data: any, config: ConfigType, method: Method): any {
|
export function request(url: string, data: any, config: ConfigType, method: Method): any {
|
||||||
if (!global.systemEnv.pluginBaseUrl) {
|
if (!global.systemEnv?.pluginBaseUrl) {
|
||||||
return Promise.reject('请安装商业版插件~');
|
return Promise.reject('商业版插件加载中...');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 去空 */
|
/* 去空 */
|
||||||
@@ -86,6 +86,7 @@ export function request(url: string, data: any, config: ConfigType, method: Meth
|
|||||||
|
|
||||||
return instance
|
return instance
|
||||||
.request({
|
.request({
|
||||||
|
baseURL: global.systemEnv.pluginBaseUrl,
|
||||||
url,
|
url,
|
||||||
method,
|
method,
|
||||||
data: ['POST', 'PUT'].includes(method) ? data : null,
|
data: ['POST', 'PUT'].includes(method) ? data : null,
|
||||||
|
Reference in New Issue
Block a user