summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author苏向夜 <fu050409@163.com>2024-01-26 23:23:45 +0800
committer苏向夜 <fu050409@163.com>2024-01-26 23:23:45 +0800
commit9017674d35d61b31574245b93693a4b712ebf201 (patch)
tree130bc92d294e5370ce12f7a39407bed7a83786e3 /src
parent99ad8110501c53db2f21269bdce389cc5fc7ebaa (diff)
downloadinfini-9017674d35d61b31574245b93693a4b712ebf201.tar.gz
infini-9017674d35d61b31574245b93693a4b712ebf201.zip
:sparkles: feat(generator): enable to use global variables
Diffstat (limited to 'src')
-rw-r--r--src/infini/generator.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/infini/generator.py b/src/infini/generator.py
index 81a6ab14..e1386c6c 100644
--- a/src/infini/generator.py
+++ b/src/infini/generator.py
@@ -10,8 +10,9 @@ class Generator:
def output(self, output: Output) -> str:
assert output.type != "workflow", "Workflow 事件无法产出文本"
- template = self.match(output)
- return template.render(output.variables)
+ variables = self.global_variables.copy()
+ variables.update(output.variables)
+ return self.match(output).render(variables)
def match(self, output: Output) -> Template:
if context := self.events.get(output.name):