重构: F-09 batch5 llm_concurrency会话级改造(决策c)
- state.rs: per_conv HashMap<conv_id,Semaphore>(每对话permits=2) + per_conv_permits热改 + acquire_per_conv(conv_id) + release_conv - agentic.rs: loop入口acquire_global+acquire_per_conv(conv_id)整loop持有(会话级并发上限3) + 删每轮acquire/drop - compress/title/knowledge_inject: acquire_per_conv(conv_id)+签名conv_id - project.rs: 扫描合成key + ai_conversation_delete release_conv global: LLM调用并发→并发会话数上限;F-260616-12 retry permit自洽 主代兜底: cargo check --workspace 0 + test 96 + grep印证
This commit is contained in:
@@ -549,7 +549,8 @@ async fn extract_description_via_llm(
|
||||
};
|
||||
|
||||
let _g = state.llm_concurrency.acquire_global().await;
|
||||
let _c = state.llm_concurrency.acquire_per_conv().await;
|
||||
// F-09 B 批5: 项目扫描无 conv_id(非会话内 LLM 调用),用合成 key 共享一槽(扫描低频,同类聚合限流)。
|
||||
let _c = state.llm_concurrency.acquire_per_conv("__project_scan__").await;
|
||||
let resp = provider.complete(request).await.map_err(err_str)?;
|
||||
// 只取 description,其它字段丢弃(批量场景不需要 project_type/stack 细化)
|
||||
let desc = parse_scan_result(&resp.text)
|
||||
@@ -644,7 +645,8 @@ pub async fn scan_project_with_ai(
|
||||
|
||||
// 4. 双层限流 + complete
|
||||
let _global_permit = state.llm_concurrency.acquire_global().await;
|
||||
let _per_conv_permit = state.llm_concurrency.acquire_per_conv().await;
|
||||
// F-09 B 批5: 项目扫描无 conv_id,用合成 key 共享一槽(扫描低频,同类聚合限流)。
|
||||
let _per_conv_permit = state.llm_concurrency.acquire_per_conv("__project_scan__").await;
|
||||
let llm_result = provider.complete(request).await;
|
||||
|
||||
// 5. 解析 + 合并 stack(LLM 失败降级纯规则)
|
||||
|
||||
Reference in New Issue
Block a user