From e4b9b72f2af1d66e9b806e670c955a6cd60a9a47 Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Sun, 28 Jan 2024 14:15:56 -0800 Subject: [PATCH] Do not repeat system prompt for chat templating (#2241) --- server/images.go | 4 ---- server/routes.go | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/server/images.go b/server/images.go index ab3b4faa..7f5a9211 100644 --- a/server/images.go +++ b/server/images.go @@ -119,10 +119,6 @@ func Prompt(promptTemplate string, p PromptVars) (string, error) { // PreResponsePrompt returns the prompt before the response tag func (m *Model) PreResponsePrompt(p PromptVars) (string, error) { - if p.System == "" { - // use the default system prompt for this model if one is not specified - p.System = m.System - } pre, _, err := extractParts(m.Template) if err != nil { return "", err diff --git a/server/routes.go b/server/routes.go index 56c275c9..e0129793 100644 --- a/server/routes.go +++ b/server/routes.go @@ -239,6 +239,11 @@ func GenerateHandler(c *gin.Context) { Prompt: req.Prompt, First: len(req.Context) == 0, } + + if promptVars.System == "" { + promptVars.System = model.System + } + p, err := model.PreResponsePrompt(promptVars) if err != nil { c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})