|
15 | 15 | use OCA\Assistant\Db\ChattyLLM\MessageMapper; |
16 | 16 | use OCA\Assistant\Db\ChattyLLM\Session; |
17 | 17 | use OCA\Assistant\Db\ChattyLLM\SessionMapper; |
18 | | -use OCP\IAppConfig; |
19 | 18 | use OCP\BackgroundJob\IJobList; |
20 | 19 | use OCP\DB\Exception; |
| 20 | +use OCP\IAppConfig; |
21 | 21 | use OCP\TaskProcessing\Task; |
22 | 22 | use OCP\TaskProcessing\TaskTypes\TextToText; |
23 | 23 | use Psr\Log\LoggerInterface; |
@@ -121,15 +121,14 @@ public function getMemories(?string $userId): array { |
121 | 121 | $memory = $session->getSummary(); |
122 | 122 | if (!$session->getIsSummaryUpToDate()) { |
123 | 123 | $lastNMessages = intval($this->appConfig->getValueString(Application::APP_ID, 'chat_last_n_messages', '10')); |
124 | | - $chatHistory = $this->messageMapper->getMessages($session->getId(),0, $lastNMessages); |
125 | | - $memory .= "The summary is outdated. These are the last messages in the raw chat history: " . json_encode($chatHistory); |
| 124 | + $chatHistory = $this->messageMapper->getMessages($session->getId(), 0, $lastNMessages); |
| 125 | + $memory .= 'The summary is outdated. These are the last messages in the raw chat history: ' . json_encode($chatHistory); |
126 | 126 | } |
127 | 127 |
|
128 | | - } |
129 | | - else { |
| 128 | + } else { |
130 | 129 | $lastNMessages = intval($this->appConfig->getValueString(Application::APP_ID, 'chat_last_n_messages', '10')); |
131 | | - $chatHistory = $this->messageMapper->getMessages($session->getId(),0, $lastNMessages); |
132 | | - $memory = "This is the raw chat history of a chat between the user and Assistant: " . json_encode($chatHistory); |
| 130 | + $chatHistory = $this->messageMapper->getMessages($session->getId(), 0, $lastNMessages); |
| 131 | + $memory = 'This is the raw chat history of a chat between the user and Assistant: ' . json_encode($chatHistory); |
133 | 132 | } |
134 | 133 | $memories[] = $memory; |
135 | 134 | } |
|
0 commit comments