fix: model markdown parse failed

This commit is contained in:
jialin
2024-11-22 11:55:19 +08:00
parent 67febd3e25
commit c8c22b3f22
15 changed files with 514 additions and 50 deletions
+1 -26
View File
@@ -18,35 +18,10 @@ export default function createProxyTable(target?: string) {
changeOrigin: true,
secure: false,
ws: true,
buffer: false,
selfHandleResponse: false,
pathRewrite: (pth: string) => pth.replace(`/^/${api}`, `/${api}`),
headers: {
origin: newTarget,
Connection: 'keep-alive',
'Cache-Control': 'no-cache'
},
onProxyRes: (proxyRes: any, req: any, res: any) => {
// let body = '';
// proxyRes.on('data', (chunk) => {
// body += chunk;
// console.log('Received data from target server::::::::::', chunk);
// });
// proxyRes.on('end', () => {
// console.log('Received data from target server=================end');
// console.log(body);
// });
if (req.headers.accept === 'text/event-stream') {
res.writeHead(res.statusCode, {
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache',
Connection: 'keep-alive',
'X-Accel-Buffering': 'no',
'Access-Control-Allow-Origin': '*'
});
proxyRes.pipe(res);
}
Connection: 'keep-alive'
}
};
return obj;