Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ai): Add toolbar actions for chat nodes #14181

Merged

Conversation

planger
Copy link
Contributor

@planger planger commented Sep 16, 2024

What it does

Introduces a ChatNodeToolbarActionContribution which allows to add icons to the chat nodes in the Chat UI on hover. Clicking these icons will trigger a command that gets the respective chat node as argument.

Possible use cases are actions for reporting the content, giving feedback, or perform other actions within the tool based on the response.

Contributed on behalf of STMicroelectronics.

How to test

Add a ChatNodeToolbarActionContribution to a frontend module:

bind(ChatNodeToolbarActionContribution).toDynamicValue(context => ({
 getToolbarActions: (args: RequestNode | ResponseNode) => {
     if (isResponseNode(args)) {
         return [{
             commandId: 'core.about',
             icon: 'codicon codicon-feedback',
             tooltip: 'Show about dialog on response nodes'
         }];
     } else {
         return [];
     }
 }

Then trigger a chat and check whether the action appears on hover.

Follow-ups

N/A

Review checklist

Reminder for reviewers

@planger planger force-pushed the add-chatnode-toolbar-actions branch 4 times, most recently from 221493a to edf9b42 Compare September 16, 2024 21:11
Introduces a `ChatNodeToolbarActionContribution` which allows to add icons to the chat nodes in the Chat UI on hover. Clicking these icons will trigger a command that gets the respective chat node as argument.

Possible use cases are actions for reporting the content, giving feedback, or perform other actions within the tool based on the response.

Contributed on behalf of STMicroelectronics.
Copy link
Member

@sdirix sdirix left a comment

Choose a reason for hiding this comment

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

Works for me!

I tested with multiple contributions including different priorities and the toolbar was rendered as expected.

I wonder whether we should add an example to the official Theia examples. Maybe with the hello world command instead of about.

@planger
Copy link
Contributor Author

planger commented Sep 19, 2024

@sdirix Thanks for the review!

Good idea regarding the example. I added a chat node action contribution. I used the about command, however, as I didn't find a better suited command defined in the examples. Please let me know what you think.

@planger planger requested a review from sdirix September 20, 2024 10:49
@planger planger merged commit ed1675b into eclipse-theia:master Sep 23, 2024
11 checks passed
@planger planger deleted the add-chatnode-toolbar-actions branch September 23, 2024 06:16
@planger planger added this to the 1.54.0 milestone Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants