From d58ef6127f28071be0999de946cceb497c62aa91 Mon Sep 17 00:00:00 2001 From: Stephen Hu Date: Wed, 20 Aug 2025 13:39:38 +0800 Subject: [PATCH] =?UTF-8?q?Fix:KeyError:=20'globals'=20KeyError=EF=BC=9A?= =?UTF-8?q?=20'globals'=20(#9571)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What problem does this PR solve? https://github.com/infiniflow/ragflow/issues/9545 add backward compatible logics ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- agent/canvas.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/agent/canvas.py b/agent/canvas.py index 986b4f9c9..78606fcd0 100644 --- a/agent/canvas.py +++ b/agent/canvas.py @@ -131,7 +131,16 @@ class Canvas: self.path = self.dsl["path"] self.history = self.dsl["history"] - self.globals = self.dsl["globals"] + if "globals" in self.dsl: + self.globals = self.dsl["globals"] + else: + self.globals = { + "sys.query": "", + "sys.user_id": "", + "sys.conversation_turns": 0, + "sys.files": [] + } + self.retrieval = self.dsl["retrieval"] self.memory = self.dsl.get("memory", [])