feat: 历史对话增加删除
This commit is contained in:
parent
b2460303db
commit
98a42074eb
@ -186,6 +186,18 @@ const getChatLogClient: (
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户端删除日志
|
||||||
|
* @param 参数 application_id, chat_id,
|
||||||
|
*/
|
||||||
|
const delChatClientLog: (
|
||||||
|
application_id: string,
|
||||||
|
chat_id: string,
|
||||||
|
loading?: Ref<boolean>
|
||||||
|
) => Promise<Result<boolean>> = (application_id, chat_id, loading) => {
|
||||||
|
return del(`${prefix}/${application_id}/chat/client/${chat_id}`, undefined, {}, loading)
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
getChatLog,
|
getChatLog,
|
||||||
delChatLog,
|
delChatLog,
|
||||||
@ -195,5 +207,6 @@ export default {
|
|||||||
getRecordDetail,
|
getRecordDetail,
|
||||||
delMarkRecord,
|
delMarkRecord,
|
||||||
exportChatLog,
|
exportChatLog,
|
||||||
getChatLogClient
|
getChatLogClient,
|
||||||
|
delChatClientLog
|
||||||
}
|
}
|
||||||
|
|||||||
@ -96,7 +96,6 @@
|
|||||||
plain
|
plain
|
||||||
size="small"
|
size="small"
|
||||||
@click="openParagraph(item)"
|
@click="openParagraph(item)"
|
||||||
:disabled="!item.paragraph_list || item.paragraph_list?.length === 0"
|
|
||||||
>引用分段:{{ item.paragraph_list?.length || 0 }}</el-button
|
>引用分段:{{ item.paragraph_list?.length || 0 }}</el-button
|
||||||
>
|
>
|
||||||
<el-tag type="info" effect="plain" class="mr-8 mt-8">
|
<el-tag type="info" effect="plain" class="mr-8 mt-8">
|
||||||
|
|||||||
@ -48,6 +48,18 @@ const useLogStore = defineStore({
|
|||||||
reject(error)
|
reject(error)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
async asyncDelChatClientLog(id: string, chatId: string, loading?: Ref<boolean>) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
logApi
|
||||||
|
.delChatClientLog(id, chatId, loading)
|
||||||
|
.then((data) => {
|
||||||
|
resolve(data)
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
reject(error)
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -43,9 +43,16 @@
|
|||||||
@click="clickListHandle"
|
@click="clickListHandle"
|
||||||
>
|
>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<auto-tooltip :content="row.abstract">
|
<div class="flex-between">
|
||||||
{{ row.abstract }}
|
<auto-tooltip :content="row.abstract">
|
||||||
</auto-tooltip>
|
{{ row.abstract }}
|
||||||
|
</auto-tooltip>
|
||||||
|
<div @click.stop>
|
||||||
|
<el-button text @click.stop="deleteLog(row)">
|
||||||
|
<el-icon><Delete /></el-icon>
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #empty>
|
<template #empty>
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
@ -92,6 +99,18 @@ const paginationConfig = reactive({
|
|||||||
const currentRecordList = ref<any>([])
|
const currentRecordList = ref<any>([])
|
||||||
const currentChatId = ref('new') // 当前历史记录Id 默认为'new'
|
const currentChatId = ref('new') // 当前历史记录Id 默认为'new'
|
||||||
|
|
||||||
|
function deleteLog(row: any) {
|
||||||
|
log.asyncDelChatClientLog(applicationDetail.value.id, row.id, left_loading).then(() => {
|
||||||
|
if (currentChatId.value === row.id) {
|
||||||
|
currentChatId.value = 'new'
|
||||||
|
paginationConfig.current_page = 1
|
||||||
|
paginationConfig.total = 0
|
||||||
|
currentRecordList.value = []
|
||||||
|
}
|
||||||
|
getChatLog(applicationDetail.value.id)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function handleScroll(event: any) {
|
function handleScroll(event: any) {
|
||||||
if (
|
if (
|
||||||
currentChatId.value !== 'new' &&
|
currentChatId.value !== 'new' &&
|
||||||
@ -289,7 +308,7 @@ onMounted(() => {
|
|||||||
padding-top: 38px;
|
padding-top: 38px;
|
||||||
}
|
}
|
||||||
.ai-chat__content {
|
.ai-chat__content {
|
||||||
padding-bottom: 104px
|
padding-bottom: 104px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,9 +25,16 @@
|
|||||||
@click="clickListHandle"
|
@click="clickListHandle"
|
||||||
>
|
>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<auto-tooltip :content="row.abstract">
|
<div class="flex-between">
|
||||||
{{ row.abstract }}
|
<auto-tooltip :content="row.abstract">
|
||||||
</auto-tooltip>
|
{{ row.abstract }}
|
||||||
|
</auto-tooltip>
|
||||||
|
<div @click.stop>
|
||||||
|
<el-button text @click.stop="deleteLog(row)">
|
||||||
|
<el-icon><Delete /></el-icon>
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #empty>
|
<template #empty>
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
@ -69,7 +76,7 @@
|
|||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="right-height chat-width">
|
<div class="right-height">
|
||||||
<!-- 对话 -->
|
<!-- 对话 -->
|
||||||
<AiChat
|
<AiChat
|
||||||
ref="AiChatRef"
|
ref="AiChatRef"
|
||||||
@ -80,7 +87,8 @@
|
|||||||
:chatId="currentChatId"
|
:chatId="currentChatId"
|
||||||
@refresh="refresh"
|
@refresh="refresh"
|
||||||
@scroll="handleScroll"
|
@scroll="handleScroll"
|
||||||
></AiChat>
|
>
|
||||||
|
</AiChat>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -143,6 +151,19 @@ const currentRecordList = ref<any>([])
|
|||||||
const currentChatId = ref('new') // 当前历史记录Id 默认为'new'
|
const currentChatId = ref('new') // 当前历史记录Id 默认为'new'
|
||||||
const currentChatName = ref('新建对话')
|
const currentChatName = ref('新建对话')
|
||||||
|
|
||||||
|
function deleteLog(row: any) {
|
||||||
|
log.asyncDelChatClientLog(applicationDetail.value.id, row.id, left_loading).then(() => {
|
||||||
|
if (currentChatId.value === row.id) {
|
||||||
|
currentChatId.value = 'new'
|
||||||
|
currentChatName.value = '新建对话'
|
||||||
|
paginationConfig.value.current_page = 1
|
||||||
|
paginationConfig.value.total = 0
|
||||||
|
currentRecordList.value = []
|
||||||
|
}
|
||||||
|
getChatLog(applicationDetail.value.id)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function handleScroll(event: any) {
|
function handleScroll(event: any) {
|
||||||
if (
|
if (
|
||||||
currentChatId.value !== 'new' &&
|
currentChatId.value !== 'new' &&
|
||||||
@ -362,10 +383,6 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-width {
|
|
||||||
max-width: var(--app-chat-width, 860px);
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
.collapse {
|
.collapse {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user