- docker-compose: 下线 Python backend/config-service,切换至 config-service-rs - archive: 归档 legacy Python 目录至 archive/python/* - services: 新增/更新 common-contracts、api-gateway、各 provider、report-generator-service、config-service-rs - data-persistence-service: API/system 模块与模型/DTO 调整 - frontend: 更新 useApi 与 API 路由 - docs: 更新路线图并勾选光荣退役 - cleanup: 移除 data-distance-service 占位测试
35 lines
812 B
Rust
35 lines
812 B
Rust
use std::sync::Arc;
|
|
|
|
use dashmap::DashMap;
|
|
use tera::Tera;
|
|
use uuid::Uuid;
|
|
|
|
use common_contracts::observability::TaskProgress;
|
|
|
|
use crate::{config::AppConfig, llm_client::LlmClient, templates::load_tera};
|
|
|
|
#[derive(Clone)]
|
|
pub struct AppState {
|
|
pub tasks: Arc<DashMap<Uuid, TaskProgress>>,
|
|
pub config: Arc<AppConfig>,
|
|
pub llm_client: Arc<LlmClient>,
|
|
pub tera: Arc<Tera>,
|
|
}
|
|
|
|
impl AppState {
|
|
pub fn new(config: AppConfig) -> Self {
|
|
let llm_client = Arc::new(LlmClient::new(
|
|
config.llm_api_url.clone(),
|
|
config.llm_api_key.clone(),
|
|
config.llm_model.clone(),
|
|
));
|
|
|
|
Self {
|
|
tasks: Arc::new(DashMap::new()),
|
|
config: Arc::new(config),
|
|
llm_client,
|
|
tera: Arc::new(load_tera()),
|
|
}
|
|
}
|
|
}
|