-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] duplicate conversations #208044
[Observability AI Assistant] duplicate conversations #208044
Conversation
Pinging @elastic/obs-ai-assistant (Team:Obs AI Assistant) |
...gins/shared/observability_solution/observability_ai_assistant/server/service/client/index.ts
Outdated
Show resolved
Hide resolved
...olutions/observability/plugins/observability_ai_assistant_app/server/rule_connector/index.ts
Outdated
Show resolved
Hide resolved
8d79ec4
to
5aae81a
Compare
x-pack/platform/packages/shared/kbn-ai-assistant/src/hooks/use_conversation.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.
@arturoliduena Is this PR ready for review?
@sorenlouv I’ve marked this PR as draft because it was initially ready for review, but we’ve changed the approach. It’s now a WIP. |
d522071
to
3ab94b5
Compare
x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/chat_body.tsx
Outdated
Show resolved
Hide resolved
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
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.
Hey @arturoliduena
I added some comments about the UI and some functionality.
Do we want to allow users to fork private
conversations too?
Or should we only have this option for shared
conversations?
(I can see the option is available for both private and shared conversations)
x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/chat_actions_menu.tsx
Outdated
Show resolved
Hide resolved
x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/chat_body.tsx
Outdated
Show resolved
Hide resolved
x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/chat_header.tsx
Outdated
Show resolved
Hide resolved
x-pack/platform/packages/shared/kbn-ai-assistant/src/chat/chat_body.tsx
Outdated
Show resolved
Hide resolved
@arturoliduena |
Thank you @viduni94, I added that users can only fork shared conversations |
@viduni94 @isaclfreire In the meantime, I’ve temporarily replaced the |
Hello, here's my comments:
Thanks everyone for the awesome work 👍 |
@@ -75,10 +84,6 @@ export function useConversation({ | |||
const initialMessages = useOnce(initialMessagesFromProps); | |||
const initialTitle = useOnce(initialTitleFromProps); | |||
|
|||
if (initialMessages.length && initialConversationId) { | |||
throw new Error('Cannot set initialMessages if initialConversationId is set'); |
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.
Hmmm, I'm not sure whether we should remove this 🤔
Any thoughts @dgieselaar @sorenlouv ?
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.
@arturoliduena
I know you might have removed this to fix https://github.com/elastic/kibana/pull/208044/files#r1971621797
But I'm not sure what other things might break if we remove this..
Let's wait to hear from Dario or Soren
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.
Cz there's a specific test to cover this scenario too - https://github.com/elastic/kibana/pull/208044/files#diff-6ae996f673c49cb1e5b461807ab7f7689995b08ebacf84ba47824bdab46a231eL87
So I'm guessing this validation is important. I'm not 100% sure though
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.
@viduni94, we don’t need to catch this error anymore, as there’s now a valid case for it, duplicating a conversation when the initial messages aren’t empty.
What this check was originally preventing is:
When a user starts a conversation with an initial message and then navigates to another conversation using a conversation ID, the previous conversation’s messages are lost. However, this only happens if the conversation was started from Contextual Insights, since those conversations are not persisted. If the user navigates away, the messages are lost, which is what this validation was trying to prevent.
In reality, though, users cannot navigate to another conversation in this scenario because the conversation list is hidden. I believe we should allow users to navigate freely (for another discussion) if they lose their messages, they can always start a new conversation from Contextual Insights again.
Additionally, when updating the title, a separate validation already handles this, so the title (pencil icon) cannot be edited when the conversation hasn’t been stored yet.
This change fixes the original bug while also removing unnecessary code.
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.
To close this thread, as discussed during the dev sync.. instead of removing this check, consider resetting initial messages when navigating to a stored conversation with conversationId.
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.
Done! Instead of removing the check, I’ve added a reset for initialMessages when duplicating the conversation.
We can open a new issue to enable the conversation list in the flyout for conversations opened from Contextual Insights and apply the same changes there.
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.
We can open a new issue to enable the conversation list in the flyout
If you enable the conversation list and click on "New conversation" after initialMessages
are set from contextual insights, does the initial messages get cleared?
(It might still be there, since the messages in use_chat
is not cleared with the solution in this PR)
Unless you do the below when clicked on "New conversation" (to reset initial messages)
service.conversations.openNewConversation({
messages: [],
});
But this will close and re-open the flyout.
Hi @arturoliduena I'm trying to test this in the UI. Can you provide directions? I'm trying it locally, stateful, and have alerts but I don't see how to share them. Should I be able to share conversations not created by alerts, too? I see you added some integration tests but having some functional UI tests would probably be good as well. |
@neptunian To manually test this:
Screen.Recording.2025-02-28.at.11.54.03.mov |
x-pack/platform/packages/shared/kbn-ai-assistant/src/hooks/use_conversation.ts
Outdated
Show resolved
Hide resolved
…_body.tsx Co-authored-by: Viduni Wickramarachchi <viduni.ushanka@gmail.com>
…_body.tsx Co-authored-by: Viduni Wickramarachchi <viduni.ushanka@gmail.com>
8b79614
to
f143b17
Compare
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
History
|
Starting backport for target branches: 8.x |
Closes elastic#209382 ### Summary: #### Duplicate Conversation - **Readonly** → Public conversations can only be modified by the owner. - Duplicated conversations are **owned** by the user who duplicates them. - Duplicated conversations are **private** by default `public: false`. https://github.com/user-attachments/assets/9a2d1727-aa0d-4d8f-a886-727c0ce1578c UPDATE: https://github.com/user-attachments/assets/ee3282e8-5ae8-445d-9368-928dd59cfb75 ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) (cherry picked from commit b331fa1)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…213167) # Backport This will backport the following commits from `main` to `8.x`: - [[Observability AI Assistant] duplicate conversations (#208044)](#208044) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Arturo Lidueña","email":"arturo.liduena@elastic.co"},"sourceCommit":{"committedDate":"2025-03-04T22:15:37Z","message":"[Observability AI Assistant] duplicate conversations (#208044)\n\nCloses #209382\n\n### Summary:\n\n#### Duplicate Conversation \n- **Readonly** → Public conversations can only be modified by the owner.\n- Duplicated conversations are **owned** by the user who duplicates\nthem.\n- Duplicated conversations are **private** by default `public: false`. \n \n\nhttps://github.com/user-attachments/assets/9a2d1727-aa0d-4d8f-a886-727c0ce1578c\n\nUPDATE:\n\n\nhttps://github.com/user-attachments/assets/ee3282e8-5ae8-445d-9368-928dd59cfb75\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"b331fa1c53f817c0e9c372ab4e5939551550ab9c","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:feature","Team:Obs AI Assistant","ci:project-deploy-observability","backport:version","v9.1.0","v8.19.0"],"title":"[Observability AI Assistant] duplicate conversations","number":208044,"url":"https://github.com/elastic/kibana/pull/208044","mergeCommit":{"message":"[Observability AI Assistant] duplicate conversations (#208044)\n\nCloses #209382\n\n### Summary:\n\n#### Duplicate Conversation \n- **Readonly** → Public conversations can only be modified by the owner.\n- Duplicated conversations are **owned** by the user who duplicates\nthem.\n- Duplicated conversations are **private** by default `public: false`. \n \n\nhttps://github.com/user-attachments/assets/9a2d1727-aa0d-4d8f-a886-727c0ce1578c\n\nUPDATE:\n\n\nhttps://github.com/user-attachments/assets/ee3282e8-5ae8-445d-9368-928dd59cfb75\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"b331fa1c53f817c0e9c372ab4e5939551550ab9c"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/208044","number":208044,"mergeCommit":{"message":"[Observability AI Assistant] duplicate conversations (#208044)\n\nCloses #209382\n\n### Summary:\n\n#### Duplicate Conversation \n- **Readonly** → Public conversations can only be modified by the owner.\n- Duplicated conversations are **owned** by the user who duplicates\nthem.\n- Duplicated conversations are **private** by default `public: false`. \n \n\nhttps://github.com/user-attachments/assets/9a2d1727-aa0d-4d8f-a886-727c0ce1578c\n\nUPDATE:\n\n\nhttps://github.com/user-attachments/assets/ee3282e8-5ae8-445d-9368-928dd59cfb75\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"b331fa1c53f817c0e9c372ab4e5939551550ab9c"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Arturo Lidueña <arturo.liduena@elastic.co>
Closes #209382
Summary:
Duplicate Conversation
public: false
.Screen.Recording.2025-02-12.at.15.19.11.mov
UPDATE:
Screen.Recording.2025-02-18.at.12.32.38.mov
Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.
release_note:breaking
label should be applied in these situations.release_note:*
label is applied per the guidelinesIdentify risks
Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss.
Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging.