fix: 反向代理

This commit is contained in:
archer
2023-04-25 22:29:43 +08:00
parent 8767c576be
commit d0e65431d0
2 changed files with 3 additions and 3 deletions

View File

@@ -9,10 +9,10 @@ import mongoose from 'mongoose';
export const getOpenAIApi = (apiKey: string) => {
const configuration = new Configuration({
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);
};
// 模型使用权校验

View File

@@ -123,9 +123,9 @@ export const gpt35StreamResponse = ({
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('X-Accel-Buffering', 'no');
res.setHeader('Cache-Control', 'no-cache, no-transform');
stream.pipe(res);
let responseContent = '';
stream.pipe(res);
const onParse = async (event: ParsedEvent | ReconnectInterval) => {
if (event.type !== 'event') return;