Skip to content

Commit 7ee33b8

Browse files
fix: Optimize the refresh issue of conversation history‌。
1 parent 617937f commit 7ee33b8

File tree

6 files changed

+42
-46
lines changed

6 files changed

+42
-46
lines changed

ui/src/components/ai-chat/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
</template>
6060
<TransitionContent
6161
v-if="transcribing"
62-
:text="t('chat.transcribing')"
62+
:text="t('chat.inputPlaceholder.recorderLoading')"
6363
:type="type"
6464
:application="applicationDetails"
6565
>

ui/src/locales/lang/en-US/ai-chat.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ export default {
5959
prologueMessage: 'Sorry, the service is currently under maintenance. Please try again later!',
6060
},
6161
inputPlaceholder: {
62-
speaking: 'Speaking...',
63-
recorderLoading: 'Transcribing...',
62+
speaking: 'Speaking',
63+
recorderLoading: 'Transcribing',
6464
default: 'Type your question',
6565
},
6666
uploadFile: {

ui/src/views/chat/embed/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,19 +131,19 @@ function clearChat() {
131131
paginationConfig.current_page = 1
132132
paginationConfig.total = 0
133133
currentRecordList.value = []
134-
getChatLog(applicationDetail.value.id)
134+
getChatLog()
135135
})
136136
}
137137
138138
function deleteLog(row: any) {
139-
chatAPI.deleteChat(row.id, left_loading).then(() => {
139+
chatAPI.deleteChat(row.id).then(() => {
140140
if (currentChatId.value === row.id) {
141141
currentChatId.value = 'new'
142142
paginationConfig.current_page = 1
143143
paginationConfig.total = 0
144144
currentRecordList.value = []
145145
}
146-
getChatLog(applicationDetail.value.id)
146+
chatLogData.value = chatLogData.value.filter((item) => item.id !== row.id)
147147
})
148148
}
149149

ui/src/views/chat/mobile/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,19 +139,19 @@ function clearChat() {
139139
paginationConfig.current_page = 1
140140
paginationConfig.total = 0
141141
currentRecordList.value = []
142-
getChatLog(applicationDetail.value.id)
142+
getChatLog()
143143
})
144144
}
145145
146146
function deleteLog(row: any) {
147-
chatAPI.deleteChat(row.id, left_loading).then(() => {
147+
chatAPI.deleteChat(row.id).then(() => {
148148
if (currentChatId.value === row.id) {
149149
currentChatId.value = 'new'
150150
paginationConfig.current_page = 1
151151
paginationConfig.total = 0
152152
currentRecordList.value = []
153153
}
154-
getChatLog(applicationDetail.value.id)
154+
chatLogData.value = chatLogData.value.filter((item) => item.id !== row.id)
155155
})
156156
}
157157
function handleScroll(event: any) {

ui/src/views/chat/pc/index.vue

Lines changed: 32 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,24 @@
4141
chatUser.chat_profile.authentication_type === 'password'
4242
"
4343
>
44-
<img src="@/assets/user-icon.svg" style="width: 54%" alt=""/>
44+
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
4545
</el-avatar>
4646
<el-dropdown v-else trigger="click" type="primary" class="w-full">
4747
<div class="flex align-center">
4848
<el-avatar :size="32">
49-
<img src="@/assets/user-icon.svg" style="width: 54%" alt=""/>
49+
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
5050
</el-avatar>
5151
<span v-show="!isPcCollapse" class="ml-8 color-text-primary">{{
52-
chatUser.chatUserProfile?.nick_name
53-
}}</span>
52+
chatUser.chatUserProfile?.nick_name
53+
}}</span>
5454
</div>
5555

5656
<template #dropdown>
5757
<el-dropdown-menu style="min-width: 260px">
5858
<div class="flex align-center p-8">
5959
<div class="mr-8 flex align-center">
6060
<el-avatar :size="40">
61-
<img src="@/assets/user-icon.svg" style="width: 54%" alt=""/>
61+
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
6262
</el-avatar>
6363
</div>
6464
<div>
@@ -83,7 +83,7 @@
8383
style="padding-top: 8px; padding-bottom: 8px"
8484
@click="logout"
8585
>
86-
<AppIcon iconName="app-export" class="color-secondary"/>
86+
<AppIcon iconName="app-export" class="color-secondary" />
8787
{{ $t('layout.logout') }}
8888
</el-dropdown-item>
8989
</el-dropdown-menu>
@@ -98,7 +98,7 @@
9898
@click="isPcCollapse = !isPcCollapse"
9999
>
100100
<el-icon>
101-
<component :is="isPcCollapse ? 'ArrowRightBold' : 'ArrowLeftBold'"/>
101+
<component :is="isPcCollapse ? 'ArrowRightBold' : 'ArrowLeftBold'" />
102102
</el-icon>
103103
</el-button>
104104
</div>
@@ -134,13 +134,13 @@
134134
<template #dropdown>
135135
<el-dropdown-menu>
136136
<el-dropdown-item @click="exportMarkdown"
137-
>{{ $t('common.export') }} Markdown</el-dropdown-item
137+
>{{ $t('common.export') }} Markdown</el-dropdown-item
138138
>
139139
<el-dropdown-item @click="exportHTML"
140-
>{{ $t('common.export') }} HTML</el-dropdown-item
140+
>{{ $t('common.export') }} HTML</el-dropdown-item
141141
>
142142
<el-dropdown-item @click="openPDFExport"
143-
>{{ $t('common.export') }} PDF</el-dropdown-item
143+
>{{ $t('common.export') }} PDF</el-dropdown-item
144144
>
145145
</el-dropdown-menu>
146146
</template>
@@ -191,8 +191,8 @@
191191
</span> -->
192192
<span>
193193
<el-button text @click="closeExecutionDetail">
194-
<el-icon size="20"><Close/></el-icon
195-
></el-button>
194+
<el-icon size="20"><Close /></el-icon
195+
></el-button>
196196
</span>
197197
</div>
198198
</div>
@@ -206,7 +206,7 @@
206206
:detail="executionDetail"
207207
:appType="applicationDetail?.type"
208208
/>
209-
<ParagraphDocumentContent :detail="rightPanelDetail" v-else/>
209+
<ParagraphDocumentContent :detail="rightPanelDetail" v-else />
210210
</div>
211211
</div>
212212
</div>
@@ -222,31 +222,28 @@
222222
</template>
223223

224224
<script setup lang="ts">
225-
import {ref, onMounted, nextTick, computed, watch} from 'vue'
226-
import {marked} from 'marked'
227-
import {saveAs} from 'file-saver'
225+
import { ref, onMounted, nextTick, computed, watch } from 'vue'
226+
import { marked } from 'marked'
227+
import { saveAs } from 'file-saver'
228228
import chatAPI from '@/api/chat/chat'
229229
import useStore from '@/stores'
230230
import useResize from '@/layout/hooks/useResize'
231-
import {hexToRgba} from '@/utils/theme'
232-
import {useRoute, useRouter} from 'vue-router'
231+
import { hexToRgba } from '@/utils/theme'
232+
import { useRoute, useRouter } from 'vue-router'
233233
import ResetPassword from '@/layout/layout-header/avatar/ResetPassword.vue'
234-
import {t} from '@/locales'
235-
import type {ResetCurrentUserPasswordRequest} from '@/api/type/user'
236-
import ExecutionDetailContent
237-
from '@/components/ai-chat/component/knowledge-source-component/ExecutionDetailContent.vue'
238-
import ParagraphSourceContent
239-
from '@/components/ai-chat/component/knowledge-source-component/ParagraphSourceContent.vue'
240-
import ParagraphDocumentContent
241-
from '@/components/ai-chat/component/knowledge-source-component/ParagraphDocumentContent.vue'
234+
import { t } from '@/locales'
235+
import type { ResetCurrentUserPasswordRequest } from '@/api/type/user'
236+
import ExecutionDetailContent from '@/components/ai-chat/component/knowledge-source-component/ExecutionDetailContent.vue'
237+
import ParagraphSourceContent from '@/components/ai-chat/component/knowledge-source-component/ParagraphSourceContent.vue'
238+
import ParagraphDocumentContent from '@/components/ai-chat/component/knowledge-source-component/ParagraphDocumentContent.vue'
242239
import HistoryPanel from '@/views/chat/component/HistoryPanel.vue'
243-
import {cloneDeep} from 'lodash'
244-
import {getFileUrl} from '@/utils/common'
240+
import { cloneDeep } from 'lodash'
241+
import { getFileUrl } from '@/utils/common'
245242
import PdfExport from '@/components/pdf-export/index.vue'
246243
247244
useResize()
248245
const pdfExportRef = ref<InstanceType<typeof PdfExport>>()
249-
const {common, chatUser} = useStore()
246+
const { common, chatUser } = useStore()
250247
const router = useRouter()
251248
const openPDFExport = () => {
252249
pdfExportRef.value?.open(document.getElementById('chatListId'))
@@ -279,7 +276,7 @@ const openResetPassword = () => {
279276
280277
const handleResetPassword = (param: ResetCurrentUserPasswordRequest) => {
281278
chatAPI.resetCurrentPassword(param).then(() => {
282-
router.push({name: 'login'})
279+
router.push({ name: 'login' })
283280
})
284281
}
285282
@@ -307,8 +304,7 @@ const applicationDetail = computed({
307304
get: () => {
308305
return props.application_profile
309306
},
310-
set: (v) => {
311-
},
307+
set: (v) => {},
312308
})
313309
314310
const chatLogData = ref<any[]>([])
@@ -331,15 +327,15 @@ function refreshFieldTitle(chatId: string, abstract: string) {
331327
}
332328
333329
function deleteLog(row: any) {
334-
chatAPI.deleteChat(row.id, left_loading).then(() => {
330+
chatAPI.deleteChat(row.id).then(() => {
335331
if (currentChatId.value === row.id) {
336332
currentChatId.value = 'new'
337333
currentChatName.value = t('chat.createChat')
338334
paginationConfig.value.current_page = 1
339335
paginationConfig.value.total = 0
340336
currentRecordList.value = []
341337
}
342-
getChatLog()
338+
chatLogData.value = chatLogData.value.filter((item) => item.id !== row.id)
343339
})
344340
}
345341
@@ -470,7 +466,7 @@ async function exportMarkdown(): Promise<void> {
470466
.map((record: any) => `# ${record.problem_text}\n\n${record.answer_text}\n\n`)
471467
.join('\n')
472468
473-
const blob: Blob = new Blob([markdownContent], {type: 'text/markdown;charset=utf-8'})
469+
const blob: Blob = new Blob([markdownContent], { type: 'text/markdown;charset=utf-8' })
474470
saveAs(blob, suggestedName)
475471
}
476472
@@ -481,7 +477,7 @@ async function exportHTML(): Promise<void> {
481477
.join('\n')
482478
const htmlContent: any = marked(markdownContent)
483479
484-
const blob: Blob = new Blob([htmlContent], {type: 'text/html;charset=utf-8'})
480+
const blob: Blob = new Blob([htmlContent], { type: 'text/html;charset=utf-8' })
485481
saveAs(blob, suggestedName)
486482
}
487483

ui/src/views/tool/McpToolFormDrawer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ const rules = reactive({
211211
})
212212
213213
function close() {
214-
if (isEdit.value || !areAllValuesNonEmpty(form.value)) {
214+
if (!areAllValuesNonEmpty(form.value)) {
215215
visible.value = false
216216
} else {
217217
MsgConfirm(t('common.tip'), t('views.tool.tip.saveMessage'), {

0 commit comments

Comments
 (0)