Commit 8344d1e2 authored by 水玉婷's avatar 水玉婷
Browse files

feat:修复历史记录滚动无限初始化ssebug

parent 45a26348
......@@ -100,7 +100,7 @@
<p>暂无历史记录</p>
</div>
</div>
<div class="history-list-header" v-if="totalCount > 0">
<div class="history-list-footer" v-if="totalCount > 0">
<span class="total-count">{{ totalCount }} 条记录</span>
<span class="display-count">显示最近 {{ displayLimit }}</span>
</div>
......@@ -123,7 +123,7 @@
:token="userToken"
:appCode="appCode"
customClass="chat-history"
:key="currentSessionId"
:key="sessionKey"
/>
</div>
</div>
......@@ -148,6 +148,7 @@ const isHistoryPanelOpen = ref(false);
const searchKeyword = ref('');
const currentSessionId = ref('');
const currentSessionDetail = ref({ title: '' });
const sessionKey = ref(''); // 专门用于AiChat组件的key
// 分页相关数据
const currentPage = ref(1);
......@@ -378,13 +379,15 @@ const filterHistory = () => {
const selectSession = (session: any) => {
currentSessionId.value = session.id;
currentSessionDetail.value = { title: session.title };
sessionKey.value = session.id; // 使用会话ID作为key
isHistoryPanelOpen.value = false;
};
const createNewChat = () => {
// 生成新的会话ID
currentSessionId.value = ''
currentSessionId.value = '';
currentSessionDetail.value = { title: '新对话' };
sessionKey.value = `new-${Date.now()}`; // 生成唯一的key用于新建会话
isHistoryPanelOpen.value = false;
};
......@@ -583,7 +586,7 @@ onMounted(() => {
}
}
.history-list-header {
.history-list-footer {
display: flex;
justify-content: space-between;
align-items: center;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment