mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 14:16:43 +00:00
fix(cliproxy): fix thinking off regression and composite error handling
- P1: Thinking "off" now fully disables all tier thinking When thinkingValue === 'off' AND no per-tier config, return early Preserves behavior for "off" with per-tier config (skips main, processes tiers) Fixes regression where tier defaults were applied despite explicit off setting - P2: Handle composite-create thrown errors in POST route Wrap createCompositeVariant() in try/catch Returns 400 instead of generic 500 when function throws (e.g., legacy mode)
This commit is contained in:
@@ -152,11 +152,20 @@ export function applyThinkingConfig(
|
||||
}
|
||||
thinkingValue = validation.value;
|
||||
|
||||
// Track whether to apply to main model (skip if validation says off)
|
||||
const applyToMainModel = thinkingValue !== 'off';
|
||||
|
||||
// Apply thinking suffix to main model (only if not off)
|
||||
if (applyToMainModel && result.ANTHROPIC_MODEL) {
|
||||
// P1 FIX: If validation says 'off' AND no per-tier thinking config, skip ALL processing
|
||||
// This distinguishes between:
|
||||
// 1. "off" with no per-tier config → no thinking anywhere
|
||||
// 2. "off" with per-tier config → skip main model, process tiers with their own values
|
||||
if (thinkingValue === 'off') {
|
||||
const hasPerTierThinking =
|
||||
compositeTierThinking &&
|
||||
Object.values(compositeTierThinking).some((v) => v !== undefined && v !== 'off');
|
||||
if (!hasPerTierThinking) {
|
||||
return result; // No thinking to apply anywhere
|
||||
}
|
||||
// Otherwise, continue to process tiers with their own config (skip main model)
|
||||
} else if (result.ANTHROPIC_MODEL) {
|
||||
// Apply thinking suffix to main model (only if not off)
|
||||
result.ANTHROPIC_MODEL = applyThinkingSuffix(result.ANTHROPIC_MODEL, thinkingValue);
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +138,13 @@ router.post('/', (req: Request, res: Response): void => {
|
||||
return;
|
||||
}
|
||||
|
||||
const result = createCompositeVariant({ name, defaultTier: default_tier, tiers });
|
||||
let result;
|
||||
try {
|
||||
result = createCompositeVariant({ name, defaultTier: default_tier, tiers });
|
||||
} catch (error) {
|
||||
res.status(400).json({ error: (error as Error).message });
|
||||
return;
|
||||
}
|
||||
|
||||
if (!result.success) {
|
||||
res.status(409).json({ error: result.error });
|
||||
|
||||
Reference in New Issue
Block a user