diff --git a/lib/ResponseDefinitions.php b/lib/ResponseDefinitions.php index be72deca..e7248ae0 100644 --- a/lib/ResponseDefinitions.php +++ b/lib/ResponseDefinitions.php @@ -30,6 +30,7 @@ * optionalOutputShape: array, * priority: integer, * category: array{id: string, name: string}, + * preferredProviderName: string|null, * } * * @psalm-type AssistantTaskProcessingTask = array{ diff --git a/lib/Service/AssistantService.php b/lib/Service/AssistantService.php index 99c88769..7dca19b4 100644 --- a/lib/Service/AssistantService.php +++ b/lib/Service/AssistantService.php @@ -336,6 +336,14 @@ public function getAvailableTaskTypes(): array { } /** @var string $typeId */ foreach ($availableTaskTypes as $typeId => $taskTypeArray) { + $preferredProviderName = null; + try { + $preferredProviderName = $this->taskProcessingManager->getPreferredProvider($typeId)->getName(); + } catch (TaskProcessingException $e) { + $this->logger->debug('Could not get preferred provider for task type ' . $typeId . ': ' . $e->getMessage()); + } catch (\Throwable $e) { + $this->logger->debug('Unexpected error while getting preferred provider for task type ' . $typeId . ': ' . $e->getMessage()); + } // skip chat, chat with tools and ContextAgent task types (not directly useful to the end user) if (!self::DEBUG) { // this appeared in 33, this is true if the task type class extends the IInternalTaskType @@ -383,6 +391,7 @@ public function getAvailableTaskTypes(): array { 'optionalInputShapeDefaults' => [], 'optionalOutputShape' => [], 'priority' => self::TASK_TYPE_PRIORITIES['chatty-llm'] ?? 1000, + 'preferredProviderName' => $preferredProviderName, ]; // do not add the raw TextToTextChat type if (!self::DEBUG) { @@ -392,6 +401,7 @@ public function getAvailableTaskTypes(): array { $taskTypeArray['id'] = $typeId; $taskTypeArray['priority'] = self::TASK_TYPE_PRIORITIES[$typeId] ?? 1000; $taskTypeArray['category'] = $this->getCategory($typeId); + $taskTypeArray['preferredProviderName'] = $preferredProviderName; if ($typeId === TextToText::ID) { $taskTypeArray['name'] = $this->l10n->t('Generate text'); diff --git a/openapi.json b/openapi.json index 851338be..2db53a8a 100644 --- a/openapi.json +++ b/openapi.json @@ -433,7 +433,8 @@ "outputShape", "optionalOutputShape", "priority", - "category" + "category", + "preferredProviderName" ], "properties": { "id": { @@ -487,6 +488,10 @@ "type": "string" } } + }, + "preferredProviderName": { + "type": "string", + "nullable": true } } } diff --git a/src/components/AssistantTextProcessingForm.vue b/src/components/AssistantTextProcessingForm.vue index 9eab6770..bf9d2450 100644 --- a/src/components/AssistantTextProcessingForm.vue +++ b/src/components/AssistantTextProcessingForm.vue @@ -53,6 +53,10 @@
+ + {{ t('assistant', 'Provider:') }} {{ selectedTaskType.preferredProviderName }} +
- {{ t.name }} + {{ taskTypeLabel(t) }} @@ -197,6 +197,12 @@ export default { }, methods: { + taskTypeLabel(taskType) { + return taskType.name + }, + taskTypeTitle(taskType) { + return taskType.description || '' + }, selectedTask(taskType) { return taskType.id === this.modelValue },