Commercial baseurl (#697)

This commit is contained in:
Archer
2024-01-06 10:36:31 +08:00
committed by GitHub
parent dfa4c0831c
commit 84cc4baf21
44 changed files with 124 additions and 119 deletions

View File

@@ -1,4 +1,5 @@
import axios, { Method, InternalAxiosRequestConfig, AxiosResponse } from 'axios';
import { FastGPTProUrl } from '../system/constants';
interface ConfigType {
headers?: { [key: string]: string };
@@ -70,7 +71,7 @@ instance.interceptors.request.use(requestStart, (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 {
if (!global.systemEnv || !global.systemEnv?.pluginBaseUrl) {
if (!FastGPTProUrl) {
console.log('未部署商业版接口', url);
return Promise.reject('The The request was denied...');
}
@@ -84,7 +85,7 @@ export function request(url: string, data: any, config: ConfigType, method: Meth
return instance
.request({
baseURL: global.systemEnv.pluginBaseUrl,
baseURL: FastGPTProUrl,
url,
method,
data: ['POST', 'PUT'].includes(method) ? data : null,