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
commit 26fd2d2cfc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

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