feat(chatbot): 禁用快捷指令区渲染

This commit is contained in:
肖应宇 2026-04-13 17:54:16 +08:00
parent 869e15d4ce
commit 3890cca114
1 changed files with 2 additions and 33 deletions

View File

@ -353,8 +353,6 @@ function updateChatbotUI() {
}
const chatBody = document.getElementById('chatbot-body');
const chatbotPresetHeader = document.getElementById('chatbot-preset-header');
const chatbotPresetBody = document.getElementById('chatbot-preset-body');
let modelSelectorDiv = document.getElementById('chatbot-model-selector');
const existingPresetContainer = document.getElementById('chatbot-preset-container');
@ -383,42 +381,14 @@ function updateChatbotUI() {
console.error("Error getting chatbot config for UI:", e);
}
const presetContainer = window.ChatbotPresetQuestionsUI.render(
chatbotWindow,
isCustomModel,
currentDocId,
updateChatbotUI,
window.ChatbotPreset?.handlePresetQuestion || window.handlePresetQuestion
);
chatbotWindow.appendChild(presetContainer);
let userMessageCount = 0;
if (window.ChatbotCore && window.ChatbotCore.chatHistory) {
userMessageCount = window.ChatbotCore.chatHistory.filter(m => m.role === 'user').length;
}
if (userMessageCount >= 3 &&
!window.presetAutoCollapseTriggeredForDoc[currentDocId] &&
!window.isPresetQuestionsCollapsed &&
!window.isModelSelectorOpen) {
window.isPresetQuestionsCollapsed = true;
window.presetAutoCollapseTriggeredForDoc[currentDocId] = true;
const presetToggleBtn = presetContainer.querySelector('#chatbot-preset-toggle-btn');
if (presetToggleBtn) {
presetToggleBtn.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>';
presetToggleBtn.title = "展开快捷指令";
}
}
// 按需禁用不渲染快捷指令chatbot-preset-container
// 仅确保历史遗留 DOM 被移除,避免占用空间或影响布局
// 获取 mainContentArea 元素
const mainContentArea = document.getElementById('chatbot-main-content-area');
if (mainContentArea) {
let current_padding_top_for_main_content_area = 12;
if (presetContainer && presetContainer.style.display !== 'none' && presetContainer.offsetHeight) {
current_padding_top_for_main_content_area = presetContainer.offsetHeight;
}
mainContentArea.style.paddingTop = current_padding_top_for_main_content_area + 'px';
// 仅在“固定模式”下根据内容自适应高度;浮动/全屏不改动用户设置的尺寸
@ -451,7 +421,6 @@ function updateChatbotUI() {
} else {
const existingModelSelectorDiv = document.getElementById('chatbot-model-selector');
if (existingModelSelectorDiv) existingModelSelectorDiv.remove();
if (presetContainer) presetContainer.style.display = '';
if (chatBody) chatBody.style.display = '';
}
if (chatBody) {