mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 03:32:23 +08:00
fix: spend time and token (#47)
This commit is contained in:
parent
d680fca996
commit
5fcd5c2499
|
@ -16,6 +16,7 @@ import type { Annotation, MessageRating } from '@/models/log'
|
||||||
import AppContext from '@/context/app-context'
|
import AppContext from '@/context/app-context'
|
||||||
import { Markdown } from '@/app/components/base/markdown'
|
import { Markdown } from '@/app/components/base/markdown'
|
||||||
import LoadingAnim from './loading-anim'
|
import LoadingAnim from './loading-anim'
|
||||||
|
import { formatNumber } from '@/utils/format'
|
||||||
|
|
||||||
const stopIcon = (
|
const stopIcon = (
|
||||||
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
@ -105,7 +106,7 @@ const MoreInfo: FC<{ more: MessageMore; isQuestion: boolean }> = ({ more, isQues
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
return (<div className={`mt-1 space-x-2 text-xs text-gray-400 ${isQuestion ? 'mr-2 text-right ' : 'ml-2 text-left float-right'}`}>
|
return (<div className={`mt-1 space-x-2 text-xs text-gray-400 ${isQuestion ? 'mr-2 text-right ' : 'ml-2 text-left float-right'}`}>
|
||||||
<span>{`${t('appLog.detail.timeConsuming')} ${more.latency}${t('appLog.detail.second')}`}</span>
|
<span>{`${t('appLog.detail.timeConsuming')} ${more.latency}${t('appLog.detail.second')}`}</span>
|
||||||
<span>{`${t('appLog.detail.tokenCost')} ${more.tokens}`}</span>
|
<span>{`${t('appLog.detail.tokenCost')} ${formatNumber(more.tokens)}`}</span>
|
||||||
<span>· </span>
|
<span>· </span>
|
||||||
<span>{more.time} </span>
|
<span>{more.time} </span>
|
||||||
</div>)
|
</div>)
|
||||||
|
|
|
@ -247,8 +247,8 @@ const Debug: FC<IDebug> = ({
|
||||||
...draft[index],
|
...draft[index],
|
||||||
more: {
|
more: {
|
||||||
time: dayjs.unix(newResponseItem.created_at).format('hh:mm A'),
|
time: dayjs.unix(newResponseItem.created_at).format('hh:mm A'),
|
||||||
tokens: newResponseItem.answer_tokens,
|
tokens: newResponseItem.answer_tokens + newResponseItem.message_tokens,
|
||||||
latency: (newResponseItem.provider_response_latency / 1000).toFixed(2),
|
latency: newResponseItem.provider_response_latency.toFixed(2),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,8 +94,8 @@ const getFormattedChatList = (messages: ChatMessage[]) => {
|
||||||
isAnswer: true,
|
isAnswer: true,
|
||||||
more: {
|
more: {
|
||||||
time: dayjs.unix(item.created_at).format('hh:mm A'),
|
time: dayjs.unix(item.created_at).format('hh:mm A'),
|
||||||
tokens: item.answer_tokens,
|
tokens: item.answer_tokens + item.message_tokens,
|
||||||
latency: (item.provider_response_latency / 1000).toFixed(2),
|
latency: item.provider_response_latency.toFixed(2),
|
||||||
},
|
},
|
||||||
annotation: item.annotation,
|
annotation: item.annotation,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user