mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 21:13:50 +00:00
fix: 反向代理
This commit is contained in:
@@ -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);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 模型使用权校验
|
// 模型使用权校验
|
||||||
|
@@ -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;
|
||||||
|
Reference in New Issue
Block a user