diff --git a/internal/controller/copilot/chat_completions.go b/internal/controller/copilot/chat_completions.go index bfe0d70f578e0ead12f0af95edf23ba839c191ea..8ea252ff2245b432a0a6630d1876551b8c28a66e 100644 --- a/internal/controller/copilot/chat_completions.go +++ b/internal/controller/copilot/chat_completions.go @@ -39,8 +39,9 @@ func chatCompletions(c *gin.Context) { } } lastIndex := len(messages) - 1 - if !strings.Contains(messages[lastIndex].Get("content").String(), "Respond in the following locale") { - body, _ = sjson.SetBytes(body, "messages."+strconv.Itoa(lastIndex)+".content", messages[lastIndex].Get("content").String()+"Respond in the following locale: "+os.Getenv("CHAT_LOCALE")+".") + chatLocale := os.Getenv("CHAT_LOCALE") + if chatLocale != "" && !strings.Contains(messages[lastIndex].Get("content").String(), "Respond in the following locale") { + body, _ = sjson.SetBytes(body, "messages."+strconv.Itoa(lastIndex)+".content", messages[lastIndex].Get("content").String()+"Respond in the following locale: "+chatLocale+".") } }