Skip to content

Commit 9c58a43

Browse files
committed
Rework AskAI suggestions
1 parent b3b15c4 commit 9c58a43

File tree

2 files changed

+34
-52
lines changed

2 files changed

+34
-52
lines changed

src/Elastic.Documentation.Site/Assets/web-components/SearchOrAskAi/AskAi/AskAiSuggestions.tsx

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,55 @@ import { useChatActions } from './chat.store'
33
import { EuiButton, useEuiTheme } from '@elastic/eui'
44
import { css } from '@emotion/react'
55
import * as React from 'react'
6-
7-
const buttonStyles = css`
8-
border: none;
9-
& > span {
10-
justify-content: flex-start;
11-
}
12-
`
6+
import { useMemo } from 'react'
137

148
export interface AskAiSuggestion {
159
question: string
1610
}
1711

18-
interface Props {
19-
suggestions: Set<AskAiSuggestion>
20-
}
12+
// Comprehensive list of AI suggestion questions
13+
const ALL_SUGGESTIONS: AskAiSuggestion[] = [
14+
{ question: 'How do I set up a data stream in Elasticsearch?' },
15+
{ question: 'What are the best practices for indexing performance?' },
16+
{ question: 'How can I create a dashboard in Kibana?' },
17+
{ question: 'What is the difference between a keyword and text field?' },
18+
{ question: 'How do I configure machine learning jobs?' },
19+
{ question: 'What are aggregations and how do I use them?' },
20+
{ question: 'How do I set up Elasticsearch security and authentication?' },
21+
{ question: 'What are the different types of Elasticsearch queries?' },
22+
{ question: 'How do I monitor cluster health and performance?' },
23+
{ question: 'What is the Elastic Stack and how do the components work together?' },
24+
{ question: 'How do I create and manage Elasticsearch indices?' },
25+
{ question: 'What are the best practices for Elasticsearch mapping?' },
26+
{ question: 'How do I set up log shipping with Beats?' },
27+
{ question: 'What is APM and how do I use it for application monitoring?' },
28+
{ question: 'How do I create custom visualizations in Kibana?' },
29+
{ question: 'What are Elasticsearch snapshots and how do I use them?' },
30+
{ question: 'How do I configure cross-cluster search?' },
31+
{ question: 'What are the different Elasticsearch node types and their roles?' },
32+
]
2133

22-
export const AskAiSuggestions = (props: Props) => {
34+
export const AskAiSuggestions = () => {
2335
const { submitQuestion } = useChatActions()
2436
const { setModalMode } = useModalActions()
2537
const { euiTheme } = useEuiTheme()
2638

27-
const dynamicButtonStyles = css`
28-
${buttonStyles}
29-
svg {
30-
color: ${euiTheme.colors.textSubdued};
31-
}
32-
`
33-
39+
// Randomly select 3 questions from the comprehensive list
40+
const selectedSuggestions = useMemo(() => {
41+
// Shuffle the array and take first 3
42+
const shuffled = [...ALL_SUGGESTIONS].sort(() => Math.random() - 0.5)
43+
return shuffled.slice(0, 3)
44+
}, [])
45+
3446
return (
3547
<ul>
36-
{Array.from(props.suggestions).map((suggestion) => (
37-
<li key={suggestion.question}>
48+
{selectedSuggestions.map((suggestion) => (
49+
<li key={suggestion.question} css={css`margin-bottom: ${euiTheme.size.s};`}>
3850
<EuiButton
3951
iconType="newChat"
40-
color="text"
52+
color="primary"
4153
fullWidth
4254
size="s"
43-
css={dynamicButtonStyles}
4455
onClick={() => {
4556
submitQuestion(suggestion.question)
4657
setModalMode('askAi')

src/Elastic.Documentation.Site/Assets/web-components/SearchOrAskAi/AskAi/Chat.tsx

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -148,36 +148,7 @@ export const Chat = () => {
148148
<h3>Try asking me:</h3>
149149
</EuiTitle>
150150
<EuiSpacer size="s" />
151-
<AskAiSuggestions
152-
suggestions={
153-
new Set([
154-
{
155-
question:
156-
'How do I set up a data stream in Elasticsearch?',
157-
},
158-
{
159-
question:
160-
'What are the best practices for indexing performance?',
161-
},
162-
{
163-
question:
164-
'How can I create a dashboard in Kibana?',
165-
},
166-
{
167-
question:
168-
'What is the difference between a keyword and text field?',
169-
},
170-
{
171-
question:
172-
'How do I configure machine learning jobs?',
173-
},
174-
{
175-
question:
176-
'What are aggregations and how do I use them?',
177-
},
178-
])
179-
}
180-
/>
151+
<AskAiSuggestions />
181152
</>
182153
}
183154
/>

0 commit comments

Comments
 (0)