feat: 对话id补充,适配不同类型
This commit is contained in:
@@ -15,6 +15,31 @@ const props = defineProps<{
|
||||
isSelected: boolean;
|
||||
}>();
|
||||
|
||||
/**
|
||||
* 格式化时间
|
||||
* 将 ISO 时间字符串格式化为 yyyy-MM-dd HH:mm:ss
|
||||
*/
|
||||
function formatTime(time: string | undefined): string {
|
||||
if (!time) return '';
|
||||
|
||||
try {
|
||||
const date = new Date(time);
|
||||
if (Number.isNaN(date.getTime())) return time;
|
||||
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const hours = String(date.getHours()).padStart(2, '0');
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
}
|
||||
catch {
|
||||
return time;
|
||||
}
|
||||
}
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'toggleSelection', item: MessageItem): void;
|
||||
(e: 'edit', item: MessageItem): void;
|
||||
@@ -163,7 +188,7 @@ function handleThinkingChange(payload: { value: boolean; status: ThinkingStatus
|
||||
<!-- 时间和token信息 -->
|
||||
<div class="message-wrapper__info">
|
||||
<span v-if="item.creationTime" class="message-wrapper__time">
|
||||
{{ item.creationTime }}
|
||||
{{ formatTime(item.creationTime) }}
|
||||
</span>
|
||||
<span
|
||||
v-if="item.role !== 'user' && item?.tokenUsage?.total"
|
||||
|
||||
Reference in New Issue
Block a user