feat:【antd】【ai】知识库的 knowledge 优化
This commit is contained in:
@@ -23,6 +23,9 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
component: 'Input',
|
||||
fieldName: 'name',
|
||||
label: '知识库名称',
|
||||
componentProps: {
|
||||
placeholder: '请输入知识库名称',
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
@@ -53,7 +56,6 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
placeholder: '请输入检索 topK',
|
||||
class: 'w-full',
|
||||
min: 0,
|
||||
max: 10,
|
||||
},
|
||||
@@ -65,7 +67,6 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
placeholder: '请输入检索相似度阈值',
|
||||
class: 'w-full',
|
||||
min: 0,
|
||||
max: 1,
|
||||
step: 0.01,
|
||||
@@ -94,14 +95,19 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||
fieldName: 'name',
|
||||
label: '知识库名称',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入知识库名称',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'status',
|
||||
label: '是否启用',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
||||
placeholder: '请选择是否启用',
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -122,22 +128,27 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||
{
|
||||
field: 'id',
|
||||
title: '编号',
|
||||
minWidth: 100,
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
title: '知识库名称',
|
||||
minWidth: 150,
|
||||
},
|
||||
{
|
||||
field: 'description',
|
||||
title: '知识库描述',
|
||||
minWidth: 200,
|
||||
},
|
||||
{
|
||||
field: 'embeddingModel',
|
||||
title: '向量化模型',
|
||||
minWidth: 150,
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '是否启用',
|
||||
minWidth: 100,
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.COMMON_STATUS },
|
||||
@@ -146,6 +157,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
minWidth: 180,
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
|
||||
@@ -28,17 +28,17 @@ function handleRefresh() {
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
/** 创建 */
|
||||
/** 创建知识库 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData(null).open();
|
||||
}
|
||||
|
||||
/** 编辑 */
|
||||
/** 编辑知识库 */
|
||||
function handleEdit(row: AiKnowledgeKnowledgeApi.Knowledge) {
|
||||
formModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 删除 */
|
||||
/** 删除知识库 */
|
||||
async function handleDelete(row: AiKnowledgeKnowledgeApi.Knowledge) {
|
||||
const hideLoading = message.loading({
|
||||
content: $t('ui.actionMessage.deleting', [row.name]),
|
||||
@@ -46,15 +46,14 @@ async function handleDelete(row: AiKnowledgeKnowledgeApi.Knowledge) {
|
||||
});
|
||||
try {
|
||||
await deleteKnowledge(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||
});
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||
handleRefresh();
|
||||
} finally {
|
||||
hideLoading();
|
||||
}
|
||||
}
|
||||
/** 文档按钮操作 */
|
||||
|
||||
/** 跳转到知识库文档页面 */
|
||||
const router = useRouter();
|
||||
function handleDocument(id: number) {
|
||||
router.push({
|
||||
@@ -92,6 +91,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: true,
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
import { getKnowledge } from '#/api/ai/knowledge/knowledge';
|
||||
import { searchKnowledgeSegment } from '#/api/ai/knowledge/segment';
|
||||
|
||||
/** 文档召回测试 */
|
||||
/** 知识库文档召回测试 */
|
||||
defineOptions({ name: 'KnowledgeDocumentRetrieval' });
|
||||
|
||||
const route = useRoute();
|
||||
@@ -32,7 +32,7 @@ const queryParams = reactive({
|
||||
similarityThreshold: 0.5,
|
||||
});
|
||||
|
||||
/** 调用文档召回测试接口 */
|
||||
/** 执行召回测试 */
|
||||
async function getRetrievalResult() {
|
||||
if (!queryParams.content) {
|
||||
message.warning('请输入查询文本');
|
||||
@@ -57,12 +57,12 @@ async function getRetrievalResult() {
|
||||
}
|
||||
}
|
||||
|
||||
/** 展开/收起段落内容 */
|
||||
/** 切换段落展开状态 */
|
||||
function toggleExpand(segment: any) {
|
||||
segment.expanded = !segment.expanded;
|
||||
}
|
||||
|
||||
/** 获取知识库信息 */
|
||||
/** 获取知识库配置信息 */
|
||||
async function getKnowledgeInfo(id: number) {
|
||||
try {
|
||||
const knowledge = await getKnowledge(id);
|
||||
|
||||
Reference in New Issue
Block a user