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.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix: generate summary error when tokens=4097 (#488)
John Wangb9b0866a467c
diff --git a/api/core/generator/llm_generator.py b/api/core/generator/llm_generator.pyindex d4b48bf00aa..87540272da3 100644--- a/api/core/generator/llm_generator.py+++ b/api/core/generator/llm_generator.py@@ -45,7 +45,7 @@ class LLMGenerator:prompt = CONVERSATION_SUMMARY_PROMPTprompt_with_empty_context = prompt.format(context='')prompt_tokens = TokenCalculator.get_num_tokens(model, prompt_with_empty_context)- rest_tokens = llm_constant.max_context_token_length[model] - prompt_tokens - max_tokens+ rest_tokens = llm_constant.max_context_token_length[model] - prompt_tokens - max_tokens - 1context = ''for message in messages:@@ -56,6 +56,9 @@ class LLMGenerator:if rest_tokens - TokenCalculator.get_num_tokens(model, context + message_qa_text) > 0:context += message_qa_text+ if not context:+ return '[message too long, no summary]'+prompt = prompt.format(context=context)llm: StreamableOpenAI = LLMBuilder.to_llm(diff --git a/api/tasks/generate_conversation_summary_task.py b/api/tasks/generate_conversation_summary_task.pyindex b19576f6fc6..fcdd1ef6d8a 100644--- a/api/tasks/generate_conversation_summary_task.py+++ b/api/tasks/generate_conversation_summary_task.py@@ -28,7 +28,7 @@ def generate_conversation_summary_task(conversation_id: str):try:# get conversation messages counthistory_message_count = conversation.message_count- if history_message_count >= 5:+ if history_message_count >= 5 and not conversation.summary:app_model = conversation.appif not app_model:return