diff --git a/src/api/aiModel.ts b/src/api/aiModel.ts index 77c5b85..8a59089 100644 --- a/src/api/aiModel.ts +++ b/src/api/aiModel.ts @@ -50,7 +50,7 @@ function edit(data) { function deleteOne(id: string) { return http.request( { - url: `/admin/model/delete/${id}`, + url: `/admin/model/del/${id}`, method: 'POST', } ) diff --git a/src/api/conversation.ts b/src/api/conversation.ts new file mode 100644 index 0000000..dbde62b --- /dev/null +++ b/src/api/conversation.ts @@ -0,0 +1,69 @@ +import { http } from '@/utils/http/axios' + +function searchPresetConvs(data, params: { current: number, size: number }) { + return http.request({ + url: `/admin/conv-preset/search?currentPage=${params.current}&pageSize=${params.size}`, + method: 'post', + data, + }) +} + +function addPresetConv(data) { + return http.request({ + url: '/admin/conv-preset/addOne', + method: 'post', + data, + }) +} + +function editPresetConv(uuid: string, data) { + return http.request({ + url: `/admin/conv-preset/edit/${uuid}`, + method: 'post', + data, + }) +} + +function deletePresetConv(uuid: string) { + return http.request( + { + url: `/admin/conv-preset/del/${uuid}`, + method: 'POST', + } + ) +} + +function searchConvs(data, params: { current: number, size: number }) { + return http.request({ + url: `/admin/conv/search?currentPage=${params.current}&pageSize=${params.size}`, + method: 'post', + data, + }) +} + +function editConv(uuid: string, data) { + return http.request({ + url: `/admin/conv/edit/${uuid}`, + method: 'post', + data, + }) +} + +function deleteConv(uuid: string) { + return http.request( + { + url: `/admin/conv/del/${uuid}`, + method: 'POST', + } + ) +} + +export default { + searchPresetConvs, + addPresetConv, + editPresetConv, + deletePresetConv, + searchConvs, + editConv, + deleteConv, +} \ No newline at end of file diff --git a/src/api/knowledgeBase.ts b/src/api/knowledgeBase.ts index fd92f8f..a3adbdc 100644 --- a/src/api/knowledgeBase.ts +++ b/src/api/knowledgeBase.ts @@ -11,7 +11,7 @@ function search(data, params: { current: number, size: number }) { function deleteOne(uuid: string) { return http.request( { - url: `/admin/kb/delete/${uuid}`, + url: `/admin/kb/del/${uuid}`, method: 'POST', } ) diff --git a/src/api/sysConfig.ts b/src/api/sysConfig.ts index 3b24866..c12a5db 100644 --- a/src/api/sysConfig.ts +++ b/src/api/sysConfig.ts @@ -20,7 +20,7 @@ function edit(params) { function deleteOne(id: string) { return http.request( { - url: `/admin/model/delete/${id}`, + url: `/admin/model/del/${id}`, method: 'POST', } ) diff --git a/src/api/user.ts b/src/api/user.ts index 1e9794b..68f70ee 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -1,11 +1,5 @@ import { http } from '@/utils/http/axios' - -export interface BasicResponseModel { - code: string - message: string - success: boolean - data: T -} +import { BasicResponseModel } from '/#/global' /** * @description: 用户登录 diff --git a/src/router/modules/conversation.ts b/src/router/modules/conversation.ts new file mode 100644 index 0000000..f7cb94b --- /dev/null +++ b/src/router/modules/conversation.ts @@ -0,0 +1,49 @@ +import { RouteRecordRaw } from 'vue-router' +import { Layout } from '@/router/constant' +import { LibraryOutline } from '@vicons/ionicons5' +import { renderIconWithProps } from '@/utils/index' + +/** + * @param name 路由名称, 必须设置,且不能重名 + * @param meta 路由元信息(路由附带扩展信息) + * @param redirect 重定向地址, 访问这个路由时,自定进行重定向 + * @param meta.disabled 禁用整个菜单 + * @param meta.title 菜单名称 + * @param meta.icon 菜单图标 + * @param meta.keepAlive 缓存该路由 + * @param meta.sort 排序越小越排前 + * + * */ +const routes: Array = [ + { + path: '/conversation', + name: 'Conversation', + redirect: '/conversation/list', + component: Layout, + meta: { + title: '会话管理', + icon: renderIconWithProps(LibraryOutline, { size: 20 }), + sort: 3, + }, + children: [ + { + path: 'list', + name: 'ConversationList', + meta: { + title: '会话管理', + }, + component: () => import('@/views/conversation/index.vue'), + }, + { + path: 'preset', + name: 'PresetConversationList', + meta: { + title: '预设会话管理', + }, + component: () => import('@/views/conversation/preset-conv/PresetConv.vue'), + }, + ], + }, +] + +export default routes diff --git a/src/views/conversation/columns.ts b/src/views/conversation/columns.ts new file mode 100644 index 0000000..5e6f686 --- /dev/null +++ b/src/views/conversation/columns.ts @@ -0,0 +1,47 @@ +import { BasicColumn } from '@/components/Table' +import { Conversation } from '/#/conversation' +export const columns: BasicColumn[] = [ + { + title: 'id', + key: 'id', + width: 50, + }, + { + title: 'uuid', + key: 'uuid', + width: 120, + }, + { + title: '标题', + key: 'title', + width: 150, + }, + { + title: '角色描述', + key: 'aiSystemMessage', + width: 200, + }, + { + title: '消耗的总token', + key: 'tokens', + width: 150, + }, + { + title: '开启上下文', + key: 'understandContextEnable', + width: 100, + render(row) { + return row.understandContextEnable ? '是' : '否' + }, + }, + { + title: '创建时间', + key: 'createTime', + width: 180, + }, + { + title: '更新时间', + key: 'updateTime', + width: 180, + }, +] diff --git a/src/views/conversation/index.vue b/src/views/conversation/index.vue new file mode 100644 index 0000000..94a9df9 --- /dev/null +++ b/src/views/conversation/index.vue @@ -0,0 +1,196 @@ + + + + + diff --git a/src/views/conversation/preset-conv/PresetConv.vue b/src/views/conversation/preset-conv/PresetConv.vue new file mode 100644 index 0000000..eb76156 --- /dev/null +++ b/src/views/conversation/preset-conv/PresetConv.vue @@ -0,0 +1,233 @@ + + + + + diff --git a/src/views/conversation/preset-conv/columns.ts b/src/views/conversation/preset-conv/columns.ts new file mode 100644 index 0000000..197db47 --- /dev/null +++ b/src/views/conversation/preset-conv/columns.ts @@ -0,0 +1,34 @@ +import { BasicColumn } from '@/components/Table' +import { ConversationPreset } from '/#/conversation' +export const columns: BasicColumn[] = [ + { + title: 'id', + key: 'id', + width: 50, + }, + { + title: 'uuid', + key: 'uuid', + width: 120, + }, + { + title: '标题', + key: 'title', + width: 100, + }, + { + title: '描述', + key: 'remark', + width: 150, + }, + { + title: '创建时间', + key: 'createTime', + width: 180, + }, + { + title: '更新时间', + key: 'updateTime', + width: 180, + }, +] diff --git a/src/views/user/index.vue b/src/views/user/index.vue index 9e66169..120c13d 100644 --- a/src/views/user/index.vue +++ b/src/views/user/index.vue @@ -64,7 +64,6 @@ import userApi from '@/api/user' import { columns, UserData } from './columns' import { PlusOutlined } from '@vicons/antd' import { type FormRules } from 'naive-ui' -import { useDialog } from 'naive-ui' const newUserRules: FormRules = { name: { @@ -151,7 +150,6 @@ const schemas: FormSchema[] = [ }, ] -const dialog = useDialog() const formRef: any = ref(null) const actionRef = ref() @@ -200,29 +198,6 @@ const actionColumn = reactive({ }, }, ], - dropDownActions: [ - { - label: '删除', - key: 'deleteUser', - }, - ], - select: (key) => { - if (key === 'deleteUser') { - dialog.warning({ - title: '提示', - content: `删除后数据无法恢复,确定要删除用户 ${record.name} 吗?`, - positiveText: '确定', - negativeText: '取消', - onPositiveClick: () => { - console.log('删除成功') - handleDelete(record) - }, - onNegativeClick: () => { - console.log('已取消') - }, - }) - } - }, }) }, }) @@ -300,11 +275,6 @@ async function handleDisable(record: Recordable) { reloadTable() } -function handleDelete(record: Recordable) { - console.log('点击了删除', record) - window['$message'].info('点击了删除') -} - function handleSubmit(values: Recordable) { console.log(values) reloadTable() diff --git a/types/conversation.d.ts b/types/conversation.d.ts new file mode 100644 index 0000000..c2985a8 --- /dev/null +++ b/types/conversation.d.ts @@ -0,0 +1,19 @@ +export interface Conversation { + id: string + uuid: string + title: string + aiSystemMessage: string + tokens: number + understandContextEnable: boolean + createTime: string + updateTime: string +} + +export interface ConversationPreset { + id: string + uuid: string + title: string + remark: string + createTime: string + updateTime: string +} \ No newline at end of file diff --git a/types/global.d.ts b/types/global.d.ts index de4a77a..68cd3cc 100644 --- a/types/global.d.ts +++ b/types/global.d.ts @@ -100,3 +100,10 @@ declare module 'vue' { | { new (): ComponentPublicInstance } | FunctionalComponent; } + +export interface BasicResponseModel { + code: string + message: string + success: boolean + data: T +} \ No newline at end of file