Merge pull request #10611 from nextcloud/fix/use-text2text

fix(summarizeMessages): use TextToText
This commit is contained in:
Christoph Wurst 2025-01-27 17:09:54 +01:00 коммит произвёл GitHub
Родитель 1c46bab097 40ab10fc71
Коммит e052cb66d9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -23,7 +23,7 @@ use OCP\IConfig;
use OCP\TaskProcessing\Exception\Exception as TaskProcessingException;
use OCP\TaskProcessing\IManager as TaskProcessingManager;
use OCP\TaskProcessing\Task as TaskProcessingTask;
use OCP\TaskProcessing\TaskTypes\TextToTextSummary;
use OCP\TaskProcessing\TaskTypes\TextToText;
use OCP\TextProcessing\FreePromptTaskType;
use OCP\TextProcessing\IManager;
use OCP\TextProcessing\SummaryTaskType;
@ -67,7 +67,7 @@ PROMPT;
*/
public function summarizeMessages(Account $account, array $messages): void {
try {
$this->taskProcessingManager->getPreferredProvider(TextToTextSummary::ID);
$this->taskProcessingManager->getPreferredProvider(TextToText::ID);
} catch (TaskProcessingException $e) {
$this->logger->info('No text summary provider available');
return;
@ -104,7 +104,7 @@ PROMPT;
"Here is the ***E-MAIL*** for which you must generate a helpful summary: \r\n" .
"***START_OF_E-MAIL***\r\n$messageBody\r\n***END_OF_E-MAIL***\r\n";
$task = new TaskProcessingTask(
TextToTextSummary::ID,
TextToText::ID,
[
'max_tokens' => 1024,
'input' => $prompt,