Skip to content

Commit 7420ad7

Browse files
committed
fix: Share chat record link
1 parent ce8ac14 commit 7420ad7

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

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

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@
4040
<el-checkbox-group v-model="multipleSelectionChat" @change="handleCheckedChatChange">
4141
<template v-for="(item, index) in chatList" :key="index">
4242
<div class="flex-between w-full">
43-
<el-checkbox :value="item.id" v-if="selection" />
43+
<el-checkbox :value="item.record_id" v-if="selection" />
4444
<div
4545
class="w-full border-r-8"
4646
:class="selection ? 'is-selected p-12 mt-8 mb-8 cursor' : 'mt-24'"
47-
@click="toggleSelect(item.id)"
47+
@click="toggleSelect(item.record_id)"
4848
>
4949
<!-- 问题 -->
5050
<QuestionContent
@@ -59,11 +59,11 @@
5959
</div>
6060
</div>
6161
<div class="flex align-center w-full">
62-
<el-checkbox :value="item.id" v-if="selection" />
62+
<el-checkbox :value="item.record_id" v-if="selection" />
6363
<div
6464
class="w-full border-r-8"
6565
:class="selection ? 'is-selected p-12 cursor' : ''"
66-
@click="toggleSelect(item.id)"
66+
@click="toggleSelect(item.record_id)"
6767
>
6868
<!-- 回答 -->
6969
<AnswerContent
@@ -304,28 +304,35 @@ watch(
304304
},
305305
)
306306
307+
// 选择对话分享
308+
const checkAll = ref(false)
309+
const multipleSelectionChat = ref<any[]>([])
310+
const shareLoading = ref(false)
311+
307312
watch(
308313
() => props.selection,
309314
(value) => {
310315
if (value) {
311316
if (value && multipleSelectionChat.value.length === 0) {
312-
multipleSelectionChat.value = chatList.value.map((v) => v.id)
317+
multipleSelectionChat.value = chatList.value.map((v) => v.record_id)
313318
checkAll.value = true
314319
}
320+
} else {
321+
checkAll.value = false
322+
multipleSelectionChat.value = []
315323
}
316324
},
317325
{
318326
immediate: true,
319327
},
320328
)
321329
322-
// 选择对话分享
323-
const checkAll = ref(false)
324-
const multipleSelectionChat = ref<any[]>([])
325-
const shareLoading = ref(false)
326330
function shareChatHandle() {
331+
const validIds = new Set(chatList.value.map((v) => v.record_id))
332+
const selectedIds = multipleSelectionChat.value.filter((id) => validIds.has(id))
333+
327334
const obj = {
328-
chat_record_ids: multipleSelectionChat.value,
335+
chat_record_ids: selectedIds,
329336
is_current_all: checkAll.value,
330337
}
331338
chatAPI.postShareChat(id || props.appId, chartOpenId.value, obj, shareLoading).then((res) => {
@@ -336,7 +343,7 @@ function shareChatHandle() {
336343
}
337344
338345
const handleCheckAllChange = (val: CheckboxValueType) => {
339-
multipleSelectionChat.value = val ? chatList.value.map((v) => v.id) : []
346+
multipleSelectionChat.value = val ? chatList.value.map((v) => v.record_id) : []
340347
checkAll.value = val as boolean
341348
}
342349
const handleCheckedChatChange = (value: CheckboxValueType[]) => {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ function handleScroll(event: any) {
387387
}
388388
389389
function newChat() {
390+
showSelection.value = false
390391
if (!chatLogData.value.some((v) => v.id === 'new')) {
391392
paginationConfig.value.current_page = 1
392393
paginationConfig.value.total = 0
@@ -458,6 +459,7 @@ function getChatRecord() {
458459
459460
const clickListHandle = (item: any) => {
460461
if (item.id !== currentChatId.value) {
462+
showSelection.value = false
461463
paginationConfig.value.current_page = 1
462464
paginationConfig.value.total = 0
463465
currentRecordList.value = []

0 commit comments

Comments
 (0)