5252 </div >
5353 <div v-show =" !isPcCollapse" class =" left-height" v-if =" showHistory" >
5454 <el-scrollbar >
55- <div class =" p-16 pt-0" >
56- <common-list
57- :data =" chatLogData"
58- class =" mt-8"
59- v-loading =" leftLoading"
60- :defaultActive =" currentChatId"
61- @click =" handleClickList"
62- @mouseenter =" mouseenter"
63- @mouseleave =" mouseId = ''"
64- >
65- <template #default =" { row } " >
66- <div class =" flex-between" >
67- <span :title =" row.abstract" class =" ellipsis" style =" max-width : 180px " >
68- {{ row.abstract }}
69- </span >
70- <div @click.stop v-show =" mouseId === row.id && row.id !== 'new'" >
71- <el-dropdown trigger =" click" :teleported =" false" >
72- <el-button text >
73- <AppIcon iconName =" app-more" ></AppIcon >
74- </el-button >
55+ <InfiniteScroll
56+ :size =" chatLogData.length"
57+ :total =" _chatLogPagination?.total || 0"
58+ :page_size =" _chatLogPagination?.page_size || 20"
59+ v-model:current_page =" _chatLogPagination.current_page"
60+ @load =" scrollData"
61+ :loading =" leftLoading"
62+ >
63+ <div class =" p-16 pt-0" >
64+ <common-list
65+ :data =" chatLogData"
66+ class =" mt-8"
67+ v-loading =" leftLoading"
68+ :defaultActive =" currentChatId"
69+ @click =" handleClickList"
70+ @mouseenter =" mouseenter"
71+ @mouseleave =" mouseId = ''"
72+ >
73+ <template #default =" { row } " >
74+ <div class =" flex-between" >
75+ <span :title =" row.abstract" class =" ellipsis" style =" max-width : 180px " >
76+ {{ row.abstract }}
77+ </span >
78+ <div @click.stop v-show =" mouseId === row.id && row.id !== 'new'" >
79+ <el-dropdown trigger =" click" :teleported =" false" >
80+ <el-button text >
81+ <AppIcon iconName =" app-more" ></AppIcon >
82+ </el-button >
7583
76- <template #dropdown >
77- <el-dropdown-menu >
78- <el-dropdown-item @click.stop =" editLogTitle(row)" >
79- <AppIcon iconName =" app-edit" class =" color-secondary" ></AppIcon >
80- {{ $t('common.edit') }}
81- </el-dropdown-item >
82- <el-dropdown-item @click.stop =" deleteChatLog(row)" >
83- <AppIcon iconName =" app-delete" class =" color-secondary" ></AppIcon >
84- {{ $t('common.delete') }}
85- </el-dropdown-item >
86- </el-dropdown-menu >
87- </template >
88- </el-dropdown >
84+ <template #dropdown >
85+ <el-dropdown-menu >
86+ <el-dropdown-item @click.stop =" editLogTitle(row)" >
87+ <AppIcon iconName =" app-edit" class =" color-secondary" ></AppIcon >
88+ {{ $t('common.edit') }}
89+ </el-dropdown-item >
90+ <el-dropdown-item @click.stop =" deleteChatLog(row)" >
91+ <AppIcon iconName =" app-delete" class =" color-secondary" ></AppIcon >
92+ {{ $t('common.delete') }}
93+ </el-dropdown-item >
94+ </el-dropdown-menu >
95+ </template >
96+ </el-dropdown >
97+ </div >
8998 </div >
90- </div >
91- </template >
99+ </template >
92100
93- <template #empty >
94- <div class =" text-center" >
95- <el-text type =" info" >{{ $t('chat.noHistory') }}</el-text >
96- </div >
97- </template >
98- </common-list >
99- </div >
100- <div v-if =" chatLogData?.length" class =" text-center lighter color-secondary" >
101+ <template #empty >
102+ <div class =" text-center" >
103+ <el-text type =" info" >{{ $t('chat.noHistory') }}</el-text >
104+ </div >
105+ </template >
106+ </common-list >
107+ </div >
108+ </InfiniteScroll >
109+ <!-- <div v-if="chatLogData?.length" class="text-center lighter color-secondary">
101110 <span>{{ $t('chat.only20history') }}</span>
102- </div >
111+ </div> -->
103112 </el-scrollbar >
104113 </div >
105114 <el-menu-item index =" 1" v-show =" isPcCollapse" @click =" newChat" >
164173 </div >
165174</template >
166175<script setup lang="ts">
167- import { ref , computed } from ' vue'
176+ import { ref , computed , inject , type Ref } from ' vue'
168177import { isAppIcon } from ' @/utils/common'
169178import EditTitleDialog from ' ./EditTitleDialog.vue'
170- import useStore from ' @/stores'
171179
172- const { user } = useStore ()
180+ const scrollData = inject (' scrollData' ) as any
181+ // 子组件
182+ const chatLogPagination = inject (' chatLogPagination' ) as any
183+ const _chatLogPagination = chatLogPagination ()
184+
173185const props = defineProps <{
174186 applicationDetail: any
175187 chatLogData: any []
@@ -180,19 +192,26 @@ const props = defineProps<{
180192const emit = defineEmits ([' newChat' , ' clickLog' , ' deleteLog' , ' refreshFieldTitle' , ' clearChat' ])
181193
182194const showHistory = computed (() => {
183- console .log (props .applicationDetail ?.show_history )
184195 return props .applicationDetail ?.show_history != null || undefined
185196 ? props .applicationDetail ?.show_history
186197 : true
187198})
188199
200+ // 更新页码的方法
201+ const updateCurrentPage = (page : number ) => {
202+ if (chatLogPagination ) {
203+ chatLogPagination .current_page = page
204+ }
205+ }
206+
189207const EditTitleDialogRef = ref ()
190208
191209const mouseId = ref (' ' )
192210
193211function mouseenter(row : any ) {
194212 mouseId .value = row .id
195213}
214+
196215const newChat = () => {
197216 emit (' newChat' )
198217}
0 commit comments