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
[Observability AI Assistant] Use up / down arrows to select up to 5 previously used prompts #179696
base: main
Are you sure you want to change the base?
Conversation
Pinging @elastic/obs-knowledge-team (Team:obs-knowledge) |
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
...s/observability_solution/observability_ai_assistant_app/public/hooks/use_previous_prompts.ts
Outdated
Show resolved
Hide resolved
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.
nice addition!
46e85d1
to
774d549
Compare
...s/observability_solution/observability_ai_assistant_app/public/hooks/use_previous_prompts.ts
Outdated
Show resolved
Hide resolved
...s/observability_solution/observability_ai_assistant_app/public/hooks/use_previous_prompts.ts
Outdated
Show resolved
Hide resolved
...s/observability_solution/observability_ai_assistant_app/public/hooks/use_previous_prompts.ts
Outdated
Show resolved
Hide resolved
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.
Two things I've noticed:
- I can't clear a previously used prompt, even though it looks like there is a clear button. Clearing it actually selects it.
- WDYT about only enabling this when there is no input text? I can imagine people want to use the up/down arrows for other reasons once they've entered text. (e.g. to scroll back)
Two more cents here:
|
|
|
5db59ca
to
28e1280
Compare
.../observability_solution/observability_ai_assistant_app/public/hooks/use_last_used_prompts.ts
Outdated
Show resolved
Hide resolved
...ty_solution/observability_ai_assistant_app/public/components/prompt_editor/prompt_editor.tsx
Outdated
Show resolved
Hide resolved
.../observability_solution/observability_ai_assistant_app/public/hooks/use_last_used_prompts.ts
Outdated
Show resolved
Hide resolved
.../observability_solution/observability_ai_assistant_app/public/hooks/use_last_used_prompts.ts
Outdated
Show resolved
Hide resolved
.../observability_solution/observability_ai_assistant_app/public/hooks/use_last_used_prompts.ts
Outdated
Show resolved
Hide resolved
...gins/observability_solution/observability_ai_assistant_app/public/utils/shared_providers.tsx
Outdated
Show resolved
Hide resolved
def013d
to
901e0e3
Compare
...ins/observability_solution/observability_ai_assistant_app/public/hooks/use_local_storage.tsx
Outdated
Show resolved
Hide resolved
...gins/observability_solution/observability_ai_assistant_app/public/utils/shared_providers.tsx
Outdated
Show resolved
Hide resolved
...ty_solution/observability_ai_assistant_app/public/components/prompt_editor/prompt_editor.tsx
Outdated
Show resolved
Hide resolved
...ty_solution/observability_ai_assistant_app/public/components/prompt_editor/prompt_editor.tsx
Outdated
Show resolved
Hide resolved
content: selectedOption.label, | ||
}); | ||
setSelectablePopoverOpen(false); | ||
onFocus(); |
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.
Shouldn't onFocus
be called when the EuiInputPopover
element moves focus back to the text area? I'm assuming it does do that, and if not, should we do that ourselves? Depending on what we do on focus in the consumer of this component, maybe that doesn't matter much.
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.
handleClosePopover
on line 89 also calls onFocus
. I removed the onFocus
here and the focus is correctly passed back to the text area.
x-pack/plugins/observability_solution/observability_ai_assistant_app/public/hooks/use_kibana.ts
Outdated
Show resolved
Hide resolved
...ins/observability_solution/observability_ai_assistant_app/public/hooks/use_local_storage.tsx
Outdated
Show resolved
Hide resolved
.../observability_solution/observability_ai_assistant_app/public/hooks/use_last_used_prompts.ts
Outdated
Show resolved
Hide resolved
...gins/observability_solution/observability_ai_assistant_app/public/utils/shared_providers.tsx
Outdated
Show resolved
Hide resolved
...ins/observability_solution/observability_ai_assistant_app/public/hooks/use_local_storage.tsx
Outdated
Show resolved
Hide resolved
d029a39
to
0143c3d
Compare
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Canvas Sharable Runtime
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @CoenWarmer |
Summary
This adds storing the last 5 used prompts in local storage for quick reuse.
Triggered by using the up or down arrow keys while the natural language prompt textarea editor has focus.
Screen.Recording.2024-03-29.at.15.46.30.mov