|
|
@@ -12,7 +12,7 @@
|
|
|
<template #title>
|
|
|
<div class="ai-chat-title">
|
|
|
<a-avatar :size="36" class="ai-chat-title__avatar">
|
|
|
- <img src="https://lepao-api.xxoo365.top/uploads/9aca0644-f1f8-4773-b25e-4cd5d268cf0e.png" alt="小妍助理" />
|
|
|
+ <img src="https://lepao-api.xxoo365.top/uploads/9aca0644-f1f8-4773-b25e-4cd5d268cf0e.png" alt="小妍助理" draggable="false" />
|
|
|
</a-avatar>
|
|
|
<div class="ai-chat-title__copy">
|
|
|
<div class="ai-chat-title__name">小妍助理</div>
|
|
|
@@ -80,12 +80,6 @@
|
|
|
</a-popconfirm>
|
|
|
</div>
|
|
|
|
|
|
- <div v-if="!conversations.length" class="conversation-empty">
|
|
|
- <a-avatar :size="42" class="conversation-empty__avatar">
|
|
|
- <img src="https://lepao-api.xxoo365.top/uploads/9aca0644-f1f8-4773-b25e-4cd5d268cf0e.png" alt="小妍助理" />
|
|
|
- </a-avatar>
|
|
|
- <div>暂无会话</div>
|
|
|
- </div>
|
|
|
</div>
|
|
|
</aside>
|
|
|
|
|
|
@@ -104,7 +98,7 @@
|
|
|
|
|
|
<div class="chat-toolbar__identity">
|
|
|
<a-avatar :size="34" class="chat-toolbar__avatar">
|
|
|
- <img src="https://lepao-api.xxoo365.top/uploads/9aca0644-f1f8-4773-b25e-4cd5d268cf0e.png" alt="小妍助理" />
|
|
|
+ <img src="@/assets/img/ai.svg" alt="小妍助理" draggable="false" />
|
|
|
</a-avatar>
|
|
|
<div class="chat-toolbar__text">
|
|
|
<strong>{{ currentConversation?.title || '新对话' }}</strong>
|
|
|
@@ -112,8 +106,8 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <a-popconfirm content="是否删除该对话?" @ok="deleteCurrentConversation">
|
|
|
- <a-button :disabled="!currentConversationId" type="text" shape="circle" status="danger">
|
|
|
+ <a-popconfirm v-if="canDeleteCurrentConversation" content="是否删除该对话?" @ok="deleteCurrentConversation">
|
|
|
+ <a-button type="text" shape="circle" status="danger">
|
|
|
<template #icon><icon-delete /></template>
|
|
|
</a-button>
|
|
|
</a-popconfirm>
|
|
|
@@ -122,7 +116,7 @@
|
|
|
<div ref="messageContainer" class="message-list">
|
|
|
<div v-if="!currentConversationId" class="empty-state">
|
|
|
<a-avatar :size="64" class="empty-state__avatar">
|
|
|
- <img src="https://lepao-api.xxoo365.top/uploads/9aca0644-f1f8-4773-b25e-4cd5d268cf0e.png" alt="小妍助理" />
|
|
|
+ <img src="@/assets/img/ai.svg" alt="小妍助理" draggable="false" />
|
|
|
</a-avatar>
|
|
|
<div class="empty-state__title">开启一段新对话</div>
|
|
|
</div>
|
|
|
@@ -134,7 +128,7 @@
|
|
|
|
|
|
<div v-if="!messagesLoading && !messages.length" class="welcome-card">
|
|
|
<a-avatar :size="52" class="welcome-card__avatar">
|
|
|
- <img src="https://lepao-api.xxoo365.top/uploads/9aca0644-f1f8-4773-b25e-4cd5d268cf0e.png" alt="小妍助理" />
|
|
|
+ <img src="https://lepao-api.xxoo365.top/uploads/9aca0644-f1f8-4773-b25e-4cd5d268cf0e.png" alt="小妍助理" draggable="false" />
|
|
|
</a-avatar>
|
|
|
<div>
|
|
|
<div class="welcome-card__title">我是小妍助理</div>
|
|
|
@@ -161,8 +155,8 @@
|
|
|
:class="`message-row--${message.role}`"
|
|
|
>
|
|
|
<a-avatar :size="36" class="message-avatar">
|
|
|
- <img v-if="message.role === 'assistant'" src="https://lepao-api.xxoo365.top/uploads/9aca0644-f1f8-4773-b25e-4cd5d268cf0e.png" alt="小妍助理" />
|
|
|
- <img v-else-if="message.role === 'user' && avatar" :src="avatar"/>
|
|
|
+ <img v-if="message.role === 'assistant'" src="https://lepao-api.xxoo365.top/uploads/9aca0644-f1f8-4773-b25e-4cd5d268cf0e.png" alt="小妍助理" draggable="false" />
|
|
|
+ <img v-else-if="message.role === 'user' && avatar" :src="avatar" draggable="false" />
|
|
|
<icon-user v-else-if="message.role === 'user'" />
|
|
|
<icon-info-circle v-else />
|
|
|
</a-avatar>
|
|
|
@@ -292,6 +286,7 @@ let messageTimer = null
|
|
|
const visible = computed(() => props.visible)
|
|
|
const drawerWidth = computed(() => (isMobile.value ? '100%' : '940px'))
|
|
|
const currentConversation = computed(() => conversations.value.find(item => item.id === currentConversationId.value))
|
|
|
+const canDeleteCurrentConversation = computed(() => canShowConversationActions(currentConversation.value))
|
|
|
const canSend = computed(() => currentConversationId.value && (input.value.trim() || uploadingImages.value.length > 0))
|
|
|
const unreadTotal = computed(() => Object.values(unreadMap.value).reduce((sum, value) => sum + Number(value || 0), 0))
|
|
|
const seenKey = computed(() => `aiChatSeen:${userStore.uuid || 'guest'}`)
|
|
|
@@ -359,8 +354,12 @@ const loadConversations = async () => {
|
|
|
const localItems = conversations.value.filter(item => item.local)
|
|
|
conversations.value = [...localItems, ...(res.data || [])]
|
|
|
updateUnreadByConversations(conversations.value)
|
|
|
- if (visible.value && !currentConversationId.value && conversations.value.length) {
|
|
|
- await openConversation(conversations.value[0].id)
|
|
|
+ if (visible.value && !currentConversationId.value) {
|
|
|
+ if (conversations.value.length) {
|
|
|
+ await openConversation(conversations.value[0].id)
|
|
|
+ } else {
|
|
|
+ await createConversationAndOpen()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -654,6 +653,20 @@ onUnmounted(() => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+.ai-chat-title__avatar,
|
|
|
+.chat-toolbar__avatar,
|
|
|
+.empty-state__avatar,
|
|
|
+.welcome-card__avatar,
|
|
|
+.message-avatar {
|
|
|
+ user-select: none;
|
|
|
+
|
|
|
+ :deep(img) {
|
|
|
+ user-select: none;
|
|
|
+ -webkit-user-drag: none;
|
|
|
+ pointer-events: none;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
:global(.ai-chat-drawer .arco-drawer-header) {
|
|
|
height: 48px;
|
|
|
padding: 7px 16px;
|
|
|
@@ -857,19 +870,6 @@ onUnmounted(() => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-.conversation-empty {
|
|
|
- display: grid;
|
|
|
- place-items: center;
|
|
|
- gap: 10px;
|
|
|
- padding: 40px 12px;
|
|
|
- color: #86909c;
|
|
|
- font-size: 13px;
|
|
|
-
|
|
|
- &__avatar {
|
|
|
- background: #eef4ff;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
.chat-main {
|
|
|
position: relative;
|
|
|
display: grid;
|
|
|
@@ -969,6 +969,7 @@ onUnmounted(() => {
|
|
|
.empty-state__avatar,
|
|
|
.welcome-card__avatar {
|
|
|
background: linear-gradient(135deg, #eaf2ff, #f7ecff);
|
|
|
+ user-select: none;
|
|
|
}
|
|
|
|
|
|
.empty-state__title,
|