diff --git a/lib/Settings/Admin.php b/lib/Settings/Admin.php
index 419f27d9..6aae60b0 100644
--- a/lib/Settings/Admin.php
+++ b/lib/Settings/Admin.php
@@ -9,8 +9,16 @@
use OCA\Github\Service\SecretService;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
+use OCP\Files\File;
+use OCP\Files\IRootFolder;
use OCP\IConfig;
use OCP\Settings\ISettings;
+use OCP\SpeechToText\ISpeechToTextManager;
+use OCP\TaskProcessing\IManager;
+use OCP\TaskProcessing\Task;
+use OCP\TaskProcessing\TaskTypes\TextToText;
+use OCP\TextProcessing\FreePromptTaskType;
+use OCP\TextProcessing\IManager as TextProcessingIManager;
class Admin implements ISettings {
@@ -18,6 +26,10 @@ public function __construct(
private SecretService $secretService,
private IConfig $config,
private IInitialState $initialStateService,
+ private IManager $taskprocessingManager,
+ private TextProcessingIManager $textProcessingManager,
+ private ISpeechToTextManager $speechToTextManager,
+ private IRootFolder $root,
) {
}
@@ -34,6 +46,20 @@ public function getForm(): TemplateResponse {
$allowDefaultTokenToAnonymous = $this->config->getAppValue(Application::APP_ID, 'allow_default_link_token_to_anonymous', '0') === '1';
$allowDefaultTokenToGuests = $this->config->getAppValue(Application::APP_ID, 'allow_default_link_token_to_guests', '0') === '1';
+// $task = new Task(TextToText::ID, ['input' => 'count to 4 reverse'], Application::APP_ID, 'admin');
+// $task = $this->taskprocessingManager->runTask($task);
+// $clientID = $task->getOutput()['output'];
+
+// $textProTask = new \OCP\TextProcessing\Task(FreePromptTaskType::class, 'count to 5 random', Application::APP_ID, 'admin');
+// $output = $this->textProcessingManager->runTask($textProTask);
+// $clientID = $output;
+
+// $adminFolder = $this->root->getUserFolder('admin');
+// $file = $adminFolder->getFirstNodeById(766);
+// if ($file !== null && $file instanceof File) {
+// $clientID = $this->speechToTextManager->transcribeFile($file, 'admin', 'integration_github');
+// }
+
$adminConfig = [
'client_id' => $clientID,
'client_secret' => $clientSecret === '' ? '' : 'dummyClientSecret',
diff --git a/src/components/AdminSettings.vue b/src/components/AdminSettings.vue
index d8fa4d63..10e93440 100644
--- a/src/components/AdminSettings.vue
+++ b/src/components/AdminSettings.vue
@@ -8,6 +8,10 @@
{{ t('integration_github', 'If you want to allow your Nextcloud users to use OAuth to authenticate to https://github.com, create an OAuth application in your GitHub settings.') }} {{ t('integration_github', 'GitHub OAuth settings') }} @@ -140,6 +144,7 @@ export default { // to prevent some browsers to fill fields with remembered passwords readonly: true, redirect_uri: window.location.protocol + '//' + window.location.host, + text: '', } }, @@ -150,6 +155,35 @@ export default { }, methods: { + onButtonClick() { + if (OCA.Assistant.openAssistantForm) { + OCA.Assistant.openAssistantForm({ + appId: 'spreed', + customId: 'message translation', + // taskType: 'core:text2text:translate', + taskType: 'core:text2text', + inputs: { + // input: { fileId: 3296 }, + input: { filePath: '/aaa.md' }, + // input: 'the content of the message', + }, + taskTypeIdList: [ + 'richdocuments:text_to_text_document', + 'core:text2text', + 'core:audio2text', + ], + closeOnResult: false, + }).then(task => { + console.debug('assistant promise result', task) + if (task.status === 'STATUS_SUCCESSFUL') { + this.text = task.output.output + console.debug('assistant result task output', task.output.output) + } else { + console.debug('assistant result task', task) + } + }) + } + }, onCheckboxChanged(newValue, key) { this.state[key] = newValue this.saveOptions({ [key]: this.state[key] ? '1' : '0' }, false)