-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Allow adding variant via prompttemplate files #14509
Conversation
fixed #14507 Signed-off-by: Jonas Helming <[email protected]>
There was a problem hiding this 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 editing the workspace agent template. Creating a new template and setting it in the AI configuration works fine.
There are some glitches when deleting this file:
- Create this custom variant template
- Set it in the UI for an agent
- Send a request for the agent, observe it is correctly set as system prompt
If the file is now deleted, the following happens:
- It's still shown in the AI configuration UI until the selection is switched back and forth
- Although it's gone, clicking on "Edit" will still open an editor for the no longer existing file
- When sending a request to the agent, it will use NO system prompt
What is likely going on is that, although deleted, Theia AI still tries to use the deleted prompt variant. In the UI this leads to the variant no longer appearing in the dropdown, but still being selected. At request time, the prompt can't be found and then no prompt is used.
This use case should be handled cleaner:
- The UI should be updated immediately
- The Edit button should always open the correct file
- Requests should fallback to their regular prompt
Signed-off-by: Jonas Helming <[email protected]>
Great catch, thank you! New commit should fix the describe issue:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is one more problematic flow:
- When there are multiple variants, the flow works as expected.
- However when there is no variant left, then the UI disables all buttons, the dropdown vanishes, there is no error message and the user can't recover from the state without re-adding a variant
Steps to reproduce:
- Open AI configuration view
- Select workspace agent
- Click "edit", edit the template and use "File > Save As" to save it as a variant
- Select the newly added variant in the UI
- Delete the prompt template again
- Now the UI is in the broken state and does not recover without reloading or readding a variant
One more thing (could be a followup):
- Deleting the variant can also be accomplished via the "Reset" button.
- For these custom variants it would be nice if the button would show "Delete" instead as they are then gone in contrast to the "built-in" variants
Besides this edge case it seems to work great now 👍
packages/ai-core/src/browser/ai-configuration/template-settings-renderer.tsx
Outdated
Show resolved
Hide resolved
Signed-off-by: Jonas Helming <[email protected]>
Great catch, fixed the describe workflow! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great for me. Thanks!
fixed #14507
What it does
Allows users to add custom variants to existing main prompts via adding .prompttemplate files.
If the file name of a .prompttemplate file starts with the id of an existing main prompt, the custom prompt file is treated as a variant.
How to test
Follow-ups
we might allow users to create variants in the UI
Review checklist
Reminder for reviewers