Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
e589350e
authored
Aug 24, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: base url
parent
a99ef9e2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
client/src/api/service/request.ts
+4
-3
No files found.
client/src/api/service/request.ts
View file @
e589350e
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) {
...
@@ -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));
...
@@ -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
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment