feat: support goose mode in UI (#1434)
Co-authored-by: Lily Delalande <ldelalande@squareup.com>
This commit is contained in:
@@ -3,13 +3,13 @@ use goose::agents::Agent;
|
||||
use serde_json::Value;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::Mutex;
|
||||
use tokio::sync::{Mutex, RwLock};
|
||||
|
||||
/// Shared application state
|
||||
#[allow(dead_code)]
|
||||
#[derive(Clone)]
|
||||
pub struct AppState {
|
||||
pub agent: Arc<Mutex<Option<Box<dyn Agent>>>>,
|
||||
pub agent: Arc<RwLock<Option<Box<dyn Agent>>>>,
|
||||
pub secret_key: String,
|
||||
pub config: Arc<Mutex<HashMap<String, Value>>>,
|
||||
}
|
||||
@@ -17,7 +17,7 @@ pub struct AppState {
|
||||
impl AppState {
|
||||
pub async fn new(secret_key: String) -> Result<Self> {
|
||||
Ok(Self {
|
||||
agent: Arc::new(Mutex::new(None)),
|
||||
agent: Arc::new(RwLock::new(None)),
|
||||
secret_key,
|
||||
config: Arc::new(Mutex::new(HashMap::new())),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user