style: apply oxfmt
This commit is contained in:
@@ -210,9 +210,9 @@ function buildKimiCodeProvider(): ProviderConfig {
|
|||||||
contextWindow: KIMI_CODE_CONTEXT_WINDOW,
|
contextWindow: KIMI_CODE_CONTEXT_WINDOW,
|
||||||
maxTokens: KIMI_CODE_MAX_TOKENS,
|
maxTokens: KIMI_CODE_MAX_TOKENS,
|
||||||
headers: KIMI_CODE_HEADERS,
|
headers: KIMI_CODE_HEADERS,
|
||||||
compat: KIMI_CODE_COMPAT
|
compat: KIMI_CODE_COMPAT,
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,9 +224,7 @@ function buildSyntheticProvider(): ProviderConfig {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function resolveImplicitProviders(params: {
|
export function resolveImplicitProviders(params: { agentDir: string }): ModelsConfig["providers"] {
|
||||||
agentDir: string;
|
|
||||||
}): ModelsConfig["providers"] {
|
|
||||||
const providers: Record<string, ProviderConfig> = {};
|
const providers: Record<string, ProviderConfig> = {};
|
||||||
const authStore = ensureAuthProfileStore(params.agentDir, {
|
const authStore = ensureAuthProfileStore(params.agentDir, {
|
||||||
allowKeychainPrompt: false,
|
allowKeychainPrompt: false,
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ describe("cli program (smoke)", () => {
|
|||||||
"--auth-choice",
|
"--auth-choice",
|
||||||
"kimi-code-api-key",
|
"kimi-code-api-key",
|
||||||
"--kimi-code-api-key",
|
"--kimi-code-api-key",
|
||||||
"sk-kimi-code-test"
|
"sk-kimi-code-test",
|
||||||
],
|
],
|
||||||
{ from: "user" },
|
{ from: "user" },
|
||||||
);
|
);
|
||||||
@@ -197,7 +197,7 @@ describe("cli program (smoke)", () => {
|
|||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
nonInteractive: true,
|
nonInteractive: true,
|
||||||
authChoice: "kimi-code-api-key",
|
authChoice: "kimi-code-api-key",
|
||||||
kimiCodeApiKey: "sk-kimi-code-test"
|
kimiCodeApiKey: "sk-kimi-code-test",
|
||||||
}),
|
}),
|
||||||
runtime,
|
runtime,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ export async function applyAuthChoiceApiProviders(
|
|||||||
await params.prompter.note(
|
await params.prompter.note(
|
||||||
[
|
[
|
||||||
"Kimi Code uses a dedicated endpoint and API key.",
|
"Kimi Code uses a dedicated endpoint and API key.",
|
||||||
"Get your API key at: https://www.kimi.com/code/en"
|
"Get your API key at: https://www.kimi.com/code/en",
|
||||||
].join("\n"),
|
].join("\n"),
|
||||||
"Kimi Code",
|
"Kimi Code",
|
||||||
);
|
);
|
||||||
@@ -242,7 +242,7 @@ export async function applyAuthChoiceApiProviders(
|
|||||||
nextConfig = applyAuthProfileConfig(nextConfig, {
|
nextConfig = applyAuthProfileConfig(nextConfig, {
|
||||||
profileId: "kimi-code:default",
|
profileId: "kimi-code:default",
|
||||||
provider: "kimi-code",
|
provider: "kimi-code",
|
||||||
mode: "api_key"
|
mode: "api_key",
|
||||||
});
|
});
|
||||||
{
|
{
|
||||||
const applied = await applyDefaultModelChoice({
|
const applied = await applyDefaultModelChoice({
|
||||||
@@ -253,7 +253,7 @@ export async function applyAuthChoiceApiProviders(
|
|||||||
applyProviderConfig: applyKimiCodeProviderConfig,
|
applyProviderConfig: applyKimiCodeProviderConfig,
|
||||||
noteDefault: KIMI_CODE_MODEL_REF,
|
noteDefault: KIMI_CODE_MODEL_REF,
|
||||||
noteAgentModel,
|
noteAgentModel,
|
||||||
prompter: params.prompter
|
prompter: params.prompter,
|
||||||
});
|
});
|
||||||
nextConfig = applied.config;
|
nextConfig = applied.config;
|
||||||
agentModelOverride = applied.agentModelOverride ?? agentModelOverride;
|
agentModelOverride = applied.agentModelOverride ?? agentModelOverride;
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ export function applyKimiCodeProviderConfig(cfg: ClawdbotConfig): ClawdbotConfig
|
|||||||
const models = { ...cfg.agents?.defaults?.models };
|
const models = { ...cfg.agents?.defaults?.models };
|
||||||
models[KIMI_CODE_MODEL_REF] = {
|
models[KIMI_CODE_MODEL_REF] = {
|
||||||
...models[KIMI_CODE_MODEL_REF],
|
...models[KIMI_CODE_MODEL_REF],
|
||||||
alias: models[KIMI_CODE_MODEL_REF]?.alias ?? "Kimi Code"
|
alias: models[KIMI_CODE_MODEL_REF]?.alias ?? "Kimi Code",
|
||||||
};
|
};
|
||||||
|
|
||||||
const providers = { ...cfg.models?.providers };
|
const providers = { ...cfg.models?.providers };
|
||||||
@@ -220,7 +220,7 @@ export function applyKimiCodeProviderConfig(cfg: ClawdbotConfig): ClawdbotConfig
|
|||||||
baseUrl: KIMI_CODE_BASE_URL,
|
baseUrl: KIMI_CODE_BASE_URL,
|
||||||
api: "openai-completions",
|
api: "openai-completions",
|
||||||
...(normalizedApiKey ? { apiKey: normalizedApiKey } : {}),
|
...(normalizedApiKey ? { apiKey: normalizedApiKey } : {}),
|
||||||
models: mergedModels.length > 0 ? mergedModels : [defaultModel]
|
models: mergedModels.length > 0 ? mergedModels : [defaultModel],
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -254,7 +254,7 @@ export function applyKimiCodeConfig(cfg: ClawdbotConfig): ClawdbotConfig {
|
|||||||
fallbacks: (existingModel as { fallbacks?: string[] }).fallbacks,
|
fallbacks: (existingModel as { fallbacks?: string[] }).fallbacks,
|
||||||
}
|
}
|
||||||
: undefined),
|
: undefined),
|
||||||
primary: KIMI_CODE_MODEL_REF
|
primary: KIMI_CODE_MODEL_REF,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ export async function setKimiCodeApiKey(key: string, agentDir?: string) {
|
|||||||
credential: {
|
credential: {
|
||||||
type: "api_key",
|
type: "api_key",
|
||||||
provider: "kimi-code",
|
provider: "kimi-code",
|
||||||
key
|
key,
|
||||||
},
|
},
|
||||||
agentDir: resolveAuthAgentDir(agentDir),
|
agentDir: resolveAuthAgentDir(agentDir),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export const KIMI_CODE_DEFAULT_COST = {
|
|||||||
input: 0,
|
input: 0,
|
||||||
output: 0,
|
output: 0,
|
||||||
cacheRead: 0,
|
cacheRead: 0,
|
||||||
cacheWrite: 0
|
cacheWrite: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
const MINIMAX_MODEL_CATALOG = {
|
const MINIMAX_MODEL_CATALOG = {
|
||||||
@@ -113,6 +113,6 @@ export function buildKimiCodeModelDefinition(): ModelDefinitionConfig {
|
|||||||
contextWindow: KIMI_CODE_CONTEXT_WINDOW,
|
contextWindow: KIMI_CODE_CONTEXT_WINDOW,
|
||||||
maxTokens: KIMI_CODE_MAX_TOKENS,
|
maxTokens: KIMI_CODE_MAX_TOKENS,
|
||||||
headers: KIMI_CODE_HEADERS,
|
headers: KIMI_CODE_HEADERS,
|
||||||
compat: KIMI_CODE_COMPAT
|
compat: KIMI_CODE_COMPAT,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -240,14 +240,14 @@ export async function applyNonInteractiveAuthChoice(params: {
|
|||||||
flagValue: opts.kimiCodeApiKey,
|
flagValue: opts.kimiCodeApiKey,
|
||||||
flagName: "--kimi-code-api-key",
|
flagName: "--kimi-code-api-key",
|
||||||
envVar: "KIMICODE_API_KEY",
|
envVar: "KIMICODE_API_KEY",
|
||||||
runtime
|
runtime,
|
||||||
});
|
});
|
||||||
if (!resolved) return null;
|
if (!resolved) return null;
|
||||||
if (resolved.source !== "profile") await setKimiCodeApiKey(resolved.key);
|
if (resolved.source !== "profile") await setKimiCodeApiKey(resolved.key);
|
||||||
nextConfig = applyAuthProfileConfig(nextConfig, {
|
nextConfig = applyAuthProfileConfig(nextConfig, {
|
||||||
profileId: "kimi-code:default",
|
profileId: "kimi-code:default",
|
||||||
provider: "kimi-code",
|
provider: "kimi-code",
|
||||||
mode: "api_key"
|
mode: "api_key",
|
||||||
});
|
});
|
||||||
return applyKimiCodeConfig(nextConfig);
|
return applyKimiCodeConfig(nextConfig);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user