style: applied formatting to new long run features
This commit is contained in:
@@ -52,6 +52,7 @@ use std::fs::{File, OpenOptions, read_dir, read_to_string, remove_dir_all, remov
|
||||
use std::io::Write;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use std::{env, fs};
|
||||
|
||||
pub struct AutoContinueConfig {
|
||||
@@ -3941,12 +3942,9 @@ impl RequestContext {
|
||||
.clone()
|
||||
.unwrap_or_else(|| SUMMARIZATION_PROMPT.into());
|
||||
let input = Input::from_str(self, &prompt, None)?;
|
||||
let summary = tokio::time::timeout(
|
||||
std::time::Duration::from_secs(120),
|
||||
input.fetch_chat_text(),
|
||||
)
|
||||
.await
|
||||
.map_err(|_| anyhow::anyhow!("Compression LLM call timed out after 120 s"))??;
|
||||
let summary = tokio::time::timeout(Duration::from_secs(120), input.fetch_chat_text())
|
||||
.await
|
||||
.map_err(|_| anyhow::anyhow!("Compression LLM call timed out after 120 s"))??;
|
||||
let summary_context_prompt = self
|
||||
.app
|
||||
.config
|
||||
@@ -3969,7 +3967,10 @@ impl RequestContext {
|
||||
.and_then(|a| a.compression_keep_last())
|
||||
.unwrap_or(self.app.config.compression_keep_last);
|
||||
if let Some(session) = self.session.as_mut() {
|
||||
session.compress(format!("{todo_prefix}{summary_context_prompt}{summary}"), keep_last);
|
||||
session.compress(
|
||||
format!("{todo_prefix}{summary_context_prompt}{summary}"),
|
||||
keep_last,
|
||||
);
|
||||
}
|
||||
self.discontinuous_last_message();
|
||||
Ok(())
|
||||
|
||||
@@ -153,12 +153,11 @@ impl Debug for Supervisor {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::utils::create_abort_signal;
|
||||
use anyhow::Error;
|
||||
use tokio::runtime::Builder;
|
||||
|
||||
fn make_handle(id: &str, agent_name: &str, depth: usize) -> AgentHandle {
|
||||
let rt = tokio::runtime::Builder::new_current_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.unwrap();
|
||||
let rt = Builder::new_current_thread().enable_all().build().unwrap();
|
||||
let join_handle = rt.spawn(async {
|
||||
Ok(AgentResult {
|
||||
id: "done".into(),
|
||||
@@ -198,12 +197,9 @@ mod tests {
|
||||
// Keep the runtime alive in this scope so the spawned task is never
|
||||
// polled (current_thread only polls inside block_on), keeping
|
||||
// join_handle.is_finished() == false and the slot occupied.
|
||||
let rt = tokio::runtime::Builder::new_current_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.unwrap();
|
||||
let rt = Builder::new_current_thread().enable_all().build().unwrap();
|
||||
let join_handle = rt.spawn(async {
|
||||
Ok::<AgentResult, anyhow::Error>(AgentResult {
|
||||
Ok::<AgentResult, Error>(AgentResult {
|
||||
id: "done".into(),
|
||||
agent_name: "test".into(),
|
||||
output: "result".into(),
|
||||
|
||||
Reference in New Issue
Block a user