Skip to content

Commit

Permalink
feat: integrate the output language to the system/user prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeis authored Sep 19, 2024
1 parent 2b79a05 commit 26fccfe
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions core/fabric.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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")
Expand Down

0 comments on commit 26fccfe

Please sign in to comment.