feat(chatbot): 禁用快捷指令区渲染
This commit is contained in:
parent
869e15d4ce
commit
3890cca114
|
|
@ -353,8 +353,6 @@ function updateChatbotUI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const chatBody = document.getElementById('chatbot-body');
|
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');
|
let modelSelectorDiv = document.getElementById('chatbot-model-selector');
|
||||||
|
|
||||||
const existingPresetContainer = document.getElementById('chatbot-preset-container');
|
const existingPresetContainer = document.getElementById('chatbot-preset-container');
|
||||||
|
|
@ -383,42 +381,14 @@ function updateChatbotUI() {
|
||||||
console.error("Error getting chatbot config for UI:", e);
|
console.error("Error getting chatbot config for UI:", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
const presetContainer = window.ChatbotPresetQuestionsUI.render(
|
// 按需禁用:不渲染快捷指令(chatbot-preset-container)
|
||||||
chatbotWindow,
|
// 仅确保历史遗留 DOM 被移除,避免占用空间或影响布局
|
||||||
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 = "展开快捷指令";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取 mainContentArea 元素
|
// 获取 mainContentArea 元素
|
||||||
const mainContentArea = document.getElementById('chatbot-main-content-area');
|
const mainContentArea = document.getElementById('chatbot-main-content-area');
|
||||||
|
|
||||||
if (mainContentArea) {
|
if (mainContentArea) {
|
||||||
let current_padding_top_for_main_content_area = 12;
|
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';
|
mainContentArea.style.paddingTop = current_padding_top_for_main_content_area + 'px';
|
||||||
|
|
||||||
// 仅在“固定模式”下根据内容自适应高度;浮动/全屏不改动用户设置的尺寸
|
// 仅在“固定模式”下根据内容自适应高度;浮动/全屏不改动用户设置的尺寸
|
||||||
|
|
@ -451,7 +421,6 @@ function updateChatbotUI() {
|
||||||
} else {
|
} else {
|
||||||
const existingModelSelectorDiv = document.getElementById('chatbot-model-selector');
|
const existingModelSelectorDiv = document.getElementById('chatbot-model-selector');
|
||||||
if (existingModelSelectorDiv) existingModelSelectorDiv.remove();
|
if (existingModelSelectorDiv) existingModelSelectorDiv.remove();
|
||||||
if (presetContainer) presetContainer.style.display = '';
|
|
||||||
if (chatBody) chatBody.style.display = '';
|
if (chatBody) chatBody.style.display = '';
|
||||||
}
|
}
|
||||||
if (chatBody) {
|
if (chatBody) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue