fix: Optimize the refresh issue of conversation history‌。

This commit is contained in:
wangdan-fit2cloud 2025-08-29 13:48:10 +08:00
parent 617937fe58
commit 7ee33b82dc
6 changed files with 42 additions and 46 deletions

View File

@ -59,7 +59,7 @@
</template>
<TransitionContent
v-if="transcribing"
:text="t('chat.transcribing')"
:text="t('chat.inputPlaceholder.recorderLoading')"
:type="type"
:application="applicationDetails"
>

View File

@ -59,8 +59,8 @@ export default {
prologueMessage: 'Sorry, the service is currently under maintenance. Please try again later!',
},
inputPlaceholder: {
speaking: 'Speaking...',
recorderLoading: 'Transcribing...',
speaking: 'Speaking',
recorderLoading: 'Transcribing',
default: 'Type your question',
},
uploadFile: {

View File

@ -131,19 +131,19 @@ function clearChat() {
paginationConfig.current_page = 1
paginationConfig.total = 0
currentRecordList.value = []
getChatLog(applicationDetail.value.id)
getChatLog()
})
}
function deleteLog(row: any) {
chatAPI.deleteChat(row.id, left_loading).then(() => {
chatAPI.deleteChat(row.id).then(() => {
if (currentChatId.value === row.id) {
currentChatId.value = 'new'
paginationConfig.current_page = 1
paginationConfig.total = 0
currentRecordList.value = []
}
getChatLog(applicationDetail.value.id)
chatLogData.value = chatLogData.value.filter((item) => item.id !== row.id)
})
}

View File

@ -139,19 +139,19 @@ function clearChat() {
paginationConfig.current_page = 1
paginationConfig.total = 0
currentRecordList.value = []
getChatLog(applicationDetail.value.id)
getChatLog()
})
}
function deleteLog(row: any) {
chatAPI.deleteChat(row.id, left_loading).then(() => {
chatAPI.deleteChat(row.id).then(() => {
if (currentChatId.value === row.id) {
currentChatId.value = 'new'
paginationConfig.current_page = 1
paginationConfig.total = 0
currentRecordList.value = []
}
getChatLog(applicationDetail.value.id)
chatLogData.value = chatLogData.value.filter((item) => item.id !== row.id)
})
}
function handleScroll(event: any) {

View File

@ -41,16 +41,16 @@
chatUser.chat_profile.authentication_type === 'password'
"
>
<img src="@/assets/user-icon.svg" style="width: 54%" alt=""/>
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
</el-avatar>
<el-dropdown v-else trigger="click" type="primary" class="w-full">
<div class="flex align-center">
<el-avatar :size="32">
<img src="@/assets/user-icon.svg" style="width: 54%" alt=""/>
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
</el-avatar>
<span v-show="!isPcCollapse" class="ml-8 color-text-primary">{{
chatUser.chatUserProfile?.nick_name
}}</span>
chatUser.chatUserProfile?.nick_name
}}</span>
</div>
<template #dropdown>
@ -58,7 +58,7 @@
<div class="flex align-center p-8">
<div class="mr-8 flex align-center">
<el-avatar :size="40">
<img src="@/assets/user-icon.svg" style="width: 54%" alt=""/>
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
</el-avatar>
</div>
<div>
@ -83,7 +83,7 @@
style="padding-top: 8px; padding-bottom: 8px"
@click="logout"
>
<AppIcon iconName="app-export" class="color-secondary"/>
<AppIcon iconName="app-export" class="color-secondary" />
{{ $t('layout.logout') }}
</el-dropdown-item>
</el-dropdown-menu>
@ -98,7 +98,7 @@
@click="isPcCollapse = !isPcCollapse"
>
<el-icon>
<component :is="isPcCollapse ? 'ArrowRightBold' : 'ArrowLeftBold'"/>
<component :is="isPcCollapse ? 'ArrowRightBold' : 'ArrowLeftBold'" />
</el-icon>
</el-button>
</div>
@ -134,13 +134,13 @@
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="exportMarkdown"
>{{ $t('common.export') }} Markdown</el-dropdown-item
>{{ $t('common.export') }} Markdown</el-dropdown-item
>
<el-dropdown-item @click="exportHTML"
>{{ $t('common.export') }} HTML</el-dropdown-item
>{{ $t('common.export') }} HTML</el-dropdown-item
>
<el-dropdown-item @click="openPDFExport"
>{{ $t('common.export') }} PDF</el-dropdown-item
>{{ $t('common.export') }} PDF</el-dropdown-item
>
</el-dropdown-menu>
</template>
@ -191,8 +191,8 @@
</span> -->
<span>
<el-button text @click="closeExecutionDetail">
<el-icon size="20"><Close/></el-icon
></el-button>
<el-icon size="20"><Close /></el-icon
></el-button>
</span>
</div>
</div>
@ -206,7 +206,7 @@
:detail="executionDetail"
:appType="applicationDetail?.type"
/>
<ParagraphDocumentContent :detail="rightPanelDetail" v-else/>
<ParagraphDocumentContent :detail="rightPanelDetail" v-else />
</div>
</div>
</div>
@ -222,31 +222,28 @@
</template>
<script setup lang="ts">
import {ref, onMounted, nextTick, computed, watch} from 'vue'
import {marked} from 'marked'
import {saveAs} from 'file-saver'
import { ref, onMounted, nextTick, computed, watch } from 'vue'
import { marked } from 'marked'
import { saveAs } from 'file-saver'
import chatAPI from '@/api/chat/chat'
import useStore from '@/stores'
import useResize from '@/layout/hooks/useResize'
import {hexToRgba} from '@/utils/theme'
import {useRoute, useRouter} from 'vue-router'
import { hexToRgba } from '@/utils/theme'
import { useRoute, useRouter } from 'vue-router'
import ResetPassword from '@/layout/layout-header/avatar/ResetPassword.vue'
import {t} from '@/locales'
import type {ResetCurrentUserPasswordRequest} from '@/api/type/user'
import ExecutionDetailContent
from '@/components/ai-chat/component/knowledge-source-component/ExecutionDetailContent.vue'
import ParagraphSourceContent
from '@/components/ai-chat/component/knowledge-source-component/ParagraphSourceContent.vue'
import ParagraphDocumentContent
from '@/components/ai-chat/component/knowledge-source-component/ParagraphDocumentContent.vue'
import { t } from '@/locales'
import type { ResetCurrentUserPasswordRequest } from '@/api/type/user'
import ExecutionDetailContent from '@/components/ai-chat/component/knowledge-source-component/ExecutionDetailContent.vue'
import ParagraphSourceContent from '@/components/ai-chat/component/knowledge-source-component/ParagraphSourceContent.vue'
import ParagraphDocumentContent from '@/components/ai-chat/component/knowledge-source-component/ParagraphDocumentContent.vue'
import HistoryPanel from '@/views/chat/component/HistoryPanel.vue'
import {cloneDeep} from 'lodash'
import {getFileUrl} from '@/utils/common'
import { cloneDeep } from 'lodash'
import { getFileUrl } from '@/utils/common'
import PdfExport from '@/components/pdf-export/index.vue'
useResize()
const pdfExportRef = ref<InstanceType<typeof PdfExport>>()
const {common, chatUser} = useStore()
const { common, chatUser } = useStore()
const router = useRouter()
const openPDFExport = () => {
pdfExportRef.value?.open(document.getElementById('chatListId'))
@ -279,7 +276,7 @@ const openResetPassword = () => {
const handleResetPassword = (param: ResetCurrentUserPasswordRequest) => {
chatAPI.resetCurrentPassword(param).then(() => {
router.push({name: 'login'})
router.push({ name: 'login' })
})
}
@ -307,8 +304,7 @@ const applicationDetail = computed({
get: () => {
return props.application_profile
},
set: (v) => {
},
set: (v) => {},
})
const chatLogData = ref<any[]>([])
@ -331,7 +327,7 @@ function refreshFieldTitle(chatId: string, abstract: string) {
}
function deleteLog(row: any) {
chatAPI.deleteChat(row.id, left_loading).then(() => {
chatAPI.deleteChat(row.id).then(() => {
if (currentChatId.value === row.id) {
currentChatId.value = 'new'
currentChatName.value = t('chat.createChat')
@ -339,7 +335,7 @@ function deleteLog(row: any) {
paginationConfig.value.total = 0
currentRecordList.value = []
}
getChatLog()
chatLogData.value = chatLogData.value.filter((item) => item.id !== row.id)
})
}
@ -470,7 +466,7 @@ async function exportMarkdown(): Promise<void> {
.map((record: any) => `# ${record.problem_text}\n\n${record.answer_text}\n\n`)
.join('\n')
const blob: Blob = new Blob([markdownContent], {type: 'text/markdown;charset=utf-8'})
const blob: Blob = new Blob([markdownContent], { type: 'text/markdown;charset=utf-8' })
saveAs(blob, suggestedName)
}
@ -481,7 +477,7 @@ async function exportHTML(): Promise<void> {
.join('\n')
const htmlContent: any = marked(markdownContent)
const blob: Blob = new Blob([htmlContent], {type: 'text/html;charset=utf-8'})
const blob: Blob = new Blob([htmlContent], { type: 'text/html;charset=utf-8' })
saveAs(blob, suggestedName)
}

View File

@ -211,7 +211,7 @@ const rules = reactive({
})
function close() {
if (isEdit.value || !areAllValuesNonEmpty(form.value)) {
if (!areAllValuesNonEmpty(form.value)) {
visible.value = false
} else {
MsgConfirm(t('common.tip'), t('views.tool.tip.saveMessage'), {