fix(chat): restore active tasks bar at top of chat workspace

This commit is contained in:
Sycun 2026-11-29 20:30:44 +08:00
parent eaf1199cb2
commit b98f6411bf
56 changed files with 633 additions and 167 deletions

View File

@ -0,0 +1,142 @@
import { useMemo } from 'react';
import { Button, Tag } from '@douyinfe/semi-ui';
import { formatTime } from '../../lib/format';
import { useI18n } from '../../lib/i18n';
export const FINAL_TASK_STATUSES = new Set([
'failed',
'timeout',
'cancelled',
'completed',
'cleanup_unconfirmed'
]);
const TASK_STATUS_META = {
running: { key: 'tasks.statusRunning', fallback: '执行中', color: 'blue' },
cancelling: { key: 'tasks.statusCancelling', fallback: '取消中', color: 'amber' },
cleaning: { key: 'tasks.statusCleaning', fallback: '清理中', color: 'amber' },
cleanup_failed: { key: 'tasks.statusCleanupFailed', fallback: '清理异常(自动重试)', color: 'orange' },
cleanup_unconfirmed: { key: 'tasks.statusCleanupUnconfirmed', fallback: '远端停止状态待确认', color: 'amber' },
failed: { key: 'tasks.statusFailed', fallback: '执行失败', color: 'red' },
timeout: { key: 'tasks.statusTimeout', fallback: '执行超时', color: 'red' },
cancelled: { key: 'tasks.statusCancelled', fallback: '已取消', color: 'grey' },
completed: { key: 'tasks.statusCompleted', fallback: '已完成', color: 'green' }
};
function sortActiveTasks(tasks) {
return (Array.isArray(tasks) ? tasks : [])
.filter(Boolean)
.slice()
.sort((a, b) => {
const aParsed = Date.parse(a?.startedAt || '');
const bParsed = Date.parse(b?.startedAt || '');
const aTime = Number.isFinite(aParsed) ? aParsed : Number.MAX_SAFE_INTEGER;
const bTime = Number.isFinite(bParsed) ? bParsed : Number.MAX_SAFE_INTEGER;
if (aTime !== bTime) return aTime - bTime;
const convDiff = String(a?.conversationId || '').localeCompare(String(b?.conversationId || ''));
if (convDiff !== 0) return convDiff;
return String(a?.runId || '').localeCompare(String(b?.runId || ''));
});
}
function resolveTaskTitle(task, currentConversationId, currentConversationTitle, t) {
const taskConvId = String(task?.conversationId || '').trim();
if (taskConvId && taskConvId === currentConversationId && String(currentConversationTitle || '').trim()) {
return String(currentConversationTitle).trim();
}
const title = String(task?.title || '').trim();
if (title) return title;
const message = String(task?.message || '').trim();
if (message) return message;
return t('tasks.unnamedTask', null, '未命名任务');
}
export default function ActiveTasksBar({
tasks,
currentConversationId = '',
currentConversationTitle = '',
canStop = false,
stoppingIds,
onSelect,
onStop
}) {
const { lang, t } = useI18n();
const sortedTasks = useMemo(() => sortActiveTasks(tasks), [tasks]);
if (!sortedTasks.length) return null;
return (
<div
className="chat-active-tasks"
role="region"
aria-label={t('dashboard.runningTasks', null, '运行中任务')}
>
{sortedTasks.map((task, index) => {
const taskConvId = String(task?.conversationId || '').trim();
const statusKey = String(task?.status || 'running').toLowerCase();
const statusMeta = TASK_STATUS_META[statusKey] || TASK_STATUS_META.running;
const statusLabel = t(statusMeta.key, null, statusMeta.fallback);
const isFinal = FINAL_TASK_STATUSES.has(statusKey);
const isCancelling = statusKey === 'cancelling' || Boolean(taskConvId && stoppingIds?.has(taskConvId));
const isCurrent = Boolean(taskConvId && taskConvId === currentConversationId);
const displayTitle = resolveTaskTitle(task, currentConversationId, currentConversationTitle, t);
const formattedTime = formatTime(task?.startedAt, lang);
const timeLabel = formattedTime === '—' ? '' : formattedTime;
const viewHint = taskConvId
? `${t('tasks.viewConversation', null, '查看对话')}:${displayTitle}`
: displayTitle;
return (
<div
key={task?.runId || `${taskConvId || 'task'}-${index}`}
className={`chat-active-task${isCurrent ? ' is-current' : ''}${taskConvId ? ' is-clickable' : ''}`}
data-conversation-id={taskConvId || undefined}
onClick={event => {
if (!taskConvId) return;
if (event.target.closest('.chat-active-task-stop') || event.target.closest('.chat-active-task-main')) {
return;
}
onSelect?.(taskConvId);
}}
>
<button
type="button"
className="chat-active-task-main"
disabled={!taskConvId}
title={viewHint}
onClick={() => taskConvId && onSelect?.(taskConvId)}
>
<Tag
size="small"
shape="circle"
color={statusMeta.color}
type="light"
className="chat-active-task-status"
>
{statusLabel}
</Tag>
<span className="chat-active-task-title">{displayTitle}</span>
</button>
<div className="chat-active-task-actions">
{timeLabel ? <span className="chat-active-task-time">{timeLabel}</span> : null}
{!isFinal && (
<Button
size="small"
type="danger"
theme="light"
className="chat-active-task-stop"
disabled={!canStop || !taskConvId || isCancelling}
onClick={() => taskConvId && onStop?.(taskConvId)}
>
{isCancelling
? t('tasks.cancelling', null, '取消中...')
: t('tasks.stopTask', null, '停止任务')}
</Button>
)}
</div>
</div>
);
})}
</div>
);
}

View File

