Workerのリファクタリング
This commit is contained in:
@@ -40,17 +40,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
println!("📡 Sending request to LLM...");
|
||||
|
||||
// Mutable::run consumes self → (Locked, WorkerResult)
|
||||
match worker.run("Tell me a very long story about a brave knight. Make it as detailed as possible with many paragraphs.").await {
|
||||
Ok((_locked, WorkerResult::Finished)) => {
|
||||
println!("✅ Task completed normally");
|
||||
}
|
||||
Ok((_locked, WorkerResult::Paused)) => {
|
||||
println!("⏸️ Task paused");
|
||||
}
|
||||
Ok((_locked, WorkerResult::LimitReached)) => {
|
||||
println!("🔒 Turn limit reached");
|
||||
}
|
||||
Ok(out) => match out.result {
|
||||
WorkerResult::Finished => println!("✅ Task completed normally"),
|
||||
WorkerResult::Paused => println!("⏸️ Task paused"),
|
||||
WorkerResult::LimitReached => println!("🔒 Turn limit reached"),
|
||||
},
|
||||
Err(e) => {
|
||||
println!("❌ Task error: {}", e);
|
||||
}
|
||||
|
||||
@@ -476,8 +476,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let (mut locked, _) = match worker.run(first_input).await {
|
||||
Ok(pair) => pair,
|
||||
let mut locked = match worker.run(first_input).await {
|
||||
Ok(out) => out.worker,
|
||||
Err(e) => {
|
||||
eprintln!("\n❌ Error: {}", e);
|
||||
return Ok(());
|
||||
|
||||
Reference in New Issue
Block a user