fix: default low thinking for reasoning models
This commit is contained in:
@@ -7,6 +7,7 @@ export type ModelCatalogEntry = {
|
||||
name: string;
|
||||
provider: string;
|
||||
contextWindow?: number;
|
||||
reasoning?: boolean;
|
||||
};
|
||||
|
||||
type DiscoveredModel = {
|
||||
@@ -14,6 +15,7 @@ type DiscoveredModel = {
|
||||
name?: string;
|
||||
provider: string;
|
||||
contextWindow?: number;
|
||||
reasoning?: boolean;
|
||||
};
|
||||
|
||||
let modelCatalogPromise: Promise<ModelCatalogEntry[]> | null = null;
|
||||
@@ -56,7 +58,9 @@ export async function loadModelCatalog(params?: {
|
||||
typeof entry?.contextWindow === "number" && entry.contextWindow > 0
|
||||
? entry.contextWindow
|
||||
: undefined;
|
||||
models.push({ id, name, provider, contextWindow });
|
||||
const reasoning =
|
||||
typeof entry?.reasoning === "boolean" ? entry.reasoning : undefined;
|
||||
models.push({ id, name, provider, contextWindow, reasoning });
|
||||
}
|
||||
} catch {
|
||||
// Leave models empty on discovery errors.
|
||||
|
||||
@@ -6,6 +6,8 @@ export type ModelRef = {
|
||||
model: string;
|
||||
};
|
||||
|
||||
export type ThinkLevel = "off" | "minimal" | "low" | "medium" | "high";
|
||||
|
||||
export type ModelAliasIndex = {
|
||||
byAlias: Map<string, { alias: string; ref: ModelRef }>;
|
||||
byKey: Map<string, string[]>;
|
||||
@@ -152,3 +154,19 @@ export function buildAllowedModelSet(params: {
|
||||
|
||||
return { allowAny: false, allowedCatalog, allowedKeys };
|
||||
}
|
||||
|
||||
export function resolveThinkingDefault(params: {
|
||||
cfg: ClawdisConfig;
|
||||
provider: string;
|
||||
model: string;
|
||||
catalog?: ModelCatalogEntry[];
|
||||
}): ThinkLevel {
|
||||
const configured = params.cfg.agent?.thinkingDefault;
|
||||
if (configured) return configured;
|
||||
const candidate = params.catalog?.find(
|
||||
(entry) =>
|
||||
entry.provider === params.provider && entry.id === params.model,
|
||||
);
|
||||
if (candidate?.reasoning) return "low";
|
||||
return "off";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user