mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-08-01 04:02:02 +08:00
Add media fallback rectifier for text-only models
Replace unsupported Anthropic image blocks with an [Unsupported Image] marker when routed models are text-only or upstream rejects image input. Add rectifier settings for media fallback and heuristic model detection, wire the controls into the settings UI, and cover the sanitizer and forwarder gates with regression tests.
This commit is contained in:
@@ -15,6 +15,8 @@ export function RectifierConfigPanel() {
|
||||
enabled: true,
|
||||
requestThinkingSignature: true,
|
||||
requestThinkingBudget: true,
|
||||
requestMediaFallback: true,
|
||||
requestMediaHeuristic: true,
|
||||
});
|
||||
const [optimizerConfig, setOptimizerConfig] = useState<OptimizerConfig>({
|
||||
enabled: false,
|
||||
@@ -111,6 +113,36 @@ export function RectifierConfigPanel() {
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-center justify-between pl-4">
|
||||
<div className="space-y-0.5">
|
||||
<Label>{t("settings.advanced.rectifier.mediaFallback")}</Label>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{t("settings.advanced.rectifier.mediaFallbackDescription")}
|
||||
</p>
|
||||
</div>
|
||||
<Switch
|
||||
checked={config.requestMediaFallback}
|
||||
disabled={!config.enabled}
|
||||
onCheckedChange={(checked) =>
|
||||
handleChange({ requestMediaFallback: checked })
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-center justify-between pl-8">
|
||||
<div className="space-y-0.5">
|
||||
<Label>{t("settings.advanced.rectifier.mediaHeuristic")}</Label>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{t("settings.advanced.rectifier.mediaHeuristicDescription")}
|
||||
</p>
|
||||
</div>
|
||||
<Switch
|
||||
checked={config.requestMediaHeuristic}
|
||||
disabled={!config.enabled || !config.requestMediaFallback}
|
||||
onCheckedChange={(checked) =>
|
||||
handleChange({ requestMediaHeuristic: checked })
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="border-t pt-6 mt-6">
|
||||
|
||||
Reference in New Issue
Block a user