Compare commits

...

2 Commits

2 changed files with 24 additions and 3 deletions

View File

@ -128,12 +128,24 @@ impl OpenAIProvider {
let normalized = self.normalize_tool_arguments(arguments); let normalized = self.normalize_tool_arguments(arguments);
if self.uses_json_tool_arguments() { if self.uses_json_tool_arguments() {
// Model expects JSON object format
normalized normalized
} else { } else {
// Standard OpenAI format: arguments as JSON string
// But ensure we serialize valid JSON, not null
match normalized { match normalized {
Value::String(raw) => Value::String(raw), Value::String(raw) => {
// If the string is already valid JSON, keep it as-is
// Otherwise, ensure it's a proper JSON string
if serde_json::from_str::<Value>(raw).is_ok() {
Value::String(raw)
} else {
// Invalid JSON string - wrap it as a proper JSON string
serde_json::to_string(&raw).unwrap_or_else(|_| "null".to_string())
}
}
value => Value::String( value => Value::String(
serde_json::to_string(&value).unwrap_or_else(|_| "null".to_string()), serde_json::to_string(&value).unwrap_or_else(|_| "{}".to_string()),
), ),
} }
} }

View File

@ -31,7 +31,16 @@ impl Tool for SchedulerManageTool {
} }
fn description(&self) -> &str { fn description(&self) -> &str {
"Manage repository-backed scheduled jobs. Supports actions: list, get, put, delete, pause, resume. Jobs are persisted by the configured scheduler job repository and executed by the scheduler runtime. When creating agent_task or silent_agent_task jobs, keep prompt/system_prompt focused on the work to perform; do not restate execution times unless the task logic truly depends on them, because the trigger already controls timing. For cron schedules, standard cron syntax is supported: use 1-5 for Monday-Friday, 0 or 7 for Sunday." "Manage repository-backed scheduled jobs. Supports actions: list, get, put, delete, pause, resume. Jobs are persisted by the configured scheduler job repository and executed by the scheduler runtime. \
\
When creating agent_task or silent_agent_task jobs, keep prompt/system_prompt focused on the work to perform; do not restate execution times unless the task logic truly depends on them, because the trigger already controls timing. For cron schedules, standard cron syntax is supported: use 1-5 for Monday-Friday, 0 or 7 for Sunday. \
\
IMPORTANT - Target Configuration: \
For agent_task and silent_agent_task, the target.channel and target.chat_id determine where notifications are sent. \
- If target is omitted or fields are empty, they are automatically filled from the current conversation context. \
- To send to the current conversation: omit target or set target fields to null/empty. \
- To send to a specific target: explicitly provide channel (e.g., 'feishu', 'wechat', 'cli') and chat_id (e.g., 'oc_xxx'). \
- Do NOT use placeholder values like 'current' or 'default' - these will be treated as literal values and cause message delivery failures."
} }
fn parameters_schema(&self) -> serde_json::Value { fn parameters_schema(&self) -> serde_json::Value {