From 490b11aa3a09ed6cba1d7e3695f477f7bf0d0c91 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Wed, 15 May 2024 23:57:41 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=A2=9E=E5=8A=A0=E3=80=91AI=20?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/chat/role/RoleList.vue | 10 ++++++++-- src/views/ai/chat/role/index.vue | 17 +++++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/views/ai/chat/role/RoleList.vue b/src/views/ai/chat/role/RoleList.vue index b4e5c6ec..834eb3cb 100644 --- a/src/views/ai/chat/role/RoleList.vue +++ b/src/views/ai/chat/role/RoleList.vue @@ -33,7 +33,7 @@
- 使用 + 使用
@@ -53,7 +53,8 @@ const props = defineProps({ } }) // 定义钩子 -const emits = defineEmits(['onDelete', 'onEdit']) +const emits = defineEmits(['onDelete', 'onEdit', 'onUse']) + // more 点击 const handleMoreClick = async (data) => { const type = data[0] @@ -65,6 +66,11 @@ const handleMoreClick = async (data) => { } } +// 使用 +const handleUseClick = (role) => { + emits('onUse', role) +} + onMounted(() => { console.log('props', props.roleList) }) diff --git a/src/views/ai/chat/role/index.vue b/src/views/ai/chat/role/index.vue index bb5e02bd..3bfc9b84 100644 --- a/src/views/ai/chat/role/index.vue +++ b/src/views/ai/chat/role/index.vue @@ -23,7 +23,7 @@ - + @@ -43,9 +43,13 @@ import RoleList from './RoleList.vue' import ChatRoleForm from '@/views/ai/model/chatRole/ChatRoleForm.vue' import RoleCategoryList from './RoleCategoryList.vue' import {ChatRoleApi, ChatRolePageReqVO, ChatRoleVO} from '@/api/ai/model/chatRole' +import {ChatConversationApi, ChatConversationVO} from '@/api/ai/chat/conversation' import {TabsPaneContext} from "element-plus"; import {Search, User} from "@element-plus/icons-vue"; +// 获取路由 +const router = useRouter() + // 属性定义 const activeRole = ref('my-role') // 选中的角色 const loadding = ref(true) // 加载中 @@ -136,6 +140,16 @@ const handlerCardEdit = async (role) => { formRef.value.open('my-update', role.id, '编辑角色') } +// card 使用 +const handlerCardUse = async (role) => { + const data : ChatConversationVO = { + roleId: role.id + } as unknown as ChatConversationVO + // 创建对话 + const conversation = await ChatConversationApi.createChatConversationMy(data) + +} + // 添加角色成功 const handlerAddRoleSuccess = async (e) => { console.log(e) @@ -143,7 +157,6 @@ const handlerAddRoleSuccess = async (e) => { await getActiveTabsRole() } - // onMounted( async () => { // 获取分类