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

persist bing ai conversation

Daniel Avila7b7548c905d1
diff --git a/models/Message.js b/models/Message.js
index 50492331d0..e6657c060a 100644
--- a/models/Message.js
+++ b/models/Message.js
@@ -18,7 +18,7 @@ const messageSchema = mongoose.Schema({
type: String,
},
invocationId: {
- type: Number,
+ type: String,
},
parentMessageId: {
type: String,
diff --git a/server/routes/ask.js b/server/routes/ask.js
index 20c2f94e9f..02133748c3 100644
--- a/server/routes/ask.js
+++ b/server/routes/ask.js
@@ -49,8 +49,8 @@ router.post('/bing', async (req, res) => {
convo
});
- console.log('CLIENT RESPONSE');
- console.dir(response, { depth: null });
+ // console.log('CLIENT RESPONSE');
+ // console.dir(response, { depth: null });
userMessage.conversationSignature =
convo.conversationSignature || response.conversationSignature;
@@ -72,7 +72,7 @@ router.post('/bing', async (req, res) => {
response.text = response.response;
response.id = response.details.messageId;
- response.suggestions = response.details.suggestedResponses.map((s) => s.text);
+ response.suggestions = response.details.suggestedResponses && response.details.suggestedResponses.map((s) => s.text);
response.sender = model;
response.final = true;
await saveMessage(response);
diff --git a/src/components/main/TextChat.jsx b/src/components/main/TextChat.jsx
index 30d4a7b2f1..9dd47259cf 100644
--- a/src/components/main/TextChat.jsx
+++ b/src/components/main/TextChat.jsx
@@ -42,8 +42,17 @@ export default function TextChat({ messages }) {
const { title, conversationId, id } = data;
console.log('parentMessageId is null');
console.log('title, convoId, id', title, conversationId, id);
- dispatch(setConversation({ title, conversationId, parentMessageId: id }));
- } else if (convo.conversationSignature === null) {
+ dispatch(
+ setConversation({
+ title,
+ conversationId,
+ parentMessageId: id,
+ conversationSignature: null,
+ clientId: null,
+ invocationId: null
+ })
+ );
+ } else if (convo.invocationId === null) {
const { title, conversationSignature, clientId, conversationId, invocationId } = data;
console.log('convoSig is null');
console.log(
@@ -60,7 +69,8 @@ export default function TextChat({ messages }) {
conversationSignature,
clientId,
conversationId,
- invocationId
+ invocationId,
+ parentMessageId: null
})
);
}
@@ -160,4 +170,4 @@ export default function TextChat({ messages }) {
<Footer />
</div>
);
-}
\ No newline at end of file
+}
diff --git a/src/utils/handleSubmit.js b/src/utils/handleSubmit.js
index cc86b708f3..a892c4c588 100644
--- a/src/utils/handleSubmit.js
+++ b/src/utils/handleSubmit.js
@@ -18,6 +18,16 @@ export default function handleSubmit({
};
}
+ if (model === 'bingai' && convo.conversationId) {
+ payload = {
+ ...payload,
+ conversationId: convo.conversationId,
+ conversationSignature: convo.conversationSignature,
+ clientId: convo.clientId,
+ invocationId: convo.invocationId,
+ };
+ }
+
const server = model === 'bingai' ? endpoint + '/bing' : endpoint;
const events = new SSE(server, {
payload: JSON.stringify(payload),