preserve last assistant message (#5802)

This commit is contained in:
Jeffrey Morgan
2024-07-19 20:19:26 -07:00
committed by GitHub
parent 69a2d4ccff
commit 20090f3172
2 changed files with 22 additions and 1 deletions

View File

@@ -264,6 +264,7 @@ func (t *Template) Execute(w io.Writer, v Values) error {
nodes := deleteNode(t.Template.Root.Copy(), func(n parse.Node) bool {
if field, ok := n.(*parse.FieldNode); ok && slices.Contains(field.Ident, "Response") {
cut = true
return false
}
return cut
@@ -273,7 +274,7 @@ func (t *Template) Execute(w io.Writer, v Values) error {
if err := template.Must(template.New("").AddParseTree("", &tree)).Execute(&b, map[string]any{
"System": system,
"Prompt": prompt,
"Response": "",
"Response": response,
}); err != nil {
return err
}