Commit 48707721 authored by Hoanganhvu123's avatar Hoanganhvu123

fix(lead-stage): escape curly braces in STYLIST_SYSTEM_PROMPT before format

Prompt contains JSON examples with { } that confused .format().
Escape all braces first, then substitute only stage_injection.
Co-Authored-By: 's avatarClaude Sonnet 4.6 <noreply@anthropic.com>
parent c4514a9c
......@@ -555,7 +555,8 @@ class LeadStageGraph:
injection = format_insight_injection(old_insight) if old_insight else "Chưa có insight — đây là lần đầu."
stylist_sys = STYLIST_SYSTEM_PROMPT.format(stage_injection=injection)
# Escape curly braces in prompt, then substitute only stage_injection
stylist_sys = STYLIST_SYSTEM_PROMPT.replace("{", "{{").replace("}", "}}").replace("{{stage_injection}}", "{stage_injection}").format(stage_injection=injection)
# Build messages cho Stylist
stylist_messages: list[BaseMessage] = [SystemMessage(content=stylist_sys)]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment