Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

feat: regenerate for bingai

Wentao Lyu66ad54168a94
diff --git a/api/server/routes/askBing.js b/api/server/routes/askBing.js
index 0614faf86a..007aba779b 100644
--- a/api/server/routes/askBing.js
+++ b/api/server/routes/askBing.js
@@ -9,6 +9,7 @@ router.post('/', async (req, res) => {
const {
model,
text,
+ overrideParentMessageId=null,
parentMessageId,
conversationId: oldConversationId,
...convo
@@ -37,8 +38,10 @@ router.post('/', async (req, res) => {
...convo
});
- await saveMessage(userMessage);
- await saveConvo(req?.session?.user?.username, { ...userMessage, model, ...convo });
+ if (!overrideParentMessageId) {
+ await saveMessage(userMessage);
+ await saveConvo(req?.session?.user?.username, { ...userMessage, model, ...convo });
+ }
return await ask({
isNewConversation,
@@ -46,6 +49,7 @@ router.post('/', async (req, res) => {
model,
convo,
preSendRequest: true,
+ overrideParentMessageId,
req,
res
});
@@ -101,7 +105,8 @@ const ask = async ({
convo.conversationSignature || response.conversationSignature;
userMessage.conversationId = response.conversationId || conversationId;
userMessage.invocationId = response.invocationId;
- await saveMessage(userMessage);
+ if (!overrideParentMessageId)
+ await saveMessage(userMessage);
// Bing API will not use our conversationId at the first time,
// so change the placeholder conversationId to the real one.
diff --git a/api/server/routes/askSydney.js b/api/server/routes/askSydney.js
index a2017cf7d6..77f95371a0 100644
--- a/api/server/routes/askSydney.js
+++ b/api/server/routes/askSydney.js
@@ -9,6 +9,7 @@ router.post('/', async (req, res) => {
const {
model,
text,
+ overrideParentMessageId=null,
parentMessageId,
conversationId: oldConversationId,
...convo
@@ -37,8 +38,10 @@ router.post('/', async (req, res) => {
...convo
});
- await saveMessage(userMessage);
- await saveConvo(req?.session?.user?.username, { ...userMessage, model, ...convo });
+ if (!overrideParentMessageId) {
+ await saveMessage(userMessage);
+ await saveConvo(req?.session?.user?.username, { ...userMessage, model, ...convo });
+ }
return await ask({
isNewConversation,
@@ -46,6 +49,7 @@ router.post('/', async (req, res) => {
model,
convo,
preSendRequest: true,
+ overrideParentMessageId,
req,
res
});
@@ -102,7 +106,8 @@ const ask = async ({
userMessage.conversationId = response.conversationId || conversationId;
userMessage.invocationId = response.invocationId;
// Unlike gpt and bing, Sydney will never accept our given userMessage.messageId, it will generate its own one.
- await saveMessage(userMessage);
+ if (!overrideParentMessageId)
+ await saveMessage(userMessage);
// Save sydney response
// response.id = response.messageId;
@@ -125,7 +130,8 @@ const ask = async ({
// Save user message
userMessage.conversationId = response.conversationId || conversationId;
- await saveMessage(userMessage);
+ if (!overrideParentMessageId)
+ await saveMessage(userMessage);
// Bing API will not use our conversationId at the first time,
// so change the placeholder conversationId to the real one.