Skip to content

Commit

Permalink
feat: insert images via assistant
Browse files Browse the repository at this point in the history
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
  • Loading branch information
elzody committed Dec 16, 2024
1 parent b96a1df commit f75bab3
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/mixins/assistant.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/

import { translate as t } from '@nextcloud/l10n'
import { generateUrl } from '@nextcloud/router'
import axios from '@nextcloud/axios'

const SupportedTaskTypes = {
Text: 'core:text2text',
Expand Down Expand Up @@ -39,6 +41,7 @@ export default {
break

case SupportedTaskTypes.Image:
this.insertAIImages(task.output.images)
break

default:
Expand All @@ -51,5 +54,21 @@ export default {
Data: text,
})
},
async insertAIImages(images) {
// TODO: Clean this up, things here are for testing still
const firstImage = images[0]
const response = await axios({
method: 'post',
url: generateUrl('apps/richdocuments/assets/tasks'),
data: {
fileId: firstImage,
},
})

this.sendPostMessage('Action_InsertGraphic', {
filename: 'something.png',
url: response.data.url,
})
},
},
}

0 comments on commit f75bab3

Please sign in to comment.