mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-04-28 03:30:06 +00:00
feat: Set Success Rate as - while waiting for execution (#1424)
Some checks are pending
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (python) (push) Waiting to run
Pre-commit / pre-commit (push) Waiting to run
Test / Run Python Tests (push) Waiting to run
Some checks are pending
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (python) (push) Waiting to run
Pre-commit / pre-commit (push) Waiting to run
Test / Run Python Tests (push) Waiting to run
Co-authored-by: Xiangyu Shi <sxyu.shi@gmail.com> Co-authored-by: bytecii <994513625@qq.com>
This commit is contained in:
parent
44764099f3
commit
008d428ba7
2 changed files with 16 additions and 4 deletions
|
|
@ -50,6 +50,10 @@ export interface TriggerExecutionData {
|
||||||
logs: ExecutionLogEntry[];
|
logs: ExecutionLogEntry[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Success rate thresholds for color coding (percentage)
|
||||||
|
const SUCCESS_CRITERIA_EXCELLENT = 90;
|
||||||
|
const SUCCESS_CRITERIA_ACCEPTABLE = 70;
|
||||||
|
|
||||||
// Helper function to map ExecutionStatus to display status
|
// Helper function to map ExecutionStatus to display status
|
||||||
const mapExecutionStatus = (
|
const mapExecutionStatus = (
|
||||||
status: ExecutionStatus
|
status: ExecutionStatus
|
||||||
|
|
@ -164,6 +168,13 @@ const getStatusColor = (status: ExecutionLogEntry['status']) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getSuccessRateColorClass = (rate: number | null): string => {
|
||||||
|
if (rate === null) return 'text-text-label';
|
||||||
|
if (rate >= SUCCESS_CRITERIA_EXCELLENT) return 'text-icon-success';
|
||||||
|
if (rate >= SUCCESS_CRITERIA_ACCEPTABLE) return 'text-icon-warning';
|
||||||
|
return 'text-icon-caution';
|
||||||
|
};
|
||||||
|
|
||||||
interface ExecutionLogsProps {
|
interface ExecutionLogsProps {
|
||||||
triggerId: number;
|
triggerId: number;
|
||||||
}
|
}
|
||||||
|
|
@ -275,12 +286,12 @@ export function ExecutionLogs({ triggerId }: ExecutionLogsProps) {
|
||||||
const successfulExecutions = Array.isArray(executions)
|
const successfulExecutions = Array.isArray(executions)
|
||||||
? executions.filter((e) => e.status === ExecutionStatus.Completed)
|
? executions.filter((e) => e.status === ExecutionStatus.Completed)
|
||||||
: [];
|
: [];
|
||||||
const successRate =
|
const successRate: number | null =
|
||||||
completedExecutions.length > 0
|
completedExecutions.length > 0
|
||||||
? Math.round(
|
? Math.round(
|
||||||
(successfulExecutions.length / completedExecutions.length) * 100
|
(successfulExecutions.length / completedExecutions.length) * 100
|
||||||
)
|
)
|
||||||
: 0;
|
: null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full flex-col">
|
<div className="flex h-full flex-col">
|
||||||
|
|
@ -314,9 +325,9 @@ export function ExecutionLogs({ triggerId }: ExecutionLogsProps) {
|
||||||
</div>
|
</div>
|
||||||
<div className="border-r-1 mr-4 flex flex-col border-y-0 border-l-0 border-solid border-border-tertiary pr-4">
|
<div className="border-r-1 mr-4 flex flex-col border-y-0 border-l-0 border-solid border-border-tertiary pr-4">
|
||||||
<span
|
<span
|
||||||
className={`text-label-sm font-medium ${successRate >= 90 ? 'text-icon-success' : successRate >= 70 ? 'text-icon-warning' : 'text-icon-cuation'}`}
|
className={`text-label-sm font-medium ${getSuccessRateColorClass(successRate)}`}
|
||||||
>
|
>
|
||||||
{successRate}%
|
{successRate !== null ? `${successRate}%` : '-'}
|
||||||
</span>
|
</span>
|
||||||
<span className="text-label-xs text-text-label">
|
<span className="text-label-xs text-text-label">
|
||||||
{t('triggers.success-rate')}
|
{t('triggers.success-rate')}
|
||||||
|
|
|
||||||
|
|
@ -528,6 +528,7 @@ module.exports = {
|
||||||
'icon-information': 'var(--icon-information)',
|
'icon-information': 'var(--icon-information)',
|
||||||
'icon-success': 'var(--icon-success)',
|
'icon-success': 'var(--icon-success)',
|
||||||
'icon-warning': 'var(--icon-warning)',
|
'icon-warning': 'var(--icon-warning)',
|
||||||
|
'icon-caution': 'var(--icon-cuation)',
|
||||||
'icon-cuation': 'var(--icon-cuation)',
|
'icon-cuation': 'var(--icon-cuation)',
|
||||||
'icon-action-hover': 'var(--icon-action-hover)',
|
'icon-action-hover': 'var(--icon-action-hover)',
|
||||||
'icon-multimodal': 'var(--icon-multimodal)',
|
'icon-multimodal': 'var(--icon-multimodal)',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue