feat: integrate the output language to the system/user prompt
This commit is contained in:
parent
2b79a058de
commit
26fccfe18e
@ -257,6 +257,9 @@ func (o *Chat) BuildChatSession(raw bool) (ret *db.Session, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
systemMessage := strings.TrimSpace(o.Context) + strings.TrimSpace(o.Pattern)
|
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)
|
userMessage := strings.TrimSpace(o.Message)
|
||||||
|
|
||||||
if raw {
|
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() {
|
if ret.IsEmpty() {
|
||||||
ret = nil
|
ret = nil
|
||||||
err = fmt.Errorf("no session, pattern or user messages provided")
|
err = fmt.Errorf("no session, pattern or user messages provided")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user