Compare commits
No commits in common. "5280fe8a2eb4df03687a7ae5bfa32c5d0c5c9620" and "c3ee85bf359587ea4c343cf0e9a77fc5cd1ff641" have entirely different histories.
5280fe8a2e
...
c3ee85bf35
|
@ -144,7 +144,7 @@ func (b *Bot) processMention(message *telego.Message) {
|
|||
|
||||
requestContext := b.createLlmRequestContextFromMessage(message)
|
||||
|
||||
userMessageData := tgUserMessageToMessageData(message, true)
|
||||
userMessageData := tgUserMessageToMessageData(message)
|
||||
|
||||
llmReply, err := b.llm.HandleChatMessage(
|
||||
messageDataToLlmMessage(userMessageData),
|
||||
|
|
|
@ -56,7 +56,7 @@ func (b *Bot) saveChatMessageToHistory(message *telego.Message) {
|
|||
b.history[chatId] = NewMessageHistory(HistoryLength)
|
||||
}
|
||||
|
||||
msgData := tgUserMessageToMessageData(message, false)
|
||||
msgData := tgUserMessageToMessageData(message)
|
||||
|
||||
b.history[chatId].Push(msgData)
|
||||
}
|
||||
|
@ -99,17 +99,16 @@ func (b *Bot) saveBotReplyToHistory(replyTo *telego.Message, text string) {
|
|||
b.history[chatId].Push(msgData)
|
||||
}
|
||||
|
||||
func tgUserMessageToMessageData(message *telego.Message, isUserRequest bool) MessageData {
|
||||
func tgUserMessageToMessageData(message *telego.Message) MessageData {
|
||||
msgData := MessageData{
|
||||
Name: message.From.FirstName,
|
||||
Username: message.From.Username,
|
||||
Text: message.Text,
|
||||
IsMe: false,
|
||||
IsUserRequest: isUserRequest,
|
||||
Name: message.From.FirstName,
|
||||
Username: message.From.Username,
|
||||
Text: message.Text,
|
||||
IsMe: false,
|
||||
}
|
||||
|
||||
if message.ReplyToMessage != nil {
|
||||
replyData := tgUserMessageToMessageData(message.ReplyToMessage, false)
|
||||
replyData := tgUserMessageToMessageData(message.ReplyToMessage)
|
||||
msgData.ReplyTo = &replyData
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ func (l *LlmConnector) HandleChatMessage(userMessage ChatMessage, model string,
|
|||
historyLength := len(requestContext.Chat.History)
|
||||
|
||||
if historyLength > 0 {
|
||||
systemPrompt += "\nYou have access to last " + strconv.Itoa(historyLength) + " messages in this chat."
|
||||
systemPrompt += "\nYou have access to last " + strconv.Itoa(historyLength) + "messages in this chat."
|
||||
}
|
||||
|
||||
req := openai.ChatCompletionRequest{
|
||||
|
|
|
@ -56,7 +56,7 @@ func (c RequestContext) Prompt() string {
|
|||
prompt += "Chat description is \"" + c.Chat.Description + "\". "
|
||||
}
|
||||
|
||||
prompt += "\nProfile of the user who mentioned you in the chat:\n" +
|
||||
prompt += "\nProfile of the user who mentioned you in the chat:" +
|
||||
"First name: \"" + c.User.FirstName + "\"\n"
|
||||
if c.User.Username != "" {
|
||||
prompt += "Username: @" + c.User.Username + ".\n"
|
||||
|
|
Loading…
Reference in a new issue