агенты: добавить поиск инструментов по каталогу
This commit is contained in:
@@ -2,7 +2,7 @@ use crank_core::{
|
||||
AgentId, AgentStatus, ApprovalRequestStatus, AuthConfig, AuthKind, ExecutionMode, ExportMode,
|
||||
GeneratedDraft, InvocationLevel, InvocationSource, InvocationStatus, OperationSecurityLevel,
|
||||
OperationStatus, PlatformApiKeyKind, PlatformApiKeyScope, Protocol, SecretKind, Target,
|
||||
UsagePeriod, WizardState, WorkspaceId, WorkspaceStatus,
|
||||
ToolSelectionPolicy, UsagePeriod, WizardState, WorkspaceId, WorkspaceStatus,
|
||||
};
|
||||
use crank_mapping::MappingSet;
|
||||
use crank_registry::{
|
||||
@@ -144,7 +144,7 @@ pub struct AgentPayload {
|
||||
#[serde(default)]
|
||||
pub instructions: Value,
|
||||
#[serde(default)]
|
||||
pub tool_selection_policy: Value,
|
||||
pub tool_selection_policy: ToolSelectionPolicy,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
@@ -165,6 +165,43 @@ pub struct AgentBindingPayload {
|
||||
pub enabled: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
pub struct ToolSearchPreviewPayload {
|
||||
pub query: String,
|
||||
#[serde(default)]
|
||||
pub group_ids: Vec<String>,
|
||||
pub bindings: Vec<AgentBindingPayload>,
|
||||
pub tool_selection_policy: ToolSelectionPolicy,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum AgentCatalogPayload {
|
||||
Bindings(Vec<AgentBindingPayload>),
|
||||
Config {
|
||||
bindings: Vec<AgentBindingPayload>,
|
||||
tool_selection_policy: ToolSelectionPolicy,
|
||||
},
|
||||
}
|
||||
|
||||
impl AgentCatalogPayload {
|
||||
pub fn into_parts(self) -> (Vec<AgentBindingPayload>, Option<ToolSelectionPolicy>) {
|
||||
match self {
|
||||
Self::Bindings(bindings) => (bindings, None),
|
||||
Self::Config {
|
||||
bindings,
|
||||
tool_selection_policy,
|
||||
} => (bindings, Some(tool_selection_policy)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Vec<AgentBindingPayload>> for AgentCatalogPayload {
|
||||
fn from(bindings: Vec<AgentBindingPayload>) -> Self {
|
||||
Self::Bindings(bindings)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize)]
|
||||
pub struct CreatedAgentResponse {
|
||||
pub agent_id: String,
|
||||
@@ -196,6 +233,7 @@ pub struct AgentSummaryView {
|
||||
pub published_at: Option<String>,
|
||||
pub operation_count: usize,
|
||||
pub operation_ids: Vec<String>,
|
||||
pub tool_selection_policy: ToolSelectionPolicy,
|
||||
pub key_count: usize,
|
||||
pub calls_today: u64,
|
||||
pub mcp_endpoint: String,
|
||||
|
||||
Reference in New Issue
Block a user