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,
|
chat_id,
|
||||||
loading,
|
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,
|
textToSpeech,
|
||||||
speechToText,
|
speechToText,
|
||||||
deleteChat,
|
deleteChat,
|
||||||
|
clearChat,
|
||||||
modifyChat,
|
modifyChat,
|
||||||
postUploadFile,
|
postUploadFile,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,7 +41,10 @@
|
|||||||
<span>{{ $t('chat.history') }}</span>
|
<span>{{ $t('chat.history') }}</span>
|
||||||
<el-tooltip effect="dark" :content="$t('chat.clearChat')" placement="right">
|
<el-tooltip effect="dark" :content="$t('chat.clearChat')" placement="right">
|
||||||
<!-- // TODO: 清空 -->
|
<!-- // TODO: 清空 -->
|
||||||
<el-button text>
|
<el-button
|
||||||
|
text
|
||||||
|
@click="clearChat"
|
||||||
|
>
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<Delete />
|
<Delete />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
@ -184,7 +187,7 @@ const props = defineProps<{
|
|||||||
currentChatId: string
|
currentChatId: string
|
||||||
isPcCollapse?: boolean
|
isPcCollapse?: boolean
|
||||||
}>()
|
}>()
|
||||||
const emit = defineEmits(['newChat', 'clickLog', 'deleteLog', 'refreshFieldTitle'])
|
const emit = defineEmits(['newChat', 'clickLog', 'deleteLog', 'refreshFieldTitle','clearChat'])
|
||||||
|
|
||||||
const EditTitleDialogRef = ref()
|
const EditTitleDialogRef = ref()
|
||||||
|
|
||||||
@ -205,6 +208,10 @@ const deleteChatLog = (row: any) => {
|
|||||||
emit('deleteLog', row)
|
emit('deleteLog', row)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const clearChat = () => {
|
||||||
|
emit('clearChat')
|
||||||
|
}
|
||||||
|
|
||||||
function editLogTitle(row: any) {
|
function editLogTitle(row: any) {
|
||||||
EditTitleDialogRef.value.open(row, props.applicationDetail.id)
|
EditTitleDialogRef.value.open(row, props.applicationDetail.id)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,6 +29,7 @@
|
|||||||
@new-chat="newChat"
|
@new-chat="newChat"
|
||||||
@clickLog="clickListHandle"
|
@clickLog="clickListHandle"
|
||||||
@delete-log="deleteLog"
|
@delete-log="deleteLog"
|
||||||
|
@clear-chat="clearChat"
|
||||||
@refreshFieldTitle="refreshFieldTitle"
|
@refreshFieldTitle="refreshFieldTitle"
|
||||||
:isPcCollapse="isPcCollapse"
|
: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) {
|
function handleScroll(event: any) {
|
||||||
if (
|
if (
|
||||||
currentChatId.value !== 'new' &&
|
currentChatId.value !== 'new' &&
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user