mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-12 16:15:13 +00:00
fix: strip stale Gemini extended context suffixes
This commit is contained in:
1 parent
7f369f75dc
commit
5943c8fa3c
2 files changed
+21
-1
No files matched your search
@@ -168,6 +168,26 @@ describe('applyExtendedContextConfig', () => {
|
|||||||
expect(env.ANTHROPIC_MODEL).toBe('gemini-2.5-pro(high)[1m]');
|
expect(env.ANTHROPIC_MODEL).toBe('gemini-2.5-pro(high)[1m]');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('preserves a saved [1m] preference for supported Claude models in auto mode', () => {
|
||||||
|
const env: NodeJS.ProcessEnv = {
|
||||||
|
ANTHROPIC_MODEL: 'claude-sonnet-4-5-20250929[1m]',
|
||||||
|
};
|
||||||
|
|
||||||
|
applyExtendedContextConfig(env, 'claude', undefined);
|
||||||
|
|
||||||
|
expect(env.ANTHROPIC_MODEL).toBe('claude-sonnet-4-5-20250929[1m]');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('strips a stale [1m] preference from unsupported native Gemini models', () => {
|
||||||
|
const env: NodeJS.ProcessEnv = {
|
||||||
|
ANTHROPIC_MODEL: 'gemini-2.5-flash[1m]',
|
||||||
|
};
|
||||||
|
|
||||||
|
applyExtendedContextConfig(env, 'gemini', undefined);
|
||||||
|
|
||||||
|
expect(env.ANTHROPIC_MODEL).toBe('gemini-2.5-flash');
|
||||||
|
});
|
||||||
|
|
||||||
it('handles empty env vars gracefully', () => {
|
it('handles empty env vars gracefully', () => {
|
||||||
const env: NodeJS.ProcessEnv = {};
|
const env: NodeJS.ProcessEnv = {};
|
||||||
applyExtendedContextConfig(env, 'gemini', undefined);
|
applyExtendedContextConfig(env, 'gemini', undefined);
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ export function applyExtendedContextConfig(
|
|||||||
if (isNativeGeminiModel(modelId)) {
|
if (isNativeGeminiModel(modelId)) {
|
||||||
envVars[key] = supportsExtendedContext(provider, modelId)
|
envVars[key] = supportsExtendedContext(provider, modelId)
|
||||||
? applyExtendedContextSuffixShared(value)
|
? applyExtendedContextSuffixShared(value)
|
||||||
: value;
|
: stripExtendedContextSuffix(value);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user