fix(projects): keep attack path nodes readable when fitting the canvas
This commit is contained in:
parent
4f1ed1e650
commit
9c67d8c4bb
|
|
@ -19,7 +19,7 @@ export function GraphNodeIcon({ type }) {
|
|||
return <span className="graph-node-icon" aria-hidden="true"><Icon size="small" /></span>;
|
||||
}
|
||||
|
||||
export function GraphNodeCard({ id, title, type, category, color, factKey, boundary, ports = [], selected, card, onSelect }) {
|
||||
export function GraphNodeCard({ id, title, type, category, color, factKey, boundary, ports = [], selected, card, onSelect, onPreview }) {
|
||||
const { density, box } = card;
|
||||
const detail = density === 'detail';
|
||||
const textScale = Math.min(Math.max(box.width / CARD_WIDTH, 1), 1.6);
|
||||
|
|
@ -35,6 +35,10 @@ export function GraphNodeCard({ id, title, type, category, color, factKey, bound
|
|||
data-wrap={density === 'standard' && box.height >= 50 || undefined}
|
||||
style={{ ...box, '--graph-node-color': color, '--graph-node-text-scale': textScale }}
|
||||
onClick={() => onSelect(id)}
|
||||
onMouseEnter={() => onPreview?.(id, true)}
|
||||
onMouseLeave={() => onPreview?.(id, false)}
|
||||
onFocus={() => onPreview?.(id, true)}
|
||||
onBlur={() => onPreview?.(id, false)}
|
||||
>
|
||||
<span className="graph-node-content">
|
||||
{density !== 'compact' && (
|
||||
|
|
|
|||
|
|
@ -1,8 +1,63 @@
|
|||
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { bindGraphCardWheel, CARD_HEIGHT, CARD_WIDTH, GraphNodeCard, visibleGraphCards, zoomGraph } from '../../components/graph-card';
|
||||
import { bindGraphCardWheel, CARD_HEIGHT, CARD_WIDTH, GraphNodeCard, GraphNodeIcon, visibleGraphCards, zoomGraph } from '../../components/graph-card';
|
||||
import { NODE_COLORS } from './helpers';
|
||||
import { projectGraphLayout } from './fact-graph-layout';
|
||||
|
||||
const READABLE_ZOOM = 0.78;
|
||||
const PREVIEW_WIDTH = 340;
|
||||
|
||||
function nodeText(node) {
|
||||
const key = node.fact_key || node.id;
|
||||
const title = (node.summary || (node.label !== '—' && node.label) || key).replace(/\s+/g, ' ').trim() || key;
|
||||
return { key, title };
|
||||
}
|
||||
|
||||
function fittedViewport(cy, selectedId, mode) {
|
||||
const width = cy.width();
|
||||
const height = cy.height();
|
||||
const nodes = cy.nodes();
|
||||
const elements = cy.elements();
|
||||
const viewport = cy.getFitViewport(elements, Math.min(36, width / 10, height / 10));
|
||||
if (!viewport) return null;
|
||||
if (viewport.zoom > 1) {
|
||||
return { zoom: 1, pan: cy.getCenterPan(elements, 1), view: mode === 'overview' ? mode : 'fitted' };
|
||||
}
|
||||
if (mode === 'overview' || viewport.zoom >= READABLE_ZOOM) {
|
||||
return { ...viewport, view: mode === 'overview' ? mode : 'fitted' };
|
||||
}
|
||||
|
||||
// On dense graphs start at a readable size and keep the focused node or first branch in view.
|
||||
const anchor = selectedId ? cy.$id(selectedId) : nodes.reduce((first, node) => {
|
||||
const point = node.position();
|
||||
const current = first.position();
|
||||
return point.x < current.x || (point.x === current.x && point.y < current.y) ? node : first;
|
||||
}, nodes[0]);
|
||||
const { x, y } = anchor.position();
|
||||
const margin = 24;
|
||||
return {
|
||||
zoom: READABLE_ZOOM,
|
||||
pan: selectedId
|
||||
? { x: width / 2 - x * READABLE_ZOOM, y: height / 2 - y * READABLE_ZOOM }
|
||||
: { x: margin - (x - CARD_WIDTH / 2) * READABLE_ZOOM, y: margin - (y - CARD_HEIGHT / 2) * READABLE_ZOOM },
|
||||
view: 'reading'
|
||||
};
|
||||
}
|
||||
|
||||
function previewPosition(cy, node) {
|
||||
const { x, y } = node.renderedPosition();
|
||||
const width = Math.min(PREVIEW_WIDTH, cy.width() - 24);
|
||||
const left = Math.max(12, Math.min(x - width / 2, cy.width() - width - 12));
|
||||
const offset = node.renderedHeight() / 2 + 9;
|
||||
const maxInset = Math.max(8, cy.height() - 164);
|
||||
const clampInset = value => Math.max(8, Math.min(value, maxInset));
|
||||
return {
|
||||
width, left,
|
||||
...(y <= cy.height() / 2
|
||||
? { top: clampInset(y + offset) }
|
||||
: { bottom: clampInset(cy.height() - y + offset) })
|
||||
};
|
||||
}
|
||||
|
||||
const STYLE = [
|
||||
{
|
||||
selector: 'node',
|
||||
|
|
@ -87,13 +142,16 @@ function graphElements(nodes, edges, selectedId) {
|
|||
};
|
||||
}
|
||||
|
||||
export default function FactGraphCanvas({ nodes, edges, selectedId, onSelect, chartRef, label, errorText, typeLabel }) {
|
||||
export default function FactGraphCanvas({ nodes, edges, selectedId, onSelect, chartRef, label, errorText, typeLabel, onFitChange }) {
|
||||
const canvas = useRef(null);
|
||||
const nodeLayer = useRef(null);
|
||||
const [cards, setCards] = useState([]);
|
||||
const [preview, setPreview] = useState(null);
|
||||
const [failed, setFailed] = useState(false);
|
||||
const nodeMap = useMemo(() => new Map(nodes.map(node => [node.id, node])), [nodes]);
|
||||
|
||||
const inspectCard = (id, visible) => chartRef.current?.inspect(id, visible);
|
||||
|
||||
useEffect(() => {
|
||||
const container = canvas.current;
|
||||
const layer = nodeLayer.current;
|
||||
|
|
@ -102,9 +160,10 @@ export default function FactGraphCanvas({ nodes, edges, selectedId, onSelect, ch
|
|||
let resize;
|
||||
let frame;
|
||||
let unbindWheel;
|
||||
let fitted = true;
|
||||
let fittedMode = 'reading';
|
||||
let fitting = false;
|
||||
setCards([]);
|
||||
setPreview(null);
|
||||
setFailed(false);
|
||||
|
||||
import('cytoscape').then(({ default: cytoscape }) => {
|
||||
|
|
@ -128,20 +187,40 @@ export default function FactGraphCanvas({ nodes, edges, selectedId, onSelect, ch
|
|||
setCards(visible.map(card => ({ ...card, ports: ports.get(card.id) })));
|
||||
});
|
||||
};
|
||||
const fit = () => {
|
||||
const fit = (mode = 'reading') => {
|
||||
const viewport = fittedViewport(cy, selectedId, mode);
|
||||
if (!viewport) return;
|
||||
fitting = true;
|
||||
fitted = true;
|
||||
cy.fit(cy.elements(), Math.min(56, cy.width() / 8));
|
||||
if (cy.zoom() > 1) cy.zoom(1).center();
|
||||
fittedMode = mode;
|
||||
setPreview(null);
|
||||
cy.viewport({ zoom: viewport.zoom, pan: viewport.pan });
|
||||
onFitChange(viewport.view);
|
||||
fitting = false;
|
||||
place();
|
||||
};
|
||||
chartRef.current = { fit, zoom: factor => zoomGraph(cy, factor) };
|
||||
const inspect = (id, visible) => {
|
||||
const node = cy.$id(id);
|
||||
if (visible && node.nonempty()) {
|
||||
setPreview({ id, box: previewPosition(cy, node) });
|
||||
} else if (!visible) {
|
||||
setPreview(previous => previous?.id === id ? null : previous);
|
||||
}
|
||||
};
|
||||
chartRef.current = {
|
||||
fit: () => fit(),
|
||||
overview: () => fit('overview'),
|
||||
zoom: factor => zoomGraph(cy, factor),
|
||||
inspect
|
||||
};
|
||||
unbindWheel = bindGraphCardWheel(layer, cy);
|
||||
cy.on('viewport', () => {
|
||||
if (!fitting) fitted = false;
|
||||
if (!fitting) fittedMode = null;
|
||||
setPreview(null);
|
||||
place();
|
||||
});
|
||||
cy.on('zoom', () => { if (!fitting) onFitChange('manual'); });
|
||||
cy.on('mouseover', 'node', event => inspect(event.target.id(), true));
|
||||
cy.on('mouseout', 'node', event => inspect(event.target.id(), false));
|
||||
cy.on('tap', 'node', event => onSelect(event.target.id()));
|
||||
|
||||
let width = cy.width();
|
||||
|
|
@ -151,7 +230,7 @@ export default function FactGraphCanvas({ nodes, edges, selectedId, onSelect, ch
|
|||
const nextWidth = cy.width();
|
||||
const nextHeight = cy.height();
|
||||
if (width === nextWidth && height === nextHeight) return;
|
||||
if (fitted) fit();
|
||||
if (fittedMode) fit(fittedMode);
|
||||
else cy.panBy({ x: (nextWidth - width) / 2, y: (nextHeight - height) / 2 });
|
||||
width = nextWidth;
|
||||
height = nextHeight;
|
||||
|
|
@ -168,8 +247,10 @@ export default function FactGraphCanvas({ nodes, edges, selectedId, onSelect, ch
|
|||
cy?.destroy();
|
||||
chartRef.current = null;
|
||||
};
|
||||
}, [nodes, edges, selectedId, onSelect, chartRef]);
|
||||
}, [nodes, edges, selectedId, onSelect, chartRef, onFitChange]);
|
||||
|
||||
const previewNode = preview && nodeMap.get(preview.id);
|
||||
const previewText = previewNode && nodeText(previewNode);
|
||||
return (
|
||||
<div className="project-graph-canvas-wrap" role="group" aria-label={label}>
|
||||
<div ref={canvas} className="project-graph-canvas" />
|
||||
|
|
@ -177,8 +258,7 @@ export default function FactGraphCanvas({ nodes, edges, selectedId, onSelect, ch
|
|||
{cards.map(card => {
|
||||
const node = nodeMap.get(card.id);
|
||||
if (!node) return null;
|
||||
const key = node.fact_key || node.id;
|
||||
const title = (node.summary || (node.label !== '—' && node.label) || key).replace(/\s+/g, ' ').trim() || key;
|
||||
const { key, title } = nodeText(node);
|
||||
return (
|
||||
<GraphNodeCard
|
||||
card={card}
|
||||
|
|
@ -192,10 +272,25 @@ export default function FactGraphCanvas({ nodes, edges, selectedId, onSelect, ch
|
|||
ports={card.ports}
|
||||
selected={node.id === selectedId}
|
||||
onSelect={onSelect}
|
||||
onPreview={inspectCard}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
{previewNode && (
|
||||
<div
|
||||
className="project-graph-node-preview"
|
||||
role="tooltip"
|
||||
style={{ ...preview.box, '--graph-node-color': NODE_COLORS[previewNode.type] || NODE_COLORS.missing }}
|
||||
>
|
||||
<span className="project-graph-preview-type">
|
||||
<GraphNodeIcon type={previewNode.type} />
|
||||
{typeLabel(previewNode.type || 'note')}
|
||||
</span>
|
||||
<strong dir="auto">{previewText.title}</strong>
|
||||
<code dir="auto">{previewText.key}</code>
|
||||
</div>
|
||||
)}
|
||||
{failed && <div className="project-graph-overlay" role="alert">{errorText}</div>}
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ export default function FactGraphPanel({
|
|||
const [hideDeprecated, setHideDeprecated] = useState(true);
|
||||
const [selectedId, setSelectedId] = useState('');
|
||||
const [showEdges, setShowEdges] = useState(false);
|
||||
const [fitView, setFitView] = useState('fitted');
|
||||
const chartRef = useRef(null);
|
||||
const sideRef = useRef(null);
|
||||
const scope = `${view}:${hideDeprecated}`;
|
||||
|
|
@ -158,6 +159,10 @@ export default function FactGraphPanel({
|
|||
);
|
||||
|
||||
const graphLabel = t('projects.tabGraph', null, '攻击路径');
|
||||
const viewHint = {
|
||||
reading: t('projects.graphReadingHint', null, '已保留可读字号,拖动画布浏览其他节点。'),
|
||||
overview: t('projects.graphFullOverviewHint', null, '悬停预览节点摘要,点选查看详情。')
|
||||
}[fitView];
|
||||
const factSelected = selected && selected.type !== 'missing' && !selected.id.startsWith('vuln:');
|
||||
return (
|
||||
<SectionCard
|
||||
|
|
@ -211,9 +216,10 @@ export default function FactGraphPanel({
|
|||
{t('projects.graphFocus', { stats: stats(shownNodes.length, shownEdges.length) }, `聚焦直接关系 · ${stats(shownNodes.length, shownEdges.length)}`)}
|
||||
</Text>
|
||||
</>
|
||||
) : (
|
||||
) : null}
|
||||
{(!selected || viewHint) && (
|
||||
<Text type="tertiary" size="small">
|
||||
{t('projects.graphOverviewHint', null, '点选节点查看直接关系,放大可查看卡片摘要。')}
|
||||
{viewHint || t('projects.graphOverviewHint', null, '点选节点查看直接关系和摘要。')}
|
||||
</Text>
|
||||
)}
|
||||
</div>
|
||||
|
|
@ -226,6 +232,7 @@ export default function FactGraphPanel({
|
|||
onSelect={openNode}
|
||||
chartRef={chartRef}
|
||||
typeLabel={typeLabel}
|
||||
onFitChange={setFitView}
|
||||
label={t('projects.graphCanvas', null, '攻击路径画布')}
|
||||
errorText={t('projects.graphRenderError', null, '图谱加载失败,请刷新重试。')}
|
||||
/>
|
||||
|
|
@ -241,10 +248,23 @@ export default function FactGraphPanel({
|
|||
<span><i className="project-graph-legend-dash" aria-hidden="true" />{t('projects.graphTentativeEdge', null, '待确认关系')}</span>
|
||||
)}
|
||||
</div>
|
||||
<Space spacing={4}>
|
||||
<Space spacing={4} wrap>
|
||||
<Button size="small" icon={<IconMinus />} aria-label={t('projects.graphZoomOut', null, '缩小')} onClick={() => chartRef.current?.zoom(1 / 1.3)} />
|
||||
<Button size="small" icon={<IconPlus />} aria-label={t('projects.graphZoomIn', null, '放大')} onClick={() => chartRef.current?.zoom(1.3)} />
|
||||
<Button size="small" onClick={() => chartRef.current?.fit()}>{t('projects.graphFit', null, '适合画布')}</Button>
|
||||
<Button
|
||||
size="small"
|
||||
aria-pressed={fitView === 'fitted' || fitView === 'reading'}
|
||||
onClick={() => chartRef.current?.fit()}
|
||||
>
|
||||
{t('projects.graphFit', null, '适合画布')}
|
||||
</Button>
|
||||
<Button
|
||||
size="small"
|
||||
aria-pressed={fitView === 'overview'}
|
||||
onClick={() => chartRef.current?.overview()}
|
||||
>
|
||||
{t('projects.graphFullOverview', null, '全图总览')}
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -216,11 +216,49 @@
|
|||
color-mix(in srgb, var(--semi-color-bg-1) 96%, #537cba);
|
||||
overflow: hidden;
|
||||
}
|
||||
.project-graph-canvas { width: 100%; height: 100%; }
|
||||
.project-graph-canvas { width: 100%; height: 100%; cursor: grab; }
|
||||
.project-graph-canvas:active { cursor: grabbing; }
|
||||
.project-graph-overlay { position: absolute; inset: 0; }
|
||||
.project-graph-overlay, .project-graph-loading { display: grid; place-items: center; }
|
||||
.project-graph-overlay { padding: 16px; color: var(--semi-color-danger); background: var(--semi-color-bg-1); }
|
||||
.project-graph-loading { min-height: 180px; }
|
||||
.project-graph-node-preview {
|
||||
position: absolute;
|
||||
box-sizing: border-box;
|
||||
z-index: 2;
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid var(--semi-color-border);
|
||||
border-radius: 8px;
|
||||
background: var(--semi-color-bg-1);
|
||||
box-shadow: 0 6px 20px rgba(20, 31, 53, .17);
|
||||
color: var(--semi-color-text-0);
|
||||
pointer-events: none;
|
||||
}
|
||||
.project-graph-preview-type {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
color: var(--semi-color-text-1);
|
||||
font-size: 12px;
|
||||
}
|
||||
.project-graph-node-preview strong {
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 5;
|
||||
overflow: hidden;
|
||||
overflow-wrap: anywhere;
|
||||
font-size: 14px;
|
||||
line-height: 1.45;
|
||||
}
|
||||
.project-graph-node-preview code {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
color: var(--semi-color-text-2);
|
||||
font-size: 12px;
|
||||
}
|
||||
.project-graph-footer {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
|
@ -229,6 +267,10 @@
|
|||
gap: 8px 12px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.project-graph-footer .semi-button[aria-pressed="true"] {
|
||||
background: var(--semi-color-primary-light-default);
|
||||
color: var(--semi-color-primary);
|
||||
}
|
||||
.project-graph-legend {
|
||||
display: flex;
|
||||
flex: 1 1 200px;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ function denseGraph() {
|
|||
return { nodes: [...targets, ...infra, ...findings, ...chains, ...vulns], edges };
|
||||
}
|
||||
|
||||
test('project graph: dense overview keeps labels legible and search follows the stored connections', async ({ page, mockApi }, testInfo) => {
|
||||
test('project graph: readable fit, full overview previews and search work with a dense graph', async ({ page, mockApi }, testInfo) => {
|
||||
const graph = denseGraph();
|
||||
const selected = graph.nodes.find(node => node.id === 'finding/sample-0');
|
||||
const detail = { ...selected, body: '匿名事实正文,用于验证详情入口。' };
|
||||
|
|
@ -43,21 +43,56 @@ test('project graph: dense overview keeps labels legible and search follows the
|
|||
await expect(main.getByText('节点: 127 | 边: 141', { exact: true })).toBeVisible();
|
||||
|
||||
const reads = mockApi.calls('GET', graphPath).length;
|
||||
const fit = main.getByRole('button', { name: '适合画布' });
|
||||
const summaryCard = canvas.locator('.graph-node--detail').filter({ hasText: /^发现/ }).first();
|
||||
await expect(fit).toHaveAttribute('aria-pressed', 'true');
|
||||
await expect(summaryCard.locator('.graph-node-title')).toHaveCSS('font-size', '15px');
|
||||
|
||||
const overview = main.getByRole('button', { name: '全图总览', exact: true });
|
||||
await overview.click();
|
||||
await expect(overview).toHaveAttribute('aria-pressed', 'true');
|
||||
await expect(canvas.locator('.graph-node--compact').first()).toBeVisible();
|
||||
const boxes = await labels.evaluateAll(items => items.map(item => {
|
||||
const { left, top, right, bottom } = item.getBoundingClientRect();
|
||||
return { left, top, right, bottom, fontSize: getComputedStyle(item).fontSize };
|
||||
}));
|
||||
expect(boxes.length).toBeGreaterThan(4);
|
||||
expect(boxes.length).toBeLessThanOrEqual(graph.nodes.length);
|
||||
await expect(canvas.locator('.graph-node--compact').first()).toBeVisible();
|
||||
for (const [index, box] of boxes.entries()) {
|
||||
expect(box.fontSize).toBe('14px');
|
||||
for (const other of boxes.slice(index + 1)) {
|
||||
expect(box.left < other.right && box.right > other.left && box.top < other.bottom && box.bottom > other.top).toBe(false);
|
||||
}
|
||||
}
|
||||
await expect(canvas.getByRole('button', { name: selected.label, exact: true })).toHaveCount(0);
|
||||
await canvas.scrollIntoViewIfNeeded();
|
||||
const point = await canvas.locator('.project-graph-canvas').evaluate((element, id) => {
|
||||
const { x, y } = element._cyreg.cy.$id(id).renderedPosition();
|
||||
const bounds = element.getBoundingClientRect();
|
||||
return { x: bounds.left + x, y: bounds.top + y };
|
||||
}, selected.id);
|
||||
await page.mouse.move(point.x, point.y);
|
||||
const preview = canvas.getByRole('tooltip');
|
||||
await expect(preview.getByText(selected.label, { exact: true })).toBeVisible();
|
||||
await expect(preview.getByText(selected.fact_key, { exact: true })).toBeVisible();
|
||||
await main.locator('.project-graph-card').screenshot({ path: testInfo.outputPath('project-graph-overview.png') });
|
||||
|
||||
await fit.click();
|
||||
await expect(fit).toHaveAttribute('aria-pressed', 'true');
|
||||
await expect(preview).toHaveCount(0);
|
||||
await expect(summaryCard.locator('.graph-node-title')).toHaveCSS('font-size', '15px');
|
||||
await main.locator('.project-graph-card').screenshot({ path: testInfo.outputPath('project-graph-readable-fit.png') });
|
||||
|
||||
await canvas.scrollIntoViewIfNeeded();
|
||||
const anchor = canvas.getByRole('button', { name: '示例入口 1', exact: true });
|
||||
const beforeDrag = await anchor.boundingBox();
|
||||
const bounds = await canvas.boundingBox();
|
||||
await page.mouse.move(bounds.x + 12, bounds.y + 12);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(bounds.x + 72, bounds.y + 28, { steps: 4 });
|
||||
await page.mouse.up();
|
||||
await expect.poll(async () => (await anchor.boundingBox()).x).toBeGreaterThan(beforeDrag.x + 30);
|
||||
|
||||
const search = main.getByRole('textbox', { name: '搜索节点' });
|
||||
await search.fill('不匹配的节点');
|
||||
await expect(main.getByText('未找到匹配节点')).toBeVisible();
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n}from"./react-QV7DAAIx.js";import{Et as r,F as i,H as a,L as o,M as s,W as c,i as l,kt as u,lt as d,ot as f,st as p}from"./semi-CYW2cRsN.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-D7Qi_vNu.js";var k=e(t(),1),A=e(n(),1),{Text:j}=c;function M(){let e=g(),{hasPermission:t}=m(),n=t(`agents:write`),c=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)(o,{icon:(0,A.jsx)(p,{}),onClick:()=>B.reload(),loading:B.loading,children:`刷新`}),n&&(0,A.jsx)(o,{theme:`solid`,type:`primary`,icon:(0,A.jsx)(d,{}),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)(s,{size:`small`,color:`purple`,children:`编排器`})]}),(0,A.jsx)(j,{type:`tertiary`,children:t.filename})]})},{title:`类型`,dataIndex:`kind`,width:110,render:e=>(0,A.jsx)(s,{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)(o,{size:`small`,theme:`borderless`,onClick:()=>H(t),children:`详情`}),n&&(0,A.jsx)(o,{size:`small`,theme:`borderless`,icon:(0,A.jsx)(r,{}),onClick:()=>L({record:t,form:{}})}),c&&(0,A.jsx)(o,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,A.jsx)(u,{}),onClick:()=>W(t)})]})}],dataSource:V,rowKey:`filename`,loading:B.loading,pagination:{pageSize:20},toolbar:(0,A.jsx)(a,{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)(l,{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)(l.Input,{field:`filename`,label:`文件名(留空自动生成)`,placeholder:`例如 recon.md`}),(0,A.jsx)(l.Input,{field:`name`,label:`名称`,rules:[{required:!0,message:`请输入名称`}]}),(0,A.jsx)(l.Input,{field:`description`,label:`描述`}),(0,A.jsx)(l.Select,{field:`kind`,label:`类型`,optionList:[{value:`sub`,label:`子智能体`},{value:`orchestrator`,label:`编排器`},{value:`plan_execute`,label:`计划执行`}]}),(0,A.jsx)(l.Input,{field:`tools`,label:`工具(逗号分隔)`,placeholder:`toolName, mcp::tool`}),(0,A.jsx)(l.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{Et as r,F as i,H as a,L as o,M as s,W as c,i as l,kt as u,lt as d,ot as f,st as p}from"./semi-CYW2cRsN.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-DqPdLFno.js";var k=e(t(),1),A=e(n(),1),{Text:j}=c;function M(){let e=g(),{hasPermission:t}=m(),n=t(`agents:write`),c=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)(o,{icon:(0,A.jsx)(p,{}),onClick:()=>B.reload(),loading:B.loading,children:`刷新`}),n&&(0,A.jsx)(o,{theme:`solid`,type:`primary`,icon:(0,A.jsx)(d,{}),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)(s,{size:`small`,color:`purple`,children:`编排器`})]}),(0,A.jsx)(j,{type:`tertiary`,children:t.filename})]})},{title:`类型`,dataIndex:`kind`,width:110,render:e=>(0,A.jsx)(s,{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)(o,{size:`small`,theme:`borderless`,onClick:()=>H(t),children:`详情`}),n&&(0,A.jsx)(o,{size:`small`,theme:`borderless`,icon:(0,A.jsx)(r,{}),onClick:()=>L({record:t,form:{}})}),c&&(0,A.jsx)(o,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,A.jsx)(u,{}),onClick:()=>W(t)})]})}],dataSource:V,rowKey:`filename`,loading:B.loading,pagination:{pageSize:20},toolbar:(0,A.jsx)(a,{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)(l,{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)(l.Input,{field:`filename`,label:`文件名(留空自动生成)`,placeholder:`例如 recon.md`}),(0,A.jsx)(l.Input,{field:`name`,label:`名称`,rules:[{required:!0,message:`请输入名称`}]}),(0,A.jsx)(l.Input,{field:`description`,label:`描述`}),(0,A.jsx)(l.Select,{field:`kind`,label:`类型`,optionList:[{value:`sub`,label:`子智能体`},{value:`orchestrator`,label:`编排器`},{value:`plan_execute`,label:`计划执行`}]}),(0,A.jsx)(l.Input,{field:`tools`,label:`工具(逗号分隔)`,placeholder:`toolName, mcp::tool`}),(0,A.jsx)(l.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
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
|
|
@ -1 +1 @@
|
|||
import{I as e,L as t}from"./index-D7Qi_vNu.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{I as e,L as t}from"./index-DqPdLFno.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};
|
||||
|
|
@ -1 +1 @@
|
|||
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{F as t,L as n,W as r}from"./semi-CYW2cRsN.js";import{E as i,P as a,k as o}from"./index-D7Qi_vNu.js";import"./c2-shared-BcckGOHm.js";import{t as s}from"./react-QV7DAAIx.js";var c=e(s(),1),{Text:l}=r,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:r,ns:i=`tasks`}){let o=a();return(0,c.jsxs)(t,{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(t=>(0,c.jsx)(n,{size:`small`,theme:t.value===e?`solid`:`borderless`,type:t.value===e?`primary`:`tertiary`,onClick:()=>r(t.value),children:o(`c2.${i}.preset${t.value===`all`?`All`:t.value}`,null,t.label)},t.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{F as t,L as n,W as r}from"./semi-CYW2cRsN.js";import{E as i,P as a,k as o}from"./index-DqPdLFno.js";import"./c2-shared-DF4Z5kmu.js";import{t as s}from"./react-QV7DAAIx.js";var c=e(s(),1),{Text:l}=r,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:r,ns:i=`tasks`}){let o=a();return(0,c.jsxs)(t,{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(t=>(0,c.jsx)(n,{size:`small`,theme:t.value===e?`solid`:`borderless`,type:t.value===e?`primary`:`tertiary`,onClick:()=>r(t.value),children:o(`c2.${i}.preset${t.value===`all`?`All`:t.value}`,null,t.label)},t.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};
|
||||
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
|
|
@ -1 +0,0 @@
|
|||
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{t}from"./react-QV7DAAIx.js";import{Ct as n,Ut as r,Vt as i,X as a,Yt as o,_t as s,bt as c,ht as l,it as u,ot as d,wt as f,xt as p}from"./semi-CYW2cRsN.js";var m=e(t(),1),h={target:p,infra:u,auth:s,finding:d,chain:i,exploit:r,poc:a,vulnerability:o,missing:c,goal:n,step:i,fact:f,receipt:a,observation:d,memory:l,digest:f,guidance:r};function g({type:e}){let t=h[e]||f;return(0,m.jsx)(`span`,{className:`graph-node-icon`,"aria-hidden":`true`,children:(0,m.jsx)(t,{size:`small`})})}function _({id:e,title:t,type:n,category:r,color:i,factKey:a,boundary:o,ports:s=[],selected:c,card:l,onSelect:u}){let{density:d,box:f}=l,p=d===`detail`,h=Math.min(Math.max(f.width/216,1),1.6);return(0,m.jsxs)(`button`,{type:`button`,className:`graph-node graph-node--${d}`,title:t,"aria-label":t,"aria-pressed":c,"data-root":n===`goal`||n===`target`||void 0,"data-boundary":o||void 0,"data-wrap":d===`standard`&&f.height>=50||void 0,style:{...f,"--graph-node-color":i,"--graph-node-text-scale":h},onClick:()=>u(e),children:[(0,m.jsxs)(`span`,{className:`graph-node-content`,children:[d!==`compact`&&(0,m.jsxs)(`span`,{className:`graph-node-kind`,children:[(0,m.jsx)(g,{type:n}),(0,m.jsx)(`span`,{children:r})]}),(0,m.jsx)(`span`,{className:`graph-node-title`,dir:`auto`,children:t}),p&&f.height>=84&&a&&t!==a&&(0,m.jsx)(`span`,{className:`graph-node-keyline`,dir:`auto`,children:a})]}),p&&[...s].map(e=>(0,m.jsx)(`span`,{className:`graph-node-port is-${e}`,"aria-hidden":`true`},e))]})}function v(e,{anchorId:t,allowCompact:n=()=>!0}={}){let r=e.width(),i=e.height(),a=216*e.zoom(),o=98*e.zoom(),s=o>=68?`detail`:o>=36?`standard`:`compact`,c=[];for(let l of e.nodes(`:visible`)){let e=l.id();if(l.hasClass(`dim`)||s===`compact`&&e!==t&&(a<49||!n(l)))continue;let{x:u,y:d}=l.renderedPosition(),f=u-a/2,p=d-o/2;if(f+a<=0||f>=r||p+o<=0||p>=i)continue;let m={left:f,top:p,width:a,height:o};e===t&&a<49&&(m={left:Math.max(3,f),top:d-13,width:Math.min(108,r-Math.max(3,f)),height:26}),c.push({id:e,density:s,box:m})}return c}function y(e,t,n={x:e.width()/2,y:e.height()/2}){e.zoom({level:e.zoom()*t,renderedPosition:n})}function b(e,t){let n=n=>{if(!n.deltaY)return;n.preventDefault();let{left:r,top:i,height:a}=e.getBoundingClientRect(),o=n.deltaMode===1?33:n.deltaMode===2?a:1;y(t,10**(-n.deltaY*o/1250),{x:n.clientX-r,y:n.clientY-i})};return e.addEventListener(`wheel`,n,{passive:!1}),()=>e.removeEventListener(`wheel`,n)}function x(e,t){let n=new Map,r=new Set;for(let i of e){if(t(i.target)||n.has(i.target))continue;let e=i.source;for(;e&&e!==i.target;)e=n.get(e);e!==i.target&&(n.set(i.target,i.source),r.add(i))}return{parents:n,parentEdges:r}}export{v as a,b as i,_ as n,y as o,g as r,x as t};
|
||||
|
|
@ -0,0 +1 @@
|
|||
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{t}from"./react-QV7DAAIx.js";import{Ct as n,Ut as r,Vt as i,X as a,Yt as o,_t as s,bt as c,ht as l,it as u,ot as d,wt as f,xt as p}from"./semi-CYW2cRsN.js";var m=e(t(),1),h={target:p,infra:u,auth:s,finding:d,chain:i,exploit:r,poc:a,vulnerability:o,missing:c,goal:n,step:i,fact:f,receipt:a,observation:d,memory:l,digest:f,guidance:r};function g({type:e}){let t=h[e]||f;return(0,m.jsx)(`span`,{className:`graph-node-icon`,"aria-hidden":`true`,children:(0,m.jsx)(t,{size:`small`})})}function _({id:e,title:t,type:n,category:r,color:i,factKey:a,boundary:o,ports:s=[],selected:c,card:l,onSelect:u,onPreview:d}){let{density:f,box:p}=l,h=f===`detail`,_=Math.min(Math.max(p.width/216,1),1.6);return(0,m.jsxs)(`button`,{type:`button`,className:`graph-node graph-node--${f}`,title:t,"aria-label":t,"aria-pressed":c,"data-root":n===`goal`||n===`target`||void 0,"data-boundary":o||void 0,"data-wrap":f===`standard`&&p.height>=50||void 0,style:{...p,"--graph-node-color":i,"--graph-node-text-scale":_},onClick:()=>u(e),onMouseEnter:()=>d?.(e,!0),onMouseLeave:()=>d?.(e,!1),onFocus:()=>d?.(e,!0),onBlur:()=>d?.(e,!1),children:[(0,m.jsxs)(`span`,{className:`graph-node-content`,children:[f!==`compact`&&(0,m.jsxs)(`span`,{className:`graph-node-kind`,children:[(0,m.jsx)(g,{type:n}),(0,m.jsx)(`span`,{children:r})]}),(0,m.jsx)(`span`,{className:`graph-node-title`,dir:`auto`,children:t}),h&&p.height>=84&&a&&t!==a&&(0,m.jsx)(`span`,{className:`graph-node-keyline`,dir:`auto`,children:a})]}),h&&[...s].map(e=>(0,m.jsx)(`span`,{className:`graph-node-port is-${e}`,"aria-hidden":`true`},e))]})}function v(e,{anchorId:t,allowCompact:n=()=>!0}={}){let r=e.width(),i=e.height(),a=216*e.zoom(),o=98*e.zoom(),s=o>=68?`detail`:o>=36?`standard`:`compact`,c=[];for(let l of e.nodes(`:visible`)){let e=l.id();if(l.hasClass(`dim`)||s===`compact`&&e!==t&&(a<49||!n(l)))continue;let{x:u,y:d}=l.renderedPosition(),f=u-a/2,p=d-o/2;if(f+a<=0||f>=r||p+o<=0||p>=i)continue;let m={left:f,top:p,width:a,height:o};e===t&&a<49&&(m={left:Math.max(3,f),top:d-13,width:Math.min(108,r-Math.max(3,f)),height:26}),c.push({id:e,density:s,box:m})}return c}function y(e,t,n={x:e.width()/2,y:e.height()/2}){e.zoom({level:e.zoom()*t,renderedPosition:n})}function b(e,t){let n=n=>{if(!n.deltaY)return;n.preventDefault();let{left:r,top:i,height:a}=e.getBoundingClientRect(),o=n.deltaMode===1?33:n.deltaMode===2?a:1;y(t,10**(-n.deltaY*o/1250),{x:n.clientX-r,y:n.clientY-i})};return e.addEventListener(`wheel`,n,{passive:!1}),()=>e.removeEventListener(`wheel`,n)}function x(e,t){let n=new Map,r=new Set;for(let i of e){if(t(i.target)||n.has(i.target))continue;let e=i.source;for(;e&&e!==i.target;)e=n.get(e);e!==i.target&&(n.set(i.target,i.source),r.add(i))}return{parents:n,parentEdges:r}}export{v as a,b as i,_ as n,y as o,g as r,x as t};
|
||||
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
|
|
@ -1 +1 @@
|
|||
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n}from"./react-QV7DAAIx.js";import{F as r,H as i,L as a,M as o,W as s,kt as c,ot as l,st as u}from"./semi-CYW2cRsN.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-D7Qi_vNu.js";var T=e(t(),1),E=e(n(),1),{Text:D}=s;function O(){let e=m(),{hasPermission:t}=f(),n=t(`knowledge:delete`),[s,O]=(0,T.useState)(``),[k,A]=(0,T.useState)(50),[j,M]=(0,T.useState)(null),N=h(()=>p.get(`/knowledge/retrieval-logs`,{conversationId:s||void 0,limit:k}),[s,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)(a,{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)(r,{children:[(0,E.jsx)(a,{size:`small`,theme:`borderless`,onClick:()=>M(t),children:`详情`}),n&&(0,E.jsx)(a,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,E.jsx)(c,{}),onClick:()=>F(t)})]})}],dataSource:P,rowKey:`id`,loading:N.loading,pagination:!1,toolbar:(0,E.jsxs)(r,{children:[(0,E.jsx)(i,{prefix:(0,E.jsx)(l,{}),placeholder:`按会话 ID 过滤`,value:s,onChange:O,style:{width:260}}),(0,E.jsx)(i,{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{F as r,H as i,L as a,M as o,W as s,kt as c,ot as l,st as u}from"./semi-CYW2cRsN.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-DqPdLFno.js";var T=e(t(),1),E=e(n(),1),{Text:D}=s;function O(){let e=m(),{hasPermission:t}=f(),n=t(`knowledge:delete`),[s,O]=(0,T.useState)(``),[k,A]=(0,T.useState)(50),[j,M]=(0,T.useState)(null),N=h(()=>p.get(`/knowledge/retrieval-logs`,{conversationId:s||void 0,limit:k}),[s,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)(a,{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)(r,{children:[(0,E.jsx)(a,{size:`small`,theme:`borderless`,onClick:()=>M(t),children:`详情`}),n&&(0,E.jsx)(a,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,E.jsx)(c,{}),onClick:()=>F(t)})]})}],dataSource:P,rowKey:`id`,loading:N.loading,pagination:!1,toolbar:(0,E.jsxs)(r,{children:[(0,E.jsx)(i,{prefix:(0,E.jsx)(l,{}),placeholder:`按会话 ID 过滤`,value:s,onChange:O,style:{width:260}}),(0,E.jsx)(i,{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
|
|
@ -1 +1 @@
|
|||
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n}from"./react-QV7DAAIx.js";import{W as r,i}from"./semi-CYW2cRsN.js";import{I as a,P as o,c as s,l as c,x as l}from"./index-D7Qi_vNu.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{W as r,i}from"./semi-CYW2cRsN.js";import{I as a,P as o,c as s,l as c,x as l}from"./index-DqPdLFno.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};
|
||||
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
|
|
@ -1 +1 @@
|
|||
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n}from"./react-QV7DAAIx.js";import{Et as r,F as i,H as a,L as o,M as s,W as c,i as l,kt as u,lt as d,ot as f,st as p}from"./semi-CYW2cRsN.js";import{F as m,I as h,P as g,a as _,b as v,c as y,l as b,m as x,p as S,s as C,x as w,y as T}from"./index-D7Qi_vNu.js";var E=e(t(),1),D=e(n(),1),{Text:O}=c;function k(){let e=g(),{hasPermission:t}=m(),n=t(`roles:write`),c=t(`roles:delete`),[k,A]=(0,E.useState)(``),[j,M]=(0,E.useState)(null),[N,P]=(0,E.useState)(!1),F=_(()=>h.get(`/roles`),[]),I=(Array.isArray(F.data?.roles)?F.data.roles:[]).filter(e=>{if(!k)return!0;let t=k.toLowerCase();return[e.name,e.description].some(e=>String(e||``).toLowerCase().includes(t))}),L=async()=>{let e=await j.form.validate();P(!0);try{let t={name:e.name.trim(),description:e.description?.trim()||``,user_prompt:e.user_prompt||``,tools:String(e.tools||``).split(`,`).map(e=>e.trim()).filter(Boolean),enabled:e.enabled!==!1},n=j.role?.name;n&&n!==t.name?(await h.post(`/roles`,t),await h.del(`/roles/${encodeURIComponent(n)}`)):n?await h.put(`/roles/${encodeURIComponent(n)}`,t):await h.post(`/roles`,t),w(`角色已保存`),M(null),F.reload()}catch(e){v(e,`保存角色失败`)}finally{P(!1)}},R=e=>T({title:`删除角色「${e.name}」?`,content:`已绑定该角色的对话将失去对应提示词与工具配置。`,onOk:async()=>{await h.del(`/roles/${encodeURIComponent(e.name)}`),w(`已删除`),F.reload()}});return(0,D.jsxs)(`div`,{children:[(0,D.jsx)(S,{title:e(`roles.title`,null,`角色管理`),description:`角色定义对话的系统提示词、可用工具与绑定工作流。`,extra:(0,D.jsxs)(i,{children:[(0,D.jsx)(o,{icon:(0,D.jsx)(p,{}),onClick:()=>F.reload(),loading:F.loading,children:`刷新`}),n&&(0,D.jsx)(o,{theme:`solid`,type:`primary`,icon:(0,D.jsx)(d,{}),onClick:()=>M({role:null,form:{}}),children:`新建角色`})]})}),(0,D.jsxs)(x,{title:`角色(${I.length})`,children:[(0,D.jsx)(b,{error:F.error,onRetry:()=>F.reload()}),(0,D.jsx)(C,{columns:[{title:`角色`,dataIndex:`name`,render:(e,t)=>(0,D.jsxs)(i,{vertical:!0,spacing:0,align:`start`,children:[(0,D.jsxs)(i,{children:[(0,D.jsx)(O,{strong:!0,children:e}),t.enabled===!1&&(0,D.jsx)(s,{size:`small`,color:`grey`,children:`已停用`})]}),(0,D.jsx)(O,{type:`tertiary`,ellipsis:{showTooltip:!0},style:{maxWidth:460},children:t.description||`—`})]})},{title:`工具`,dataIndex:`tools`,width:260,render:e=>Array.isArray(e)&&e.length?(0,D.jsxs)(i,{wrap:!0,spacing:4,children:[e.slice(0,4).map(e=>(0,D.jsx)(s,{size:`small`,children:e},e)),e.length>4&&(0,D.jsxs)(O,{type:`tertiary`,children:[`+`,e.length-4]})]}):(0,D.jsx)(O,{type:`tertiary`,children:`未绑定`})},{title:`工作流`,dataIndex:`workflow_id`,width:160,render:e=>e||`—`},{title:`操作`,width:150,render:(e,t)=>(0,D.jsxs)(i,{children:[n&&(0,D.jsx)(o,{size:`small`,theme:`borderless`,icon:(0,D.jsx)(r,{}),onClick:()=>M({role:t,form:{}}),children:`编辑`}),c&&(0,D.jsx)(o,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,D.jsx)(u,{}),onClick:()=>R(t)})]})}],dataSource:I,rowKey:`name`,loading:F.loading,pagination:{pageSize:20},toolbar:(0,D.jsx)(a,{prefix:(0,D.jsx)(f,{}),value:k,onChange:A,placeholder:`搜索角色名称`,style:{width:260}})})]}),(0,D.jsx)(y,{title:j?.role?`编辑角色`:`新建角色`,visible:!!j,onCancel:()=>M(null),onOk:L,confirmLoading:N,width:760,children:(0,D.jsxs)(l,{getFormApi:e=>M(t=>t&&{...t,form:e}),initValues:j?.role?{name:j.role.name,description:j.role.description,user_prompt:j.role.user_prompt,tools:Array.isArray(j.role.tools)?j.role.tools.join(`, `):``,enabled:j.role.enabled!==!1}:{enabled:!0},children:[(0,D.jsx)(l.Input,{field:`name`,label:`角色名称`,rules:[{required:!0,message:`请输入角色名称`}]}),(0,D.jsx)(l.Input,{field:`description`,label:`描述`}),(0,D.jsx)(l.Input,{field:`tools`,label:`工具(逗号分隔)`,placeholder:`toolName, mcp::toolName`}),(0,D.jsx)(l.TextArea,{field:`user_prompt`,label:`用户提示词(追加到用户消息前)`,autosize:{minRows:6,maxRows:18}}),(0,D.jsx)(l.Slot,{label:`启用`,children:(0,D.jsx)(l.Switch,{field:`enabled`})})]})},j?.role?.name||`new-role`)]})}export{k as default};
|
||||
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,t as n}from"./react-QV7DAAIx.js";import{Et as r,F as i,H as a,L as o,M as s,W as c,i as l,kt as u,lt as d,ot as f,st as p}from"./semi-CYW2cRsN.js";import{F as m,I as h,P as g,a as _,b as v,c as y,l as b,m as x,p as S,s as C,x as w,y as T}from"./index-DqPdLFno.js";var E=e(t(),1),D=e(n(),1),{Text:O}=c;function k(){let e=g(),{hasPermission:t}=m(),n=t(`roles:write`),c=t(`roles:delete`),[k,A]=(0,E.useState)(``),[j,M]=(0,E.useState)(null),[N,P]=(0,E.useState)(!1),F=_(()=>h.get(`/roles`),[]),I=(Array.isArray(F.data?.roles)?F.data.roles:[]).filter(e=>{if(!k)return!0;let t=k.toLowerCase();return[e.name,e.description].some(e=>String(e||``).toLowerCase().includes(t))}),L=async()=>{let e=await j.form.validate();P(!0);try{let t={name:e.name.trim(),description:e.description?.trim()||``,user_prompt:e.user_prompt||``,tools:String(e.tools||``).split(`,`).map(e=>e.trim()).filter(Boolean),enabled:e.enabled!==!1},n=j.role?.name;n&&n!==t.name?(await h.post(`/roles`,t),await h.del(`/roles/${encodeURIComponent(n)}`)):n?await h.put(`/roles/${encodeURIComponent(n)}`,t):await h.post(`/roles`,t),w(`角色已保存`),M(null),F.reload()}catch(e){v(e,`保存角色失败`)}finally{P(!1)}},R=e=>T({title:`删除角色「${e.name}」?`,content:`已绑定该角色的对话将失去对应提示词与工具配置。`,onOk:async()=>{await h.del(`/roles/${encodeURIComponent(e.name)}`),w(`已删除`),F.reload()}});return(0,D.jsxs)(`div`,{children:[(0,D.jsx)(S,{title:e(`roles.title`,null,`角色管理`),description:`角色定义对话的系统提示词、可用工具与绑定工作流。`,extra:(0,D.jsxs)(i,{children:[(0,D.jsx)(o,{icon:(0,D.jsx)(p,{}),onClick:()=>F.reload(),loading:F.loading,children:`刷新`}),n&&(0,D.jsx)(o,{theme:`solid`,type:`primary`,icon:(0,D.jsx)(d,{}),onClick:()=>M({role:null,form:{}}),children:`新建角色`})]})}),(0,D.jsxs)(x,{title:`角色(${I.length})`,children:[(0,D.jsx)(b,{error:F.error,onRetry:()=>F.reload()}),(0,D.jsx)(C,{columns:[{title:`角色`,dataIndex:`name`,render:(e,t)=>(0,D.jsxs)(i,{vertical:!0,spacing:0,align:`start`,children:[(0,D.jsxs)(i,{children:[(0,D.jsx)(O,{strong:!0,children:e}),t.enabled===!1&&(0,D.jsx)(s,{size:`small`,color:`grey`,children:`已停用`})]}),(0,D.jsx)(O,{type:`tertiary`,ellipsis:{showTooltip:!0},style:{maxWidth:460},children:t.description||`—`})]})},{title:`工具`,dataIndex:`tools`,width:260,render:e=>Array.isArray(e)&&e.length?(0,D.jsxs)(i,{wrap:!0,spacing:4,children:[e.slice(0,4).map(e=>(0,D.jsx)(s,{size:`small`,children:e},e)),e.length>4&&(0,D.jsxs)(O,{type:`tertiary`,children:[`+`,e.length-4]})]}):(0,D.jsx)(O,{type:`tertiary`,children:`未绑定`})},{title:`工作流`,dataIndex:`workflow_id`,width:160,render:e=>e||`—`},{title:`操作`,width:150,render:(e,t)=>(0,D.jsxs)(i,{children:[n&&(0,D.jsx)(o,{size:`small`,theme:`borderless`,icon:(0,D.jsx)(r,{}),onClick:()=>M({role:t,form:{}}),children:`编辑`}),c&&(0,D.jsx)(o,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,D.jsx)(u,{}),onClick:()=>R(t)})]})}],dataSource:I,rowKey:`name`,loading:F.loading,pagination:{pageSize:20},toolbar:(0,D.jsx)(a,{prefix:(0,D.jsx)(f,{}),value:k,onChange:A,placeholder:`搜索角色名称`,style:{width:260}})})]}),(0,D.jsx)(y,{title:j?.role?`编辑角色`:`新建角色`,visible:!!j,onCancel:()=>M(null),onOk:L,confirmLoading:N,width:760,children:(0,D.jsxs)(l,{getFormApi:e=>M(t=>t&&{...t,form:e}),initValues:j?.role?{name:j.role.name,description:j.role.description,user_prompt:j.role.user_prompt,tools:Array.isArray(j.role.tools)?j.role.tools.join(`, `):``,enabled:j.role.enabled!==!1}:{enabled:!0},children:[(0,D.jsx)(l.Input,{field:`name`,label:`角色名称`,rules:[{required:!0,message:`请输入角色名称`}]}),(0,D.jsx)(l.Input,{field:`description`,label:`描述`}),(0,D.jsx)(l.Input,{field:`tools`,label:`工具(逗号分隔)`,placeholder:`toolName, mcp::toolName`}),(0,D.jsx)(l.TextArea,{field:`user_prompt`,label:`用户提示词(追加到用户消息前)`,autosize:{minRows:6,maxRows:18}}),(0,D.jsx)(l.Slot,{label:`启用`,children:(0,D.jsx)(l.Switch,{field:`enabled`})})]})},j?.role?.name||`new-role`)]})}export{k as default};
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,_ as n,t as r,y as i}from"./react-QV7DAAIx.js";import{A as a,Dt as o,F as s,H as c,I as l,L as u,M as d,O as f,W as p,Z as m,Zt as h,c as g,f as _,h as ee,m as v,ot as y,p as b,s as x,st as te,u as S,v as C,x as w,z as T}from"./semi-CYW2cRsN.js";import{A as E,D,E as O,F as k,I as A,L as j,M,N,P,R as F,S as I,T as L,_ as ne,a as R,b as z,d as B,j as re,l as V,m as H,n as ie,o as U,p as W,s as ae,u as G,x as oe,y as se}from"./index-D7Qi_vNu.js";import{n as ce,r as le,t as K}from"./model-channel-mQ6lfvSO.js";var q=e(t(),1),J=class extends Error{constructor(e,t){super(t?`第 ${t} 行:${e}`:e),this.name=`YamlError`,this.line=t||0}},ue=/^(?:[-?:,\[\]{}#&*!|>'"%@`]|.*[:\s]$|.*\s#|.*[\n\r\t])/,de=/^(?:true|false|null|~|yes|no|on|off|[-+]?(?:\d+|\d*\.\d+)(?:[eE][-+]?\d+)?)$/i;function Y(e){let t=String(e);return!(t===``||de.test(t)||/^[-+]?(?:\d+\.\d*|\.\d+|\d+)(?:[eE][-+]?\d+)?$/.test(t)||ue.test(t)||/^(?:\s)|:(?:\s|$)|[\r\n\t]/.test(t)||/[,[\]{}]/.test(t)||/^[!&*|>@`]/.test(t))}function fe(e){return JSON.stringify(String(e))}function pe(e){let t=String(e);return Y(t)?t:fe(t)}function me(e){if(e==null)return`null`;if(typeof e==`boolean`)return e?`true`:`false`;if(typeof e==`number`)return Number.isFinite(e)?String(e):fe(String(e));let t=String(e);return Y(t)?t:fe(t)}function he(e){return e==null||[`string`,`number`,`boolean`].includes(typeof e)}function ge(e,t,n,r){let i=` `.repeat(n),a=pe(e);if(he(t))r.push(`${i}${a}: ${me(t)}`);else if(Array.isArray(t)){if(!t.length){r.push(`${i}${a}: []`);return}r.push(`${i}${a}:`),ye(t,n+2,r)}else Object.entries(t).length?(r.push(`${i}${a}:`),_e(t,n+2,r)):r.push(`${i}${a}: {}`)}function _e(e,t,n){for(let[r,i]of Object.entries(e))ge(r,i,t,n)}function ve(e,t,n){let r=` `.repeat(t);if(he(e)){n.push(`${r}- ${me(e)}`);return}if(Array.isArray(e)){if(!e.length){n.push(`${r}- []`);return}n.push(`${r}-`),ye(e,t+2,n);return}let i=Object.entries(e);if(!i.length){n.push(`${r}- {}`);return}let[a,o]=i[0],s=i.slice(1);he(o)?n.push(`${r}- ${pe(a)}: ${me(o)}`):(n.push(`${r}-`),ge(a,o,t+2,n));for(let[e,r]of s)ge(e,r,t+2,n)}function ye(e,t,n){for(let r of e)ve(r,t,n)}function be(e,{header:t}={}){let n=[];if(t){for(let e of String(t).replace(/\r\n?/g,`
|
||||
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{S as t,_ as n,t as r,y as i}from"./react-QV7DAAIx.js";import{A as a,Dt as o,F as s,H as c,I as l,L as u,M as d,O as f,W as p,Z as m,Zt as h,c as g,f as _,h as ee,m as v,ot as y,p as b,s as x,st as te,u as S,v as C,x as w,z as T}from"./semi-CYW2cRsN.js";import{A as E,D,E as O,F as k,I as A,L as j,M,N,P,R as F,S as I,T as L,_ as ne,a as R,b as z,d as B,j as re,l as V,m as H,n as ie,o as U,p as W,s as ae,u as G,x as oe,y as se}from"./index-DqPdLFno.js";import{n as ce,r as le,t as K}from"./model-channel-mQ6lfvSO.js";var q=e(t(),1),J=class extends Error{constructor(e,t){super(t?`第 ${t} 行:${e}`:e),this.name=`YamlError`,this.line=t||0}},ue=/^(?:[-?:,\[\]{}#&*!|>'"%@`]|.*[:\s]$|.*\s#|.*[\n\r\t])/,de=/^(?:true|false|null|~|yes|no|on|off|[-+]?(?:\d+|\d*\.\d+)(?:[eE][-+]?\d+)?)$/i;function Y(e){let t=String(e);return!(t===``||de.test(t)||/^[-+]?(?:\d+\.\d*|\.\d+|\d+)(?:[eE][-+]?\d+)?$/.test(t)||ue.test(t)||/^(?:\s)|:(?:\s|$)|[\r\n\t]/.test(t)||/[,[\]{}]/.test(t)||/^[!&*|>@`]/.test(t))}function fe(e){return JSON.stringify(String(e))}function pe(e){let t=String(e);return Y(t)?t:fe(t)}function me(e){if(e==null)return`null`;if(typeof e==`boolean`)return e?`true`:`false`;if(typeof e==`number`)return Number.isFinite(e)?String(e):fe(String(e));let t=String(e);return Y(t)?t:fe(t)}function he(e){return e==null||[`string`,`number`,`boolean`].includes(typeof e)}function ge(e,t,n,r){let i=` `.repeat(n),a=pe(e);if(he(t))r.push(`${i}${a}: ${me(t)}`);else if(Array.isArray(t)){if(!t.length){r.push(`${i}${a}: []`);return}r.push(`${i}${a}:`),ye(t,n+2,r)}else Object.entries(t).length?(r.push(`${i}${a}:`),_e(t,n+2,r)):r.push(`${i}${a}: {}`)}function _e(e,t,n){for(let[r,i]of Object.entries(e))ge(r,i,t,n)}function ve(e,t,n){let r=` `.repeat(t);if(he(e)){n.push(`${r}- ${me(e)}`);return}if(Array.isArray(e)){if(!e.length){n.push(`${r}- []`);return}n.push(`${r}-`),ye(e,t+2,n);return}let i=Object.entries(e);if(!i.length){n.push(`${r}- {}`);return}let[a,o]=i[0],s=i.slice(1);he(o)?n.push(`${r}- ${pe(a)}: ${me(o)}`):(n.push(`${r}-`),ge(a,o,t+2,n));for(let[e,r]of s)ge(e,r,t+2,n)}function ye(e,t,n){for(let r of e)ve(r,t,n)}function be(e,{header:t}={}){let n=[];if(t){for(let e of String(t).replace(/\r\n?/g,`
|
||||
`).split(`
|
||||
`))n.push(`# ${e}`.trimEnd());n.length&&n.push(``)}return he(e)?(n.push(me(e)),`${n.join(`
|
||||
`)}\n`):Array.isArray(e)?(e.length?ye(e,0,n):n.push(`[]`),`${n.join(`
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -1 +1 @@
|
|||
import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{F as t,L as n,W as r,kt as i,st as a}from"./semi-CYW2cRsN.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-D7Qi_vNu.js";import{t as y}from"./react-QV7DAAIx.js";var b=e(y(),1),{Text:x}=r;function S(){let e=u(),{hasPermission:r}=s(),y=r(`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)(t,{children:[(0,b.jsx)(n,{icon:(0,b.jsx)(a,{}),onClick:()=>S.reload(),loading:S.loading,children:`刷新`}),y&&(0,b.jsx)(n,{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)(n,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,b.jsx)(i,{}),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{F as t,L as n,W as r,kt as i,st as a}from"./semi-CYW2cRsN.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-DqPdLFno.js";import{t as y}from"./react-QV7DAAIx.js";var b=e(y(),1),{Text:x}=r;function S(){let e=u(),{hasPermission:r}=s(),y=r(`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)(t,{children:[(0,b.jsx)(n,{icon:(0,b.jsx)(a,{}),onClick:()=>S.reload(),loading:S.loading,children:`刷新`}),y&&(0,b.jsx)(n,{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)(n,{size:`small`,theme:`borderless`,type:`danger`,icon:(0,b.jsx)(i,{}),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
File diff suppressed because one or more lines are too long
|
|
@ -18,7 +18,7 @@
|
|||
} catch (error) { /* first paint fallback */ }
|
||||
})();
|
||||
</script>
|
||||
<script type="module" crossorigin src="/static/app/assets/index-D7Qi_vNu.js"></script>
|
||||
<script type="module" crossorigin src="/static/app/assets/index-DqPdLFno.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-CYW2cRsN.js">
|
||||
|
|
|
|||
|
|
@ -513,7 +513,10 @@
|
|||
"graphNoMatches": "لا توجد عُقد مطابقة",
|
||||
"graphBackToOverview": "العودة إلى النظرة العامة",
|
||||
"graphFocus": "العلاقات المباشرة · {{stats}}",
|
||||
"graphOverviewHint": "اختر عقدة لعرض علاقاتها. كبّر الرسم لقراءة ملخصات البطاقات.",
|
||||
"graphOverviewHint": "اختر عقدة للاطلاع على ملخصها وعلاقاتها.",
|
||||
"graphFullOverview": "عرض الرسم بالكامل",
|
||||
"graphReadingHint": "حُفظ حجم النص للقراءة. اسحب اللوحة لتصفح المزيد من العُقد.",
|
||||
"graphFullOverviewHint": "مرّر المؤشر لمعاينة ملخص العقدة، وانقر لعرض التفاصيل.",
|
||||
"graphCanvas": "لوحة مسار الهجوم",
|
||||
"graphRenderError": "تعذّر تحميل الرسم. حدّث الصفحة للمحاولة مجددًا.",
|
||||
"graphTentativeEdge": "علاقة مبدئية",
|
||||
|
|
|
|||
|
|
@ -514,7 +514,10 @@
|
|||
"graphNoMatches": "No matching nodes",
|
||||
"graphBackToOverview": "Back to overview",
|
||||
"graphFocus": "Direct connections · {{stats}}",
|
||||
"graphOverviewHint": "Select a node to see its connections. Zoom in to read the card summaries.",
|
||||
"graphOverviewHint": "Select a node to see its summary and connections.",
|
||||
"graphFullOverview": "Full overview",
|
||||
"graphReadingHint": "Text stays readable. Drag the canvas to browse more nodes.",
|
||||
"graphFullOverviewHint": "Hover to preview a node. Select it to see its details.",
|
||||
"graphCanvas": "Attack path canvas",
|
||||
"graphRenderError": "Could not load the graph. Refresh to retry.",
|
||||
"graphTentativeEdge": "Tentative link",
|
||||
|
|
|
|||
|
|
@ -526,7 +526,10 @@
|
|||
"graphNoMatches": "Подходящие узлы не найдены",
|
||||
"graphBackToOverview": "К общему виду",
|
||||
"graphFocus": "Прямые связи · {{stats}}",
|
||||
"graphOverviewHint": "Выберите узел, чтобы увидеть его связи. Увеличьте масштаб, чтобы прочитать описания в карточках.",
|
||||
"graphOverviewHint": "Выберите узел, чтобы увидеть его описание и связи.",
|
||||
"graphFullOverview": "Общий вид",
|
||||
"graphReadingHint": "Размер текста сохранён. Перетащите холст, чтобы увидеть другие узлы.",
|
||||
"graphFullOverviewHint": "Наведите указатель для просмотра краткого описания, нажмите для подробностей.",
|
||||
"graphCanvas": "Граф путей атаки",
|
||||
"graphRenderError": "Не удалось загрузить граф. Обновите страницу.",
|
||||
"graphTentativeEdge": "Предварительная связь",
|
||||
|
|
|
|||
|
|
@ -502,7 +502,10 @@
|
|||
"graphNoMatches": "未找到匹配节点",
|
||||
"graphBackToOverview": "返回全图",
|
||||
"graphFocus": "聚焦直接关系 · {{stats}}",
|
||||
"graphOverviewHint": "点选节点查看直接关系,放大可查看卡片摘要。",
|
||||
"graphOverviewHint": "点选节点查看直接关系和摘要。",
|
||||
"graphFullOverview": "全图总览",
|
||||
"graphReadingHint": "已保留可读字号,拖动画布浏览其他节点。",
|
||||
"graphFullOverviewHint": "悬停预览节点摘要,点选查看详情。",
|
||||
"graphCanvas": "攻击路径画布",
|
||||
"graphRenderError": "图谱加载失败,请刷新重试。",
|
||||
"graphTentativeEdge": "待确认关系",
|
||||
|
|
|
|||
Loading…
Reference in New Issue