pub struct AppState {
pub llm_service: Arc<RwLock<Service>>,
pub config: Arc<RwLock<Settings>>,
}Expand description
应用状态
Fields§
§llm_service: Arc<RwLock<Service>>§config: Arc<RwLock<Settings>>Implementations§
Source§impl AppState
impl AppState
pub fn new(llm_service: LlmService, config: Settings) -> Self
Sourcepub fn update_llm_service(&self, new_backend: &LlmBackendSettings) -> Result<()>
pub fn update_llm_service(&self, new_backend: &LlmBackendSettings) -> Result<()>
动态更新 LLM 服务配置
这个方法允许在运行时更新 LLM 后端配置,而无需重启服务
Sourcepub fn get_current_config(&self) -> Settings
pub fn get_current_config(&self) -> Settings
获取当前配置的只读副本
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AppState
impl RefUnwindSafe for AppState
impl Send for AppState
impl Sync for AppState
impl Unpin for AppState
impl UnwindSafe for AppState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more