remove empty history, change model
This commit is contained in:
+1
-1
@@ -26,7 +26,7 @@ func NewClient(token string) *Client {
|
|||||||
return &Client{
|
return &Client{
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
c: gClient,
|
c: gClient,
|
||||||
model: "gemini-2.5-pro-exp-03-25",
|
model: "gemini-2.5-flash-preview-04-17",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,6 +86,11 @@ func (h Handler) OnMessageCreated(s *discordgo.Session, m *discordgo.MessageCrea
|
|||||||
}
|
}
|
||||||
|
|
||||||
func addMessageToHistory(m *discordgo.Message, isHal bool) []*genai.Content {
|
func addMessageToHistory(m *discordgo.Message, isHal bool) []*genai.Content {
|
||||||
|
message := cleanMessage(m.Content)
|
||||||
|
if message == "" {
|
||||||
|
return geminiHistory
|
||||||
|
}
|
||||||
|
|
||||||
var role string
|
var role string
|
||||||
if isHal {
|
if isHal {
|
||||||
role = "model"
|
role = "model"
|
||||||
@@ -96,7 +101,7 @@ func addMessageToHistory(m *discordgo.Message, isHal bool) []*genai.Content {
|
|||||||
geminiHistory = append(geminiHistory, &genai.Content{
|
geminiHistory = append(geminiHistory, &genai.Content{
|
||||||
Role: role,
|
Role: role,
|
||||||
Parts: []*genai.Part{
|
Parts: []*genai.Part{
|
||||||
genai.NewPartFromText(cleanMessage(m.Content)),
|
genai.NewPartFromText(message),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user