fix 修复时区显示问题以及知识库描述显示不全的问题

This commit is contained in:
Wenjie Zhang 2025-05-15 23:06:19 +08:00
parent b81f31c652
commit 645acff37c
2 changed files with 10 additions and 4 deletions

View File

@ -555,10 +555,14 @@ const openFileDetail = (record) => {
state.lock = false
}
}
const formatRelativeTime = (timestamp) => {
// UTC+8
const timezoneOffset = 8 * 60 * 60 * 1000; //
const adjustedTimestamp = timestamp + timezoneOffset;
const now = Date.now();
const secondsPast = (now - timestamp) / 1000;
const secondsPast = (now - adjustedTimestamp) / 1000;
if (secondsPast < 60) {
return Math.round(secondsPast) + ' 秒前';
} else if (secondsPast < 3600) {
@ -566,7 +570,7 @@ const formatRelativeTime = (timestamp) => {
} else if (secondsPast < 86400) {
return Math.round(secondsPast / 3600) + ' 小时前';
} else {
const date = new Date(timestamp);
const date = new Date(adjustedTimestamp);
const year = date.getFullYear();
const month = date.getMonth() + 1;
const day = date.getDate();

View File

@ -46,7 +46,9 @@
<p><span>{{ database.files ? Object.keys(database.files).length : 0 }} 文件</span></p>
</div>
</div>
<p class="description">{{ database.description || '暂无描述' }}</p>
<a-tooltip :title="database.description || '暂无描述'">
<p class="description">{{ database.description || '暂无描述' }}</p>
</a-tooltip>
<div class="tags">
<a-tag color="blue" v-if="database.embed_model">{{ database.embed_model }}</a-tag>
<a-tag color="green" v-if="database.dimension">{{ database.dimension }}</a-tag>