RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Fix mutable default argument (#2635)
yqkcn604061c4a589
diff --git a/graphrag/utils.py b/graphrag/utils.pyindex ec7be23dfb..d4bbfadf99 100644--- a/graphrag/utils.py+++ b/graphrag/utils.py@@ -14,23 +14,25 @@ ErrorHandlerFn = Callable[[BaseException | None, str | None, dict | None], None]def perform_variable_replacements(- input: str, history: list[dict]=[], variables: dict | None ={}+ input: str, history: list[dict] | None = None, variables: dict | None = None) -> str:"""Perform variable replacements on the input string and in a chat log."""+ if history is None:+ history = []+ if variables is None:+ variables = {}result = inputdef replace_all(input: str) -> str:result = input- if variables:- for entry in variables:- result = result.replace(f"{{{entry}}}", variables[entry])+ for k, v in variables.items():+ result = result.replace(f"{{{k}}}", v)return resultresult = replace_all(result)- for i in range(len(history)):- entry = history[i]+ for i, entry in enumerate(history):if entry.get("role") == "system":- history[i]["content"] = replace_all(entry.get("content") or "")+ entry["content"] = replace_all(entry.get("content") or "")return result