diff options
| author | 2024-01-26 23:23:45 +0800 | |
|---|---|---|
| committer | 2024-01-26 23:23:45 +0800 | |
| commit | 9017674d35d61b31574245b93693a4b712ebf201 (patch) | |
| tree | 130bc92d294e5370ce12f7a39407bed7a83786e3 /src/infini | |
| parent | 99ad8110501c53db2f21269bdce389cc5fc7ebaa (diff) | |
| download | infini-9017674d35d61b31574245b93693a4b712ebf201.tar.gz infini-9017674d35d61b31574245b93693a4b712ebf201.zip | |
:sparkles: feat(generator): enable to use global variables
Diffstat (limited to 'src/infini')
| -rw-r--r-- | src/infini/generator.py | 5 |
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): |
