Merge branch 'fixups/mixed'
This commit is contained in:
@@ -122,6 +122,11 @@ func (d *Discord) handleChannelMessage(a *agent.Agent, s *discordgo.Session, m *
|
|||||||
|
|
||||||
conv := d.conversationTracker.GetConversation(m.ChannelID)
|
conv := d.conversationTracker.GetConversation(m.ChannelID)
|
||||||
|
|
||||||
|
d.conversationTracker.AddMessage(m.ChannelID, openai.ChatCompletionMessage{
|
||||||
|
Role: "user",
|
||||||
|
Content: m.Content,
|
||||||
|
})
|
||||||
|
|
||||||
jobResult := a.Ask(
|
jobResult := a.Ask(
|
||||||
types.WithConversationHistory(conv),
|
types.WithConversationHistory(conv),
|
||||||
)
|
)
|
||||||
@@ -131,16 +136,15 @@ func (d *Discord) handleChannelMessage(a *agent.Agent, s *discordgo.Session, m *
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d.conversationTracker.AddMessage(m.ChannelID, openai.ChatCompletionMessage{
|
||||||
|
Role: "assistant",
|
||||||
|
Content: jobResult.Response,
|
||||||
|
})
|
||||||
|
|
||||||
_, err := s.ChannelMessageSend(m.ChannelID, jobResult.Response)
|
_, err := s.ChannelMessageSend(m.ChannelID, jobResult.Response)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
xlog.Info("error sending message,", err)
|
xlog.Info("error sending message,", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
d.conversationTracker.AddMessage(m.ChannelID, openai.ChatCompletionMessage{
|
|
||||||
Role: "user",
|
|
||||||
Content: m.Content,
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function will be called (due to AddHandler above) every time a new
|
// This function will be called (due to AddHandler above) every time a new
|
||||||
|
|||||||
@@ -122,6 +122,12 @@ func (i *IRC) Start(a *agent.Agent) {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Update the conversation history
|
||||||
|
i.conversationTracker.AddMessage(channel, openai.ChatCompletionMessage{
|
||||||
|
Content: cleanedMessage,
|
||||||
|
Role: "user",
|
||||||
|
})
|
||||||
|
|
||||||
res := a.Ask(
|
res := a.Ask(
|
||||||
types.WithConversationHistory(conv),
|
types.WithConversationHistory(conv),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -67,6 +67,14 @@ func (t *Telegram) handleUpdate(ctx context.Context, b *bot.Bot, a *agent.Agent,
|
|||||||
Role: "user",
|
Role: "user",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
t.conversationTracker.AddMessage(
|
||||||
|
update.Message.From.ID,
|
||||||
|
openai.ChatCompletionMessage{
|
||||||
|
Content: update.Message.Text,
|
||||||
|
Role: "user",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
xlog.Info("New message", "username", username, "conversation", currentConv)
|
xlog.Info("New message", "username", username, "conversation", currentConv)
|
||||||
res := a.Ask(
|
res := a.Ask(
|
||||||
types.WithConversationHistory(currentConv),
|
types.WithConversationHistory(currentConv),
|
||||||
|
|||||||
Reference in New Issue
Block a user