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: array[string] context in llm node invalid (#3518)

takatost1219e41d295a
diff --git a/api/core/workflow/nodes/llm/llm_node.py b/api/core/workflow/nodes/llm/llm_node.py
index 77781058c73..491e9844772 100644
--- a/api/core/workflow/nodes/llm/llm_node.py
+++ b/api/core/workflow/nodes/llm/llm_node.py
@@ -248,16 +248,19 @@ class LLMNode(BaseNode):
context_str = ''
original_retriever_resource = []
for item in context_value:
- if 'content' not in item:
- raise ValueError(f'Invalid context structure: {item}')
+ if isinstance(item, str):
+ context_str += item + '\n'
+ else:
+ if 'content' not in item:
+ raise ValueError(f'Invalid context structure: {item}')
- context_str += item['content'] + '\n'
+ context_str += item['content'] + '\n'
- retriever_resource = self._convert_to_original_retriever_resource(item)
- if retriever_resource:
- original_retriever_resource.append(retriever_resource)
+ retriever_resource = self._convert_to_original_retriever_resource(item)
+ if retriever_resource:
+ original_retriever_resource.append(retriever_resource)
- if self.callbacks:
+ if self.callbacks and original_retriever_resource:
for callback in self.callbacks:
callback.on_event(
event=QueueRetrieverResourcesEvent(