You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
text: 'Hi there! This is your Identity & Access Agent. I can help you with anything related to identity management and access tools. What can I assist you with today? For example, you can ask me things like:',
17
-
loading: false,
18
-
time: 0,
19
-
error: '',
20
-
isWelcome: true,
21
-
pre_loaded: false,
22
-
clarify_needed: false,
23
-
messageTime: '',
24
-
responseTime: '1:5AM',
25
-
suggestions: [
26
-
'Get me the list of users who have access to Azure Subscriptions.',
27
-
'Get me all SPNs with expired passwords.',
28
-
'Show me the access activity for user John Doe.',
29
-
],
30
-
response: {},
31
-
},
32
-
})
33
-
34
17
constlastMessageRef=useRef(null)
35
18
constscroll=()=>{
36
19
constlayout=document.getElementById('layout')
@@ -59,6 +42,7 @@ function AIChat({setOpen}:any) {
59
42
useEffect(()=>{
60
43
scroll()
61
44
},[chats])
45
+
62
46
63
47
return(
64
48
<>
@@ -73,52 +57,105 @@ function AIChat({setOpen}:any) {
73
57
Object.keys(chats).map((key)=>{
74
58
return(
75
59
<>
76
-
{!chats[key].isWelcome&&(
77
-
<KChatCard
78
-
date={
79
-
chats[key].messageTime
80
-
}
81
-
key={parseInt(key)+'chat'}
82
-
message={chats[key].message}
83
-
/>
60
+
{chats[key].show&&(
61
+
<>
62
+
{!chats[key].isWelcome&&(
63
+
<KChatCard
64
+
date={
65
+
chats[key]
66
+
.messageTime
67
+
}
68
+
key={
69
+
parseInt(key)+
70
+
'chat'
71
+
}
72
+
message={
73
+
chats[key]
74
+
.message
75
+
}
76
+
/>
77
+
)}
78
+
<KResponseCard
79
+
key={
80
+
parseInt(key)+
81
+
'result'
82
+
}
83
+
ref={
84
+
key===
85
+
(
86
+
Object.keys(
87
+
chats
88
+
)?.length-1
89
+
).toString()
90
+
? lastMessageRef
91
+
: null
92
+
}
93
+
scroll={scroll}
94
+
response={
95
+
chats[key].response
96
+
}
97
+
loading={
98
+
chats[key].loading
99
+
}
100
+
pre_loaded={
101
+
chats[key]
102
+
.pre_loaded
103
+
}
104
+
chat_id={chats[key].id}
105
+
error={chats[key].error}
106
+
time={chats[key].time}
107
+
text={chats[key].text}
108
+
isWelcome={
109
+
chats[key].isWelcome
110
+
}
111
+
date={
112
+
chats[key]
113
+
.responseTime
114
+
}
115
+
clarify_needed={
116
+
chats[key]
117
+
.clarify_needed
118
+
}
119
+
clarify_questions={
120
+
chats[key]
121
+
.clarify_questions
122
+
}
123
+
id={''}
124
+
suggestions={
125
+
chats[key]
126
+
.suggestions
127
+
}
128
+
onClickSuggestion={(
129
+
suggestion: string
130
+
)=>{
131
+
// find suggestoin index
132
+
constsug=
133
+
chats['0']
134
+
.suggestions
135
+
constindex=
136
+
sug?.indexOf(
137
+
suggestion
138
+
)
139
+
140
+
consttemp=chats
141
+
if(
142
+
index!==
143
+
undefined
144
+
){
145
+
temp[
146
+
(
147
+
index+
148
+
1
149
+
)?.toString()
150
+
].show=true
151
+
setChats({
152
+
...temp,
153
+
})
154
+
}
155
+
}}
156
+
/>
157
+
</>
84
158
)}
85
-
<KResponseCard
86
-
key={parseInt(key)+'result'}
87
-
ref={
88
-
key===
89
-
(
90
-
Object.keys(chats)
91
-
?.length-1
92
-
).toString()
93
-
? lastMessageRef
94
-
: null
95
-
}
96
-
scroll={scroll}
97
-
response={chats[key].response}
98
-
loading={chats[key].loading}
99
-
pre_loaded={
100
-
chats[key].pre_loaded
101
-
}
102
-
chat_id={chats[key].id}
103
-
error={chats[key].error}
104
-
time={chats[key].time}
105
-
text={chats[key].text}
106
-
isWelcome={chats[key].isWelcome}
107
-
date={chats[key].responseTime}
108
-
clarify_needed={
109
-
chats[key].clarify_needed
110
-
}
111
-
clarify_questions={
112
-
chats[key].clarify_questions
113
-
}
114
-
id={''}
115
-
suggestions={
116
-
chats[key].suggestions
117
-
}
118
-
onClickSuggestion={(
119
-
suggestion: string
120
-
)=>{}}
121
-
/>
122
159
</>
123
160
)
124
161
})}
@@ -136,9 +173,8 @@ function AIChat({setOpen}:any) {
0 commit comments