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
da918964
authored
Mar 01, 2025
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【功能新增】AI:知识库文档上传:50%,SplitStep 基本完成
parent
aeb59de6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
11 deletions
+34
-11
src/views/ai/knowledge/document/create/SplitStep.vue
+0
-0
src/views/ai/knowledge/document/create/UploadStep.vue
+9
-9
src/views/ai/knowledge/document/create/index.vue
+25
-2
No files found.
src/views/ai/knowledge/document/create/SplitStep.vue
View file @
da918964
This diff is collapsed.
Click to expand it.
src/views/ai/knowledge/document/create/UploadStep.vue
View file @
da918964
...
@@ -23,11 +23,11 @@
...
@@ -23,11 +23,11 @@
:accept=
"acceptedFileTypes"
:accept=
"acceptedFileTypes"
>
>
<div
class=
"flex flex-col items-center justify-center py-20px"
>
<div
class=
"flex flex-col items-center justify-center py-20px"
>
<
el-icon
class=
"text-[48px] text-[#c0c4cc] mb-10px"
><upload-filled
/></el-icon
>
<
Icon
icon=
"ep:upload-filled"
class=
"text-[48px] text-[#c0c4cc] mb-10px"
/
>
<div
class=
"el-upload__text text-[16px] text-[#606266]"
<div
class=
"el-upload__text text-[16px] text-[#606266]"
>
>
拖拽文件至此,或者
拖拽文件至此,或者
<em
class=
"text-[#409eff] not-italic cursor-pointer"
>
选择文件
</em>
</div
<em
class=
"text-[#409eff] not-italic cursor-pointer"
>
选择文件
</em>
>
</div
>
<div
class=
"el-upload__tip mt-10px text-[#909399] text-[12px]"
>
<div
class=
"el-upload__tip mt-10px text-[#909399] text-[12px]"
>
已支持
{{
supportedFileTypes
.
join
(
'、'
)
}}
,每个文件不超过
{{
maxFileSize
}}
MB。
已支持
{{
supportedFileTypes
.
join
(
'、'
)
}}
,每个文件不超过
{{
maxFileSize
}}
MB。
</div>
</div>
...
@@ -45,11 +45,11 @@
...
@@ -45,11 +45,11 @@
class=
"flex justify-between items-center py-4px px-12px border-l-4 border-l-[#409eff] rounded-sm shadow-sm hover:bg-[#ecf5ff] transition-all duration-300"
class=
"flex justify-between items-center py-4px px-12px border-l-4 border-l-[#409eff] rounded-sm shadow-sm hover:bg-[#ecf5ff] transition-all duration-300"
>
>
<div
class=
"flex items-center"
>
<div
class=
"flex items-center"
>
<
el-icon
class=
"mr-8px text-[#409eff]"
><document
/></el-icon
>
<
Icon
icon=
"ep:document"
class=
"mr-8px text-[#409eff]"
/
>
<span
class=
"text-[13px] text-[#303133] break-all"
>
{{
file
.
name
}}
</span>
<span
class=
"text-[13px] text-[#303133] break-all"
>
{{
file
.
name
}}
</span>
</div>
</div>
<el-button
type=
"danger"
link
@
click=
"removeFile(index)"
class=
"ml-2"
>
<el-button
type=
"danger"
link
@
click=
"removeFile(index)"
class=
"ml-2"
>
<
el-icon><delete
/></el-icon
>
<
Icon
icon=
"ep:delete"
/
>
</el-button>
</el-button>
</div>
</div>
</div>
</div>
...
@@ -69,10 +69,10 @@
...
@@ -69,10 +69,10 @@
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
import
{
PropType
,
ref
,
computed
,
inject
,
getCurrentInstance
,
onMounted
}
from
'vue'
import
{
PropType
,
ref
,
computed
,
inject
,
getCurrentInstance
,
onMounted
}
from
'vue'
import
{
Document
,
Delete
}
from
'@element-plus/icons-vue'
// TODO @芋艿:晚点改
import
{
useMessage
}
from
'@/hooks/web/useMessage'
import
{
useMessage
}
from
'@/hooks/web/useMessage'
import
{
useUpload
}
from
'@/components/UploadFile/src/useUpload'
import
{
useUpload
}
from
'@/components/UploadFile/src/useUpload'
import
{
generateAcceptedFileTypes
}
from
'@/utils'
import
{
generateAcceptedFileTypes
}
from
'@/utils'
import
{
Icon
}
from
'@/components/Icon'
const
props
=
defineProps
({
const
props
=
defineProps
({
modelValue
:
{
modelValue
:
{
...
@@ -173,8 +173,8 @@ const beforeUpload = (file) => {
...
@@ -173,8 +173,8 @@ const beforeUpload = (file) => {
* @param file 上传的文件
* @param file 上传的文件
*/
*/
const
handleUploadSuccess
=
(
response
,
file
)
=>
{
const
handleUploadSuccess
=
(
response
,
file
)
=>
{
// 添加到文件列表
if
(
response
&&
response
.
data
)
{
if
(
response
&&
response
.
data
)
{
// 添加到文件列表
ensureListExists
()
ensureListExists
()
emit
(
'update:modelValue'
,
{
emit
(
'update:modelValue'
,
{
...
props
.
modelValue
,
...
props
.
modelValue
,
...
...
src/views/ai/knowledge/document/create/index.vue
View file @
da918964
...
@@ -89,19 +89,42 @@ const steps = [{ title: '上传文档' }, { title: '文档分段' }, { title: '
...
@@ -89,19 +89,42 @@ const steps = [{ title: '上传文档' }, { title: '文档分段' }, { title: '
// 表单数据
// 表单数据
const
formData
=
ref
({
const
formData
=
ref
({
id
:
undefined
,
knowlegeId
:
undefined
,
// 知识库编号
list
:
[],
// 用于存储上传的文件列表
id
:
undefined
,
// 文档编号(documentId)
segmentMaxTokens
:
500
,
// 分段最大 token 数
list
:
[]
as
Array
<
{
name
:
string
url
:
string
segments
:
Array
<
{
content
?:
string
contentLength
?:
number
tokens
?:
number
}
>
}
>
,
// 用于存储上传的文件列表
status
:
0
// 0: 草稿, 1: 处理中, 2: 已完成
status
:
0
// 0: 草稿, 1: 处理中, 2: 已完成
})
})
/** 初始化数据 */
/** 初始化数据 */
const
initData
=
async
()
=>
{
const
initData
=
async
()
=>
{
// TODO @芋艿:knowlegeId 解析
const
documentId
=
route
.
params
.
id
as
string
const
documentId
=
route
.
params
.
id
as
string
if
(
documentId
)
{
if
(
documentId
)
{
// 修改场景
// 修改场景
// 这里需要调用API获取文档数据
// 这里需要调用API获取文档数据
// formData.value = await DocumentApi.getDocument(documentId)
// formData.value = await DocumentApi.getDocument(documentId)
}
}
// TODO @芋艿:为了开发方便,强制设置
if
(
false
)
{
formData
.
value
.
list
=
[
{
name
:
'项目说明文档.pdf'
,
url
:
'https://static.iocoder.cn/README_yudao.md'
,
segments
:
[]
}
]
goToNextStep
()
}
}
}
/** 切换到下一步 */
/** 切换到下一步 */
...
...
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