@ -11,6 +11,7 @@ import { consumeAgentHandoff, peekAgentHandoff } from '../../lib/agent-handoff';
import { useDebounced, useInterval, useLocalStorage, useResource } from '../../components/hooks';
import { toastError, toastSuccess, toastWarning } from '../../components/ui';
import ProjectFormModal from '../projects/project-form';
import ActiveTasksBar, { FINAL_TASK_STATUSES } from './ActiveTasksBar';
import ChatHeader from './ChatHeader';
import ChatSettings from './ChatSettings';
import ConversationList from './ConversationList';
@ -117,12 +118,27 @@ export default function Page() {
const detailInFlightRef = useRef({ id: '', active: false });
const hitlSeq = useRef(0);
const planSeq = useRef(0);
const [stoppingIds, setStoppingIds] = useState(() => new Set());
const activeTask = useResource(async ({ signal } = {}) => {
const payload = await api.get('/agent-loop/tasks', null, { signal });
return { id: conversationId, running: Array.isArray(payload?.tasks) && payload.tasks.some(task => task.conversationId === conversationId) };
}, [conversationId, canReadTasks], { skip: !conversationId || !canReadTasks });
const backgroundRunning = canReadTasks && activeTask.data?.id === conversationId && activeTask.data.running;
const checkingRun = Boolean(canReadTasks && conversationId && activeTask.data?.id !== conversationId && !activeTask.error);
const tasks = Array.isArray(payload?.tasks) ? payload.tasks.filter(Boolean) : [];
return { checkedId: conversationId, tasks };
}, [conversationId, canReadTasks], { skip: !canReadTasks });
const reloadActiveTasks = useRef(activeTask.reload);
useEffect(() => { reloadActiveTasks.current = activeTask.reload; }, [activeTask.reload]);
const activeTasks = useMemo(
() => (canReadTasks && Array.isArray(activeTask.data?.tasks) ? activeTask.data.tasks : []),
[activeTask.data, canReadTasks]
);
const backgroundRunning = Boolean(
canReadTasks
&& conversationId
&& activeTasks.some(task => (
task.conversationId === conversationId
&& !FINAL_TASK_STATUSES.has(String(task.status || '').toLowerCase())
))
);
const checkingRun = Boolean(canReadTasks && conversationId && activeTask.data?.checkedId !== conversationId && !activeTask.error);
const lastActive = useRef(null);
const conversations = useResource(
@ -285,7 +301,12 @@ export default function Page() {
reloadConversations.current?.({ silent: true });
}, [setSearchParams]);
const syncActiveTasks = useCallback(() => {
reloadActiveTasks.current?.({ silent: true, force: true });
}, []);
const settleRun = useCallback(() => {
reloadActiveTasks.current?.({ silent: true, force: true });
reloadConversations.current?.({ silent: true });
refreshHitl();
refreshPlan();
@ -295,6 +316,7 @@ export default function Page() {
conversationRef,
bindConversation,
requestDetailReload: loadDetail,
onTaskStarted: syncActiveTasks,
onSettled: settleRun,
onHitlEvent: refreshHitl,
onPlanTool: refreshPlan,
@ -328,13 +350,27 @@ export default function Page() {
}, [conversationId, isStreaming, resetRun, loadDetail, refreshHitl, refreshPlan]);
useInterval(() => {
refreshHitl();
refreshPlan();
if (backgroundRunning) {
activeTask.reload({ silent: true });
if (!sending && conversationRef.current) loadDetail(conversationRef.current, { silent: true });
if (typeof document !== 'undefined' && document.hidden) return;
if (sending || backgroundRunning) {
refreshHitl();
refreshPlan();
}
}, sending || backgroundRunning ? 4000 : 0);
if (canReadTasks) {
reloadActiveTasks.current?.({ silent: true });
}
if (backgroundRunning && !sending && conversationRef.current) {
loadDetail(conversationRef.current, { silent: true });
}
}, sending || backgroundRunning || activeTasks.length > 0 ? 4000 : (canReadTasks ? 6000 : 0));
useEffect(() => {
if (!canReadTasks || typeof document === 'undefined') return undefined;
const handleVisibility = () => {
if (!document.hidden) reloadActiveTasks.current?.({ silent: true });
};
document.addEventListener('visibilitychange', handleVisibility);
return () => document.removeEventListener('visibilitychange', handleVisibility);
}, [canReadTasks]);
useEffect(() => {
if (lastActive.current === conversationId && !backgroundRunning) {
@ -344,11 +380,36 @@ export default function Page() {
lastActive.current = backgroundRunning ? conversationId : null;
}, [backgroundRunning, conversationId, loadDetail]);
const stop = async () => {
const stopTask = useCallback(async (targetId = '') => {
if (!canStop) return;
await run.stop();
activeTask.reload({ silent: true });
};
const requested = typeof targetId === 'string' ? targetId.trim() : '';
const effectiveId = requested || conversationRef.current || live?.conversationId || '';
if (effectiveId) {
setStoppingIds(previous => {
const next = new Set(previous);
next.add(effectiveId);
return next;
});
}
try {
await run.stop(requested);
await reloadActiveTasks.current?.({ silent: true, force: true });
reloadConversations.current?.({ silent: true });
setTimeout(() => {
reloadActiveTasks.current?.({ silent: true, force: true });
reloadConversations.current?.({ silent: true });
}, 950);
} finally {
if (effectiveId) {
setStoppingIds(previous => {
if (!previous.has(effectiveId)) return previous;
const next = new Set(previous);
next.delete(effectiveId);
return next;
});
}
}
}, [canStop, live?.conversationId, run]);
const selectConversation = useCallback(id => {
if (!id) return;
@ -716,6 +777,7 @@ export default function Page() {
narrow={narrow}
onToggleSidebar={() => setSidebarOpen(true)}
onRefresh={() => {
reloadActiveTasks.current?.({ silent: true, force: true });
reloadConversations.current?.();
if (conversationId) loadDetail(conversationId);
refreshHitl();
@ -723,6 +785,15 @@ export default function Page() {
}}
/>
<div className="chat-panel">
<ActiveTasksBar
tasks={activeTasks}
currentConversationId={conversationId}
currentConversationTitle={conversation?.id === conversationId ? conversation?.title : ''}
canStop={canStop}
stoppingIds={stoppingIds}
onSelect={selectConversation}
onStop={stopTask}
/>
<MessageList
conversationId={conversationId}
messages={detail.messages}
@ -779,7 +850,7 @@ export default function Page() {
value={draft}
onChange={setDraft}
onSend={submit}
onStop={stop}
onStop={() => stopTask()}
canStop={canStop}
sending={sending || backgroundRunning}
checkingRun={checkingRun || projectSaving || model.waitingForChannel}

View File

@ -161,6 +161,108 @@
.chat-header-tags .semi-tag { max-width: 100%; }
.chat-header-actions .semi-button { height: auto; min-height: 32px; white-space: normal; text-align: start; }
/* ---------- 运行中任务栏 ---------- */
.chat-active-tasks {
flex: 0 0 auto;
min-width: 0;
display: flex;
align-items: center;
gap: 12px;
margin: 0 var(--chat-content-inset) 4px;
padding: 10px 14px;
border-radius: 10px;
border: 1px solid var(--semi-color-primary-light-active);
background: var(--semi-color-bg-1);
box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
flex-wrap: nowrap;
overflow-x: auto;
overflow-y: hidden;
overscroll-behavior-x: contain;
}
.chat-active-task {
flex: 0 0 auto;
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
min-height: 40px;
min-width: min(280px, 100%);
max-width: 520px;
padding: 4px 10px;
border-radius: 8px;
border: 1px solid var(--semi-color-primary-light-active);
background: var(--semi-color-bg-0);
transition: border-color .15s ease, box-shadow .15s ease;
}
.chat-active-task.is-clickable { cursor: pointer; }
.chat-active-task.is-clickable:hover {
border-color: var(--semi-color-primary);
box-shadow: 0 2px 8px rgba(0, 102, 255, .1);
}
.chat-active-task.is-current {
border-color: var(--semi-color-primary);
}
.chat-active-task-main {
flex: 1 1 auto;
min-width: 0;
display: inline-flex;
align-items: center;
gap: 8px;
padding: 2px 0;
border: none;
border-radius: 6px;
background: transparent;
color: var(--semi-color-text-0);
font: inherit;
text-align: start;
cursor: pointer;
}
.chat-active-task-main:disabled { cursor: default; }
.chat-active-task-main:focus-visible {
outline: 2px solid var(--semi-color-primary);
outline-offset: 2px;
}
.chat-active-task-status.semi-tag {
flex: 0 0 auto;
font-weight: 600;
}
.chat-active-task-title {
flex: 1 1 auto;
min-width: 0;
font-size: 13px;
line-height: 1.4;
color: var(--semi-color-text-0);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.chat-active-task-actions {
flex: 0 0 auto;
display: inline-flex;
align-items: center;
gap: 8px;
}
.chat-active-task-time {
font-size: 12px;
color: var(--semi-color-text-2);
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
.chat-active-task-stop.semi-button {
border: 1px solid var(--semi-color-danger-light-active);
border-radius: 6px;
font-weight: 500;
}
/* ---------- 消息与欢迎区 ---------- */
.chat-message-wrap { flex: 1 1 auto; min-width: 0; min-height: 0; position: relative; display: flex; }
@ -601,6 +703,7 @@
.chat-header-actions { width: 100%; }
.chat-header-actions .semi-button { padding-inline: 8px; }
.chat-panel { --chat-content-inset: 12px; }
.chat-active-tasks { padding: 8px 10px; gap: 8px; }
.chat-messages { padding-block: 20px; gap: 24px; }
.chat-welcome { padding: 12px 0; }
.chat-welcome-mark { width: 48px; height: 48px; }
@ -645,6 +748,7 @@
.chat-conv-item,
.chat-conv-actions,
.chat-bubble-actions,
.chat-active-task,
.chat-composer-box { transition: none; }
.chat-reasoning-picker.is-max:not(.is-disabled) .semi-slider-track,
.chat-reasoning-picker.is-max:not(.is-disabled) .semi-slider-track::after { animation: none; }

View File

@ -11,6 +11,7 @@ export function useAgentRun({
conversationRef,
bindConversation,
requestDetailReload,
onTaskStarted,
onSettled,
onHitlEvent,
onPlanTool,
@ -23,6 +24,14 @@ export function useAgentRun({
const liveRef = useRef(null);
const runRef = useRef(null);
const flushTimer = useRef(null);
const taskSyncTimer = useRef(null);
const clearTaskSyncTimer = useCallback(() => {
if (taskSyncTimer.current) {
clearTimeout(taskSyncTimer.current);
taskSyncTimer.current = null;
}
}, []);
const flushLive = useCallback((immediate = false) => {
const commit = () => {
@ -44,6 +53,7 @@ export function useAgentRun({
const finishRun = useCallback(run => {
if (!run || run.markedFinished || runRef.current !== run) return;
run.markedFinished = true;
clearTaskSyncTimer();
if (run.live.status === 'streaming') {
run.live.status = run.live.error ? 'error' : 'done';
run.live.endedAt = Date.now();
@ -67,9 +77,10 @@ export function useAgentRun({
setLive(null);
}
});
}, [conversationRef, flushLive, onSettled, requestDetailReload]);
}, [clearTaskSyncTimer, conversationRef, flushLive, onSettled, requestDetailReload]);
const send = useCallback(({ message, attachments, mode, projectId, role, aiChannelId, reasoning, hitl, requireHumanApproval }) => {
clearTaskSyncTimer();
const run = {
live: createLiveState({ conversationId: conversationRef.current }),
markedFinished: false,
@ -81,6 +92,10 @@ export function useAgentRun({
setLive({ ...run.live });
setSending(true);
setLastEvents([]);
taskSyncTimer.current = setTimeout(() => {
taskSyncTimer.current = null;
if (!run.markedFinished && runRef.current === run) onTaskStarted?.();
}, 200);
const streaming = mode !== 'single';
const body = {
@ -143,30 +158,34 @@ export function useAgentRun({
}
});
}, [
bindConversation, conversationRef, finishRun, flushLive,
onHitlEvent, onPlanTool, t
bindConversation, clearTaskSyncTimer, conversationRef, finishRun, flushLive,
onHitlEvent, onPlanTool, onTaskStarted, t
]);
const stop = useCallback(async () => {
const stop = useCallback(async (explicitId = '') => {
const run = runRef.current;
const target = conversationRef.current || run?.live?.conversationId || '';
const requestedId = typeof explicitId === 'string' ? explicitId.trim() : '';
const activeRunId = run && !run.markedFinished ? (run.live?.conversationId || conversationRef.current || '') : '';
const target = requestedId || conversationRef.current || activeRunId || '';
const isCurrentStream = Boolean(run && !run.markedFinished && (!requestedId || target === activeRunId));
if (target) {
try {
await api.post('/agent-loop/cancel', { conversationId: target });
if (run) run.stopRequested = true;
if (isCurrentStream && run) run.stopRequested = true;
toastSuccess(t('chat.stopRequested', null, '已请求停止任务'));
} catch (error) {
toastWarning(errorMessage(error, t('chat.stopFailed', null, '停止请求失败')));
}
}
run?.abort?.();
if (isCurrentStream) run?.abort?.();
// 服务端取消后仍会补写取消说明,稍后再拉一次历史拿到最终落库内容。
setTimeout(() => {
if (target && conversationRef.current === target) requestDetailReload?.(target, { silent: true });
if (target && conversationRef.current === target) requestDetailReload?.(target, { silent: true, force: true });
}, 900);
}, [conversationRef, requestDetailReload, t]);
const reset = useCallback(() => {
clearTaskSyncTimer();
const run = runRef.current;
if (run && !run.markedFinished) run.abort?.();
runRef.current = null;

View File

@ -0,0 +1,130 @@
import {
test, expect, visit, ready, screenshot, label, conversationListFixture,
UI_PERMISSIONS, CONVERSATION
} from './fixtures.mjs';
const SECOND_CONVERSATION = {
...CONVERSATION,
id: 'fixture-conversation-ssh',
title: 'ssh 巡检测试环境',
messages: [
{ id: 'fixture-ssh-user', role: 'user', content: 'ssh 检查 localhost 示例容器状态', createdAt: '2026-11-01T14:44:10Z' }
]
};
const RUNNING_TASKS = [
{
runId: 'fixture-active-1',
conversationId: CONVERSATION.id,
title: '查看示例域名归属情况',
status: 'running',
startedAt: '2026-11-01T14:43:46Z'
},
{
runId: 'fixture-active-2',
conversationId: SECOND_CONVERSATION.id,
title: SECOND_CONVERSATION.title,
status: 'running',
startedAt: '2026-11-01T14:44:12Z'
}
];
function mockTwoConversations(mockApi) {
mockApi.respond('GET', '/api/conversations', (_, url) => ({
json: conversationListFixture([CONVERSATION, SECOND_CONVERSATION], url)
}));
mockApi.respond('GET', `/api/conversations/${SECOND_CONVERSATION.id}`, { json: SECOND_CONVERSATION });
mockApi.respond('GET', `/api/conversations/${SECOND_CONVERSATION.id}/plan-tasks`, {
json: { tasks: [], total: 0, completed: 0, running: false }
});
}
test('chat: top active tasks bar shows running tasks, jumps to conversation and hides when empty', async ({ page, mockApi }, testInfo) => {
mockTwoConversations(mockApi);
let tasks = RUNNING_TASKS;
mockApi.respond('GET', '/api/agent-loop/tasks', () => ({ json: { tasks } }));
for (const width of [1440, 390]) {
await page.setViewportSize({ width, height: 900 });
const main = await visit(page, 'chat');
const bar = main.locator('.chat-active-tasks');
const items = bar.locator('.chat-active-task');
await expect(bar).toBeVisible();
await expect(items).toHaveCount(2);
await expect(items.nth(0)).toContainText(label('tasks.statusRunning', '执行中'));
await expect(items.nth(0)).toContainText('查看示例域名归属情况');
await expect(items.nth(0).locator('.chat-active-task-time')).toHaveText('22:43:46');
await expect(items.nth(0).getByRole('button', { name: label('tasks.stopTask', '停止任务') })).toBeDisabled();
await expect(items.nth(1)).toContainText(SECOND_CONVERSATION.title);
const [barBox, messagesBox] = await Promise.all([
bar.boundingBox(),
main.locator('.chat-messages').boundingBox()
]);
expect(barBox.y + barBox.height).toBeLessThanOrEqual(messagesBox.y + 1);
const overflow = await page.evaluate(() => {
const root = document.documentElement;
const content = document.querySelector('#main-content');
return Math.max(
root.scrollWidth - root.clientWidth,
content ? content.scrollWidth - content.clientWidth : 0
);
});
expect(overflow).toBeLessThanOrEqual(1);
await screenshot(page, testInfo, `chat-active-tasks-${width}`);
}
await page.setViewportSize({ width: 1440, height: 900 });
const main = await visit(page, 'chat');
const secondCard = main.locator('.chat-active-task').nth(1);
await secondCard.locator('.chat-active-task-main').click();
await expect(page).toHaveURL(new RegExp(`#/chat\\?conversation=${SECOND_CONVERSATION.id}$`));
await expect(main.locator('.chat-header-title')).toHaveText(SECOND_CONVERSATION.title);
await expect(main.locator(`.chat-active-task[data-conversation-id="${SECOND_CONVERSATION.id}"]`)).toHaveClass(/is-current/);
tasks = [];
await main.locator('.chat-header').getByRole('button', { name: label('chat.refreshConversation', '刷新对话') }).click();
await expect(main.locator('.chat-active-tasks')).toHaveCount(0);
expect(mockApi.writes()).toEqual([]);
});
test.describe('chat active tasks bar stop action', () => {
test.use({ appPermissions: [...UI_PERMISSIONS, 'tasks:write'] });
test('stopping a background task from the top bar cancels only that conversation', async ({ page, mockApi }, testInfo) => {
mockTwoConversations(mockApi);
const idleConversation = { ...CONVERSATION, id: 'fixture-conversation-idle', title: '当前草稿会话' };
mockApi.respond('GET', '/api/conversations', (_, url) => ({
json: conversationListFixture([idleConversation, CONVERSATION, SECOND_CONVERSATION], url)
}));
mockApi.respond('GET', `/api/conversations/${idleConversation.id}`, { json: idleConversation });
mockApi.respond('GET', `/api/conversations/${idleConversation.id}/plan-tasks`, {
json: { tasks: [], total: 0, completed: 0, running: false }
});
let active = [...RUNNING_TASKS];
mockApi.respond('GET', '/api/agent-loop/tasks', () => ({ json: { tasks: active } }));
mockApi.respond('POST', '/api/agent-loop/cancel', ({ body }) => {
active = active.filter(item => item.conversationId !== body?.conversationId);
return { json: { status: 'cancelling', conversationId: body?.conversationId } };
});
const main = await visit(page, `chat?conversation=${idleConversation.id}`);
const composer = main.getByRole('textbox', { name: label('chat.composerLabel', '对话内容') });
await composer.fill('保留当前会话的草稿内容');
const targetItem = main.locator(`.chat-active-task[data-conversation-id="${SECOND_CONVERSATION.id}"]`);
await expect(targetItem).toBeVisible();
await expect(targetItem.getByRole('button', { name: label('tasks.stopTask', '停止任务') })).toBeEnabled();
await screenshot(page, testInfo, 'chat-active-tasks-stoppable');
await targetItem.getByRole('button', { name: label('tasks.stopTask', '停止任务') }).click();
await expect(targetItem).toHaveCount(0);
await expect(main.locator(`.chat-active-task[data-conversation-id="${CONVERSATION.id}"]`)).toBeVisible();
await expect(composer).toHaveValue('保留当前会话的草稿内容');
expect(mockApi.calls('POST', '/api/agent-loop/cancel').map(call => call.body)).toEqual([
{ conversationId: SECOND_CONVERSATION.id }
]);
});
});

View File

@ -1 +1 @@
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n}from"./react-QV7DAAIx.js";import{G as r,I as i,Lt as a,N as o,Pt as s,R as c,U as l,ft as u,i as d,lt as f,ut as p}from"./semi-65W_4I1v.js";import{F as m,I as h,P as g,a as _,b as v,c as y,d as b,f as x,l as S,m as C,p as w,s as T,u as E,x as D,y as O}from"./index-BdnarFZR.js";var k=e(t(),1),A=e(n(),1),{Text:j}=r;function M(){let e=g(),{hasPermission:t}=m(),n=t(`agents:write`),r=t(`agents:delete`),[M,N]=(0,k.useState)(``),[P,F]=(0,k.useState)(null),[I,L]=(0,k.useState)(null),[R,z]=(0,k.useState)(!1),B=_(()=>h.get(`/multi-agent/markdown-agents`),[]),V=(Array.isArray(B.data?.agents)?B.data.agents:[]).filter(e=>{if(!M)return!0;let t=M.toLowerCase();return[e.name,e.id,e.filename,e.description].some(e=>String(e||``).toLowerCase().includes(t))}),H=async e=>{try{F(await h.get(`/multi-agent/markdown-agents/${encodeURIComponent(e.filename)}`))}catch(e){v(e,`读取智能体失败`)}},U=async()=>{let e=await I.form.validate();z(!0);try{await h.post(`/multi-agent/markdown-agents`,{filename:e.filename?.trim()||``,name:e.name.trim(),description:e.description?.trim()||``,instruction:e.instruction,kind:e.kind||`sub`,tools:String(e.tools||``).split(`,`).map(e=>e.trim()).filter(Boolean)}),D(`智能体已保存`),L(null),B.reload()}catch(e){v(e,`保存智能体失败`)}finally{z(!1)}},W=e=>O({title:`删除智能体「${e.name||e.filename}」?`,onOk:async()=>{await h.del(`/multi-agent/markdown-agents/${encodeURIComponent(e.filename)}`),D(`已删除`),B.reload()}});return(0,A.jsxs)(`div`,{children:[(0,A.jsx)(w,{title:e(`agents.title`,null,`智能体管理`),description:B.data?.dir?`目录:${B.data.dir}`:`以 Markdown 文件定义的子智能体与编排器。`,extra:(0,A.jsxs)(i,{children:[(0,A.jsx)(c,{icon:(0,A.jsx)(p,{}),onClick:()=>B.reload(),loading:B.loading,children:`刷新`}),n&&(0,A.jsx)(c,{theme:`solid`,type:`primary`,icon:(0,A.jsx)(u,{}),onClick:()=>L({record:null,form:{}}),children:`新建智能体`})]})}),B.data?.error&&(0,A.jsx)(S,{error:B.data.error}),(0,A.jsxs)(C,{title:`智能体(${V.length})`,children:[(0,A.jsx)(S,{error:B.error,onRetry:()=>B.reload()}),(0,A.jsx)(T,{columns:[{title:`智能体`,dataIndex:`name`,render:(e,t)=>(0,A.jsxs)(i,{vertical:!0,spacing:0,align:`start`,children:[(0,A.jsxs)(i,{children:[(0,A.jsx)(j,{strong:!0,children:e||t.id}),t.is_orchestrator&&(0,A.jsx)(o,{size:`small`,color:`purple`,children:`编排器`})]}),(0,A.jsx)(j,{type:`tertiary`,children:t.filename})]})},{title:`类型`,dataIndex:`kind`,width:110,render:e=>(0,A.jsx)(o,{size:`small`,children:e||`sub`})},{title:`描述`,dataIndex:`description`,render:e=>(0,A.jsx)(j,{type:`tertiary`,ellipsis:{showTooltip:!0},style:{maxWidth:460},children:e||`—`})},{title:`操作`,width:180,render:(e,t)=>(0,A.jsxs)(i,{children:[(0,A.jsx)(c,{size:`small`,theme:`borderless`,onClick:()=>H(t),children:`详情`}),n&&(0,A.jsx)(c,{size:`small`,theme:`borderless`,icon:(0,A.jsx)(s,{}),onClick:()=>L({record:t,form:{}})}),r&&(0,A.jsx)(c,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,A.jsx)(a,{}),onClick:()=>W(t)})]})}],dataSource:V,rowKey:`filename`,loading:B.loading,pagination:{pageSize:20},toolbar:(0,A.jsx)(l,{prefix:(0,A.jsx)(f,{}),value:M,onChange:N,placeholder:`搜索名称或文件名`,style:{width:280}})})]}),(0,A.jsx)(y,{title:I?.record?`编辑智能体`:`新建智能体`,visible:!!I,onCancel:()=>L(null),onOk:U,confirmLoading:R,width:760,children:(0,A.jsxs)(d,{getFormApi:e=>L(t=>t&&{...t,form:e}),initValues:I?.record?{filename:I.record.filename,name:I.record.name,description:I.record.description,kind:I.record.kind||`sub`}:{kind:`sub`},children:[(0,A.jsx)(d.Input,{field:`filename`,label:`文件名(留空自动生成)`,placeholder:`例如 recon.md`}),(0,A.jsx)(d.Input,{field:`name`,label:`名称`,rules:[{required:!0,message:`请输入名称`}]}),(0,A.jsx)(d.Input,{field:`description`,label:`描述`}),(0,A.jsx)(d.Select,{field:`kind`,label:`类型`,optionList:[{value:`sub`,label:`子智能体`},{value:`orchestrator`,label:`编排器`},{value:`plan_execute`,label:`计划执行`}]}),(0,A.jsx)(d.Input,{field:`tools`,label:`工具(逗号分隔)`,placeholder:`toolName, mcp::tool`}),(0,A.jsx)(d.TextArea,{field:`instruction`,label:`指令(Markdown)`,autosize:{minRows:8,maxRows:20}})]})},I?.record?.filename||`new-agent`),(0,A.jsx)(y,{title:P?.name||`智能体详情`,visible:!!P,onCancel:()=>F(null),width:720,children:P&&(0,A.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,A.jsx)(b,{items:[{label:`文件名`,value:P.filename},{label:`ID`,value:P.id},{label:`类型`,value:P.kind},{label:`绑定角色`,value:P.bind_role||`—`},{label:`最大迭代`,value:P.max_iterations??`—`},{label:`工具`,value:Array.isArray(P.tools)&&P.tools.length?P.tools.join(`、`):`—`}]}),(0,A.jsx)(x,{content:P.instruction||P.raw||``}),(0,A.jsx)(E,{value:P.raw||P,title:`原始 Markdown`,collapsed:!0})]})})]})}export{M as default};
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n}from"./react-QV7DAAIx.js";import{G as r,I as i,Lt as a,N as o,Pt as s,R as c,U as l,ft as u,i as d,lt as f,ut as p}from"./semi-65W_4I1v.js";import{F as m,I as h,L as g,a as _,b as v,c as y,d as b,f as x,l as S,m as C,p as w,s as T,u as E,x as D,y as O}from"./index-_8d9XBPJ.js";var k=e(t(),1),A=e(n(),1),{Text:j}=r;function M(){let e=m(),{hasPermission:t}=h(),n=t(`agents:write`),r=t(`agents:delete`),[M,N]=(0,k.useState)(``),[P,F]=(0,k.useState)(null),[I,L]=(0,k.useState)(null),[R,z]=(0,k.useState)(!1),B=_(()=>g.get(`/multi-agent/markdown-agents`),[]),V=(Array.isArray(B.data?.agents)?B.data.agents:[]).filter(e=>{if(!M)return!0;let t=M.toLowerCase();return[e.name,e.id,e.filename,e.description].some(e=>String(e||``).toLowerCase().includes(t))}),H=async e=>{try{F(await g.get(`/multi-agent/markdown-agents/${encodeURIComponent(e.filename)}`))}catch(e){v(e,`读取智能体失败`)}},U=async()=>{let e=await I.form.validate();z(!0);try{await g.post(`/multi-agent/markdown-agents`,{filename:e.filename?.trim()||``,name:e.name.trim(),description:e.description?.trim()||``,instruction:e.instruction,kind:e.kind||`sub`,tools:String(e.tools||``).split(`,`).map(e=>e.trim()).filter(Boolean)}),D(`智能体已保存`),L(null),B.reload()}catch(e){v(e,`保存智能体失败`)}finally{z(!1)}},W=e=>O({title:`删除智能体「${e.name||e.filename}」?`,onOk:async()=>{await g.del(`/multi-agent/markdown-agents/${encodeURIComponent(e.filename)}`),D(`已删除`),B.reload()}});return(0,A.jsxs)(`div`,{children:[(0,A.jsx)(w,{title:e(`agents.title`,null,`智能体管理`),description:B.data?.dir?`目录:${B.data.dir}`:`以 Markdown 文件定义的子智能体与编排器。`,extra:(0,A.jsxs)(i,{children:[(0,A.jsx)(c,{icon:(0,A.jsx)(p,{}),onClick:()=>B.reload(),loading:B.loading,children:`刷新`}),n&&(0,A.jsx)(c,{theme:`solid`,type:`primary`,icon:(0,A.jsx)(u,{}),onClick:()=>L({record:null,form:{}}),children:`新建智能体`})]})}),B.data?.error&&(0,A.jsx)(S,{error:B.data.error}),(0,A.jsxs)(C,{title:`智能体(${V.length})`,children:[(0,A.jsx)(S,{error:B.error,onRetry:()=>B.reload()}),(0,A.jsx)(T,{columns:[{title:`智能体`,dataIndex:`name`,render:(e,t)=>(0,A.jsxs)(i,{vertical:!0,spacing:0,align:`start`,children:[(0,A.jsxs)(i,{children:[(0,A.jsx)(j,{strong:!0,children:e||t.id}),t.is_orchestrator&&(0,A.jsx)(o,{size:`small`,color:`purple`,children:`编排器`})]}),(0,A.jsx)(j,{type:`tertiary`,children:t.filename})]})},{title:`类型`,dataIndex:`kind`,width:110,render:e=>(0,A.jsx)(o,{size:`small`,children:e||`sub`})},{title:`描述`,dataIndex:`description`,render:e=>(0,A.jsx)(j,{type:`tertiary`,ellipsis:{showTooltip:!0},style:{maxWidth:460},children:e||`—`})},{title:`操作`,width:180,render:(e,t)=>(0,A.jsxs)(i,{children:[(0,A.jsx)(c,{size:`small`,theme:`borderless`,onClick:()=>H(t),children:`详情`}),n&&(0,A.jsx)(c,{size:`small`,theme:`borderless`,icon:(0,A.jsx)(s,{}),onClick:()=>L({record:t,form:{}})}),r&&(0,A.jsx)(c,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,A.jsx)(a,{}),onClick:()=>W(t)})]})}],dataSource:V,rowKey:`filename`,loading:B.loading,pagination:{pageSize:20},toolbar:(0,A.jsx)(l,{prefix:(0,A.jsx)(f,{}),value:M,onChange:N,placeholder:`搜索名称或文件名`,style:{width:280}})})]}),(0,A.jsx)(y,{title:I?.record?`编辑智能体`:`新建智能体`,visible:!!I,onCancel:()=>L(null),onOk:U,confirmLoading:R,width:760,children:(0,A.jsxs)(d,{getFormApi:e=>L(t=>t&&{...t,form:e}),initValues:I?.record?{filename:I.record.filename,name:I.record.name,description:I.record.description,kind:I.record.kind||`sub`}:{kind:`sub`},children:[(0,A.jsx)(d.Input,{field:`filename`,label:`文件名(留空自动生成)`,placeholder:`例如 recon.md`}),(0,A.jsx)(d.Input,{field:`name`,label:`名称`,rules:[{required:!0,message:`请输入名称`}]}),(0,A.jsx)(d.Input,{field:`description`,label:`描述`}),(0,A.jsx)(d.Select,{field:`kind`,label:`类型`,optionList:[{value:`sub`,label:`子智能体`},{value:`orchestrator`,label:`编排器`},{value:`plan_execute`,label:`计划执行`}]}),(0,A.jsx)(d.Input,{field:`tools`,label:`工具(逗号分隔)`,placeholder:`toolName, mcp::tool`}),(0,A.jsx)(d.TextArea,{field:`instruction`,label:`指令(Markdown)`,autosize:{minRows:8,maxRows:20}})]})},I?.record?.filename||`new-agent`),(0,A.jsx)(y,{title:P?.name||`智能体详情`,visible:!!P,onCancel:()=>F(null),width:720,children:P&&(0,A.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,A.jsx)(b,{items:[{label:`文件名`,value:P.filename},{label:`ID`,value:P.id},{label:`类型`,value:P.kind},{label:`绑定角色`,value:P.bind_role||`—`},{label:`最大迭代`,value:P.max_iterations??`—`},{label:`工具`,value:Array.isArray(P.tools)&&P.tools.length?P.tools.join(`、`):`—`}]}),(0,A.jsx)(x,{content:P.instruction||P.raw||``}),(0,A.jsx)(E,{value:P.raw||P,title:`原始 Markdown`,collapsed:!0})]})})]})}export{M as default};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
import{I as e,L as t}from"./index-BdnarFZR.js";var n=encodeURIComponent,r=t=>e.get(`/c2/listeners`,t),i=t=>e.post(`/c2/listeners`,t),a=(t,r)=>e.put(`/c2/listeners/${n(t)}`,r),o=t=>e.del(`/c2/listeners/${n(t)}`),s=t=>e.post(`/c2/listeners/${n(t)}/start`,{}),c=t=>e.post(`/c2/listeners/${n(t)}/stop`,{}),l=t=>e.get(`/c2/sessions`,t),u=t=>e.get(`/c2/sessions/${n(t)}`),d=t=>e.del(`/c2/sessions/${n(t)}`),f=t=>e.del(`/c2/sessions`,{body:{ids:t}}),p=(t,{sleepSeconds:r,jitterPercent:i})=>e.put(`/c2/sessions/${n(t)}/sleep`,{sleep_seconds:r,jitter_percent:i}),m=(t,r)=>e.put(`/c2/sessions/${n(t)}/note`,{note:r}),h=t=>e.get(`/c2/tasks`,t),g=t=>e.get(`/c2/tasks/${n(t)}`),_=t=>e.post(`/c2/tasks`,t),v=(t,r)=>e.post(`/c2/sessions/${n(t)}/tasks`,r),y=t=>e.post(`/c2/tasks/${n(t)}/cancel`,{}),b=(t,r=30)=>e.get(`/c2/tasks/${n(t)}/wait`,{timeout:r},{timeout:(r+10)*1e3}),x=t=>e.del(`/c2/tasks`,{body:{ids:t}}),S=(e,r)=>t(`/c2/tasks/${n(e)}/result-file`,{filename:r}),C=t=>e.post(`/c2/payloads/oneliner`,t),w=t=>e.post(`/c2/payloads/build`,t),T=(e,r)=>t(`/c2/payloads/${n(e)}/download`,{filename:r}),E=t=>e.get(`/c2/events`,t),D=t=>e.del(`/c2/events`,{body:{ids:t}}),O=()=>e.get(`/c2/profiles`),k=t=>e.post(`/c2/profiles`,t),A=(t,r)=>e.put(`/c2/profiles/${n(t)}`,r),j=t=>e.del(`/c2/profiles/${n(t)}`);async function M(){try{let t=await e.get(`/projects`,{limit:200});return Array.isArray(t?.projects)?t.projects:[]}catch{return[]}}export{b as A,h as C,c as D,s as E,a as O,l as S,p as T,g as _,k as a,O as b,D as c,d,f,u as g,S as h,i,A as k,o as l,T as m,w as n,v as o,x as p,y as r,_ as s,C as t,j as u,E as v,m as w,M as x,r as y};
import{L as e,R as t}from"./index-_8d9XBPJ.js";var n=encodeURIComponent,r=t=>e.get(`/c2/listeners`,t),i=t=>e.post(`/c2/listeners`,t),a=(t,r)=>e.put(`/c2/listeners/${n(t)}`,r),o=t=>e.del(`/c2/listeners/${n(t)}`),s=t=>e.post(`/c2/listeners/${n(t)}/start`,{}),c=t=>e.post(`/c2/listeners/${n(t)}/stop`,{}),l=t=>e.get(`/c2/sessions`,t),u=t=>e.get(`/c2/sessions/${n(t)}`),d=t=>e.del(`/c2/sessions/${n(t)}`),f=t=>e.del(`/c2/sessions`,{body:{ids:t}}),p=(t,{sleepSeconds:r,jitterPercent:i})=>e.put(`/c2/sessions/${n(t)}/sleep`,{sleep_seconds:r,jitter_percent:i}),m=(t,r)=>e.put(`/c2/sessions/${n(t)}/note`,{note:r}),h=t=>e.get(`/c2/tasks`,t),g=t=>e.get(`/c2/tasks/${n(t)}`),_=t=>e.post(`/c2/tasks`,t),v=(t,r)=>e.post(`/c2/sessions/${n(t)}/tasks`,r),y=t=>e.post(`/c2/tasks/${n(t)}/cancel`,{}),b=(t,r=30)=>e.get(`/c2/tasks/${n(t)}/wait`,{timeout:r},{timeout:(r+10)*1e3}),x=t=>e.del(`/c2/tasks`,{body:{ids:t}}),S=(e,r)=>t(`/c2/tasks/${n(e)}/result-file`,{filename:r}),C=t=>e.post(`/c2/payloads/oneliner`,t),w=t=>e.post(`/c2/payloads/build`,t),T=(e,r)=>t(`/c2/payloads/${n(e)}/download`,{filename:r}),E=t=>e.get(`/c2/events`,t),D=t=>e.del(`/c2/events`,{body:{ids:t}}),O=()=>e.get(`/c2/profiles`),k=t=>e.post(`/c2/profiles`,t),A=(t,r)=>e.put(`/c2/profiles/${n(t)}`,r),j=t=>e.del(`/c2/profiles/${n(t)}`);async function M(){try{let t=await e.get(`/projects`,{limit:200});return Array.isArray(t?.projects)?t.projects:[]}catch{return[]}}export{b as A,h as C,c as D,s as E,a as O,l as S,p as T,g as _,k as a,O as b,D as c,d,f,u as g,S as h,i,A as k,o as l,T as m,w as n,v as o,x as p,y as r,_ as s,C as t,j as u,E as v,m as w,M as x,r as y};

View File

@ -1 +1 @@
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{G as t,I as n,R as r}from"./semi-65W_4I1v.js";import{E as i,P as a,k as o}from"./index-BdnarFZR.js";import"./c2-shared-CdRIcwcz.js";import{t as s}from"./react-QV7DAAIx.js";var c=e(s(),1),{Text:l}=t,u=[{value:`http_beacon`,label:`HTTP Beacon`},{value:`https_beacon`,label:`HTTPS Beacon`},{value:`tcp_reverse`,label:`TCP 反向`},{value:`websocket`,label:`WebSocket`}],d={running:`运行中`,stopped:`已停止`,error:`异常`},f={tcp_reverse:[{value:`bash`,label:`Bash (/dev/tcp)`},{value:`nc`,label:`Netcat (-e)`},{value:`nc_mkfifo`,label:`Netcat (mkfifo)`},{value:`python`,label:`Python`},{value:`perl`,label:`Perl`},{value:`powershell`,label:`PowerShell`}],http_beacon:[{value:`curl_beacon`,label:`Curl Beacon (HTTP)`}],https_beacon:[{value:`curl_beacon`,label:`Curl Beacon (HTTP)`}],websocket:[{value:`curl_beacon`,label:`Curl Beacon (HTTP)`}]},p=[{value:`shell`,label:`shell`},{value:`exec`,label:`exec`},{value:`ls`,label:`ls`},{value:`pwd`,label:`pwd`},{value:`cd`,label:`cd`},{value:`ps`,label:`ps`},{value:`kill_proc`,label:`kill_proc`},{value:`download`,label:`download`},{value:`upload`,label:`upload`},{value:`screenshot`,label:`screenshot`},{value:`sleep`,label:`sleep`},{value:`exit`,label:`exit`},{value:`self_delete`,label:`self_delete`},{value:`port_fwd`,label:`port_fwd`},{value:`socks_start`,label:`socks_start`},{value:`socks_stop`,label:`socks_stop`},{value:`load_assembly`,label:`load_assembly`},{value:`persist`,label:`persist`}],m=[{value:`queued`,label:`队列中`},{value:`sent`,label:`已发送`},{value:`running`,label:`执行中`},{value:`success`,label:`成功`},{value:`failed`,label:`失败`},{value:`cancelled`,label:`已取消`}],h=[{value:`info`,label:`信息`},{value:`warn`,label:`警告`},{value:`critical`,label:`严重`}],g=[{value:`listener`,label:`监听器`},{value:`session`,label:`会话`},{value:`task`,label:`任务`},{value:`payload`,label:`Payload`},{value:`opsec`,label:`OPSEC`}],_=[{value:`active`,label:`活跃`},{value:`sleeping`,label:`休眠`},{value:`dead`,label:`离线`},{value:`killed`,label:`已终止`}],v=[{value:`15m`,label:`最近15分钟`,ms:9e5},{value:`1h`,label:`最近1小时`,ms:36e5},{value:`24h`,label:`最近24小时`,ms:864e5},{value:`7d`,label:`最近7天`,ms:6048e5},{value:`all`,label:`全部`,ms:0}];function y(e){let t=v.find(t=>t.value===e);return!t||!t.ms?``:new Date(Date.now()-t.ms).toISOString()}function b({value:e,onChange:t,ns:i=`tasks`}){let o=a();return(0,c.jsxs)(n,{spacing:6,wrap:!0,className:`c2-time-presets`,children:[(0,c.jsx)(l,{type:`tertiary`,size:`small`,children:o(`c2.tasks.timePresets`,null,`快捷`)}),v.map(n=>(0,c.jsx)(r,{size:`small`,theme:n.value===e?`solid`:`borderless`,type:n.value===e?`primary`:`tertiary`,onClick:()=>t(n.value),children:o(`c2.${i}.preset${n.value===`all`?`All`:n.value}`,null,n.label)},n.value))]})}function x(e){let t=Number(e);return!Number.isFinite(t)||t<=0?`—`:t<1e3?`${Math.round(t)}ms`:t<6e4?`${(t/1e3).toFixed(1)}秒`:`${Math.round(t/6e4)}分钟`}function S({value:e}){let t=a();return e?(0,c.jsx)(`span`,{className:`c2-time-text`,title:i(e),children:o(e,t)}):(0,c.jsx)(l,{type:`tertiary`,children:`—`})}var C={running:`green`,stopped:`grey`,error:`red`},w={queued:`amber`,sent:`blue`,running:`blue`,success:`green`,failed:`red`,cancelled:`grey`},T={active:`green`,sleeping:`amber`,dead:`grey`,killed:`red`},E={info:`blue`,warn:`amber`,critical:`red`};export{d as a,T as c,m as d,p as f,y as g,x as h,C as i,_ as l,S as m,E as n,u as o,b as p,h as r,f as s,g as t,w as u};
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{G as t,I as n,R as r}from"./semi-65W_4I1v.js";import{A as i,E as a,F as o}from"./index-_8d9XBPJ.js";import"./c2-shared-d6x5yKU9.js";import{t as s}from"./react-QV7DAAIx.js";var c=e(s(),1),{Text:l}=t,u=[{value:`http_beacon`,label:`HTTP Beacon`},{value:`https_beacon`,label:`HTTPS Beacon`},{value:`tcp_reverse`,label:`TCP 反向`},{value:`websocket`,label:`WebSocket`}],d={running:`运行中`,stopped:`已停止`,error:`异常`},f={tcp_reverse:[{value:`bash`,label:`Bash (/dev/tcp)`},{value:`nc`,label:`Netcat (-e)`},{value:`nc_mkfifo`,label:`Netcat (mkfifo)`},{value:`python`,label:`Python`},{value:`perl`,label:`Perl`},{value:`powershell`,label:`PowerShell`}],http_beacon:[{value:`curl_beacon`,label:`Curl Beacon (HTTP)`}],https_beacon:[{value:`curl_beacon`,label:`Curl Beacon (HTTP)`}],websocket:[{value:`curl_beacon`,label:`Curl Beacon (HTTP)`}]},p=[{value:`shell`,label:`shell`},{value:`exec`,label:`exec`},{value:`ls`,label:`ls`},{value:`pwd`,label:`pwd`},{value:`cd`,label:`cd`},{value:`ps`,label:`ps`},{value:`kill_proc`,label:`kill_proc`},{value:`download`,label:`download`},{value:`upload`,label:`upload`},{value:`screenshot`,label:`screenshot`},{value:`sleep`,label:`sleep`},{value:`exit`,label:`exit`},{value:`self_delete`,label:`self_delete`},{value:`port_fwd`,label:`port_fwd`},{value:`socks_start`,label:`socks_start`},{value:`socks_stop`,label:`socks_stop`},{value:`load_assembly`,label:`load_assembly`},{value:`persist`,label:`persist`}],m=[{value:`queued`,label:`队列中`},{value:`sent`,label:`已发送`},{value:`running`,label:`执行中`},{value:`success`,label:`成功`},{value:`failed`,label:`失败`},{value:`cancelled`,label:`已取消`}],h=[{value:`info`,label:`信息`},{value:`warn`,label:`警告`},{value:`critical`,label:`严重`}],g=[{value:`listener`,label:`监听器`},{value:`session`,label:`会话`},{value:`task`,label:`任务`},{value:`payload`,label:`Payload`},{value:`opsec`,label:`OPSEC`}],_=[{value:`active`,label:`活跃`},{value:`sleeping`,label:`休眠`},{value:`dead`,label:`离线`},{value:`killed`,label:`已终止`}],v=[{value:`15m`,label:`最近15分钟`,ms:9e5},{value:`1h`,label:`最近1小时`,ms:36e5},{value:`24h`,label:`最近24小时`,ms:864e5},{value:`7d`,label:`最近7天`,ms:6048e5},{value:`all`,label:`全部`,ms:0}];function y(e){let t=v.find(t=>t.value===e);return!t||!t.ms?``:new Date(Date.now()-t.ms).toISOString()}function b({value:e,onChange:t,ns:i=`tasks`}){let a=o();return(0,c.jsxs)(n,{spacing:6,wrap:!0,className:`c2-time-presets`,children:[(0,c.jsx)(l,{type:`tertiary`,size:`small`,children:a(`c2.tasks.timePresets`,null,`快捷`)}),v.map(n=>(0,c.jsx)(r,{size:`small`,theme:n.value===e?`solid`:`borderless`,type:n.value===e?`primary`:`tertiary`,onClick:()=>t(n.value),children:a(`c2.${i}.preset${n.value===`all`?`All`:n.value}`,null,n.label)},n.value))]})}function x(e){let t=Number(e);return!Number.isFinite(t)||t<=0?`—`:t<1e3?`${Math.round(t)}ms`:t<6e4?`${(t/1e3).toFixed(1)}秒`:`${Math.round(t/6e4)}分钟`}function S({value:e}){let t=o();return e?(0,c.jsx)(`span`,{className:`c2-time-text`,title:a(e),children:i(e,t)}):(0,c.jsx)(l,{type:`tertiary`,children:`—`})}var C={running:`green`,stopped:`grey`,error:`red`},w={queued:`amber`,sent:`blue`,running:`blue`,success:`green`,failed:`red`,cancelled:`grey`},T={active:`green`,sleeping:`amber`,dead:`grey`,killed:`red`},E={info:`blue`,warn:`amber`,critical:`red`};export{d as a,T as c,m as d,p as f,y as g,x as h,C as i,_ as l,S as m,E as n,u as o,b as p,h as r,f as s,g as t,w as u};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n}from"./react-QV7DAAIx.js";import{G as r,I as i,Lt as a,N as o,R as s,U as c,lt as l,ut as u}from"./semi-65W_4I1v.js";import{E as d,F as f,I as p,P as m,a as h,c as g,d as _,l as v,m as y,p as b,s as x,u as S,x as C,y as w}from"./index-BdnarFZR.js";var T=e(t(),1),E=e(n(),1),{Text:D}=r;function O(){let e=m(),{hasPermission:t}=f(),n=t(`knowledge:delete`),[r,O]=(0,T.useState)(``),[k,A]=(0,T.useState)(50),[j,M]=(0,T.useState)(null),N=h(()=>p.get(`/knowledge/retrieval-logs`,{conversationId:r||void 0,limit:k}),[r,k]),P=Array.isArray(N.data?.logs)?N.data.logs:[],F=e=>w({title:`删除该检索日志?`,content:e.query||e.id,onOk:async()=>{await p.del(`/knowledge/retrieval-logs/${encodeURIComponent(e.id)}`),C(`已删除`),N.reload()}});return(0,E.jsxs)(`div`,{children:[(0,E.jsx)(b,{title:e(`knowledge.retrievalLogsTitle`,null,`检索历史`),description:`记录智能体每次知识库检索的语句、命中项与会话,用于回溯回答依据。`,extra:(0,E.jsx)(s,{icon:(0,E.jsx)(u,{}),onClick:()=>N.reload(),loading:N.loading,children:`刷新`})}),(0,E.jsxs)(y,{title:`检索记录(${P.length})`,children:[(0,E.jsx)(v,{error:N.error,onRetry:()=>N.reload()}),(0,E.jsx)(x,{columns:[{title:`检索语句`,dataIndex:`query`,render:(e,t)=>(0,E.jsx)(`button`,{type:`button`,className:`link-button`,onClick:()=>M(t),style:{background:`none`,border:`none`,padding:0,cursor:`pointer`,textAlign:`left`,color:`var(--semi-color-primary)`},children:e||`—`})},{title:`风险类型`,dataIndex:`riskType`,width:140,render:e=>e?(0,E.jsx)(o,{size:`small`,children:e}):`—`},{title:`命中知识项`,dataIndex:`retrievedItems`,width:120,render:e=>(0,E.jsxs)(D,{type:`tertiary`,children:[Array.isArray(e)?e.length:0,` 条`]})},{title:`会话`,dataIndex:`conversationId`,width:200,render:e=>(0,E.jsx)(D,{type:`tertiary`,ellipsis:{showTooltip:!0},children:e||`—`})},{title:`时间`,dataIndex:`createdAt`,width:180,render:e=>d(e)},{title:`操作`,width:110,render:(e,t)=>(0,E.jsxs)(i,{children:[(0,E.jsx)(s,{size:`small`,theme:`borderless`,onClick:()=>M(t),children:`详情`}),n&&(0,E.jsx)(s,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,E.jsx)(a,{}),onClick:()=>F(t)})]})}],dataSource:P,rowKey:`id`,loading:N.loading,pagination:!1,toolbar:(0,E.jsxs)(i,{children:[(0,E.jsx)(c,{prefix:(0,E.jsx)(l,{}),placeholder:`按会话 ID 过滤`,value:r,onChange:O,style:{width:260}}),(0,E.jsx)(c,{placeholder:`条数`,value:String(k),onChange:e=>A(Math.min(Math.max(Number(e)||50,1),500)),style:{width:100},suffix:(0,E.jsx)(D,{type:`tertiary`,children:`条`})})]})})]}),(0,E.jsx)(g,{title:`检索日志详情`,visible:!!j,onCancel:()=>M(null),width:560,children:j&&(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,E.jsx)(_,{items:[{label:`日志 ID`,value:j.id},{label:`检索语句`,value:j.query},{label:`风险类型`,value:j.riskType||`—`},{label:`会话 ID`,value:j.conversationId||`—`},{label:`消息 ID`,value:j.messageId||`—`},{label:`时间`,value:d(j.createdAt)}]}),(0,E.jsx)(S,{value:j.retrievedItems||[],title:`命中知识项`})]})})]})}export{O as default};
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n}from"./react-QV7DAAIx.js";import{G as r,I as i,Lt as a,N as o,R as s,U as c,lt as l,ut as u}from"./semi-65W_4I1v.js";import{E as d,F as f,I as p,L as m,a as h,c as g,d as _,l as v,m as y,p as b,s as x,u as S,x as C,y as w}from"./index-_8d9XBPJ.js";var T=e(t(),1),E=e(n(),1),{Text:D}=r;function O(){let e=f(),{hasPermission:t}=p(),n=t(`knowledge:delete`),[r,O]=(0,T.useState)(``),[k,A]=(0,T.useState)(50),[j,M]=(0,T.useState)(null),N=h(()=>m.get(`/knowledge/retrieval-logs`,{conversationId:r||void 0,limit:k}),[r,k]),P=Array.isArray(N.data?.logs)?N.data.logs:[],F=e=>w({title:`删除该检索日志?`,content:e.query||e.id,onOk:async()=>{await m.del(`/knowledge/retrieval-logs/${encodeURIComponent(e.id)}`),C(`已删除`),N.reload()}});return(0,E.jsxs)(`div`,{children:[(0,E.jsx)(b,{title:e(`knowledge.retrievalLogsTitle`,null,`检索历史`),description:`记录智能体每次知识库检索的语句、命中项与会话,用于回溯回答依据。`,extra:(0,E.jsx)(s,{icon:(0,E.jsx)(u,{}),onClick:()=>N.reload(),loading:N.loading,children:`刷新`})}),(0,E.jsxs)(y,{title:`检索记录(${P.length})`,children:[(0,E.jsx)(v,{error:N.error,onRetry:()=>N.reload()}),(0,E.jsx)(x,{columns:[{title:`检索语句`,dataIndex:`query`,render:(e,t)=>(0,E.jsx)(`button`,{type:`button`,className:`link-button`,onClick:()=>M(t),style:{background:`none`,border:`none`,padding:0,cursor:`pointer`,textAlign:`left`,color:`var(--semi-color-primary)`},children:e||`—`})},{title:`风险类型`,dataIndex:`riskType`,width:140,render:e=>e?(0,E.jsx)(o,{size:`small`,children:e}):`—`},{title:`命中知识项`,dataIndex:`retrievedItems`,width:120,render:e=>(0,E.jsxs)(D,{type:`tertiary`,children:[Array.isArray(e)?e.length:0,` 条`]})},{title:`会话`,dataIndex:`conversationId`,width:200,render:e=>(0,E.jsx)(D,{type:`tertiary`,ellipsis:{showTooltip:!0},children:e||`—`})},{title:`时间`,dataIndex:`createdAt`,width:180,render:e=>d(e)},{title:`操作`,width:110,render:(e,t)=>(0,E.jsxs)(i,{children:[(0,E.jsx)(s,{size:`small`,theme:`borderless`,onClick:()=>M(t),children:`详情`}),n&&(0,E.jsx)(s,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,E.jsx)(a,{}),onClick:()=>F(t)})]})}],dataSource:P,rowKey:`id`,loading:N.loading,pagination:!1,toolbar:(0,E.jsxs)(i,{children:[(0,E.jsx)(c,{prefix:(0,E.jsx)(l,{}),placeholder:`按会话 ID 过滤`,value:r,onChange:O,style:{width:260}}),(0,E.jsx)(c,{placeholder:`条数`,value:String(k),onChange:e=>A(Math.min(Math.max(Number(e)||50,1),500)),style:{width:100},suffix:(0,E.jsx)(D,{type:`tertiary`,children:`条`})})]})})]}),(0,E.jsx)(g,{title:`检索日志详情`,visible:!!j,onCancel:()=>M(null),width:560,children:j&&(0,E.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,E.jsx)(_,{items:[{label:`日志 ID`,value:j.id},{label:`检索语句`,value:j.query},{label:`风险类型`,value:j.riskType||`—`},{label:`会话 ID`,value:j.conversationId||`—`},{label:`消息 ID`,value:j.messageId||`—`},{label:`时间`,value:d(j.createdAt)}]}),(0,E.jsx)(S,{value:j.retrievedItems||[],title:`命中知识项`})]})})]})}export{O as default};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n}from"./react-QV7DAAIx.js";import{G as r,i}from"./semi-65W_4I1v.js";import{I as a,P as o,c as s,l as c,x as l}from"./index-BdnarFZR.js";var u=e(t(),1),d=e(n(),1),{Text:f}=r,p=120,m=4e3;function h({visible:e,project:t,onCancel:n,onSaved:r}){let h=o(),g=(0,u.useId)(),[_,v]=(0,u.useState)(!1),[y,b]=(0,u.useState)(null),x=!!t?.id;return(0,u.useEffect)(()=>{b(null)},[e,t?.id]),(0,d.jsxs)(s,{visible:e,width:560,closable:!_,closeOnEsc:!_,onCancel:n,cancelButtonProps:{disabled:_},title:x?h(`projects.modalEditTitle`,null,`编辑项目`):h(`projects.modalNewTitle`,null,`新建项目`),formId:g,okText:x?h(`projects.saveChanges`,null,`保存修改`):h(`projects.createProject`,null,`创建项目`),confirmLoading:_,children:[(0,d.jsx)(f,{type:`tertiary`,size:`small`,children:x?h(`projects.modalEditSubtitle`,null,`修改项目名称与描述`):h(`projects.modalNewSubtitle`,null,`创建后可绑定对话,跨会话共享事实黑板`)}),(0,d.jsxs)(i,{id:g,onSubmit:async e=>{if(!_){v(!0),b(null);try{let n={name:e.name.trim(),description:(e.description||``).slice(0,m)},i=x?await a.put(`/projects/${t.id}`,n):await a.post(`/projects`,n);l(x?h(`projects.saved`,null,`已保存`):h(`projects.createProject`,null,`创建项目`)),r?.(i)}catch(e){b(e)}finally{v(!1)}}},initValues:{name:t?.name||``,description:t?.description||``},children:[(0,d.jsx)(i.Input,{id:`${g}-name`,field:`name`,maxLength:p,label:h(`projects.projectName`,null,`项目名称`),placeholder:h(`projects.projectNamePlaceholder`,null,`例如:某客户 Web 渗透`),rules:[{required:!0,whitespace:!0,message:h(`projects.enterProjectName`,null,`请输入项目名称`)}]}),(0,d.jsx)(i.TextArea,{id:`${g}-description`,field:`description`,rows:4,maxCount:m,label:h(`projects.projectDescription`,null,`项目描述`),placeholder:h(`projects.projectDescriptionPlaceholder`,null,`客户/任务备注、协作说明…`),extraText:h(`projects.descriptionLengthHint`,null,`仅供团队成员查阅,Agent 不会读取;需让 Agent 知晓的内容请写入事实黑板`)}),(0,d.jsx)(c,{error:y})]},`${e}-${t?.id||`new`}`)]})}export{h as t};
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n}from"./react-QV7DAAIx.js";import{G as r,i}from"./semi-65W_4I1v.js";import{F as a,L as o,c as s,l as c,x as l}from"./index-_8d9XBPJ.js";var u=e(t(),1),d=e(n(),1),{Text:f}=r,p=120,m=4e3;function h({visible:e,project:t,onCancel:n,onSaved:r}){let h=a(),g=(0,u.useId)(),[_,v]=(0,u.useState)(!1),[y,b]=(0,u.useState)(null),x=!!t?.id;return(0,u.useEffect)(()=>{b(null)},[e,t?.id]),(0,d.jsxs)(s,{visible:e,width:560,closable:!_,closeOnEsc:!_,onCancel:n,cancelButtonProps:{disabled:_},title:x?h(`projects.modalEditTitle`,null,`编辑项目`):h(`projects.modalNewTitle`,null,`新建项目`),formId:g,okText:x?h(`projects.saveChanges`,null,`保存修改`):h(`projects.createProject`,null,`创建项目`),confirmLoading:_,children:[(0,d.jsx)(f,{type:`tertiary`,size:`small`,children:x?h(`projects.modalEditSubtitle`,null,`修改项目名称与描述`):h(`projects.modalNewSubtitle`,null,`创建后可绑定对话,跨会话共享事实黑板`)}),(0,d.jsxs)(i,{id:g,onSubmit:async e=>{if(!_){v(!0),b(null);try{let n={name:e.name.trim(),description:(e.description||``).slice(0,m)},i=x?await o.put(`/projects/${t.id}`,n):await o.post(`/projects`,n);l(x?h(`projects.saved`,null,`已保存`):h(`projects.createProject`,null,`创建项目`)),r?.(i)}catch(e){b(e)}finally{v(!1)}}},initValues:{name:t?.name||``,description:t?.description||``},children:[(0,d.jsx)(i.Input,{id:`${g}-name`,field:`name`,maxLength:p,label:h(`projects.projectName`,null,`项目名称`),placeholder:h(`projects.projectNamePlaceholder`,null,`例如:某客户 Web 渗透`),rules:[{required:!0,whitespace:!0,message:h(`projects.enterProjectName`,null,`请输入项目名称`)}]}),(0,d.jsx)(i.TextArea,{id:`${g}-description`,field:`description`,rows:4,maxCount:m,label:h(`projects.projectDescription`,null,`项目描述`),placeholder:h(`projects.projectDescriptionPlaceholder`,null,`客户/任务备注、协作说明…`),extraText:h(`projects.descriptionLengthHint`,null,`仅供团队成员查阅,Agent 不会读取;需让 Agent 知晓的内容请写入事实黑板`)}),(0,d.jsx)(c,{error:y})]},`${e}-${t?.id||`new`}`)]})}export{h as t};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{G as t,I as n,Lt as r,R as i,ut as a}from"./semi-65W_4I1v.js";import{D as o,F as s,I as c,O as l,P as u,_ as d,a as f,l as p,m,p as h,s as g,x as _,y as v}from"./index-BdnarFZR.js";import{t as y}from"./react-QV7DAAIx.js";var b=e(y(),1),{Text:x}=t;function S(){let e=u(),{hasPermission:t}=s(),y=t(`skills:delete`),S=f(()=>c.get(`/skills/stats`),[]),C=Array.isArray(S.data?.stats)?S.data.stats:[],w=Number(S.data?.total_calls||0),T=Number(S.data?.total_success||0),E=w>0?T/w:null,D=()=>v({title:`清空所有技能调用统计?`,content:`只影响统计计数,不删除技能文件。`,onOk:async()=>{await c.del(`/skills/stats`),_(`统计已清空`),S.reload()}}),O=e=>v({title:`清空「${e}」的统计?`,onOk:async()=>{await c.del(`/skills/${encodeURIComponent(e)}/stats`),_(`已清空`),S.reload()}});return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(h,{title:e(`skills.monitorTitle`,null,`技能状态`),description:S.data?.skills_dir?`技能目录:${S.data.skills_dir}`:`统计技能被调用的次数、成功率与最近使用时间。`,extra:(0,b.jsxs)(n,{children:[(0,b.jsx)(i,{icon:(0,b.jsx)(a,{}),onClick:()=>S.reload(),loading:S.loading,children:`刷新`}),y&&(0,b.jsx)(i,{type:`danger`,theme:`light`,onClick:D,children:`清空全部统计`})]})}),(0,b.jsx)(d,{columns:4,metrics:[{id:`skills`,label:`技能总数`,value:o(S.data?.total_skills||0),loading:S.loading},{id:`calls`,label:`调用总数`,value:o(w),loading:S.loading},{id:`success`,label:`成功次数`,value:o(T),loading:S.loading},{id:`rate`,label:`成功率`,value:E===null?`—`:l(E),tone:E!==null&&E<.8?`warning`:`success`,loading:S.loading}]}),(0,b.jsxs)(m,{title:`按技能统计`,children:[(0,b.jsx)(p,{error:S.error,onRetry:()=>S.reload()}),(0,b.jsx)(g,{columns:[{title:`技能`,dataIndex:`skill_name`,render:e=>(0,b.jsx)(x,{strong:!0,children:e})},{title:`调用次数`,dataIndex:`total_calls`,width:120,render:e=>o(e||0)},{title:`成功`,dataIndex:`success_calls`,width:100,render:e=>o(e||0)},{title:`失败`,dataIndex:`failed_calls`,width:100,render:e=>Number(e)>0?(0,b.jsx)(x,{type:`danger`,children:o(e)}):`0`},{title:`最后调用`,dataIndex:`last_call_time`,width:180,render:e=>e||`—`},{title:`操作`,width:110,render:(e,t)=>y&&Number(t.total_calls)>0?(0,b.jsx)(i,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,b.jsx)(r,{}),onClick:()=>O(t.skill_name),children:`清空`}):null}],dataSource:C,rowKey:`skill_name`,loading:S.loading,pagination:{pageSize:20}})]})]})}export{S as default};
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{G as t,I as n,Lt as r,R as i,ut as a}from"./semi-65W_4I1v.js";import{D as o,F as s,I as c,L as l,O as u,_ as d,a as f,l as p,m,p as h,s as g,x as _,y as v}from"./index-_8d9XBPJ.js";import{t as y}from"./react-QV7DAAIx.js";var b=e(y(),1),{Text:x}=t;function S(){let e=s(),{hasPermission:t}=c(),y=t(`skills:delete`),S=f(()=>l.get(`/skills/stats`),[]),C=Array.isArray(S.data?.stats)?S.data.stats:[],w=Number(S.data?.total_calls||0),T=Number(S.data?.total_success||0),E=w>0?T/w:null,D=()=>v({title:`清空所有技能调用统计?`,content:`只影响统计计数,不删除技能文件。`,onOk:async()=>{await l.del(`/skills/stats`),_(`统计已清空`),S.reload()}}),O=e=>v({title:`清空「${e}」的统计?`,onOk:async()=>{await l.del(`/skills/${encodeURIComponent(e)}/stats`),_(`已清空`),S.reload()}});return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(h,{title:e(`skills.monitorTitle`,null,`技能状态`),description:S.data?.skills_dir?`技能目录:${S.data.skills_dir}`:`统计技能被调用的次数、成功率与最近使用时间。`,extra:(0,b.jsxs)(n,{children:[(0,b.jsx)(i,{icon:(0,b.jsx)(a,{}),onClick:()=>S.reload(),loading:S.loading,children:`刷新`}),y&&(0,b.jsx)(i,{type:`danger`,theme:`light`,onClick:D,children:`清空全部统计`})]})}),(0,b.jsx)(d,{columns:4,metrics:[{id:`skills`,label:`技能总数`,value:o(S.data?.total_skills||0),loading:S.loading},{id:`calls`,label:`调用总数`,value:o(w),loading:S.loading},{id:`success`,label:`成功次数`,value:o(T),loading:S.loading},{id:`rate`,label:`成功率`,value:E===null?`—`:u(E),tone:E!==null&&E<.8?`warning`:`success`,loading:S.loading}]}),(0,b.jsxs)(m,{title:`按技能统计`,children:[(0,b.jsx)(p,{error:S.error,onRetry:()=>S.reload()}),(0,b.jsx)(g,{columns:[{title:`技能`,dataIndex:`skill_name`,render:e=>(0,b.jsx)(x,{strong:!0,children:e})},{title:`调用次数`,dataIndex:`total_calls`,width:120,render:e=>o(e||0)},{title:`成功`,dataIndex:`success_calls`,width:100,render:e=>o(e||0)},{title:`失败`,dataIndex:`failed_calls`,width:100,render:e=>Number(e)>0?(0,b.jsx)(x,{type:`danger`,children:o(e)}):`0`},{title:`最后调用`,dataIndex:`last_call_time`,width:180,render:e=>e||`—`},{title:`操作`,width:110,render:(e,t)=>y&&Number(t.total_calls)>0?(0,b.jsx)(i,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,b.jsx)(r,{}),onClick:()=>O(t.skill_name),children:`清空`}):null}],dataSource:C,rowKey:`skill_name`,loading:S.loading,pagination:{pageSize:20}})]})]})}export{S as default};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -18,7 +18,7 @@
} catch (error) { /* first paint fallback */ }
})();
</script>
<script type="module" crossorigin src="/static/app/assets/index-BdnarFZR.js"></script>
<script type="module" crossorigin src="/static/app/assets/index-_8d9XBPJ.js"></script>
<link rel="modulepreload" crossorigin href="/static/app/assets/rolldown-runtime-WkwZ5CU-.js">
<link rel="modulepreload" crossorigin href="/static/app/assets/react-QV7DAAIx.js">
<link rel="modulepreload" crossorigin href="/static/app/assets/semi-65W_4I1v.js">