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
d0e65431
authored
Apr 25, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 反向代理
parent
8767c576
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
src/service/utils/auth.ts
+2
-2
src/service/utils/openai.ts
+1
-1
No files found.
src/service/utils/auth.ts
View file @
d0e65431
...
@@ -9,10 +9,10 @@ import mongoose from 'mongoose';
...
@@ -9,10 +9,10 @@ import mongoose from 'mongoose';
export
const
getOpenAIApi
=
(
apiKey
:
string
)
=>
{
export
const
getOpenAIApi
=
(
apiKey
:
string
)
=>
{
const
configuration
=
new
Configuration
({
const
configuration
=
new
Configuration
({
apiKey
,
apiKey
,
basePath
:
process
.
env
.
OPENAI_BASE_URL
||
'https://api.openai.com/v1'
basePath
:
process
.
env
.
OPENAI_BASE_URL
});
});
return
new
OpenAIApi
(
configuration
,
undefined
);
return
new
OpenAIApi
(
configuration
);
};
};
// 模型使用权校验
// 模型使用权校验
...
...
src/service/utils/openai.ts
View file @
d0e65431
...
@@ -123,9 +123,9 @@ export const gpt35StreamResponse = ({
...
@@ -123,9 +123,9 @@ export const gpt35StreamResponse = ({
res
.
setHeader
(
'Access-Control-Allow-Origin'
,
'*'
);
res
.
setHeader
(
'Access-Control-Allow-Origin'
,
'*'
);
res
.
setHeader
(
'X-Accel-Buffering'
,
'no'
);
res
.
setHeader
(
'X-Accel-Buffering'
,
'no'
);
res
.
setHeader
(
'Cache-Control'
,
'no-cache, no-transform'
);
res
.
setHeader
(
'Cache-Control'
,
'no-cache, no-transform'
);
stream
.
pipe
(
res
);
let
responseContent
=
''
;
let
responseContent
=
''
;
stream
.
pipe
(
res
);
const
onParse
=
async
(
event
:
ParsedEvent
|
ReconnectInterval
)
=>
{
const
onParse
=
async
(
event
:
ParsedEvent
|
ReconnectInterval
)
=>
{
if
(
event
.
type
!==
'event'
)
return
;
if
(
event
.
type
!==
'event'
)
return
;
...
...
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