Skip to content

Commit

Permalink
增加会话管理
Browse files Browse the repository at this point in the history
  • Loading branch information
moyangzhan committed Oct 21, 2024
1 parent 1377710 commit c8ab7b1
Show file tree
Hide file tree
Showing 13 changed files with 658 additions and 40 deletions.
2 changes: 1 addition & 1 deletion src/api/aiModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
)
Expand Down
69 changes: 69 additions & 0 deletions src/api/conversation.ts
Original file line number Diff line number Diff line change
@@ -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,
}
2 changes: 1 addition & 1 deletion src/api/knowledgeBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
)
Expand Down
2 changes: 1 addition & 1 deletion src/api/sysConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
)
Expand Down
8 changes: 1 addition & 7 deletions src/api/user.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import { http } from '@/utils/http/axios'

export interface BasicResponseModel<T = any> {
code: string
message: string
success: boolean
data: T
}
import { BasicResponseModel } from '/#/global'

/**
* @description: 用户登录
Expand Down
49 changes: 49 additions & 0 deletions src/router/modules/conversation.ts
Original file line number Diff line number Diff line change
@@ -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<RouteRecordRaw> = [
{
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
47 changes: 47 additions & 0 deletions src/views/conversation/columns.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { BasicColumn } from '@/components/Table'
import { Conversation } from '/#/conversation'
export const columns: BasicColumn<Conversation>[] = [
{
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,
},
]
Loading

0 comments on commit c8ab7b1

Please sign in to comment.