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 () => {
// 获取分类