update aiChatQuestions.ts from api
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
<span class="title" v-text="getConversationName(item)" />
|
||||
</template>
|
||||
<template #description>
|
||||
<span v-text="formatConversationTime(item)" />
|
||||
<pass-time-label :timestamp="formatConversationTime(item)" underline />
|
||||
</template>
|
||||
</t-cell>
|
||||
<template #right>
|
||||
@@ -78,6 +78,7 @@ import { DialogPlugin } from "tdesign-mobile-vue";
|
||||
import { deleteConversation as removeConversation, type GaoAiConversation, listConversations } from "@/api/GaoAiAPI";
|
||||
import { getErrorMessage } from "@/utils/error";
|
||||
import { Message } from "@/utils/message";
|
||||
import { PassTimeLabel } from "timi-web";
|
||||
|
||||
defineOptions({
|
||||
name: "AiConversationList"
|
||||
@@ -114,16 +115,6 @@ const deletingId = ref("");
|
||||
let requestToken = 0;
|
||||
let loadingPromise: Promise<void> | undefined;
|
||||
|
||||
const loadStateText = computed(() => {
|
||||
if (isLoading.value && conversationList.value.length) {
|
||||
return "正在加载更多";
|
||||
}
|
||||
if (isNoMore.value) {
|
||||
return conversationList.value.length ? "没有更多会话" : "";
|
||||
}
|
||||
return "上拉加载更多";
|
||||
});
|
||||
|
||||
async function loadMore(): Promise<void> {
|
||||
if (loadingPromise) {
|
||||
await loadingPromise;
|
||||
@@ -240,14 +231,13 @@ function getConversationName(conversation: GaoAiConversation): string {
|
||||
return conversation.name?.trim() || conversation.introduction?.trim() || "未命名会话";
|
||||
}
|
||||
|
||||
function formatConversationTime(conversation: GaoAiConversation): string {
|
||||
function formatConversationTime(conversation: GaoAiConversation): number {
|
||||
const value = conversation["updated_at"] || conversation["created_at"];
|
||||
const timestamp = typeof value === "number" ? value : Number(value);
|
||||
if (!Number.isFinite(timestamp) || timestamp <= 0) {
|
||||
return "时间未知";
|
||||
}
|
||||
const milliseconds = timestamp < 100000000000 ? timestamp * 1000 : timestamp;
|
||||
return new Date(milliseconds).toLocaleString("zh-CN", { hour12: false });
|
||||
return timestamp < 100000000000 ? timestamp * 1000 : timestamp;
|
||||
}
|
||||
|
||||
watch(() => props.visible, async visible => {
|
||||
|
||||
Reference in New Issue
Block a user