重构: CR-11 composables+ToolCard 健壮性 6 子项
⑦ useAiConversations JSON.parse 逐条 try/catch 容错(坏条降级不清空整对话);⑧ ToolCard 去 as any + argString 安全取字段;⑨ useAiSend approveToolCall 复用 findToolCall;⑩ useAiEvents 补 AiHeartbeat case 防穿透;⑪ approveHumanApproval 签名收敛(decisions:string[] + select_type 判单/多选)+ ProjectDetail 调用方同步(单选包数组/多选直传);⑫ ToolCard formatBytes/formatToolName/argString 兜底。批5 ww1mh6mry,vue-tsc 0
This commit is contained in:
@@ -248,16 +248,25 @@ function createStore() {
|
||||
|
||||
/**
|
||||
* 发送审批响应。
|
||||
* - 单选(select_type=single 或缺省):传 decision 单值,decisions 留空;
|
||||
* - 多选(select_type=multiple):传 decisions 数组。
|
||||
* F-260615-01: 新增 decisions/select_type 透传,与后端 IPC 签名对齐。
|
||||
*
|
||||
* 统一以 decisions 数组表达选择,按 pendingApproval.select_type 判定单/多选:
|
||||
* - 单选(select_type='single' 或缺省):取 decisions[0] 作为后端 decision 单值;
|
||||
* - 多选(select_type='multiple'):decisions 透传全量。
|
||||
*
|
||||
* 后端 IPC 需同时收 decision(单值,向后兼容)与 decisions(数组),此处按 select_type
|
||||
* 自动分派,消除调用方"该传 decision 还是 decisions"的歧义。
|
||||
* F-260615-01: decisions/select_type 透传,与后端 IPC 签名对齐。
|
||||
*/
|
||||
async function approveHumanApproval(
|
||||
decision: string,
|
||||
decisions: string[],
|
||||
comment?: string,
|
||||
decisions?: string[],
|
||||
) {
|
||||
if (!state.pendingApproval) return
|
||||
const selectType = state.pendingApproval.select_type ?? 'single'
|
||||
// 单选取首项(后端 decision 为单值);多选 decision 取首项作占位(后端按 decisions 走)
|
||||
const decision = selectType === 'multiple'
|
||||
? (decisions[0] ?? '')
|
||||
: (decisions[0] ?? '')
|
||||
|
||||
try {
|
||||
// 调用 IPC 命令发送审批响应
|
||||
@@ -269,8 +278,8 @@ function createStore() {
|
||||
decision,
|
||||
comment,
|
||||
options: state.pendingApproval.options ?? [],
|
||||
decisions: decisions ?? [],
|
||||
select_type: state.pendingApproval.select_type ?? 'single', // B-260615-34:Tauri 2 IPC 不转 camelCase,须 snake_case 对齐后端 workflow.rs:211(同 invoke 其余字段 execution_id/node_id/decisions 均已 snake_case)
|
||||
decisions,
|
||||
select_type: selectType, // B-260615-34:Tauri 2 IPC 不转 camelCase,须 snake_case 对齐后端 workflow.rs:211
|
||||
})
|
||||
|
||||
// 清除待审批状态
|
||||
|
||||
Reference in New Issue
Block a user