diff --git a/static/app.js b/static/app.js index f9a1341..16679b2 100644 --- a/static/app.js +++ b/static/app.js @@ -170,6 +170,7 @@ async function bootstrapApp() { loadingMoreConversations: false, currentConversationId: null, currentConversationTitle: '当前对话', + personalPageVisible: false, // 搜索功能 searchQuery: '', @@ -629,6 +630,7 @@ async function bootstrapApp() { console.log('对话已切换:', data); this.currentConversationId = data.conversation_id; this.currentConversationTitle = data.title || ''; + this.promoteConversationToTop(data.conversation_id); if (data.cleared) { // 对话被清空 @@ -655,6 +657,7 @@ async function bootstrapApp() { if (data.title) { this.currentConversationTitle = data.title; } + this.promoteConversationToTop(convId); const pathFragment = this.stripConversationPrefix(convId); const currentPath = window.location.pathname.replace(/^\/+/, ''); if (data.created) { @@ -1544,6 +1547,7 @@ async function bootstrapApp() { // 2. 更新当前对话信息 this.currentConversationId = conversationId; this.currentConversationTitle = result.title; + this.promoteConversationToTop(conversationId); history.pushState({ conversationId }, '', `/${this.stripConversationPrefix(conversationId)}`); // 3. 重置UI状态 @@ -1570,6 +1574,17 @@ async function bootstrapApp() { alert(`加载对话异常: ${error.message}`); } }, + + promoteConversationToTop(conversationId) { + if (!Array.isArray(this.conversations) || !conversationId) { + return; + } + const index = this.conversations.findIndex(conv => conv && conv.id === conversationId); + if (index > 0) { + const [selected] = this.conversations.splice(index, 1); + this.conversations.unshift(selected); + } + }, // ========================================== // 关键功能:获取并显示历史对话内容 @@ -2020,6 +2035,14 @@ async function bootstrapApp() { this.sidebarCollapsed = !this.sidebarCollapsed; }, + openPersonalPage() { + this.personalPageVisible = true; + }, + + closePersonalPage() { + this.personalPageVisible = false; + }, + async toggleThinkingMode() { try { const resp = await fetch('/api/thinking-mode', { diff --git a/static/index.html b/static/index.html index 9f39156..be1d764 100644 --- a/static/index.html +++ b/static/index.html @@ -41,15 +41,48 @@