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.

fix: empty usage (#2168)

Yeuoly6c614f0c1f43
diff --git a/api/core/features/assistant_cot_runner.py b/api/core/features/assistant_cot_runner.py
index 0d6725d0515..6fcc02d857e 100644
--- a/api/core/features/assistant_cot_runner.py
+++ b/api/core/features/assistant_cot_runner.py
@@ -298,7 +298,7 @@ class AssistantCotApplicationRunner(BaseAssistantApplicationRunner):
message=AssistantPromptMessage(
content=final_answer
),
- usage=llm_usage['usage'],
+ usage=llm_usage['usage'] if llm_usage['usage'] else LLMUsage.empty_usage(),
system_fingerprint=''
), PublishFrom.APPLICATION_MANAGER)
diff --git a/api/core/features/assistant_fc_runner.py b/api/core/features/assistant_fc_runner.py
index 7f18607e1f0..03c4e870150 100644
--- a/api/core/features/assistant_fc_runner.py
+++ b/api/core/features/assistant_fc_runner.py
@@ -276,7 +276,7 @@ class AssistantFunctionCallApplicationRunner(BaseAssistantApplicationRunner):
message=AssistantPromptMessage(
content=final_answer,
),
- usage=llm_usage['usage'],
+ usage=llm_usage['usage'] if llm_usage['usage'] else LLMUsage.empty_usage(),
system_fingerprint=''
), PublishFrom.APPLICATION_MANAGER)