diff options
Diffstat (limited to 'Omni/Agent/Telegram.hs')
| -rw-r--r-- | Omni/Agent/Telegram.hs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Omni/Agent/Telegram.hs b/Omni/Agent/Telegram.hs index e59570a..de84e49 100644 --- a/Omni/Agent/Telegram.hs +++ b/Omni/Agent/Telegram.hs @@ -867,6 +867,9 @@ handleAuthorizedMessageContinued tgConfig provider engineCfg msg uid userName ch Memory.getConversationContext uid chatId maxConversationTokens putText <| "Conversation context: " <> tshow contextTokens <> " tokens" + now <- getCurrentTime + _ <- forkIO <| Memory.saveChatHistoryEntry chatId (Just uid) "user" (Just userName) userMessage now + processEngagedMessage tgConfig provider engineCfg msg uid userName chatId userMessage conversationContext handleAuthorizedMessageBatch :: @@ -999,6 +1002,9 @@ handleAuthorizedMessageBatch tgConfig provider engineCfg msg uid userName chatId Memory.getConversationContext uid chatId maxConversationTokens putText <| "Conversation context: " <> tshow contextTokens <> " tokens" + now <- getCurrentTime + _ <- forkIO <| Memory.saveChatHistoryEntry chatId (Just uid) "user" (Just userName) userMessage now + processEngagedMessage tgConfig provider engineCfg msg uid userName chatId userMessage conversationContext processEngagedMessage :: @@ -1212,6 +1218,11 @@ processEngagedMessage tgConfig provider engineCfg msg uid userName chatId userMe then void <| Memory.saveGroupMessage chatId threadId Memory.AssistantRole "Ava" response else void <| Memory.saveMessage uid chatId Memory.AssistantRole Nothing response + unless (Text.null response) <| do + nowResp <- getCurrentTime + _ <- forkIO <| Memory.saveChatHistoryEntry chatId (Just uid) "assistant" (Just "Ava") response nowResp + pure () + if Text.null response then do if isGroup |
