mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 21:13:50 +00:00
fix: chat data outsize
This commit is contained in:
@@ -11,6 +11,7 @@ import SideTabs from '@/components/SideTabs';
|
|||||||
import Tabs from '@/components/Tabs';
|
import Tabs from '@/components/Tabs';
|
||||||
import UserInfo from './components/Info';
|
import UserInfo from './components/Info';
|
||||||
import { serviceSideProps } from '@/utils/i18n';
|
import { serviceSideProps } from '@/utils/i18n';
|
||||||
|
import { feConfigs } from '@/store/static';
|
||||||
|
|
||||||
const BillTable = dynamic(() => import('./components/BillTable'), {
|
const BillTable = dynamic(() => import('./components/BillTable'), {
|
||||||
ssr: false
|
ssr: false
|
||||||
|
@@ -52,7 +52,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);
|
console.log(error?.response);
|
||||||
}
|
}
|
||||||
|
|
||||||
res.status(code).json({
|
res.status(code).json({
|
||||||
@@ -92,7 +92,7 @@ export const sseErrRes = (res: NextApiResponse, error: 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('sse error => ', error);
|
console.log('sse error => ', error?.response);
|
||||||
|
|
||||||
sseResponse({
|
sseResponse({
|
||||||
res,
|
res,
|
||||||
|
@@ -23,6 +23,7 @@ export async function saveChat({
|
|||||||
shareId,
|
shareId,
|
||||||
content
|
content
|
||||||
}: Props) {
|
}: Props) {
|
||||||
|
try {
|
||||||
const chatHistory = await Chat.findOne(
|
const chatHistory = await Chat.findOne(
|
||||||
{
|
{
|
||||||
chatId,
|
chatId,
|
||||||
@@ -41,7 +42,7 @@ export async function saveChat({
|
|||||||
$push: {
|
$push: {
|
||||||
content: {
|
content: {
|
||||||
$each: content,
|
$each: content,
|
||||||
$slice: -50
|
$slice: -40
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
title: content[0].value.slice(0, 20),
|
title: content[0].value.slice(0, 20),
|
||||||
@@ -73,4 +74,17 @@ export async function saveChat({
|
|||||||
}
|
}
|
||||||
|
|
||||||
await Promise.all(promise);
|
await Promise.all(promise);
|
||||||
|
} catch (error) {
|
||||||
|
Chat.updateOne(
|
||||||
|
{ chatId, userId },
|
||||||
|
{
|
||||||
|
$push: {
|
||||||
|
content: {
|
||||||
|
$each: [],
|
||||||
|
$slice: -10
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user