Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,11 +352,11 @@ public function getCapabilities(): array {
$capabilities['config']['call']['can-enable-sip'] = $this->talkConfig->canUserEnableSIP($user);
}

$supportedTaskTypes = $this->taskProcessingManager->getAvailableTaskTypes();
if (isset($supportedTaskTypes[TextToTextSummary::ID])) {
$supportedTaskTypeIds = $this->taskProcessingManager->getAvailableTaskTypeIds();
if (in_array(TextToTextSummary::ID, $supportedTaskTypeIds, true)) {
$capabilities['features'][] = 'chat-summary-api';
}
if (isset($supportedTaskTypes[TextToTextTranslate::ID])) {
if (in_array(TextToTextTranslate::ID, $supportedTaskTypeIds, true)) {
$capabilities['config']['chat']['has-translation-task-providers'] = true;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Controller/ChatController.php
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,8 @@ public function summarizeChat(
): DataResponse {
$fromMessageId = max(0, $fromMessageId);

$supportedTaskTypes = $this->taskProcessingManager->getAvailableTaskTypes();
if (!isset($supportedTaskTypes[TextToTextSummary::ID])) {
$supportedTaskTypeIds = $this->taskProcessingManager->getAvailableTaskTypeIds();
if (!in_array(TextToTextSummary::ID, $supportedTaskTypeIds, true)) {
return new DataResponse([
'error' => ChatSummaryException::REASON_AI_ERROR,
], Http::STATUS_BAD_REQUEST);
Expand Down
8 changes: 4 additions & 4 deletions lib/Service/RecordingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ public function store(Room $room, string $owner, array $file): void {
return;
}

$supportedTaskTypes = $this->taskProcessingManager->getAvailableTaskTypes();
if (!isset($supportedTaskTypes[AudioToText::ID])) {
$supportedTaskTypeIds = $this->taskProcessingManager->getAvailableTaskTypeIds();
if (!in_array(AudioToText::ID, $supportedTaskTypeIds, true)) {
$this->logger->error('Can not transcribe call recording as no Audio2Text task provider is available');
return;
}
Expand Down Expand Up @@ -258,8 +258,8 @@ public function storeTranscript(string $owner, string $roomToken, int $recording
return;
}

$supportedTaskTypes = $this->taskProcessingManager->getAvailableTaskTypes();
if (!isset($supportedTaskTypes[TextToTextSummary::ID])) {
$supportedTaskTypeIds = $this->taskProcessingManager->getAvailableTaskTypeIds();
if (!in_array(TextToTextSummary::ID, $supportedTaskTypeIds, true)) {
$this->logger->error('Can not summarize call recording as no TextToTextSummary task provider is available');
return;
}
Expand Down
12 changes: 6 additions & 6 deletions tests/php/CapabilitiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ public function testGetCapabilitiesUserAllowed(bool $isNotAllowed, bool $canCrea
$user->method('getQuota')
->willReturn($quota);

$this->taskProcessingManager->method('getAvailableTaskTypes')
->willReturn([TextToTextSummary::ID => true]);
$this->taskProcessingManager->method('getAvailableTaskTypeIds')
->willReturn([TextToTextSummary::ID]);

$this->serverConfig->expects($this->any())
->method('getAppValue')
Expand Down Expand Up @@ -509,8 +509,8 @@ public function testCapabilitiesTranslations(): void {
public function testCapabilitiesTranslationsTaskProviders(): void {
$capabilities = $this->getCapabilities();

$this->taskProcessingManager->method('getAvailableTaskTypes')
->willReturn([TextToTextTranslate::ID => true]);
$this->taskProcessingManager->method('getAvailableTaskTypeIds')
->willReturn([TextToTextTranslate::ID]);

$data = json_decode(json_encode($capabilities->getCapabilities(), JSON_THROW_ON_ERROR), true);
$this->assertEquals(true, $data['spreed']['config']['chat']['has-translation-task-providers']);
Expand All @@ -519,8 +519,8 @@ public function testCapabilitiesTranslationsTaskProviders(): void {
public function testSummaryTaskProviders(): void {
$capabilities = $this->getCapabilities();

$this->taskProcessingManager->method('getAvailableTaskTypes')
->willReturn([TextToTextFormalization::ID => true]);
$this->taskProcessingManager->method('getAvailableTaskTypeIds')
->willReturn([TextToTextFormalization::ID]);

$data = json_decode(json_encode($capabilities->getCapabilities(), JSON_THROW_ON_ERROR), true);
$this->assertNotContains('chat-summary-api', $data['spreed']['features']);
Expand Down
Loading