diff --git a/core/fabric.go b/core/fabric.go index 234f4d68d..a70ff37f2 100644 --- a/core/fabric.go +++ b/core/fabric.go @@ -257,6 +257,9 @@ func (o *Chat) BuildChatSession(raw bool) (ret *db.Session, err error) { } systemMessage := strings.TrimSpace(o.Context) + strings.TrimSpace(o.Pattern) + if o.Language != "" { + systemMessage = fmt.Sprintf("%s. Please use the language '%s' for the output.", systemMessage, o.Language) + } userMessage := strings.TrimSpace(o.Message) if raw { @@ -274,10 +277,6 @@ func (o *Chat) BuildChatSession(raw bool) (ret *db.Session, err error) { } } - if o.Language != "" { - ret.Append(&common.Message{Role: "system", Content: "please use " + o.Language + " language"}) - } - if ret.IsEmpty() { ret = nil err = fmt.Errorf("no session, pattern or user messages provided")