Compare commits

..

No commits in common. "389e222b11f78adc9dc2cb82d93354d7b68a1469" and "f8e1f3c2eb4431957784ac6209a473918545ebef" have entirely different histories.

8 changed files with 17 additions and 16 deletions

View File

@ -642,6 +642,17 @@ fn chat_message_to_llm_message(m: &ChatMessage, image_budget: &mut ImageInlineBu
}
}
fn chat_message_to_text_only_llm_message(m: &ChatMessage) -> Message {
Message {
role: m.role.clone(),
content: vec![ContentBlock::text(&m.content)],
reasoning_content: m.reasoning_content.clone(),
tool_call_id: m.tool_call_id.clone(),
name: m.tool_name.clone(),
tool_calls: m.tool_calls.clone(),
}
}
/// AgentLoop - Stateless agent that processes messages with tool calling support.
/// History is managed externally by SessionManager.
pub struct AgentLoop {

View File

@ -556,7 +556,7 @@ impl InitWizard {
let agent = AgentConfig {
provider: selected_provider.clone(),
model: selected_model.clone(),
max_tool_iterations: 1000,
max_tool_iterations: 100,
tool_result_max_chars: 100_000,
context_tool_result_trim_chars: 2000,
};

View File

@ -479,7 +479,7 @@ pub struct AgentConfig {
}
fn default_max_tool_iterations() -> usize {
1000
100
}
fn default_tool_result_max_chars() -> usize {
@ -1456,7 +1456,7 @@ mod tests {
}
#[test]
fn test_agent_config_defaults_max_tool_iterations_to_1000() {
fn test_agent_config_defaults_max_tool_iterations_to_100() {
let file = tempfile::NamedTempFile::new().unwrap();
std::fs::write(
file.path(),
@ -1485,7 +1485,7 @@ mod tests {
.unwrap();
let config = Config::load(file.path().to_str().unwrap()).unwrap();
assert_eq!(config.agents["default"].max_tool_iterations, 1000);
assert_eq!(config.agents["default"].max_tool_iterations, 100);
assert_eq!(config.agents["default"].tool_result_max_chars, 100_000);
assert_eq!(
config.agents["default"].context_tool_result_trim_chars,

View File

@ -1,6 +0,0 @@
<!-- # 自定义 Agent 配置 -->
<!--
在此处添加你的自定义指令。
此文件的内容将注入到 agent 的 system prompt 中。
支持 Markdown 语法。
-->

View File

@ -512,8 +512,7 @@ impl Session {
.unwrap_or(false)
}
#[cfg(test)]
fn matches_current_user_turn(&self, topic_id: &str, message: &ChatMessage) -> bool {
pub(crate) fn matches_current_user_turn(&self, topic_id: &str, message: &ChatMessage) -> bool {
self.history.matches_current_user_turn(topic_id, message)
}

View File

@ -220,7 +220,6 @@ impl SessionHistory {
.and_then(|history| history.iter().rev().find(|message| message.role == "user"))
}
#[cfg(test)]
pub(crate) fn matches_current_user_turn(&self, topic_id: &str, message: &ChatMessage) -> bool {
self.latest_user_message(topic_id)
.map(|current| {

View File

@ -3,7 +3,6 @@ use futures_util::StreamExt;
use reqwest::Client;
use serde::Deserialize;
use serde_json::{Value, json};
use std::collections::BTreeMap;
use std::collections::HashMap;
use std::time::Duration;
@ -26,7 +25,7 @@ struct StreamingToolCall {
struct StreamingAccumulator {
content: String,
reasoning_content: Option<String>,
tool_calls: BTreeMap<usize, StreamingToolCall>,
tool_calls: HashMap<usize, StreamingToolCall>,
response_id: String,
}

View File

@ -1232,7 +1232,6 @@ mod tests {
SkillSource::Project,
SkillSource::ProjectAgent,
SkillSource::ProjectOpenclaw,
SkillSource::Custom("unknown".to_string()),
]
);
}