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
cd9acab9
authored
Apr 28, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: request config
parent
56b3ddc1
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
22 additions
and
20 deletions
+22
-20
src/pages/api/chat/chatGpt.ts
+1
-1
src/pages/api/chat/vectorGpt.ts
+1
-1
src/pages/api/model/data/fetchingUrlData.ts
+1
-1
src/pages/api/openapi/chat/chatGpt.ts
+1
-1
src/pages/api/openapi/chat/lafGpt.ts
+2
-2
src/pages/api/openapi/chat/vectorGpt.ts
+1
-1
src/pages/model/detail/index.tsx
+0
-1
src/service/events/generateQA.ts
+6
-2
src/service/events/generateVector.ts
+5
-1
src/service/response.ts
+1
-6
src/service/utils/openai.ts
+1
-1
src/service/utils/tools.ts
+2
-2
No files found.
src/pages/api/chat/chatGpt.ts
View file @
cd9acab9
...
@@ -88,7 +88,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
...
@@ -88,7 +88,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
{
{
timeout
:
40000
,
timeout
:
40000
,
responseType
:
'stream'
,
responseType
:
'stream'
,
...
axiosConfig
...
axiosConfig
()
}
}
);
);
...
...
src/pages/api/chat/vectorGpt.ts
View file @
cd9acab9
...
@@ -150,7 +150,7 @@ ${
...
@@ -150,7 +150,7 @@ ${
{
{
timeout
:
40000
,
timeout
:
40000
,
responseType
:
'stream'
,
responseType
:
'stream'
,
...
axiosConfig
...
axiosConfig
()
}
}
);
);
...
...
src/pages/api/model/data/fetchingUrlData.ts
View file @
cd9acab9
...
@@ -22,7 +22,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
...
@@ -22,7 +22,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
const
data
=
await
axios
const
data
=
await
axios
.
get
(
url
,
{
.
get
(
url
,
{
httpsAgent
:
axiosConfig
.
httpsAgent
httpsAgent
:
axiosConfig
()
.
httpsAgent
})
})
.
then
((
res
)
=>
res
.
data
as
string
);
.
then
((
res
)
=>
res
.
data
as
string
);
...
...
src/pages/api/openapi/chat/chatGpt.ts
View file @
cd9acab9
...
@@ -100,7 +100,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
...
@@ -100,7 +100,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
{
{
timeout
:
40000
,
timeout
:
40000
,
responseType
:
isStream
?
'stream'
:
'json'
,
responseType
:
isStream
?
'stream'
:
'json'
,
...
axiosConfig
...
axiosConfig
()
}
}
);
);
...
...
src/pages/api/openapi/chat/lafGpt.ts
View file @
cd9acab9
...
@@ -120,7 +120,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
...
@@ -120,7 +120,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
},
},
{
{
timeout
:
180000
,
timeout
:
180000
,
...
axiosConfig
...
axiosConfig
()
}
}
);
);
...
@@ -196,7 +196,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
...
@@ -196,7 +196,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
{
{
timeout
:
180000
,
timeout
:
180000
,
responseType
:
isStream
?
'stream'
:
'json'
,
responseType
:
isStream
?
'stream'
:
'json'
,
...
axiosConfig
...
axiosConfig
()
}
}
);
);
...
...
src/pages/api/openapi/chat/vectorGpt.ts
View file @
cd9acab9
...
@@ -171,7 +171,7 @@ ${
...
@@ -171,7 +171,7 @@ ${
{
{
timeout
:
180000
,
timeout
:
180000
,
responseType
:
isStream
?
'stream'
:
'json'
,
responseType
:
isStream
?
'stream'
:
'json'
,
...
axiosConfig
...
axiosConfig
()
}
}
);
);
...
...
src/pages/model/detail/index.tsx
View file @
cd9acab9
...
@@ -39,7 +39,6 @@ const ModelDetail = ({ modelId }: { modelId: string }) => {
...
@@ -39,7 +39,6 @@ const ModelDetail = ({ modelId }: { modelId: string }) => {
setLoading
(
true
);
setLoading
(
true
);
try
{
try
{
const
res
=
await
getModelById
(
modelId
);
const
res
=
await
getModelById
(
modelId
);
console
.
log
(
res
);
setModel
(
res
);
setModel
(
res
);
formHooks
.
reset
(
res
);
formHooks
.
reset
(
res
);
}
catch
(
err
:
any
)
{
}
catch
(
err
:
any
)
{
...
...
src/service/events/generateQA.ts
View file @
cd9acab9
...
@@ -12,7 +12,11 @@ import { ModelSplitDataSchema } from '@/types/mongoSchema';
...
@@ -12,7 +12,11 @@ import { ModelSplitDataSchema } from '@/types/mongoSchema';
export
async
function
generateQA
(
next
=
false
):
Promise
<
any
>
{
export
async
function
generateQA
(
next
=
false
):
Promise
<
any
>
{
if
(
process
.
env
.
queueTask
!==
'1'
)
{
if
(
process
.
env
.
queueTask
!==
'1'
)
{
fetch
(
process
.
env
.
parentUrl
||
''
);
try
{
fetch
(
process
.
env
.
parentUrl
||
''
);
}
catch
(
error
)
{
console
.
log
(
'parentUrl fetch error'
,
error
);
}
return
;
return
;
}
}
if
(
global
.
generatingQA
===
true
&&
!
next
)
return
;
if
(
global
.
generatingQA
===
true
&&
!
next
)
return
;
...
@@ -97,7 +101,7 @@ A2:
...
@@ -97,7 +101,7 @@ A2:
},
},
{
{
timeout
:
180000
,
timeout
:
180000
,
...
axiosConfig
...
axiosConfig
()
}
}
)
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
...
...
src/service/events/generateVector.ts
View file @
cd9acab9
...
@@ -4,7 +4,11 @@ import { PgClient } from '@/service/pg';
...
@@ -4,7 +4,11 @@ import { PgClient } from '@/service/pg';
export
async
function
generateVector
(
next
=
false
):
Promise
<
any
>
{
export
async
function
generateVector
(
next
=
false
):
Promise
<
any
>
{
if
(
process
.
env
.
queueTask
!==
'1'
)
{
if
(
process
.
env
.
queueTask
!==
'1'
)
{
fetch
(
process
.
env
.
parentUrl
||
''
);
try
{
fetch
(
process
.
env
.
parentUrl
||
''
);
}
catch
(
error
)
{
console
.
log
(
'parentUrl fetch error'
,
error
);
}
return
;
return
;
}
}
...
...
src/service/response.ts
View file @
cd9acab9
...
@@ -39,12 +39,7 @@ export const jsonRes = <T = any>(
...
@@ -39,12 +39,7 @@ export const jsonRes = <T = any>(
}
else
if
(
openaiError
[
error
?.
response
?.
statusText
])
{
}
else
if
(
openaiError
[
error
?.
response
?.
statusText
])
{
msg
=
openaiError
[
error
.
response
.
statusText
];
msg
=
openaiError
[
error
.
response
.
statusText
];
}
}
console
.
log
(
`error-> msg:
${
msg
}
`
);
console
.
log
(
error
);
// request 时候报错
if
(
error
?.
response
)
{
console
.
log
(
'statusText:'
,
error
?.
response
?.
statusText
);
console
.
log
(
'openai error:'
,
error
?.
response
?.
data
?.
error
);
}
}
}
res
.
json
({
res
.
json
({
...
...
src/service/utils/openai.ts
View file @
cd9acab9
...
@@ -85,7 +85,7 @@ export const openaiCreateEmbedding = async ({
...
@@ -85,7 +85,7 @@ export const openaiCreateEmbedding = async ({
},
},
{
{
timeout
:
60000
,
timeout
:
60000
,
...
axiosConfig
...
axiosConfig
()
}
}
)
)
.
then
((
res
)
=>
({
.
then
((
res
)
=>
({
...
...
src/service/utils/tools.ts
View file @
cd9acab9
...
@@ -85,12 +85,12 @@ export const authOpenApiKey = async (req: NextApiRequest) => {
...
@@ -85,12 +85,12 @@ export const authOpenApiKey = async (req: NextApiRequest) => {
};
};
/* openai axios config */
/* openai axios config */
export
const
axiosConfig
=
{
export
const
axiosConfig
=
()
=>
(
{
httpsAgent
:
global
.
httpsAgent
,
httpsAgent
:
global
.
httpsAgent
,
headers
:
{
headers
:
{
auth
:
process
.
env
.
OPENAI_BASE_URL_AUTH
||
''
auth
:
process
.
env
.
OPENAI_BASE_URL_AUTH
||
''
}
}
};
}
)
;
/* delete invalid symbol */
/* delete invalid symbol */
const
simplifyStr
=
(
str
:
string
)
=>
const
simplifyStr
=
(
str
:
string
)
=>
...
...
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