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">
|
<div v-show="!isPcCollapse" class="flex-between p-8 pb-0 color-secondary mt-8">
|
||||||
<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: 清空 -->
|
<el-button text @click.stop="clearChat">
|
||||||
<el-button
|
|
||||||
text
|
|
||||||
@click="clearChat"
|
|
||||||
>
|
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<Delete />
|
<Delete />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
@ -118,8 +114,7 @@
|
|||||||
<div class="flex-between w-full">
|
<div class="flex-between w-full">
|
||||||
<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: 清空 -->
|
<el-button text @click.stop="clearChat">
|
||||||
<el-button text>
|
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<Delete />
|
<Delete />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
@ -178,16 +173,14 @@
|
|||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { isAppIcon } from '@/utils/common'
|
import { isAppIcon } from '@/utils/common'
|
||||||
import EditTitleDialog from './EditTitleDialog.vue'
|
import EditTitleDialog from './EditTitleDialog.vue'
|
||||||
import useStore from '@/stores'
|
|
||||||
const { common, chatUser } = useStore()
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
applicationDetail: any
|
applicationDetail: any
|
||||||
chatLogData: any[]
|
chatLogData: any[]
|
||||||
leftLoading: boolean
|
leftLoading?: boolean
|
||||||
currentChatId: string
|
currentChatId: string
|
||||||
isPcCollapse?: boolean
|
isPcCollapse?: boolean
|
||||||
}>()
|
}>()
|
||||||
const emit = defineEmits(['newChat', 'clickLog', 'deleteLog', 'refreshFieldTitle','clearChat'])
|
const emit = defineEmits(['newChat', 'clickLog', 'deleteLog', 'refreshFieldTitle', 'clearChat'])
|
||||||
|
|
||||||
const EditTitleDialogRef = ref()
|
const EditTitleDialogRef = ref()
|
||||||
|
|
||||||
|
|||||||
@ -8,11 +8,7 @@
|
|||||||
:size="280"
|
:size="280"
|
||||||
style="--el-drawer-padding-primary: 0"
|
style="--el-drawer-padding-primary: 0"
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button class="collapse cursor" circle @click="show = !show">
|
||||||
class="collapse cursor"
|
|
||||||
circle
|
|
||||||
@click="show = !show"
|
|
||||||
>
|
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<component :is="!show ? 'ArrowRightBold' : 'ArrowLeftBold'" />
|
<component :is="!show ? 'ArrowRightBold' : 'ArrowLeftBold'" />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
@ -26,6 +22,7 @@
|
|||||||
@clickLog="handleClickList"
|
@clickLog="handleClickList"
|
||||||
@delete-log="deleteChatLog"
|
@delete-log="deleteChatLog"
|
||||||
@refreshFieldTitle="refreshFieldTitle"
|
@refreshFieldTitle="refreshFieldTitle"
|
||||||
|
@clear-chat="clearChat"
|
||||||
>
|
>
|
||||||
<div class="user-info p-16 cursor">
|
<div class="user-info p-16 cursor">
|
||||||
<el-avatar
|
<el-avatar
|
||||||
@ -112,10 +109,14 @@ const props = defineProps<{
|
|||||||
currentChatId: string
|
currentChatId: string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const emit = defineEmits(['newChat', 'clickLog', 'deleteLog', 'refreshFieldTitle'])
|
const emit = defineEmits(['newChat', 'clickLog', 'deleteLog', 'refreshFieldTitle', 'clearChat'])
|
||||||
|
|
||||||
const { chatUser, chatLog } = useStore()
|
const { chatUser, chatLog } = useStore()
|
||||||
|
|
||||||
|
const clearChat = () => {
|
||||||
|
emit('clearChat')
|
||||||
|
}
|
||||||
|
|
||||||
const newChat = () => {
|
const newChat = () => {
|
||||||
emit('newChat')
|
emit('newChat')
|
||||||
}
|
}
|
||||||
@ -138,7 +139,7 @@ const openResetPassword = () => {
|
|||||||
|
|
||||||
const handleResetPassword = (param: ResetCurrentUserPasswordRequest) => {
|
const handleResetPassword = (param: ResetCurrentUserPasswordRequest) => {
|
||||||
chatAPI.resetCurrentPassword(param).then(() => {
|
chatAPI.resetCurrentPassword(param).then(() => {
|
||||||
router.push({name: 'login'})
|
router.push({ name: 'login' })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -81,6 +81,7 @@
|
|||||||
@clickLog="clickListHandle"
|
@clickLog="clickListHandle"
|
||||||
@delete-log="deleteLog"
|
@delete-log="deleteLog"
|
||||||
@refreshFieldTitle="refreshFieldTitle"
|
@refreshFieldTitle="refreshFieldTitle"
|
||||||
|
@clear-chat="clearChat"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</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) {
|
function deleteLog(row: any) {
|
||||||
chatAPI.deleteChat(row.id, left_loading).then(() => {
|
chatAPI.deleteChat(row.id, left_loading).then(() => {
|
||||||
if (currentChatId.value === row.id) {
|
if (currentChatId.value === row.id) {
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
@clickLog="handleClickList"
|
@clickLog="handleClickList"
|
||||||
@delete-log="deleteChatLog"
|
@delete-log="deleteChatLog"
|
||||||
@refreshFieldTitle="refreshFieldTitle"
|
@refreshFieldTitle="refreshFieldTitle"
|
||||||
|
@clear-chat="clearChat"
|
||||||
>
|
>
|
||||||
<div class="flex align-center user-info p-16" @click="toUserCenter">
|
<div class="flex align-center user-info p-16" @click="toUserCenter">
|
||||||
<el-avatar
|
<el-avatar
|
||||||
@ -47,14 +48,18 @@ const show = defineModel<boolean>('show')
|
|||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
applicationDetail: any
|
applicationDetail: any
|
||||||
chatLogData: any[]
|
chatLogData: any[]
|
||||||
leftLoading: boolean
|
leftLoading?: boolean
|
||||||
currentChatId: string
|
currentChatId: string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const emit = defineEmits(['newChat', 'clickLog', 'deleteLog', 'refreshFieldTitle'])
|
const emit = defineEmits(['newChat', 'clickLog', 'deleteLog', 'refreshFieldTitle', 'clearChat'])
|
||||||
|
|
||||||
const { chatUser, chatLog } = useStore()
|
const { chatUser, chatLog } = useStore()
|
||||||
|
|
||||||
|
const clearChat = () => {
|
||||||
|
emit('clearChat')
|
||||||
|
}
|
||||||
|
|
||||||
const newChat = () => {
|
const newChat = () => {
|
||||||
emit('newChat')
|
emit('newChat')
|
||||||
}
|
}
|
||||||
@ -70,7 +75,6 @@ function refreshFieldTitle(chatId: string, abstract: string) {
|
|||||||
emit('refreshFieldTitle', chatId, abstract)
|
emit('refreshFieldTitle', chatId, abstract)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const userCenterDrawerShow = ref(false)
|
const userCenterDrawerShow = ref(false)
|
||||||
function toUserCenter() {
|
function toUserCenter() {
|
||||||
if (
|
if (
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="chat-mobile layout-bg chat-background"
|
class="chat-mobile layout-bg chat-background"
|
||||||
v-loading="loading"
|
|
||||||
:class="classObj"
|
:class="classObj"
|
||||||
:style="{
|
:style="{
|
||||||
'--el-color-primary': applicationDetail?.custom_theme?.theme_color,
|
'--el-color-primary': applicationDetail?.custom_theme?.theme_color,
|
||||||
@ -82,6 +81,7 @@
|
|||||||
@clickLog="clickListHandle"
|
@clickLog="clickListHandle"
|
||||||
@delete-log="deleteLog"
|
@delete-log="deleteLog"
|
||||||
@refreshFieldTitle="refreshFieldTitle"
|
@refreshFieldTitle="refreshFieldTitle"
|
||||||
|
@clear-chat="clearChat"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</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) {
|
function deleteLog(row: any) {
|
||||||
chatAPI.deleteChat(row.id, left_loading).then(() => {
|
chatAPI.deleteChat(row.id, left_loading).then(() => {
|
||||||
if (currentChatId.value === row.id) {
|
if (currentChatId.value === row.id) {
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<div
|
<div
|
||||||
class="chat-pc"
|
class="chat-pc"
|
||||||
:class="classObj"
|
:class="classObj"
|
||||||
v-loading="loading || left_loading"
|
v-loading="loading"
|
||||||
:style="{
|
:style="{
|
||||||
'--el-color-primary': applicationDetail?.custom_theme?.theme_color,
|
'--el-color-primary': applicationDetail?.custom_theme?.theme_color,
|
||||||
'--el-color-primary-light-9': hexToRgba(
|
'--el-color-primary-light-9': hexToRgba(
|
||||||
@ -205,7 +205,7 @@
|
|||||||
<ExecutionDetailContent
|
<ExecutionDetailContent
|
||||||
v-if="rightPanelType === 'executionDetail'"
|
v-if="rightPanelType === 'executionDetail'"
|
||||||
:detail="executionDetail"
|
:detail="executionDetail"
|
||||||
:type="applicationDetail?.type"
|
:appType="applicationDetail?.type"
|
||||||
/>
|
/>
|
||||||
<ParagraphDocumentContent :detail="rightPanelDetail" v-else />
|
<ParagraphDocumentContent :detail="rightPanelDetail" v-else />
|
||||||
</div>
|
</div>
|
||||||
@ -450,8 +450,8 @@ const clickListHandle = (item: any) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function refresh(id: string) {
|
function refresh(id: string) {
|
||||||
getChatLog(applicationDetail.value.id, true)
|
|
||||||
currentChatId.value = id
|
currentChatId.value = id
|
||||||
|
getChatLog(applicationDetail.value.id, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function exportMarkdown(): Promise<void> {
|
async function exportMarkdown(): Promise<void> {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user