优化: 图像模型兜底防御+任务UI(状态多选+跳详情)+token popover遮挡

This commit is contained in:
lxy
2026-08-10 13:46:26 +08:00
parent 256af4e736
commit 9407f821b9
7 changed files with 182 additions and 14 deletions
+8 -1
View File
@@ -14,7 +14,7 @@ use df_ai::provider::{ChatMessage, CompletionRequest, LlmProvider};
// 摘要任务,选 Standard 智力保摘要质量;不传 tools(纯文本出,避免 LLM 调工具跑偏)。
// 池空/无匹配兜底 default_model(与 title.rs 一致,行为可预期)。
use df_ai::router::{
select_model_id, Modality, TaskRequirements,
is_likely_image_model, select_model_id, Modality, TaskRequirements,
};
use df_storage::models::AiProviderRecord;
@@ -81,6 +81,13 @@ pub(crate) async fn compress_via_llm(
};
let model = select_model_id(&compress_req, &provider_config.model_configs)
.unwrap_or_else(|| provider_config.default_model.clone());
// 防御:选中/兜底模型是图像模型时返 Err(走关键词摘要兜底,避免文本任务 404 刷屏)。
if is_likely_image_model(&model, &provider_config.model_configs) {
return Err(format!(
"压缩模型 {} 是图像模型,文本任务不可用(检查 provider default_model 应为文本模型)",
model
));
}
// 四段式 system prompt + active 消息原文,喂 complete() 非流式出摘要。
let mut prompt = vec![ChatMessage::system(compress_prompt(lang))];