goose icon indicating copy to clipboard operation
goose copied to clipboard

fix: customised recipe to yaml string to avoid minininjia parsing error

Open lifeizhou-ap opened this issue 3 months ago • 2 comments

Summary

This fix is for a recipe with backtick and {{if}} block

Issue

serde_yaml serialization uses internal heuristics to decide between | and quoted text with escaped\n and \", and the quoted form breaks MiniJinja parsing. It seems that if the texts contains backtick, it tends to use the quoted texts without "|"

Example before:

prompt: "Hello \\\"World\\\"\\n{% if user == \\\"admin\\\" %}Welcome{% endif %}"

After fix:

prompt: |
   Hello "World"
  {% if user == "admin" %}Welcome{% endif %}

Changes

Apply extra format after the yaml serialization to convert the quoted multiline texts to the texts with "|"

Type of Change

  • [ ] Feature
  • [X] Bug fix
  • [ ] Refactor / Code quality
  • [ ] Performance improvement
  • [ ] Documentation
  • [ ] Tests
  • [ ] Security fix
  • [ ] Build / Release
  • [ ] Other (specify below)

Testing

Unit testing and manual testing

lifeizhou-ap avatar Oct 31 '25 04:10 lifeizhou-ap

.bundle

lifeizhou-ap avatar Oct 31 '25 04:10 lifeizhou-ap

.bundle

lifeizhou-ap avatar Oct 31 '25 04:10 lifeizhou-ap