优化: 图像模型兜底防御+任务UI(状态多选+跳详情)+token popover遮挡
This commit is contained in:
@@ -10,7 +10,7 @@ use df_ai::provider::{ChatMessage, CompletionRequest, LlmProvider, MessageRole};
|
||||
// - 嵌入: TaskRequirements(Capability::Embedding,无工具)— 在 embedding provider 的池中选,
|
||||
// 池空兜底 config.embedding_model(行为不变,现有 KnowledgeConfig 配置即生效)。
|
||||
use df_ai::router::{
|
||||
select_model_id, Modality, TaskRequirements,
|
||||
is_likely_image_model, select_model_id, Modality, TaskRequirements,
|
||||
};
|
||||
use df_storage::crud::{AiConversationRepo, AiMessageRepo, KnowledgeRepo};
|
||||
use df_storage::db::Database;
|
||||
@@ -682,6 +682,14 @@ async fn extract_knowledge_from_conversation(
|
||||
};
|
||||
let extract_model = select_model_id(&extract_req, &provider_config.model_configs)
|
||||
.unwrap_or_else(|| provider_config.default_model.clone());
|
||||
// 防御:选中/兜底模型是图像模型时跳过 LLM 提取(避免文本任务 404 刷屏,治 default_model 配错为图像模型)。
|
||||
if is_likely_image_model(&extract_model, &provider_config.model_configs) {
|
||||
tracing::warn!(
|
||||
"知识提取跳过:模型 {} 是图像模型,文本任务不可用(检查 provider default_model 应为文本模型)",
|
||||
extract_model
|
||||
);
|
||||
return Ok(0);
|
||||
}
|
||||
let request = CompletionRequest {
|
||||
model: extract_model,
|
||||
messages: extract_messages,
|
||||
|
||||
Reference in New Issue
Block a user