mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-19 18:40:57 -07:00
Disallow unsafe type assertions (#18688)
This commit is contained in:
committed by
GitHub
parent
bce1caefd0
commit
fd65416a2f
@@ -245,6 +245,7 @@ export class ModelConfigService {
|
||||
let matchedLevel = 0; // Default to Global
|
||||
const isMatch = matchEntries.every(([key, value]) => {
|
||||
if (key === 'model') {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
const level = modelToLevel.get(value as string);
|
||||
if (level === undefined) return false;
|
||||
matchedLevel = level;
|
||||
@@ -253,6 +254,7 @@ export class ModelConfigService {
|
||||
if (key === 'overrideScope' && value === 'core') {
|
||||
return context.overrideScope === 'core' || !context.overrideScope;
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
return context[key as keyof ModelConfigKey] === value;
|
||||
});
|
||||
|
||||
@@ -291,6 +293,7 @@ export class ModelConfigService {
|
||||
);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
return {
|
||||
model: resolved.model,
|
||||
generateContentConfig: resolved.generateContentConfig,
|
||||
@@ -321,7 +324,9 @@ export class ModelConfigService {
|
||||
config2: GenerateContentConfig | undefined,
|
||||
): GenerateContentConfig {
|
||||
return ModelConfigService.genericDeepMerge(
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
config1 as Record<string, unknown> | undefined,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
config2 as Record<string, unknown> | undefined,
|
||||
) as GenerateContentConfig;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user