mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
feat: Clear chat log
This commit is contained in:
parent
ce213d78af
commit
0434a18905
|
|
@ -274,7 +274,17 @@ const deleteChat: (chat_id: string, loading?: Ref<boolean>) => Promise<Result<an
|
|||
chat_id,
|
||||
loading,
|
||||
) => {
|
||||
return del(`historical_conversation/${chat_id}`, loading)
|
||||
return del(`historical_conversation/${chat_id}`,undefined,undefined ,loading)
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param loading
|
||||
* @returns
|
||||
*/
|
||||
const clearChat: (loading?: Ref<boolean>) => Promise<Result<any>> = (
|
||||
loading
|
||||
) => {
|
||||
return del(`historical_conversation/clear`,undefined,undefined, loading)
|
||||
}
|
||||
/**
|
||||
*
|
||||
|
|
@ -344,6 +354,7 @@ export default {
|
|||
textToSpeech,
|
||||
speechToText,
|
||||
deleteChat,
|
||||
clearChat,
|
||||
modifyChat,
|
||||
postUploadFile,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,10 @@
|
|||
<span>{{ $t('chat.history') }}</span>
|
||||
<el-tooltip effect="dark" :content="$t('chat.clearChat')" placement="right">
|
||||
<!-- // TODO: 清空 -->
|
||||
<el-button text>
|
||||
<el-button
|
||||
text
|
||||
@click="clearChat"
|
||||
>
|
||||
<el-icon>
|
||||
<Delete />
|
||||
</el-icon>
|
||||
|
|
@ -184,7 +187,7 @@ const props = defineProps<{
|
|||
currentChatId: string
|
||||
isPcCollapse?: boolean
|
||||
}>()
|
||||
const emit = defineEmits(['newChat', 'clickLog', 'deleteLog', 'refreshFieldTitle'])
|
||||
const emit = defineEmits(['newChat', 'clickLog', 'deleteLog', 'refreshFieldTitle','clearChat'])
|
||||
|
||||
const EditTitleDialogRef = ref()
|
||||
|
||||
|
|
@ -205,6 +208,10 @@ const deleteChatLog = (row: any) => {
|
|||
emit('deleteLog', row)
|
||||
}
|
||||
|
||||
const clearChat = () => {
|
||||
emit('clearChat')
|
||||
}
|
||||
|
||||
function editLogTitle(row: any) {
|
||||
EditTitleDialogRef.value.open(row, props.applicationDetail.id)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
@new-chat="newChat"
|
||||
@clickLog="clickListHandle"
|
||||
@delete-log="deleteLog"
|
||||
@clear-chat="clearChat"
|
||||
@refreshFieldTitle="refreshFieldTitle"
|
||||
:isPcCollapse="isPcCollapse"
|
||||
>
|
||||
|
|
@ -325,6 +326,18 @@ function deleteLog(row: any) {
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
function clearChat() {
|
||||
chatAPI.clearChat(left_loading, ).then(() => {
|
||||
currentChatId.value = 'new'
|
||||
currentChatName.value = t('chat.createChat')
|
||||
paginationConfig.value.current_page = 1
|
||||
paginationConfig.value.total = 0
|
||||
currentRecordList.value = []
|
||||
getChatLog(applicationDetail.value.id)
|
||||
})
|
||||
}
|
||||
|
||||
function handleScroll(event: any) {
|
||||
if (
|
||||
currentChatId.value !== 'new' &&
|
||||
|
|
|
|||
Loading…
Reference in New Issue