mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
fix: clear history
This commit is contained in:
parent
bf657aced0
commit
5cb21a69e5
|
|
@ -40,11 +40,7 @@
|
|||
<div v-show="!isPcCollapse" class="flex-between p-8 pb-0 color-secondary mt-8">
|
||||
<span>{{ $t('chat.history') }}</span>
|
||||
<el-tooltip effect="dark" :content="$t('chat.clearChat')" placement="right">
|
||||
<!-- // TODO: 清空 -->
|
||||
<el-button
|
||||
text
|
||||
@click="clearChat"
|
||||
>
|
||||
<el-button text @click.stop="clearChat">
|
||||
<el-icon>
|
||||
<Delete />
|
||||
</el-icon>
|
||||
|
|
@ -118,8 +114,7 @@
|
|||
<div class="flex-between w-full">
|
||||
<span>{{ $t('chat.history') }}</span>
|
||||
<el-tooltip effect="dark" :content="$t('chat.clearChat')" placement="right">
|
||||
<!-- // TODO: 清空 -->
|
||||
<el-button text>
|
||||
<el-button text @click.stop="clearChat">
|
||||
<el-icon>
|
||||
<Delete />
|
||||
</el-icon>
|
||||
|
|
@ -178,16 +173,14 @@
|
|||
import { ref } from 'vue'
|
||||
import { isAppIcon } from '@/utils/common'
|
||||
import EditTitleDialog from './EditTitleDialog.vue'
|
||||
import useStore from '@/stores'
|
||||
const { common, chatUser } = useStore()
|
||||
const props = defineProps<{
|
||||
applicationDetail: any
|
||||
chatLogData: any[]
|
||||
leftLoading: boolean
|
||||
leftLoading?: boolean
|
||||
currentChatId: string
|
||||
isPcCollapse?: boolean
|
||||
}>()
|
||||
const emit = defineEmits(['newChat', 'clickLog', 'deleteLog', 'refreshFieldTitle','clearChat'])
|
||||
const emit = defineEmits(['newChat', 'clickLog', 'deleteLog', 'refreshFieldTitle', 'clearChat'])
|
||||
|
||||
const EditTitleDialogRef = ref()
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
:size="280"
|
||||
style="--el-drawer-padding-primary: 0"
|
||||
>
|
||||
<el-button
|
||||
class="collapse cursor"
|
||||
circle
|
||||
@click="show = !show"
|
||||
>
|
||||
<el-button class="collapse cursor" circle @click="show = !show">
|
||||
<el-icon>
|
||||
<component :is="!show ? 'ArrowRightBold' : 'ArrowLeftBold'" />
|
||||
</el-icon>
|
||||
|
|
@ -26,6 +22,7 @@
|
|||
@clickLog="handleClickList"
|
||||
@delete-log="deleteChatLog"
|
||||
@refreshFieldTitle="refreshFieldTitle"
|
||||
@clear-chat="clearChat"
|
||||
>
|
||||
<div class="user-info p-16 cursor">
|
||||
<el-avatar
|
||||
|
|
@ -112,10 +109,14 @@ const props = defineProps<{
|
|||
currentChatId: string
|
||||
}>()
|
||||
|
||||
const emit = defineEmits(['newChat', 'clickLog', 'deleteLog', 'refreshFieldTitle'])
|
||||
const emit = defineEmits(['newChat', 'clickLog', 'deleteLog', 'refreshFieldTitle', 'clearChat'])
|
||||
|
||||
const { chatUser, chatLog } = useStore()
|
||||
|
||||
const clearChat = () => {
|
||||
emit('clearChat')
|
||||
}
|
||||
|
||||
const newChat = () => {
|
||||
emit('newChat')
|
||||
}
|
||||
|
|
@ -138,7 +139,7 @@ const openResetPassword = () => {
|
|||
|
||||
const handleResetPassword = (param: ResetCurrentUserPasswordRequest) => {
|
||||
chatAPI.resetCurrentPassword(param).then(() => {
|
||||
router.push({name: 'login'})
|
||||
router.push({ name: 'login' })
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@
|
|||
@clickLog="clickListHandle"
|
||||
@delete-log="deleteLog"
|
||||
@refreshFieldTitle="refreshFieldTitle"
|
||||
@clear-chat="clearChat"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -124,6 +125,16 @@ const customStyle = computed(() => {
|
|||
}
|
||||
})
|
||||
|
||||
function clearChat() {
|
||||
chatAPI.clearChat(left_loading).then(() => {
|
||||
currentChatId.value = 'new'
|
||||
paginationConfig.current_page = 1
|
||||
paginationConfig.total = 0
|
||||
currentRecordList.value = []
|
||||
getChatLog(applicationDetail.value.id)
|
||||
})
|
||||
}
|
||||
|
||||
function deleteLog(row: any) {
|
||||
chatAPI.deleteChat(row.id, left_loading).then(() => {
|
||||
if (currentChatId.value === row.id) {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
@clickLog="handleClickList"
|
||||
@delete-log="deleteChatLog"
|
||||
@refreshFieldTitle="refreshFieldTitle"
|
||||
@clear-chat="clearChat"
|
||||
>
|
||||
<div class="flex align-center user-info p-16" @click="toUserCenter">
|
||||
<el-avatar
|
||||
|
|
@ -47,14 +48,18 @@ const show = defineModel<boolean>('show')
|
|||
const props = defineProps<{
|
||||
applicationDetail: any
|
||||
chatLogData: any[]
|
||||
leftLoading: boolean
|
||||
leftLoading?: boolean
|
||||
currentChatId: string
|
||||
}>()
|
||||
|
||||
const emit = defineEmits(['newChat', 'clickLog', 'deleteLog', 'refreshFieldTitle'])
|
||||
const emit = defineEmits(['newChat', 'clickLog', 'deleteLog', 'refreshFieldTitle', 'clearChat'])
|
||||
|
||||
const { chatUser, chatLog } = useStore()
|
||||
|
||||
const clearChat = () => {
|
||||
emit('clearChat')
|
||||
}
|
||||
|
||||
const newChat = () => {
|
||||
emit('newChat')
|
||||
}
|
||||
|
|
@ -70,7 +75,6 @@ function refreshFieldTitle(chatId: string, abstract: string) {
|
|||
emit('refreshFieldTitle', chatId, abstract)
|
||||
}
|
||||
|
||||
|
||||
const userCenterDrawerShow = ref(false)
|
||||
function toUserCenter() {
|
||||
if (
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
<template>
|
||||
<div
|
||||
class="chat-mobile layout-bg chat-background"
|
||||
v-loading="loading"
|
||||
:class="classObj"
|
||||
:style="{
|
||||
'--el-color-primary': applicationDetail?.custom_theme?.theme_color,
|
||||
|
|
@ -82,6 +81,7 @@
|
|||
@clickLog="clickListHandle"
|
||||
@delete-log="deleteLog"
|
||||
@refreshFieldTitle="refreshFieldTitle"
|
||||
@clear-chat="clearChat"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -133,6 +133,16 @@ const classObj = computed(() => {
|
|||
}
|
||||
})
|
||||
|
||||
function clearChat() {
|
||||
chatAPI.clearChat(left_loading).then(() => {
|
||||
currentChatId.value = 'new'
|
||||
paginationConfig.current_page = 1
|
||||
paginationConfig.total = 0
|
||||
currentRecordList.value = []
|
||||
getChatLog(applicationDetail.value.id)
|
||||
})
|
||||
}
|
||||
|
||||
function deleteLog(row: any) {
|
||||
chatAPI.deleteChat(row.id, left_loading).then(() => {
|
||||
if (currentChatId.value === row.id) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<div
|
||||
class="chat-pc"
|
||||
:class="classObj"
|
||||
v-loading="loading || left_loading"
|
||||
v-loading="loading"
|
||||
:style="{
|
||||
'--el-color-primary': applicationDetail?.custom_theme?.theme_color,
|
||||
'--el-color-primary-light-9': hexToRgba(
|
||||
|
|
@ -205,7 +205,7 @@
|
|||
<ExecutionDetailContent
|
||||
v-if="rightPanelType === 'executionDetail'"
|
||||
:detail="executionDetail"
|
||||
:type="applicationDetail?.type"
|
||||
:appType="applicationDetail?.type"
|
||||
/>
|
||||
<ParagraphDocumentContent :detail="rightPanelDetail" v-else />
|
||||
</div>
|
||||
|
|
@ -450,8 +450,8 @@ const clickListHandle = (item: any) => {
|
|||
}
|
||||
|
||||
function refresh(id: string) {
|
||||
getChatLog(applicationDetail.value.id, true)
|
||||
currentChatId.value = id
|
||||
getChatLog(applicationDetail.value.id, true)
|
||||
}
|
||||
|
||||
async function exportMarkdown(): Promise<void> {
|
||||
|
|
|
|||
Loading…
Reference in New Issue