Merge pull request #40 from gwtt/gwtt

fix pocketflow-workflow yaml parse error
This commit is contained in:
Zachary Huang
2025-04-23 10:09:13 -04:00
committed by GitHub
+6
View File
@@ -1,3 +1,4 @@
import re
from pocketflow import Node, BatchNode
from utils import call_llm
import yaml
@@ -21,6 +22,11 @@ sections:
```"""
response = call_llm(prompt)
yaml_str = response.split("```yaml")[1].split("```")[0].strip()
yaml_str = re.sub(
r'(?m)^(\s*)-\s*([^"\n]+)',
r'\1- "\2"',
yaml_str
)
structured_result = yaml.safe_load(yaml_str)
return structured_result