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: Skip Title Generation for Temporary Chats (#11282)

Scott Finlay083251508edd
diff --git a/api/server/controllers/agents/client.js b/api/server/controllers/agents/client.js
index 2601fb3be0..79e63d1c7f 100644
--- a/api/server/controllers/agents/client.js
+++ b/api/server/controllers/agents/client.js
@@ -1120,6 +1120,14 @@ class AgentClient extends BaseClient {
}
const { handleLLMEnd, collected: collectedMetadata } = createMetadataAggregator();
const { req, agent } = this.options;
+
+ if (req?.body?.isTemporary) {
+ logger.debug(
+ `[api/server/controllers/agents/client.js #titleConvo] Skipping title generation for temporary conversation`,
+ );
+ return;
+ }
+
const appConfig = req.config;
let endpoint = agent.endpoint;
diff --git a/api/server/controllers/agents/client.test.js b/api/server/controllers/agents/client.test.js
index f8abf60955..14f0df9bb0 100644
--- a/api/server/controllers/agents/client.test.js
+++ b/api/server/controllers/agents/client.test.js
@@ -336,6 +336,25 @@ describe('AgentClient - titleConvo', () => {
expect(client.recordCollectedUsage).not.toHaveBeenCalled();
});
+ it('should skip title generation for temporary chats', async () => {
+ // Set isTemporary to true
+ mockReq.body.isTemporary = true;
+
+ const text = 'Test temporary chat';
+ const abortController = new AbortController();
+
+ const result = await client.titleConvo({ text, abortController });
+
+ // Should return undefined without generating title
+ expect(result).toBeUndefined();
+
+ // generateTitle should NOT have been called
+ expect(mockRun.generateTitle).not.toHaveBeenCalled();
+
+ // recordCollectedUsage should NOT have been called
+ expect(client.recordCollectedUsage).not.toHaveBeenCalled();
+ });
+
it('should skip title generation when titleConvo is false in all config', async () => {
// Set titleConvo to false in "all" config
mockReq.config = {
diff --git a/api/server/services/Endpoints/agents/title.js b/api/server/services/Endpoints/agents/title.js
index 74cdc0b2c2..1d6d359bd6 100644
--- a/api/server/services/Endpoints/agents/title.js
+++ b/api/server/services/Endpoints/agents/title.js
@@ -17,6 +17,11 @@ const addTitle = async (req, { text, response, client }) => {
return;
}
+ // Skip title generation for temporary conversations
+ if (req?.body?.isTemporary) {
+ return;
+ }
+
const titleCache = getLogStores(CacheKeys.GEN_TITLE);
const key = `${req.user.id}-${response.conversationId}`;
/** @type {NodeJS.Timeout} */
diff --git a/api/server/services/Endpoints/assistants/title.js b/api/server/services/Endpoints/assistants/title.js
index 020549a1be..a34de4d1af 100644
--- a/api/server/services/Endpoints/assistants/title.js
+++ b/api/server/services/Endpoints/assistants/title.js
@@ -50,6 +50,11 @@ const addTitle = async (req, { text, responseText, conversationId }) => {
return;
}
+ // Skip title generation for temporary conversations
+ if (req?.body?.isTemporary) {
+ return;
+ }
+
const titleCache = getLogStores(CacheKeys.GEN_TITLE);
const key = `${req.user.id}-${conversationId}`;