feat: 新增技能编排引擎和工作流构建器组件
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
refactor: 统一Hands系统常量到单个源文件 refactor: 更新Hands中文名称和描述 fix: 修复技能市场在连接状态变化时重新加载 fix: 修复身份变更提案的错误处理逻辑 docs: 更新多个功能文档的验证状态和实现位置 docs: 更新Hands系统文档 test: 添加测试文件验证工作区路径
This commit is contained in:
@@ -30,6 +30,30 @@ import {
|
||||
import { useChatStore } from '../store/chatStore';
|
||||
import { Button, Badge } from './ui';
|
||||
|
||||
// === Error Parsing Utility ===
|
||||
|
||||
type ProposalOperation = 'approval' | 'rejection' | 'restore';
|
||||
|
||||
function parseProposalError(err: unknown, operation: ProposalOperation): string {
|
||||
const errorMessage = err instanceof Error ? err.message : String(err);
|
||||
|
||||
if (errorMessage.includes('not found') || errorMessage.includes('不存在')) {
|
||||
return '提案不存在或已被处理,请刷新页面';
|
||||
}
|
||||
if (errorMessage.includes('not pending') || errorMessage.includes('已处理')) {
|
||||
return '该提案已被处理,请刷新页面';
|
||||
}
|
||||
if (errorMessage.includes('network') || errorMessage.includes('fetch') || errorMessage.includes('网络')) {
|
||||
return '网络连接失败,请检查网络后重试';
|
||||
}
|
||||
if (errorMessage.includes('timeout') || errorMessage.includes('超时')) {
|
||||
return '操作超时,请重试';
|
||||
}
|
||||
|
||||
const operationName = operation === 'approval' ? '审批' : operation === 'rejection' ? '拒绝' : '恢复';
|
||||
return `${operationName}失败: ${errorMessage}`;
|
||||
}
|
||||
|
||||
// === Diff View Component ===
|
||||
|
||||
function DiffView({
|
||||
@@ -331,8 +355,7 @@ export function IdentityChangeProposalPanel() {
|
||||
setSnapshots(agentSnapshots);
|
||||
} catch (err) {
|
||||
console.error('[IdentityChangeProposal] Failed to approve:', err);
|
||||
const message = err instanceof Error ? err.message : '审批失败,请重试';
|
||||
setError(`审批失败: ${message}`);
|
||||
setError(parseProposalError(err, 'approval'));
|
||||
} finally {
|
||||
setProcessingId(null);
|
||||
}
|
||||
@@ -349,8 +372,7 @@ export function IdentityChangeProposalPanel() {
|
||||
setProposals(pendingProposals);
|
||||
} catch (err) {
|
||||
console.error('[IdentityChangeProposal] Failed to reject:', err);
|
||||
const message = err instanceof Error ? err.message : '拒绝失败,请重试';
|
||||
setError(`拒绝失败: ${message}`);
|
||||
setError(parseProposalError(err, 'rejection'));
|
||||
} finally {
|
||||
setProcessingId(null);
|
||||
}
|
||||
@@ -367,8 +389,7 @@ export function IdentityChangeProposalPanel() {
|
||||
setSnapshots(agentSnapshots);
|
||||
} catch (err) {
|
||||
console.error('[IdentityChangeProposal] Failed to restore:', err);
|
||||
const message = err instanceof Error ? err.message : '恢复失败,请重试';
|
||||
setError(`恢复失败: ${message}`);
|
||||
setError(parseProposalError(err, 'restore'));
|
||||
} finally {
|
||||
setProcessingId(null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user