优化: 工具调用标识类型安全加固

This commit is contained in:
lxy
2026-08-10 08:04:30 +08:00
parent 5a1b7a871a
commit 256af4e736
5 changed files with 86 additions and 11 deletions
+4 -2
View File
@@ -1,7 +1,7 @@
//! 数据模型定义 — 与数据库表对应的 Rust 结构体
use df_ai_core::model::{deserialize_model_configs, ModelConfig};
use df_types::types::{IdeaStatus, LinkType, NodeType, ProjectStatus, TaskStatus};
use df_types::types::{IdeaStatus, LinkType, NodeType, ProjectStatus, TaskStatus, ToolCallId};
use serde::{Deserialize, Serialize};
// ============================================================
@@ -383,7 +383,9 @@ pub struct AiToolExecutionRecord {
/// 升级后,audit 写入从 ContextManager 取当前 assistant 消息 id 填入。
#[serde(default, skip_serializing_if = "Option::is_none")]
pub message_id: Option<String>,
pub tool_call_id: String,
/// 工具调用关联键(跨 tool_calls / pending_approvals / ai_tool_executions)。
/// branded newtype 防把 execution_id / conversation_id 等同形 String 误传。
pub tool_call_id: ToolCallId,
pub tool_name: String,
pub arguments: String,
pub result: Option<String>,