coai/api/utils.go
2023-08-09 17:54:38 +08:00

17 lines
530 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package api
import (
"chat/types"
"chat/utils"
"chat/web"
"fmt"
"time"
)
func ChatWithWeb(message []types.ChatGPTMessage, current string) []types.ChatGPTMessage {
return utils.Insert(message, 0, types.ChatGPTMessage{
Role: "system",
Content: fmt.Sprintf("你将扮演AI问答助手你的知识库不是截止于2021年9月而是可以实时联网的你可以提供实时联网的知识库。当前时间: %s, 你的知识库:%s", time.Now().Format("2006-01-02 15:04:05"), web.SearchBing(current)),
})
}