重构: DRY截断正典改名收尾
- audit/utils.rs truncate_chars→truncate_chars_ellipsis 正典改名(补…语义),re-export 链同步 - record.rs/generate_image.rs/knowledge_inject.rs/tools/knowledge.rs 调用点全链更新 - df-ai context_helpers.rs 私有版跨 crate 不引依赖保留原名,加正典标注注释 - DRY #11 收口,同名不同义陷阱消除
This commit is contained in:
@@ -21,7 +21,7 @@ use df_types::types::new_id;
|
||||
|
||||
use crate::state::{AppState, ExtractTrigger, LlmConcurrency, log_slow_lock};
|
||||
|
||||
use crate::commands::ai::audit::truncate_chars;
|
||||
use crate::commands::ai::audit::truncate_chars_ellipsis;
|
||||
use crate::commands::err_str;
|
||||
|
||||
use super::{AiSession};
|
||||
@@ -562,7 +562,7 @@ pub(crate) async fn build_knowledge_context(
|
||||
let kind = r.kind.clone();
|
||||
let title = r.title.clone();
|
||||
// 截断 content 防膨胀(注入侧最多 500 字符;走 audit 正典,截断时尾部补 … 提示有省略)
|
||||
let snippet: String = truncate_chars(&r.content, 500);
|
||||
let snippet: String = truncate_chars_ellipsis(&r.content, 500);
|
||||
out.push_str(&format!("- [{}] {}: {} (复用 {} 次)\n", kind, title, snippet, r.reuse_count));
|
||||
}
|
||||
out
|
||||
|
||||
Reference in New Issue
Block a user