feat(flow): 新增分组执行与异步模式支持

refactor(executors): 将 Rhai 引擎评估逻辑迁移至 script_rhai 模块
docs: 添加 Flow 架构文档与示例 JSON
feat(i18n): 新增前端多语言支持
perf(axios): 优化 token 刷新与 401 处理逻辑
style: 统一代码格式化与简化条件判断
This commit is contained in:
2025-12-03 20:51:22 +08:00
parent a1b21e87b3
commit 75c6974a35
20 changed files with 1830 additions and 299 deletions

View File

@ -10,6 +10,8 @@ pub struct FlowContext {
pub enum ExecutionMode {
#[serde(rename = "sync")] Sync,
#[serde(rename = "async")] AsyncFireAndForget,
#[serde(rename = "queued")] AsyncQueued,
#[serde(rename = "bounded")] AsyncBounded,
}
impl Default for ExecutionMode { fn default() -> Self { ExecutionMode::Sync } }
@ -35,8 +37,15 @@ pub struct DriveOptions {
// 新增:事件通道(仅运行时使用,不做序列化/反序列化)
#[serde(default, skip_serializing, skip_deserializing)]
pub event_tx: Option<tokio::sync::mpsc::Sender<StreamEvent>>,
// 新增:异步分组追踪器(仅运行时使用,不做序列化/反序列化)
#[serde(default, skip_serializing, skip_deserializing)]
pub async_groups: Option<std::sync::Arc<tokio::sync::Mutex<std::collections::HashMap<String, Vec<tokio::task::JoinHandle<()>>>>>>,
#[serde(default, skip_serializing, skip_deserializing)]
pub group_semaphores: Option<std::sync::Arc<tokio::sync::Mutex<std::collections::HashMap<String, std::sync::Arc<tokio::sync::Semaphore>>>>>,
#[serde(default)]
pub bounded_limit: Option<usize>,
}
impl Default for DriveOptions {
fn default() -> Self { Self { max_steps: 10_000, execution_mode: ExecutionMode::Sync, event_tx: None } }
fn default() -> Self { Self { max_steps: 10_000, execution_mode: ExecutionMode::Sync, event_tx: None, async_groups: None, group_semaphores: None, bounded_limit: None } }
}