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

fix: dont send gen_title twice

Wentao Lyu8b00805d24bc
diff --git a/api/server/routes/ask.js b/api/server/routes/ask.js
index 794f6367b1..73b85b8012 100644
--- a/api/server/routes/ask.js
+++ b/api/server/routes/ask.js
@@ -167,6 +167,8 @@ router.post('/', async (req, res) => {
response: JSON.stringify(gptResponse?.text)
});
+ console.log('CONVERSATION TITLE', title);
+
await saveConvo({
conversationId,
title
diff --git a/api/server/routes/askBing.js b/api/server/routes/askBing.js
index 885741d08c..ffe8f2ae6d 100644
--- a/api/server/routes/askBing.js
+++ b/api/server/routes/askBing.js
@@ -104,6 +104,8 @@ router.post('/', async (req, res) => {
response: JSON.stringify(gptResponse?.text)
});
+ console.log('CONVERSATION TITLE', title);
+
await saveConvo({
conversationId,
title
diff --git a/api/server/routes/askSydney.js b/api/server/routes/askSydney.js
index 5a63f97004..20f6c302b3 100644
--- a/api/server/routes/askSydney.js
+++ b/api/server/routes/askSydney.js
@@ -115,6 +115,8 @@ router.post('/', async (req, res) => {
response: JSON.stringify(gptResponse?.text)
});
+ console.log('CONVERSATION TITLE', title);
+
await saveConvo({
conversationId,
title
diff --git a/api/server/routes/convos.js b/api/server/routes/convos.js
index a82242db4a..bfe3bc2d56 100644
--- a/api/server/routes/convos.js
+++ b/api/server/routes/convos.js
@@ -17,20 +17,23 @@ router.post('/gen_title', async (req, res) => {
const firstMessage = (await getMessages({ conversationId }))[0]
const secondMessage = (await getMessages({ conversationId }))[1]
- const title = convo.jailbreakConversationId
- ? await getConvoTitle(conversationId)
- : await titleConvo({
- model: convo?.model,
- message: firstMessage?.text,
- response: JSON.stringify(secondMessage?.text || '')
- });
-
- await saveConvo({
- conversationId,
- title
- })
-
- res.status(200).send(title);
+ // if (convo.title == 'New Chat') {
+ // const title = await titleConvo({
+ // model: convo?.model,
+ // message: firstMessage?.text,
+ // response: JSON.stringify(secondMessage?.text || '')
+ // });
+
+ // console.log('CONVERSATION TITLE', title);
+
+ // await saveConvo({
+ // conversationId,
+ // title
+ // })
+
+ // res.status(200).send(title);
+ // } else
+ return res.status(200).send(convo.title);
});
router.post('/clear', async (req, res) => {
diff --git a/client/src/components/Main/TextChat.jsx b/client/src/components/Main/TextChat.jsx
index 0045718617..8ed3576661 100644
--- a/client/src/components/Main/TextChat.jsx
+++ b/client/src/components/Main/TextChat.jsx
@@ -60,12 +60,14 @@ export default function TextChat({ messages }) {
const isBing = model === 'bingai' || model === 'sydney';
if (requestMessage.parentMessageId == '00000000-0000-0000-0000-000000000000') {
- genTitle.trigger({ conversationId }).then((ret) => {
- const title = ret?.data
+ setTimeout(() => {
+ dispatch(refreshConversation());
+ }, 2000);
- if (title)
+ // in case it takes too long.
+ setTimeout(() => {
dispatch(refreshConversation());
- })
+ }, 5000);
}
if (!isBing && convo.conversationId === null && convo.parentMessageId === null) {