Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
poc-fe
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
poc
poc-fe
Commits
5755d530
Commit
5755d530
authored
Mar 13, 2025
by
nick zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: 【问答知识库】设置索引取消底部按钮&&开关阻止同时多次执行
parent
77c8748e
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
7 deletions
+31
-7
knowledge.ts
src/apis/knowledge.ts
+4
-0
columns.tsx
...nal-space/personal-knowledge/knowledge-detail/columns.tsx
+1
-0
setting-knowledge-chunk-index-modal.vue
...wledge/components/setting-knowledge-chunk-index-modal.vue
+17
-4
qa-knowledge-chunk-detail.vue
...owledge-detail/qa-knowledge/qa-knowledge-chunk-detail.vue
+8
-3
types.d.ts
src/views/personal-space/personal-knowledge/types.d.ts
+1
-0
No files found.
src/apis/knowledge.ts
View file @
5755d530
...
...
@@ -244,6 +244,10 @@ export function fetchOpenQAKnowledgeChunk<T>(payload: { kdId: number; chunkRelat
export
function
fetchBatchDeleteQAKnowledgeChunks
<
T
>
(
kdId
:
number
,
chunkRelationIds
:
string
[])
{
return
request
.
post
<
T
>
(
`/qAKnowledgeRest/batchDeleteKnowledgeChunks.json?kdId=
${
kdId
}
&chunkRelationIds=
${
chunkRelationIds
}
`
,
null
,
{
timeout
:
15000
,
},
)
}
...
...
src/views/personal-space/personal-knowledge/knowledge-detail/columns.tsx
View file @
5755d530
...
...
@@ -133,6 +133,7 @@ export function createQAKnowledgeChunkColumn(
<
NSwitch
value=
{
row
.
isOpen
===
'Y'
}
size=
'small'
loading=
{
row
.
isOpenLoading
}
onUpdateValue=
{
()
=>
handleKnowledgeChunkTableAction
(
'updateOpen'
,
row
.
chunkRelationId
,
row
)
}
/>
</
div
>
...
...
src/views/personal-space/personal-knowledge/knowledge-detail/qa-knowledge/components/setting-knowledge-chunk-index-modal.vue
View file @
5755d530
...
...
@@ -2,6 +2,7 @@
import
{
computed
,
h
}
from
'vue'
import
{
NSwitch
}
from
'naive-ui'
import
{
useI18n
}
from
'vue-i18n'
import
{
useDebounceFn
}
from
'@vueuse/core'
import
CustomModal
from
'@/components/custom-modal/custom-modal.vue'
import
{
QAKnowledgeChunkKeyItem
}
from
'../../../types'
...
...
@@ -42,7 +43,11 @@ function createChunkIndexColumns() {
render
:
(
row
:
QAKnowledgeChunkKeyItem
)
=>
{
return
h
(
NSwitch
,
{
value
:
row
.
isIndex
===
'Y'
,
size
:
'small'
,
onUpdateValue
:
()
=>
handleKnowledgeTableAction
(
row
)
},
{
value
:
row
.
isIndex
===
'Y'
,
size
:
'small'
,
onUpdateValue
:
()
=>
handleKnowledgeTableAction
(
row
),
},
{},
)
},
...
...
@@ -50,7 +55,7 @@ function createChunkIndexColumns() {
]
}
function
handleKnowledgeTableAction
(
chunkKeyItem
:
QAKnowledgeChunkKeyItem
)
{
const
handleKnowledgeTableAction
=
useDebounceFn
((
chunkKeyItem
:
QAKnowledgeChunkKeyItem
)
=>
{
chunkKeyItem
.
isIndex
=
chunkKeyItem
.
isIndex
===
'Y'
?
'N'
:
'Y'
if
(
!
isHasChunkIndex
.
value
)
{
...
...
@@ -60,7 +65,7 @@ function handleKnowledgeTableAction(chunkKeyItem: QAKnowledgeChunkKeyItem) {
}
emit
(
'updateKnowledgeChunkIndex'
,
chunkKeyItem
)
}
}
,
500
)
</
script
>
<
template
>
...
...
@@ -75,7 +80,15 @@ function handleKnowledgeTableAction(chunkKeyItem: QAKnowledgeChunkKeyItem) {
{{
t
(
'personal_space_module.knowledge_module.setting_index_desc'
)
}}
</p>
<n-data-table
:single-line=
"false"
:columns=
"chunkIndexColumns"
:data=
"knowledgeChunkKeyList"
:max-height=
"300"
/>
<n-data-table
:single-line=
"false"
:columns=
"chunkIndexColumns"
:data=
"knowledgeChunkKeyList"
:max-height=
"300"
class=
"mb-1"
/>
</
template
>
<
template
#
footer
></
template
>
</CustomModal>
</template>
src/views/personal-space/personal-knowledge/knowledge-detail/qa-knowledge/qa-knowledge-chunk-detail.vue
View file @
5755d530
...
...
@@ -290,6 +290,7 @@ async function handleDeleteQAKnowledgeChunk(chunkRelationId: string) {
// 更新知识库是否开启
function
handleUpdateQAKnowledgeChunkOpen
(
chunkRelationId
:
string
,
chunkContentItem
:
QAKnowledgeChunkContentItem
)
{
chunkContentItem
.
isOpen
=
chunkContentItem
.
isOpen
===
'Y'
?
'N'
:
'Y'
chunkContentItem
.
isOpenLoading
=
true
const
payload
=
{
kdId
:
props
.
kdId
,
...
...
@@ -297,9 +298,13 @@ function handleUpdateQAKnowledgeChunkOpen(chunkRelationId: string, chunkContentI
isOpen
:
chunkContentItem
.
isOpen
,
}
fetchOpenQAKnowledgeChunk
(
payload
).
catch
(()
=>
{
fetchOpenQAKnowledgeChunk
(
payload
)
.
catch
(()
=>
{
chunkContentItem
.
isOpen
=
chunkContentItem
.
isOpen
===
'Y'
?
'N'
:
'Y'
})
.
finally
(()
=>
{
chunkContentItem
.
isOpenLoading
=
false
})
}
// 批量删除知识库分片
...
...
src/views/personal-space/personal-knowledge/types.d.ts
View file @
5755d530
...
...
@@ -60,6 +60,7 @@ export interface QAKnowledgeChunkContentItem {
chunkSort
:
number
chunkInfo
:
QAKnowledgeChunkInfoItem
[]
isOpen
:
'Y'
|
'N'
isOpenLoading
?:
boolean
}
export
interface
QAKnowledgeChunkInfoItem
{
...
...
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