Skip to content
Open
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
1 change: 1 addition & 0 deletions lib/ResponseDefinitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
* optionalOutputShape: array<string, AssistantShapeDescriptor>,
* priority: integer,
* category: array{id: string, name: string},
* preferredProviderName: string|null,
* }
*
* @psalm-type AssistantTaskProcessingTask = array{
Expand Down
10 changes: 10 additions & 0 deletions lib/Service/AssistantService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand All @@ -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');
Expand Down
7 changes: 6 additions & 1 deletion openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,8 @@
"outputShape",
"optionalOutputShape",
"priority",
"category"
"category",
"preferredProviderName"
],
"properties": {
"id": {
Expand Down Expand Up @@ -487,6 +488,10 @@
"type": "string"
}
}
},
"preferredProviderName": {
"type": "string",
"nullable": true
}
}
}
Expand Down
17 changes: 17 additions & 0 deletions src/components/AssistantTextProcessingForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
<div class="session-area__top-bar">
<div class="session-area__top-bar__title">
<EditableTextField :initial-text="selectedTaskType.name ?? ''" />
<span v-if="selectedTaskType.preferredProviderName"
class="session-area__top-bar__provider">
{{ t('assistant', 'Provider:') }} {{ selectedTaskType.preferredProviderName }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{{ t('assistant', 'Provider:') }} {{ selectedTaskType.preferredProviderName }}
{{ t('assistant', 'Provider: {name}', { name: selectedTaskType.preferredProviderName }) }}

Better for RTL languages.

</span>
</div>
</div>
<div v-if="mySelectedTaskTypeId === 'core:text2text:translate'"
Expand Down Expand Up @@ -790,7 +794,20 @@ export default {
background-color: var(--color-main-background);

&__title {
display: flex;
align-items: center;
gap: 0.5em;
width: 100%;
min-width: 0;
}

&__provider {
font-weight: normal;
font-size: 0.9em;
color: var(--color-text-maxcontrast);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/ContextChat/ContextChatInputForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export default {
defaultProviderKey: 'files__default',

sccEnabled: !!this.inputs.scopeType && this.inputs.scopeType !== _ScopeType.NONE && !!this.inputs.scopeList,
indexingComplete: loadState('assistant', 'contextChatIndexingComplete'),
indexingComplete: loadState('assistant', 'contextChatIndexingComplete', false),
}
},

Expand Down
14 changes: 10 additions & 4 deletions src/components/TaskTypeSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
<NcActionButton v-for="t in variants.tasks"
:key="t.id"
:disabled="selectedTask(t)"
:title="t.description"
:title="taskTypeTitle(t)"
:close-after-click="true"
@click="onTaskSelected(t)">
<template #icon>
<div style="width: 16px" />
</template>
{{ t.name }}
{{ taskTypeLabel(t) }}
</NcActionButton>
<template #icon>
<component :is="variants.icon" />
Expand Down Expand Up @@ -61,13 +61,13 @@
<NcActionButton v-for="t in categorySubMenuTaskType.tasks"
:key="t.id"
:disabled="selectedTask(t)"
:title="t.description"
:title="taskTypeTitle(t)"
:close-after-click="true"
@click="onTaskSelected(t)">
<template #icon>
<div style="width: 16px" />
</template>
{{ t.name }}
{{ taskTypeLabel(t) }}
</NcActionButton>
</template>
</NcActions>
Expand Down Expand Up @@ -197,6 +197,12 @@ export default {
},

methods: {
taskTypeLabel(taskType) {
return taskType.name
},
taskTypeTitle(taskType) {
return taskType.description || ''
},
selectedTask(taskType) {
return taskType.id === this.modelValue
},
Expand Down
Loading