2025-07-14 11:30:13 +08:00
|
|
|
<template>
|
2025-07-16 18:49:28 +08:00
|
|
|
<div>
|
2025-07-15 15:16:03 +08:00
|
|
|
<div class="logo">
|
2025-07-16 18:49:28 +08:00
|
|
|
<img :src="cozeInfo?.icon_url" class="agent-img" />
|
2025-07-14 11:30:13 +08:00
|
|
|
</div>
|
2025-07-16 18:49:28 +08:00
|
|
|
|
2025-07-14 11:30:13 +08:00
|
|
|
<a-menu mode="inline" theme="light">
|
|
|
|
|
<a-menu-item key="1">
|
2025-07-17 19:32:47 +08:00
|
|
|
<span class="menu-title">{{ cozeInfo.name }}</span>
|
2025-07-15 15:16:03 +08:00
|
|
|
<span style="color: #8492ff; font-size: 12px">{{ cozeInfo.type == 1 ? '智能体' : '对话式' }}</span>
|
|
|
|
|
<span style="float: right">{{ cozeInfo.views }}次使用</span>
|
2025-07-16 18:49:28 +08:00
|
|
|
<p>{{ cozeInfo.description }}</p>
|
2025-07-14 11:30:13 +08:00
|
|
|
</a-menu-item>
|
2025-07-16 18:49:28 +08:00
|
|
|
|
|
|
|
|
<div v-for="(item, index) in conversations" :key="index">
|
|
|
|
|
<a-dropdown-button>
|
|
|
|
|
<span> {{ item.content }} </span>
|
|
|
|
|
<template #content>
|
|
|
|
|
<a-doption>重命名</a-doption>
|
|
|
|
|
<a-popconfirm
|
|
|
|
|
content="确认删除对话吗?删除后,聊天记录将不可恢复。"
|
|
|
|
|
@ok="delMessage(item.chat_id, item.conversation_id)"
|
|
|
|
|
type="error"
|
|
|
|
|
>
|
|
|
|
|
<a-button>删除</a-button>
|
|
|
|
|
</a-popconfirm>
|
|
|
|
|
</template>
|
|
|
|
|
</a-dropdown-button>
|
|
|
|
|
</div>
|
2025-07-14 11:30:13 +08:00
|
|
|
</a-menu>
|
2025-07-16 18:49:28 +08:00
|
|
|
</div>
|
2025-07-14 11:30:13 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2025-07-15 15:16:03 +08:00
|
|
|
import { defineProps } from 'vue';
|
2025-07-16 18:49:28 +08:00
|
|
|
import { delAgentMessage, getHistoryChat } from '@/api/all/agent';
|
2025-07-14 11:30:13 +08:00
|
|
|
|
2025-07-15 15:16:03 +08:00
|
|
|
const props = defineProps({
|
|
|
|
|
cozeInfo: {
|
|
|
|
|
type: Object as () => any,
|
|
|
|
|
default: () => ({}),
|
2025-07-18 16:51:48 +08:00
|
|
|
}
|
2025-07-15 15:16:03 +08:00
|
|
|
});
|
2025-07-16 18:49:28 +08:00
|
|
|
|
|
|
|
|
const delMessage = async (chatId, conversationId) => {
|
|
|
|
|
const { code, data } = await delAgentMessage({ chat_id: chatId, conversation_id: conversationId });
|
|
|
|
|
if (code === 200) {
|
|
|
|
|
console.log(data, 'data');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const conversations = ref([]);
|
|
|
|
|
|
|
|
|
|
const getHistoryChatData = async (botId) => {
|
|
|
|
|
const { code, data } = await getHistoryChat({ bot_id: botId });
|
|
|
|
|
if (code === 200) {
|
|
|
|
|
conversations.value = data.list;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const truncateText = (text: string, maxLength = 30) => {
|
|
|
|
|
if (text.length <= maxLength) return text;
|
|
|
|
|
return text.slice(0, maxLength) + '...';
|
2025-07-15 15:16:03 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
2025-07-18 16:51:48 +08:00
|
|
|
getHistoryChatData(props.cozeInfo.bot_id);
|
2025-07-14 11:30:13 +08:00
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.logo {
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
}
|
2025-07-16 18:49:28 +08:00
|
|
|
|
|
|
|
|
.menu-title {
|
|
|
|
|
color: var(--Text-1, #211f24);
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
font-family: Alibaba PuHuiTi;
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
line-height: 26px;
|
|
|
|
|
word-wrap: break-word;
|
|
|
|
|
}
|
|
|
|
|
.agent-img {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 230px;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-14 11:30:13 +08:00
|
|
|
</style>
|