mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-10-11 02:08:51 +02:00
Add files via upload
This commit is contained in:
2 files changed
+47
-29
No files matched your search
+40
-29
@@ -1948,38 +1948,13 @@ function setAttackChainLoading(conversationId, loading) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加攻击链按钮
|
// 添加攻击链按钮(已移至菜单,此函数保留以保持兼容性,但不再显示顶部按钮)
|
||||||
function addAttackChainButton(conversationId) {
|
function addAttackChainButton(conversationId) {
|
||||||
const attackChainBtn = document.getElementById('attack-chain-btn');
|
// 攻击链按钮已移至三点菜单,不再需要显示顶部按钮
|
||||||
|
// 此函数保留以保持代码兼容性,但不再执行任何操作
|
||||||
const conversationHeader = document.getElementById('conversation-header');
|
const conversationHeader = document.getElementById('conversation-header');
|
||||||
|
if (conversationHeader) {
|
||||||
if (!attackChainBtn || !conversationHeader) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (conversationId) {
|
|
||||||
// 显示会话顶部栏
|
|
||||||
conversationHeader.style.display = 'block';
|
|
||||||
|
|
||||||
const isRunning = typeof isConversationTaskRunning === 'function'
|
|
||||||
? isConversationTaskRunning(conversationId)
|
|
||||||
: false;
|
|
||||||
if (isRunning) {
|
|
||||||
attackChainBtn.disabled = true;
|
|
||||||
attackChainBtn.title = '当前对话正在执行,请稍后再生成攻击链';
|
|
||||||
attackChainBtn.onclick = null;
|
|
||||||
} else {
|
|
||||||
attackChainBtn.disabled = false;
|
|
||||||
attackChainBtn.title = '查看当前对话的攻击链';
|
|
||||||
attackChainBtn.onclick = () => showAttackChain(conversationId);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 隐藏会话顶部栏
|
|
||||||
conversationHeader.style.display = 'none';
|
conversationHeader.style.display = 'none';
|
||||||
|
|
||||||
attackChainBtn.disabled = true;
|
|
||||||
attackChainBtn.title = '请选择一个对话以查看攻击链';
|
|
||||||
attackChainBtn.onclick = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4323,6 +4298,33 @@ async function showConversationContextMenu(event) {
|
|||||||
submenuLoading = false;
|
submenuLoading = false;
|
||||||
|
|
||||||
const convId = contextMenuConversationId;
|
const convId = contextMenuConversationId;
|
||||||
|
|
||||||
|
// 更新攻击链菜单项的启用状态
|
||||||
|
const attackChainMenuItem = document.getElementById('attack-chain-menu-item');
|
||||||
|
if (attackChainMenuItem) {
|
||||||
|
if (convId) {
|
||||||
|
const isRunning = typeof isConversationTaskRunning === 'function'
|
||||||
|
? isConversationTaskRunning(convId)
|
||||||
|
: false;
|
||||||
|
if (isRunning) {
|
||||||
|
attackChainMenuItem.style.opacity = '0.5';
|
||||||
|
attackChainMenuItem.style.cursor = 'not-allowed';
|
||||||
|
attackChainMenuItem.onclick = null;
|
||||||
|
attackChainMenuItem.title = '当前对话正在执行,请稍后再生成攻击链';
|
||||||
|
} else {
|
||||||
|
attackChainMenuItem.style.opacity = '1';
|
||||||
|
attackChainMenuItem.style.cursor = 'pointer';
|
||||||
|
attackChainMenuItem.onclick = showAttackChainFromContext;
|
||||||
|
attackChainMenuItem.title = '查看当前对话的攻击链';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
attackChainMenuItem.style.opacity = '0.5';
|
||||||
|
attackChainMenuItem.style.cursor = 'not-allowed';
|
||||||
|
attackChainMenuItem.onclick = null;
|
||||||
|
attackChainMenuItem.title = '请选择一个对话以查看攻击链';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 先获取对话的置顶状态并更新菜单文本(在显示菜单之前)
|
// 先获取对话的置顶状态并更新菜单文本(在显示菜单之前)
|
||||||
if (convId) {
|
if (convId) {
|
||||||
try {
|
try {
|
||||||
@@ -5045,6 +5047,15 @@ async function loadConversationGroupMapping() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 从上下文菜单查看攻击链
|
||||||
|
function showAttackChainFromContext() {
|
||||||
|
const convId = contextMenuConversationId;
|
||||||
|
if (!convId) return;
|
||||||
|
|
||||||
|
closeContextMenu();
|
||||||
|
showAttackChain(convId);
|
||||||
|
}
|
||||||
|
|
||||||
// 从上下文菜单删除对话
|
// 从上下文菜单删除对话
|
||||||
function deleteConversationFromContext() {
|
function deleteConversationFromContext() {
|
||||||
const convId = contextMenuConversationId;
|
const convId = contextMenuConversationId;
|
||||||
|
|||||||
@@ -1171,6 +1171,13 @@
|
|||||||
|
|
||||||
<!-- 上下文菜单 -->
|
<!-- 上下文菜单 -->
|
||||||
<div id="conversation-context-menu" class="context-menu" style="display: none;">
|
<div id="conversation-context-menu" class="context-menu" style="display: none;">
|
||||||
|
<div id="attack-chain-menu-item" class="context-menu-item" onclick="showAttackChainFromContext()">
|
||||||
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M10.5 13.5l3-3M8 8H5a4 4 0 1 0 0 8h3m8-8h3a4 4 0 0 1 0 8h-3" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
<span>查看攻击链</span>
|
||||||
|
</div>
|
||||||
|
<div class="context-menu-divider"></div>
|
||||||
<div class="context-menu-item" onclick="renameConversation()">
|
<div class="context-menu-item" onclick="renameConversation()">
|
||||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
|||||||
Reference in new issue
Block a user