前后端页面同步策略,支持分析模板热编辑以及yaml配置,修改提示词编码,占用符等问题,优化文件扫描
This commit is contained in:
@@ -84,6 +84,20 @@ class LLMHelper:
|
||||
else:
|
||||
yaml_content = response.strip()
|
||||
|
||||
# Strip language identifier if LLM used ```python instead of ```yaml
|
||||
# e.g. "python\naction: ..." → "action: ..."
|
||||
import re
|
||||
if re.match(r'^[a-zA-Z]+\n', yaml_content):
|
||||
yaml_content = yaml_content.split('\n', 1)[1]
|
||||
|
||||
# Fix Windows backslash paths that break YAML double-quoted strings.
|
||||
# e.g. "D:\code\iov..." → "D:/code/iov..." inside quoted values
|
||||
yaml_content = re.sub(
|
||||
r'"([A-Za-z]:\\[^"]*)"',
|
||||
lambda m: '"' + m.group(1).replace('\\', '/') + '"',
|
||||
yaml_content,
|
||||
)
|
||||
|
||||
parsed = yaml.safe_load(yaml_content)
|
||||
return parsed if parsed is not None else {}
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user