fix: add toast feedback for OMO "Fill Recommended" button silent failures

This commit is contained in:
Jason
2026-02-26 16:02:18 +08:00
parent 2b30819510
commit 90cb8db16b
4 changed files with 58 additions and 2 deletions
@@ -722,14 +722,23 @@ export function OmoFormFields({
return;
}
let filledCount = 0;
let alreadySetCount = 0;
let unmatchedCount = 0;
const updatedAgents = { ...agents };
for (const agentDef of builtinAgentDefs) {
const recommendedValue = resolveRecommendedModel(agentDef.recommended);
if (recommendedValue && !updatedAgents[agentDef.key]?.model) {
if (!recommendedValue) {
unmatchedCount++;
} else if (updatedAgents[agentDef.key]?.model) {
alreadySetCount++;
} else {
updatedAgents[agentDef.key] = {
...updatedAgents[agentDef.key],
model: recommendedValue,
};
filledCount++;
}
}
onAgentsChange(updatedAgents);
@@ -738,15 +747,50 @@ export function OmoFormFields({
const updatedCategories = { ...categories };
for (const catDef of OMO_BUILTIN_CATEGORIES) {
const recommendedValue = resolveRecommendedModel(catDef.recommended);
if (recommendedValue && !updatedCategories[catDef.key]?.model) {
if (!recommendedValue) {
unmatchedCount++;
} else if (updatedCategories[catDef.key]?.model) {
alreadySetCount++;
} else {
updatedCategories[catDef.key] = {
...updatedCategories[catDef.key],
model: recommendedValue,
};
filledCount++;
}
}
onCategoriesChange(updatedCategories);
}
if (filledCount > 0 && unmatchedCount === 0) {
toast.success(
t("omo.fillRecommendedSuccess", {
defaultValue: "Filled {{count}} recommended models",
count: filledCount,
}),
);
} else if (filledCount > 0 && unmatchedCount > 0) {
toast.success(
t("omo.fillRecommendedPartial", {
defaultValue:
"Filled {{filled}} recommended models, {{unmatched}} unmatched",
filled: filledCount,
unmatched: unmatchedCount,
}),
);
} else if (alreadySetCount > 0 && unmatchedCount === 0) {
toast.info(
t("omo.fillRecommendedAllSet", {
defaultValue: "All slots already have models configured",
}),
);
} else {
toast.warning(
t("omo.fillRecommendedNoMatch", {
defaultValue: "Recommended models not found in configured providers",
}),
);
}
};
const configuredAgentCount = Object.keys(agents).length;
+4
View File
@@ -1840,6 +1840,10 @@
"customCategories": "Custom Categories",
"modelConfiguration": "Model Configuration",
"fillRecommended": "Fill Recommended",
"fillRecommendedSuccess": "Filled {{count}} recommended models",
"fillRecommendedPartial": "Filled {{filled}} recommended models, {{unmatched}} unmatched",
"fillRecommendedAllSet": "All slots already have models configured",
"fillRecommendedNoMatch": "Recommended models not found in configured providers",
"configSummary": "{{agents}} agents, {{categories}} categories configured · Click ⚙ for advanced params",
"enabledModelsCount": "{{count}} configured models available",
"source": "from:",
+4
View File
@@ -1840,6 +1840,10 @@
"customCategories": "カスタムカテゴリ",
"modelConfiguration": "モデル設定",
"fillRecommended": "推奨を入力",
"fillRecommendedSuccess": "推奨モデル {{count}} 件を設定しました",
"fillRecommendedPartial": "推奨モデル {{filled}} 件を設定、{{unmatched}} 件は未一致",
"fillRecommendedAllSet": "すべてのスロットにモデルが設定済みです",
"fillRecommendedNoMatch": "推奨モデルが設定済みプロバイダーに見つかりませんでした",
"configSummary": "{{agents}} 個の Agent、{{categories}} 個の Category を設定済み · ⚙ で詳細を展開",
"enabledModelsCount": "設定済みモデル {{count}} 件",
"source": "出典:",
+4
View File
@@ -1840,6 +1840,10 @@
"customCategories": "自定义分类",
"modelConfiguration": "模型配置",
"fillRecommended": "填充推荐",
"fillRecommendedSuccess": "已填充 {{count}} 个推荐模型",
"fillRecommendedPartial": "已填充 {{filled}} 个推荐模型,{{unmatched}} 个未匹配",
"fillRecommendedAllSet": "所有槽位已有模型配置",
"fillRecommendedNoMatch": "推荐模型在已配置的供应商中未找到匹配",
"configSummary": "已配置 {{agents}} 个 Agent{{categories}} 个 Category · 点击 ⚙ 展开高级参数",
"enabledModelsCount": "可选已配置模型 {{count}} 个",
"source": "来源:",