Skip to content

api调用场景下,如果大量调用带有图片或视频,产生的聊天记录会导致后台mongo数据库异常 #3964

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/service/core/chat/saveChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export async function saveChat({
content,
metadata = {}
}: Props) {
if (!chatId) return;

try {
const chat = await MongoChat.findOne(
{
Expand Down
2 changes: 1 addition & 1 deletion projects/app/src/pages/api/v1/chat/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
[DispatchNodeResponseKeyEnum.nodeResponse]: flowResponses
};

const saveChatId = chatId || getNanoid(24);
const saveChatId = chatId === 'no-history-sT$hjq*K!vmx' ? '' : chatId || getNanoid(24);
if (isInteractiveRequest) {
await updateInteractiveChat({
chatId: saveChatId,
Expand Down
Loading