|
@@ -517,11 +517,13 @@
|
|
|
<div class="chat-main-content">
|
|
<div class="chat-main-content">
|
|
|
<div id="chat-messages" class="chat-messages glass-panel">
|
|
<div id="chat-messages" class="chat-messages glass-panel">
|
|
|
<div class="message bot">
|
|
<div class="message bot">
|
|
|
- <div class="message-content">请发送你的投放数据。 如果是视频诊断,目前仅能诊断文案,请去聚德神转转为文案(最好是带时间戳的字幕-聚德智能视频处理工具可导出)。
|
|
|
|
|
|
|
+ <div class="message-content">您好,我是聚德策划大师。请输入您需要的内容,例如:
|
|
|
<ul>
|
|
<ul>
|
|
|
- <!-- <li>请输入想要分析的疾病或者产品名称</li> -->
|
|
|
|
|
|
|
+ <li>请输入需要撰写的产品或疾病名称</li>
|
|
|
|
|
+ <li>补充目标人群、投放场景、文案风格</li>
|
|
|
</ul>
|
|
</ul>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <div class="message-content">我将为您输出可直接使用的营销文案、脚本方向和优化建议。</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="chat-input-container glass-panel">
|
|
<div class="chat-input-container glass-panel">
|
|
@@ -1046,10 +1048,86 @@
|
|
|
}, 100);
|
|
}, 100);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ const AGENT_META = {
|
|
|
|
|
+ 'planning': {
|
|
|
|
|
+ name: '智能策划大师',
|
|
|
|
|
+ icon: "{{ url_for('static', filename='img/planning.png') }}"
|
|
|
|
|
+ },
|
|
|
|
|
+ 'videoaccount': {
|
|
|
|
|
+ name: '病理分析',
|
|
|
|
|
+ icon: "{{ url_for('static', filename='img/videoaccount.svg') }}"
|
|
|
|
|
+ },
|
|
|
|
|
+ 'diagnosis': {
|
|
|
|
|
+ name: '投放诊断',
|
|
|
|
|
+ icon: "{{ url_for('static', filename='img/diagnosis.svg') }}"
|
|
|
|
|
+ },
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const AGENT_WELCOME_CONTENT = {
|
|
|
|
|
+ 'planning': [
|
|
|
|
|
+ `您好,我是聚德策划大师。请输入您需要的内容,例如:
|
|
|
|
|
+ <ul>
|
|
|
|
|
+ <li>请输入需要撰写的产品或疾病名称</li>
|
|
|
|
|
+ <li>补充目标人群、投放场景、文案风格</li>
|
|
|
|
|
+ </ul>`,
|
|
|
|
|
+ '我将为您输出可直接使用的营销文案、脚本方向和优化建议。'
|
|
|
|
|
+ ],
|
|
|
|
|
+ 'videoaccount': [
|
|
|
|
|
+ `您好,我是病理分析助手。为了更准确分析,请尽量提供:
|
|
|
|
|
+ <ul>
|
|
|
|
|
+ <li>疾病或产品名称</li>
|
|
|
|
|
+ </ul>`,
|
|
|
|
|
+ '我会给出病理逻辑拆解、用户关注点与内容表达建议。'
|
|
|
|
|
+ ],
|
|
|
|
|
+ 'diagnosis': [
|
|
|
|
|
+ `您好,我是投放诊断助手。请发送您的投放数据,例如:
|
|
|
|
|
+ <ul>
|
|
|
|
|
+ <li>消耗、曝光、点击、转化、成本等核心指标</li>
|
|
|
|
|
+ </ul>`,
|
|
|
|
|
+ '如果是视频诊断,目前仅支持文案诊断,建议先转为文案(最好附时间戳字幕)。'
|
|
|
|
|
+ ]
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ function getCurrentAgentType() {
|
|
|
|
|
+ return localStorage.getItem('current_agent') || 'planning';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function getAgentWelcomeHtml(agentType) {
|
|
|
|
|
+ const welcomeBlocks = AGENT_WELCOME_CONTENT[agentType] || AGENT_WELCOME_CONTENT['planning'];
|
|
|
|
|
+ return `
|
|
|
|
|
+ <div class="message bot">
|
|
|
|
|
+ ${welcomeBlocks.map(content => `<div class="message-content">${content}</div>`).join('')}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ `;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function renderAgentWelcomeMessage(agentType) {
|
|
|
|
|
+ const chatMessages = document.getElementById('chat-messages');
|
|
|
|
|
+ if (!chatMessages) return;
|
|
|
|
|
+ chatMessages.innerHTML = getAgentWelcomeHtml(agentType || getCurrentAgentType());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function syncAgentWelcomeMessageForEmptyConversation() {
|
|
|
|
|
+ const chatMessages = document.getElementById('chat-messages');
|
|
|
|
|
+ if (!chatMessages) return;
|
|
|
|
|
+
|
|
|
|
|
+ const hasUserMessages = chatMessages.querySelectorAll('.message.user').length > 0;
|
|
|
|
|
+ if (hasUserMessages) return;
|
|
|
|
|
+
|
|
|
|
|
+ const hasOnlyOneBotMessage = chatMessages.children.length === 1 &&
|
|
|
|
|
+ chatMessages.querySelectorAll('.message.bot').length === 1;
|
|
|
|
|
+ const hasNoMessages = chatMessages.children.length === 0;
|
|
|
|
|
+
|
|
|
|
|
+ if (hasOnlyOneBotMessage || hasNoMessages) {
|
|
|
|
|
+ renderAgentWelcomeMessage(getCurrentAgentType());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 智能体选择(悬停展开)
|
|
// 智能体选择(悬停展开)
|
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
initializeAgentHoverDropdown();
|
|
initializeAgentHoverDropdown();
|
|
|
|
|
+ syncAgentWelcomeMessageForEmptyConversation();
|
|
|
}, 100);
|
|
}, 100);
|
|
|
|
|
|
|
|
// 监听窗口大小变化,重新初始化智能体菜单
|
|
// 监听窗口大小变化,重新初始化智能体菜单
|
|
@@ -1069,20 +1147,7 @@
|
|
|
const triggerIcon = document.getElementById('agent-trigger-icon');
|
|
const triggerIcon = document.getElementById('agent-trigger-icon');
|
|
|
if (!dropdown || !menu) return;
|
|
if (!dropdown || !menu) return;
|
|
|
|
|
|
|
|
- const agentMeta = {
|
|
|
|
|
- 'planning': {
|
|
|
|
|
- name: '智能策划大师',
|
|
|
|
|
- icon: "{{ url_for('static', filename='img/planning.png') }}"
|
|
|
|
|
- },
|
|
|
|
|
- 'videoaccount': {
|
|
|
|
|
- name: '病理分析',
|
|
|
|
|
- icon: "{{ url_for('static', filename='img/videoaccount.svg') }}"
|
|
|
|
|
- },
|
|
|
|
|
- 'diagnosis': {
|
|
|
|
|
- name: '投放诊断',
|
|
|
|
|
- icon: "{{ url_for('static', filename='img/diagnosis.svg') }}"
|
|
|
|
|
- },
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ const agentMeta = AGENT_META;
|
|
|
|
|
|
|
|
// 兼容历史存储:如果之前存的是已删除的智能体,强制切回智能策划大师
|
|
// 兼容历史存储:如果之前存的是已删除的智能体,强制切回智能策划大师
|
|
|
const storedAgent = localStorage.getItem('current_agent');
|
|
const storedAgent = localStorage.getItem('current_agent');
|
|
@@ -1348,6 +1413,9 @@
|
|
|
// 更新状态提示(如有)
|
|
// 更新状态提示(如有)
|
|
|
updateStatusIndicator(agentType);
|
|
updateStatusIndicator(agentType);
|
|
|
|
|
|
|
|
|
|
+ // 空对话下切换智能体时,同步更新说明文案
|
|
|
|
|
+ syncAgentWelcomeMessageForEmptyConversation();
|
|
|
|
|
+
|
|
|
// 显示切换提示
|
|
// 显示切换提示
|
|
|
showAgentSwitchNotification(agentType);
|
|
showAgentSwitchNotification(agentType);
|
|
|
}
|
|
}
|
|
@@ -1600,7 +1668,7 @@
|
|
|
|
|
|
|
|
// 获取当前平台类型(供其他功能使用)
|
|
// 获取当前平台类型(供其他功能使用)
|
|
|
function getCurrentAgent() {
|
|
function getCurrentAgent() {
|
|
|
- return localStorage.getItem('current_agent') || 'planning';
|
|
|
|
|
|
|
+ return getCurrentAgentType();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 动态调整聊天消息区域高度
|
|
// 动态调整聊天消息区域高度
|
|
@@ -2012,12 +2080,7 @@
|
|
|
function clearCurrentConversation() {
|
|
function clearCurrentConversation() {
|
|
|
const chatMessages = document.getElementById('chat-messages');
|
|
const chatMessages = document.getElementById('chat-messages');
|
|
|
if (chatMessages) {
|
|
if (chatMessages) {
|
|
|
- chatMessages.innerHTML = `
|
|
|
|
|
- <div class="message bot">
|
|
|
|
|
- <div class="message-content">请发送你的投放数据。如果是视频诊断,目前仅能诊断文案,请去聚德神转转为文案(最好是带时间戳的字幕-聚德智能视频处理工具可导出)。
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- `;
|
|
|
|
|
|
|
+ renderAgentWelcomeMessage(getCurrentAgentType());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 清除全局状态管理中的当前激活对话
|
|
// 清除全局状态管理中的当前激活对话
|
|
@@ -2115,11 +2178,7 @@
|
|
|
|
|
|
|
|
// 如果没有消息,显示提示语
|
|
// 如果没有消息,显示提示语
|
|
|
if (!data.messages || data.messages.length === 0) {
|
|
if (!data.messages || data.messages.length === 0) {
|
|
|
- chatMessages.innerHTML = `
|
|
|
|
|
- <div class="message bot">
|
|
|
|
|
- <div class="message-content">请发送你的投放数据。如果是视频诊断,目前仅能诊断文案,请去聚德神转转为文案(最好是带时间戳的字幕-聚德智能视频处理工具可导出)。</div>
|
|
|
|
|
- </div>
|
|
|
|
|
- `;
|
|
|
|
|
|
|
+ renderAgentWelcomeMessage(getCurrentAgentType());
|
|
|
} else {
|
|
} else {
|
|
|
renderAllMessages(data.messages, chatMessages);
|
|
renderAllMessages(data.messages, chatMessages);
|
|
|
}
|
|
}
|