Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

feat: optimize generate name length (#924)

takatost8d6d1c442bf6
diff --git a/api/events/event_handlers/generate_conversation_name_when_first_message_created.py b/api/events/event_handlers/generate_conversation_name_when_first_message_created.py
index dc18bf44f42..9e84e74a93a 100644
--- a/api/events/event_handlers/generate_conversation_name_when_first_message_created.py
+++ b/api/events/event_handlers/generate_conversation_name_when_first_message_created.py
@@ -20,6 +20,10 @@ def handle(sender, **kwargs):
# generate conversation name
try:
name = LLMGenerator.generate_conversation_name(app_model.tenant_id, message.query, message.answer)
+
+ if len(name) > 75:
+ name = name[:75] + '...'
+
conversation.name = name
except:
conversation.name = 'New Chat'