mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 01:54:32 +00:00
refactor(commands): dedupe provider config + default model helpers
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { applyProviderConfigWithDefaultModel } from "./onboard-auth.config-shared.js";
|
||||
import {
|
||||
applyAgentDefaultModelPrimary,
|
||||
applyProviderConfigWithDefaultModel,
|
||||
} from "./onboard-auth.config-shared.js";
|
||||
import { LITELLM_DEFAULT_MODEL_REF } from "./onboard-auth.credentials.js";
|
||||
|
||||
export const LITELLM_BASE_URL = "http://localhost:4000";
|
||||
@@ -58,22 +61,5 @@ export function applyLitellmProviderConfig(cfg: OpenClawConfig): OpenClawConfig
|
||||
|
||||
export function applyLitellmConfig(cfg: OpenClawConfig): OpenClawConfig {
|
||||
const next = applyLitellmProviderConfig(cfg);
|
||||
const existingModel = next.agents?.defaults?.model;
|
||||
return {
|
||||
...next,
|
||||
agents: {
|
||||
...next.agents,
|
||||
defaults: {
|
||||
...next.agents?.defaults,
|
||||
model: {
|
||||
...(existingModel && "fallbacks" in (existingModel as Record<string, unknown>)
|
||||
? {
|
||||
fallbacks: (existingModel as { fallbacks?: string[] }).fallbacks,
|
||||
}
|
||||
: undefined),
|
||||
primary: LITELLM_DEFAULT_MODEL_REF,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
return applyAgentDefaultModelPrimary(next, LITELLM_DEFAULT_MODEL_REF);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user