优化会话列表名称,添加复制和转发,转发待完善
This commit is contained in:
@@ -72,10 +72,7 @@
|
||||
<view class="history-chat-avatar">
|
||||
<uni-icons type="chat-filled" size="26" color="#007aff"></uni-icons>
|
||||
</view>
|
||||
<view v-if="chat.agent_id">
|
||||
{{truncateText(chat.agent_data?.title) || "加载中"}}
|
||||
</view>
|
||||
<view v-else>{{truncateText(chat.title)}}</view>
|
||||
<view>{{truncateText(getConvName(chat))}}</view>
|
||||
</view>
|
||||
<!-- 好友对话列表 -->
|
||||
<view v-if="chatType === 1" v-for="chat in UserConversations" :key="chat.sessionId"
|
||||
@@ -325,6 +322,18 @@
|
||||
return text.length > maxLength ? text.substring(0, maxLength) + '...' : text
|
||||
}
|
||||
|
||||
// 获取会话名称:agent_title > 清理后的title > 格式化时间
|
||||
const getConvName = (conv) => {
|
||||
if (conv.agent_data?.title) return conv.agent_data.title
|
||||
if (conv.title && !conv.title.startsWith('[文件信息')) return conv.title
|
||||
if (conv.created_at) {
|
||||
const t = conv.created_at
|
||||
const pad = (n) => String(n).padStart(2, '0')
|
||||
return `${t.year}年${t.month}月${t.day}日 ${pad(t.hour)}:${pad(t.minute)}:${pad(t.second)}`
|
||||
}
|
||||
return '未命名会话'
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
UserToken.value = getToken()
|
||||
const UserInfo = await getUserInfo(UserToken.value)
|
||||
|
||||
Reference in New Issue
Block a user