fixup previous
This commit is contained in:
@@ -56,16 +56,16 @@ pub struct ClaudeConfig {
|
|||||||
pub struct CompactionConfig {
|
pub struct CompactionConfig {
|
||||||
/// Path to file containing the compaction prompt.
|
/// Path to file containing the compaction prompt.
|
||||||
#[conf(long, env)]
|
#[conf(long, env)]
|
||||||
pub compaction_prompt_file: PathBuf,
|
pub prompt_file: PathBuf,
|
||||||
/// Model to use for compaction (typically a faster/cheaper model).
|
/// Model to use for compaction (typically a faster/cheaper model).
|
||||||
#[conf(long, env, default_value = "claude-sonnet-4-5-20250929")]
|
#[conf(long, env, default_value = "claude-sonnet-4-5-20250929")]
|
||||||
pub compaction_model: String,
|
pub model: String,
|
||||||
/// Maximum tokens for the compaction response.
|
/// Maximum tokens for the compaction response.
|
||||||
#[conf(long, env, default_value = "2048")]
|
#[conf(long, env, default_value = "2048")]
|
||||||
pub compaction_max_tokens: u32,
|
pub max_tokens: u32,
|
||||||
/// Trigger compaction when message buffer exceeds this many characters.
|
/// Trigger compaction when message buffer exceeds this many characters.
|
||||||
#[conf(long, env, default_value = "50000")]
|
#[conf(long, env, default_value = "50000")]
|
||||||
pub compaction_trigger_chars: u32,
|
pub trigger_chars: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Error type for Claude API operations.
|
/// Error type for Claude API operations.
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ impl ClaudeWorker {
|
|||||||
.collect::<Result<_, _>>()?;
|
.collect::<Result<_, _>>()?;
|
||||||
|
|
||||||
let compaction_prompt = {
|
let compaction_prompt = {
|
||||||
let path = &config.compaction.compaction_prompt_file;
|
let path = &config.compaction.prompt_file;
|
||||||
std::fs::read_to_string(path)
|
std::fs::read_to_string(path)
|
||||||
.map_err(|e| ClaudeError::SystemPromptRead(path.clone(), e))?
|
.map_err(|e| ClaudeError::SystemPromptRead(path.clone(), e))?
|
||||||
};
|
};
|
||||||
@@ -156,7 +156,7 @@ impl ClaudeWorker {
|
|||||||
|
|
||||||
// Check if we need to trigger compaction
|
// Check if we need to trigger compaction
|
||||||
let buffer_chars = self.message_buffer_chars();
|
let buffer_chars = self.message_buffer_chars();
|
||||||
if buffer_chars > self.config.compaction.compaction_trigger_chars as usize {
|
if buffer_chars > self.config.compaction.trigger_chars as usize {
|
||||||
self.handle_compact().await;
|
self.handle_compact().await;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,8 +259,8 @@ impl ClaudeWorker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let request_body = MessagesRequest {
|
let request_body = MessagesRequest {
|
||||||
model: &self.config.compaction.compaction_model,
|
model: &self.config.compaction.model,
|
||||||
max_tokens: self.config.compaction.compaction_max_tokens,
|
max_tokens: self.config.compaction.max_tokens,
|
||||||
system: &system,
|
system: &system,
|
||||||
messages: &self.messages,
|
messages: &self.messages,
|
||||||
tools: Vec::new(),
|
tools: Vec::new(),
|
||||||
|
|||||||
Reference in New Issue
Block a user