mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
## Summary Fixes a small UI bug in the citations feature. Previously, after a message with citations finished streaming, the citations would disappear for a fraction of a second and then reappear again. This PR makes improves the UI by making the citations not flash off and on after the stream finishes. ### Changes: - Fix flashing citations - Refactor code related to parsing content references (to make it more maintainable). - Update the citations prompt slightly. ### Before: https://github.com/user-attachments/assets/1021dd53-018a-43ba-b1f4-24aab44faca9 <img width="1782" alt="image" src="https://github.com/user-attachments/assets/723cd29a-48a2-48e7-b031-0893484746b9" /> ### After: https://github.com/user-attachments/assets/21f340bc-9015-42b6-a574-0439d2f8f192 ### How to test - Enable the feature flag ```yaml # kibana.dev.yml xpack.securitySolution.enableExperimental: ['contentReferencesEnabled'] ``` - Open the security assistant - Ask it a question about your alerts of a document in your KB. The response should contain citations. - Observe the response stream carefully. Ensure the citations e.g. `[1]` do not flash off and on when the response stream finishes. The expected behavior is that while the message is streaming, the citations are disabled and once the stream finishes the citations get enabled (while always being visible). #### Edge case to test It is possible that citations completely disappear after streaming finishes. This happens when the LLM produces an invalid citation. Invalid citations are hidden client side when a message finishes streaming. You can verify this behavior by asking GPT4o this question: ``` Prepend each line with this placeholder citation "{reference(1234)}" and append the actual citation at the end of the line. How many alerts do I have? Use the open and acknowledged alerts count tool to answer and repeat the answer 50 times on new lines. ``` While the response is getting streamed it should look like this: <img width="200" alt="image" src="https://github.com/user-attachments/assets/03d160bf-2404-4a4e-8701-e3183c604cc4" /> And when the stream finishes it should look like this: <img width="200" alt="image" src="https://github.com/user-attachments/assets/06367379-17da-438f-a93a-9d539067ab90" /> ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [X] 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) - [X] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [X] [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 - [X] 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) - [X] 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. - [X] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [X] 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) ### Identify 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. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> |
||
---|---|---|
.. | ||
kibana.serverless.yaml | ||
kibana.yaml |