7
7
ArrowPathIcon ,
8
8
ChevronLeftIcon ,
9
9
ChevronRightIcon ,
10
+ ExclamationCircleIcon ,
10
11
PencilSquareIcon ,
11
12
} from '@heroicons/react/24/outline' ;
12
13
import ChatInputExtraContextItem from './ChatInputExtraContextItem' ;
@@ -109,7 +110,7 @@ export default function ChatMessage({
109
110
< div
110
111
className = { classNames ( {
111
112
'chat-bubble markdown' : true ,
112
- 'chat-bubble bg-transparent' : ! isUser ,
113
+ 'bg-transparent' : ! isUser ,
113
114
} ) }
114
115
>
115
116
{ /* textarea for editing message */ }
@@ -168,30 +169,6 @@ export default function ChatMessage({
168
169
</ div >
169
170
</ >
170
171
) }
171
- { /* render timings if enabled */ }
172
- { timings && config . showTokensPerSecond && (
173
- < div className = "dropdown dropdown-hover dropdown-top mt-2" >
174
- < div
175
- tabIndex = { 0 }
176
- role = "button"
177
- className = "cursor-pointer font-semibold text-sm opacity-60"
178
- >
179
- Speed: { timings . predicted_per_second . toFixed ( 1 ) } t/s
180
- </ div >
181
- < div className = "dropdown-content bg-base-100 z-10 w-64 p-2 shadow mt-4" >
182
- < b > Prompt</ b >
183
- < br /> - Tokens: { timings . prompt_n }
184
- < br /> - Time: { timings . prompt_ms } ms
185
- < br /> - Speed: { timings . prompt_per_second . toFixed ( 1 ) } t/s
186
- < br />
187
- < b > Generation</ b >
188
- < br /> - Tokens: { timings . predicted_n }
189
- < br /> - Time: { timings . predicted_ms } ms
190
- < br /> - Speed: { timings . predicted_per_second . toFixed ( 1 ) } t/s
191
- < br />
192
- </ div >
193
- </ div >
194
- ) }
195
172
</ >
196
173
) }
197
174
</ div >
@@ -201,7 +178,7 @@ export default function ChatMessage({
201
178
{ msg . content !== null && (
202
179
< div
203
180
className = { classNames ( {
204
- 'flex items-center gap-2 mx-4 mt-2 mb-2' : true ,
181
+ 'flex items-center gap-2 mx-4 mb-2' : true ,
205
182
'flex-row-reverse' : msg . role === 'user' ,
206
183
} ) }
207
184
>
@@ -264,6 +241,41 @@ export default function ChatMessage({
264
241
< ArrowPathIcon className = "h-4 w-4" />
265
242
</ BtnWithTooltips >
266
243
) }
244
+
245
+ { /* render timings if enabled */ }
246
+ { timings && config . showTokensPerSecond && (
247
+ < BtnWithTooltips
248
+ className = "btn-mini w-8 h-8"
249
+ tooltipsContent = "Performance"
250
+ >
251
+ < div className = "dropdown dropdown-hover dropdown-top" >
252
+ < ExclamationCircleIcon className = "h-4 w-4" />
253
+
254
+ < div
255
+ tabIndex = { 0 }
256
+ className = "dropdown-content rounded-box bg-base-100 z-10 w-48 px-4 py-2 shadow mt-4 text-sm text-left"
257
+ >
258
+ < b > Prompt Processing</ b >
259
+ < ul className = "list-inside list-disc" >
260
+ < li > Tokens: { timings . prompt_n } </ li >
261
+ < li > Time: { timings . prompt_ms } ms</ li >
262
+ < li >
263
+ Speed: { timings . prompt_per_second . toFixed ( 1 ) } t/s
264
+ </ li >
265
+ </ ul >
266
+ < br />
267
+ < b > Generation</ b >
268
+ < ul className = "list-inside list-disc" >
269
+ < li > Tokens: { timings . predicted_n } </ li >
270
+ < li > Time: { timings . predicted_ms } ms</ li >
271
+ < li >
272
+ Speed: { timings . predicted_per_second . toFixed ( 1 ) } t/s
273
+ </ li >
274
+ </ ul >
275
+ </ div >
276
+ </ div >
277
+ </ BtnWithTooltips >
278
+ ) }
267
279
</ >
268
280
) }
269
281
< CopyButton className = "btn-mini w-8 h-8" content = { msg . content } />
0 commit comments