diff --git a/web/app/components/base/chat/chat/answer/more.tsx b/web/app/components/base/chat/chat/answer/more.tsx index e86011ea19..9326c6827f 100644 --- a/web/app/components/base/chat/chat/answer/more.tsx +++ b/web/app/components/base/chat/chat/answer/more.tsx @@ -18,20 +18,28 @@ const More: FC = ({ more && ( <>
{`${t('appLog.detail.timeConsuming')} ${more.latency}${t('appLog.detail.second')}`}
{`${t('appLog.detail.tokenCost')} ${formatNumber(more.tokens)}`}
+ {more.tokens_per_second && ( +
+ {`${more.tokens_per_second} tokens/s`} +
+ )}
ยท
{more.time} diff --git a/web/app/components/base/chat/chat/hooks.ts b/web/app/components/base/chat/chat/hooks.ts index a10b359724..3729fd4a6d 100644 --- a/web/app/components/base/chat/chat/hooks.ts +++ b/web/app/components/base/chat/chat/hooks.ts @@ -318,6 +318,7 @@ export const useChat = ( return player } + ssePost( url, { @@ -393,6 +394,7 @@ export const useChat = ( time: formatTime(newResponseItem.created_at, 'hh:mm A'), tokens: newResponseItem.answer_tokens + newResponseItem.message_tokens, latency: newResponseItem.provider_response_latency.toFixed(2), + tokens_per_second: newResponseItem.provider_response_latency > 0 ? (newResponseItem.answer_tokens / newResponseItem.provider_response_latency).toFixed(2) : undefined, }, // for agent log conversationId: conversationId.current, diff --git a/web/app/components/base/chat/chat/type.ts b/web/app/components/base/chat/chat/type.ts index d4cf460884..98cc05dda4 100644 --- a/web/app/components/base/chat/chat/type.ts +++ b/web/app/components/base/chat/chat/type.ts @@ -8,6 +8,7 @@ export type MessageMore = { time: string tokens: number latency: number | string + tokens_per_second?: number | string } export type FeedbackType = {