clean code
This commit is contained in:
@@ -192,10 +192,9 @@ pub async fn editor_agent_message(
|
||||
.tool(GenerateCharacterTool {
|
||||
context: tool_context.clone(),
|
||||
})
|
||||
// TODO icons gen's result query is not prepared for now.
|
||||
// .tool(GenerateIconSpritesheetTool {
|
||||
// context: tool_context.clone(),
|
||||
// })
|
||||
.tool(GenerateIconSpritesheetTool {
|
||||
context: tool_context.clone(),
|
||||
})
|
||||
.tool(GenerateSoundEffectTool)
|
||||
.tool(GenerateBackgroundMusicTool)
|
||||
.tool(GenerateVideoTool {
|
||||
@@ -798,7 +797,7 @@ pub async fn confirm_editor_agent_tool_call(
|
||||
let title = args.prompt.clone();
|
||||
let payload = EditorSoundEffectGenerateRequest {
|
||||
prompt: args.prompt,
|
||||
model: args.model,
|
||||
model: None,
|
||||
duration: args.duration.unwrap_or(3),
|
||||
project_id: Some(conversation.project_id.clone()),
|
||||
canvas_completion: Some(build_editor_agent_canvas_completion(
|
||||
|
||||
@@ -178,7 +178,6 @@ pub fn build_tool_call_display_args(
|
||||
duration.to_string(),
|
||||
);
|
||||
}
|
||||
push_optional_string_display_arg(&mut display_args, "model", "模型", args.model);
|
||||
price_mud_points
|
||||
}
|
||||
GenerateBackgroundMusicTool::NAME => {
|
||||
|
||||
@@ -20,21 +20,6 @@ use platform_editor_agent::agent::tools::generate_ui_design::GenerateUiDesignToo
|
||||
use platform_editor_agent::agent::tools::generate_video::{GenerateVideoTool, GenerateVideoToolArgs};
|
||||
use crate::editor_generation_config::{load_editor_generation_pricing_from_paths, EditorGenerationPricingConfig};
|
||||
|
||||
fn context() -> EditorToolContext {
|
||||
EditorToolContext {
|
||||
images: HashMap::new(),
|
||||
}
|
||||
}
|
||||
|
||||
fn image_args(image_size: Option<&str>) -> GenerateImageToolArgs {
|
||||
GenerateImageToolArgs {
|
||||
prompt: "生成图片".to_string(),
|
||||
reference_image_ids: Vec::new(),
|
||||
aspect_ratio: Some("1:1".to_string()),
|
||||
image_size: image_size.map(ToOwned::to_owned),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_editor_agent_tool_exposes_argument_based_pricing() {
|
||||
let pricing = load_editor_generation_pricing_from_paths(None)
|
||||
@@ -232,13 +217,7 @@ impl EditorAgentPricedTool for GenerateSoundEffectTool {
|
||||
pricing: &EditorGenerationPricingConfig,
|
||||
args: &GenerateSoundEffectToolArgs,
|
||||
) -> u32 {
|
||||
let model = args
|
||||
.model
|
||||
.as_deref()
|
||||
.map(str::trim)
|
||||
.filter(|value| !value.is_empty())
|
||||
.unwrap_or(Self::DEFAULT_MODEL);
|
||||
pricing.sound_effect_model_mud_points(Some(model))
|
||||
pricing.sound_effect_model_mud_points(None)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,7 +279,7 @@ impl EditorAgentPricedTool for GenerateBackgroundMusicTool {
|
||||
pricing: &EditorGenerationPricingConfig,
|
||||
_args: &GenerateBackgroundMusicToolArgs,
|
||||
) -> u32 {
|
||||
pricing.background_music_model_mud_points(Some(Self::DEFAULT_MODEL))
|
||||
pricing.background_music_model_mud_points(None)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,6 @@ impl Tool for GenerateBackgroundMusicTool {
|
||||
}
|
||||
|
||||
impl GenerateBackgroundMusicTool {
|
||||
pub const DEFAULT_MODEL: &'static str = "chirp-v5";
|
||||
|
||||
pub fn format_execute_message(
|
||||
&self,
|
||||
|
||||
@@ -25,8 +25,6 @@ pub struct GenerateSoundEffectToolArgs {
|
||||
pub prompt: String,
|
||||
#[serde(default)]
|
||||
pub duration: Option<u8>,
|
||||
#[serde(default)]
|
||||
pub model: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
@@ -50,7 +48,7 @@ impl Tool for GenerateSoundEffectTool {
|
||||
"properties": {
|
||||
"prompt": { "type": "string", "description": "音效内容、材质、节奏和情绪描述。" },
|
||||
"duration": { "type": "integer", "description": "可选时长(秒)。" },
|
||||
"model": { "type": "string", "description": "可选音效模型。" }
|
||||
// "model": { "type": "string", "description": "可选音效模型。" }
|
||||
},
|
||||
"required": ["prompt"],
|
||||
"additionalProperties": false
|
||||
@@ -77,7 +75,7 @@ impl Tool for GenerateSoundEffectTool {
|
||||
}
|
||||
|
||||
impl GenerateSoundEffectTool {
|
||||
pub const DEFAULT_MODEL: &'static str = "audio1.0";
|
||||
// pub const DEFAULT_MODEL: &'static str = "audio1.0";
|
||||
|
||||
pub fn format_execute_message(
|
||||
&self,
|
||||
|
||||
Reference in New Issue
Block a user