diff --git a/lib/Controller/ChattyLLMController.php b/lib/Controller/ChattyLLMController.php index 2288a33f..421c2f9e 100644 --- a/lib/Controller/ChattyLLMController.php +++ b/lib/Controller/ChattyLLMController.php @@ -36,7 +36,7 @@ #[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)] class ChattyLLMController extends Controller { - private array $agencyActionNames; + private array $agencyActionData; public function __construct( string $appName, @@ -51,19 +51,47 @@ public function __construct( private ?string $userId, ) { parent::__construct($appName, $request); - $this->agencyActionNames = [ - 'send_message_to_conversation' => $this->l10n->t('Send a message to a Talk conversation'), - 'list_talk_conversations' => $this->l10n->t('List Talk conversations'), - 'list_messages_in_conversation' => $this->l10n->t('List messages in a Talk conversation'), - 'schedule_event' => $this->l10n->t('Schedule a calendar event'), - 'list_calendars' => $this->l10n->t('List calendars'), + $this->agencyActionData = [ + // talk + 'send_message_to_conversation' => [ + 'title' => $this->l10n->t('Send a message to a Talk conversation'), + 'icon' => 'Send', + ], + 'create_public_conversation' => [ + 'title' => $this->l10n->t('Create a conversation'), + 'icon' => 'ChatPlus', + ], + // mail + 'send_email' => [ + 'title' => $this->l10n->t('Send an email'), + 'icon' => 'EmailPlus', + ], + // calendar + 'schedule_event' => [ + 'title' => $this->l10n->t('Schedule a calendar event'), + 'icon' => 'CalendarPlus', + ], + 'add_task' => [ + 'title' => $this->l10n->t('Add a calendar task'), + 'icon' => 'CalendarCheck', + ], + // deck + 'add_card' => [ + 'title' => $this->l10n->t('Create a Deck card'), + 'icon' => 'CardPlus', + ], ]; } private function improveAgencyActionNames(array $actions): array { return array_map(function ($action) { - if (isset($action->name) && isset($this->agencyActionNames[$action->name])) { - $action->name = $this->agencyActionNames[$action->name]; + if (isset($action->name, $this->agencyActionData[$action->name])) { + if (isset($this->agencyActionData[$action->name]['icon'])) { + $action->icon = $this->agencyActionData[$action->name]['icon']; + } + if (isset($this->agencyActionData[$action->name]['title'])) { + $action->name = $this->agencyActionData[$action->name]['title']; + } } return $action; }, $actions); diff --git a/package-lock.json b/package-lock.json index b251c91d..41070fe7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "0.0.1", "license": "AGPL-3.0", "dependencies": { + "@mdi/js": "^7.4.47", "@mdi/svg": "^7.4.47", "@nextcloud/auth": "^2.0.0", "@nextcloud/axios": "^2.0.0", diff --git a/package.json b/package.json index 16ff8346..698b9bfa 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "npm": "^10.0.0" }, "dependencies": { + "@mdi/js": "^7.4.47", "@mdi/svg": "^7.4.47", "@nextcloud/auth": "^2.0.0", "@nextcloud/axios": "^2.0.0", diff --git a/src/components/ChattyLLM/AgencyAction.vue b/src/components/ChattyLLM/AgencyAction.vue index bac9dfbb..76a74bce 100644 --- a/src/components/ChattyLLM/AgencyAction.vue +++ b/src/components/ChattyLLM/AgencyAction.vue @@ -4,39 +4,47 @@ --> @@ -57,12 +96,29 @@ export default { diff --git a/src/components/ChattyLLM/AgencyActions.vue b/src/components/ChattyLLM/AgencyActions.vue index b6065d78..ced316e2 100644 --- a/src/components/ChattyLLM/AgencyActions.vue +++ b/src/components/ChattyLLM/AgencyActions.vue @@ -6,7 +6,8 @@
+ :action="action" + class="action" />
@@ -32,8 +33,12 @@ export default { diff --git a/src/components/ChattyLLM/AgencyConfirmation.vue b/src/components/ChattyLLM/AgencyConfirmation.vue index c16d56f7..fe8b0bce 100644 --- a/src/components/ChattyLLM/AgencyConfirmation.vue +++ b/src/components/ChattyLLM/AgencyConfirmation.vue @@ -3,7 +3,7 @@ - SPDX-License-Identifier: AGPL-3.0-or-later --> - - {{ t('assistant', 'Confirm those actions') }} - - - {{ t('assistant', 'Cancel') }} + + {{ t('assistant', 'Confirm those actions') }} + +