nextcloud / assistant

✨ Nextcloud Assistant
GNU Affero General Public License v3.0
23 stars 4 forks source link

Integration improvements #18

Closed julien-nc closed 8 months ago

julien-nc commented 9 months ago

refs https://github.com/nextcloud/text/issues/4686

https://github.com/nextcloud/assistant/assets/11291457/5d579c0b-7ee5-4368-97ef-78ff519ff46d

const params = {
    appId: 'plopApp',
    identifier: 'idid',
    input: 'give me a short summary of a simple settings section about GitHub',
    closeOnResult: false,
    actionButtons: [
        {
            label: 'Put in field 1',
            title: 'Title 1',
            type: 'warning',
            iconSvg: cogSvg,
            onClick: (task) => { this.field1 = task.output },
        },
        {
            label: 'Put in field 2',
            title: 'Title 2',
            onClick: (task) => { this.field2 = task.output },
        },
    ],
}
OCA.TPAssistant.openAssistantForm(params)

Is it enough to get the task output as parameter of button callbacks? I could refactor a bit and make it possible to get the task itself if necessary.

juliushaertl commented 9 months ago

Awesome. The task would be nice as we maintain the list of tasks as local state in text, so we could update that right away.

julien-nc commented 9 months ago

Done.

One little detail: If the user edits the result before pressing the action button, the value of the text area is passed to the action button, not the value that we really got in the task. I thought it would make sense as users might want to adjust the result in the Assistant UI before pressing a button.

julien-nc commented 9 months ago

Oh and the code example has been adjusted.