Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
809fb9fd
authored
Mar 01, 2025
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【功能新增】AI:知识库文档上传:70%,SplitStep 已完成
parent
de41b6cd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
9 deletions
+49
-9
src/api/ai/knowledge/document/index.ts
+14
-6
src/views/ai/knowledge/document/form/SplitStep.vue
+8
-2
src/views/ai/knowledge/document/index.vue
+27
-1
No files found.
src/api/ai/knowledge/document/index.ts
View file @
809fb9fd
...
@@ -25,19 +25,27 @@ export const KnowledgeDocumentApi = {
...
@@ -25,19 +25,27 @@ export const KnowledgeDocumentApi = {
},
},
// 新增知识库文档(单个)
// 新增知识库文档(单个)
createKnowledgeDocument
:
async
(
data
:
KnowledgeDocumentVO
)
=>
{
createKnowledgeDocument
:
async
(
data
:
any
)
=>
{
return
await
request
.
post
({
url
:
`/ai/knowledge/document/create`
,
data
})
return
await
request
.
post
({
url
:
`/ai/knowledge/document/create`
,
data
})
},
},
// 新增知识库文档(
批量
)
// 新增知识库文档(
多个
)
createKnowledgeDocumentList
:
async
(
data
:
any
)
=>
{
createKnowledgeDocumentList
:
async
(
data
:
any
)
=>
{
return
await
request
.
post
({
url
:
`/ai/knowledge/document/create-list`
,
data
})
return
await
request
.
post
({
url
:
`/ai/knowledge/document/create-list`
,
data
})
},
},
// // 修改AI 知识库文档
// 修改知识库文档
// updateKnowledgeDocument: async (data: KnowledgeDocumentVO) => {
updateKnowledgeDocument
:
async
(
data
:
any
)
=>
{
// return await request.put({ url: `/ai/knowledge/document/update`, data })
return
await
request
.
put
({
url
:
`/ai/knowledge/document/update`
,
data
})
// },
},
// 修改知识库文档状态
updateKnowledgeDocumentStatus
:
async
(
data
:
any
)
=>
{
return
await
request
.
put
({
url
:
`/ai/knowledge/document/update-status`
,
data
})
},
// 删除知识库文档
// 删除知识库文档
deleteKnowledgeDocument
:
async
(
id
:
number
)
=>
{
deleteKnowledgeDocument
:
async
(
id
:
number
)
=>
{
...
...
src/views/ai/knowledge/document/form/SplitStep.vue
View file @
809fb9fd
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
<div
class=
"segment-settings mb-20px"
>
<div
class=
"segment-settings mb-20px"
>
<el-form
label-width=
"120px"
>
<el-form
label-width=
"120px"
>
<el-form-item
label=
"最大 Token 数"
>
<el-form-item
label=
"最大 Token 数"
>
<el-input-number
v-model=
"modelData.segmentMaxTokens"
:min=
"1
00"
:max=
"2000
"
/>
<el-input-number
v-model=
"modelData.segmentMaxTokens"
:min=
"1
"
:max=
"2048
"
/>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
</div>
</div>
...
@@ -38,6 +38,9 @@
...
@@ -38,6 +38,9 @@
<div
class=
"flex items-center cursor-pointer"
>
<div
class=
"flex items-center cursor-pointer"
>
<Icon
icon=
"ep:document"
class=
"text-danger mr-5px"
/>
<Icon
icon=
"ep:document"
class=
"text-danger mr-5px"
/>
<span>
{{
currentFile
?.
name
||
'请选择文件'
}}
</span>
<span>
{{
currentFile
?.
name
||
'请选择文件'
}}
</span>
<span
v-if=
"currentFile?.segments"
class=
"ml-5px text-gray-500 text-12px"
>
(
{{
currentFile
.
segments
.
length
}}
个分片)
</span>
<Icon
icon=
"ep:arrow-down"
class=
"ml-5px"
/>
<Icon
icon=
"ep:arrow-down"
class=
"ml-5px"
/>
</div>
</div>
<template
#
dropdown
>
<template
#
dropdown
>
...
@@ -48,6 +51,9 @@
...
@@ -48,6 +51,9 @@
@
click=
"selectFile(index)"
@
click=
"selectFile(index)"
>
>
{{
file
.
name
}}
{{
file
.
name
}}
<span
v-if=
"file.segments"
class=
"ml-5px text-gray-500 text-12px"
>
(
{{
file
.
segments
.
length
}}
个分片)
</span>
</el-dropdown-item>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown-menu>
</
template
>
</
template
>
...
@@ -182,7 +188,7 @@ const handleSave = async () => {
...
@@ -182,7 +188,7 @@ const handleSave = async () => {
try
{
try
{
if
(
modelData
.
value
.
id
)
{
if
(
modelData
.
value
.
id
)
{
// 修改场景
// 修改场景
modelData
.
value
.
ids
=
await
KnowledgeDocumentApi
.
createKnowledgeDocumentLis
t
({
modelData
.
value
.
ids
=
await
KnowledgeDocumentApi
.
updateKnowledgeDocumen
t
({
id
:
modelData
.
value
.
id
,
id
:
modelData
.
value
.
id
,
segmentMaxTokens
:
modelData
.
value
.
segmentMaxTokens
segmentMaxTokens
:
modelData
.
value
.
segmentMaxTokens
})
})
...
...
src/views/ai/knowledge/document/index.vue
View file @
809fb9fd
...
@@ -53,7 +53,13 @@
...
@@ -53,7 +53,13 @@
<el-table-column
label=
"召回次数"
align=
"center"
prop=
"retrievalCount"
/>
<el-table-column
label=
"召回次数"
align=
"center"
prop=
"retrievalCount"
/>
<el-table-column
label=
"是否启用"
align=
"center"
prop=
"status"
>
<el-table-column
label=
"是否启用"
align=
"center"
prop=
"status"
>
<template
#
default=
"scope"
>
<template
#
default=
"scope"
>
<dict-tag
:type=
"DICT_TYPE.COMMON_STATUS"
:value=
"scope.row.status"
/>
<el-switch
v-model=
"scope.row.status"
:active-value=
"0"
:inactive-value=
"1"
@
change=
"handleStatusChange(scope.row)"
:disabled=
"!checkPermi(['ai:knowledge:update'])"
/>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
<el-table-column
...
@@ -102,6 +108,8 @@ import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
...
@@ -102,6 +108,8 @@ import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import
{
dateFormatter
}
from
'@/utils/formatTime'
import
{
dateFormatter
}
from
'@/utils/formatTime'
import
{
KnowledgeDocumentApi
,
KnowledgeDocumentVO
}
from
'@/api/ai/knowledge/document'
import
{
KnowledgeDocumentApi
,
KnowledgeDocumentVO
}
from
'@/api/ai/knowledge/document'
import
{
useRoute
,
useRouter
}
from
'vue-router'
import
{
useRoute
,
useRouter
}
from
'vue-router'
import
{
checkPermi
}
from
'@/utils/permission'
import
{
CommonStatusEnum
}
from
'@/utils/constants'
// import KnowledgeDocumentForm from './KnowledgeDocumentForm.vue'
// import KnowledgeDocumentForm from './KnowledgeDocumentForm.vue'
/** AI 知识库文档 列表 */
/** AI 知识库文档 列表 */
...
@@ -177,6 +185,24 @@ const handleDelete = async (id: number) => {
...
@@ -177,6 +185,24 @@ const handleDelete = async (id: number) => {
}
catch
{}
}
catch
{}
}
}
/** 修改状态操作 */
const
handleStatusChange
=
async
(
row
:
KnowledgeDocumentVO
)
=>
{
try
{
// 修改状态的二次确认
const
text
=
row
.
status
===
CommonStatusEnum
.
ENABLE
?
'启用'
:
'禁用'
await
message
.
confirm
(
'确认要"'
+
text
+
'""'
+
row
.
name
+
'"文档吗?'
)
// 发起修改状态
await
KnowledgeDocumentApi
.
updateKnowledgeDocumentStatus
({
id
:
row
.
id
,
status
:
row
.
status
})
message
.
success
(
t
(
'common.updateSuccess'
))
// 刷新列表
await
getList
()
}
catch
{
// 取消后,进行恢复按钮
row
.
status
=
row
.
status
===
CommonStatusEnum
.
ENABLE
?
CommonStatusEnum
.
DISABLE
:
CommonStatusEnum
.
ENABLE
}
}
/** 初始化 **/
/** 初始化 **/
onMounted
(()
=>
{
onMounted
(()
=>
{
// 如果知识库 ID 不存在,显示错误提示并关闭页面
// 如果知识库 ID 不存在,显示错误提示并关闭页面
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment