-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathonboard.ts
More file actions
34 lines (32 loc) · 1.11 KB
/
onboard.ts
File metadata and controls
34 lines (32 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import {
applyAgentDefaultModelPrimary,
type OpenClawConfig,
} from "openclaw/plugin-sdk/provider-onboard";
import { COMMONSTACK_BASE_URL } from "./api.js";
export const COMMONSTACK_DEFAULT_MODEL_REF = "commonstack/openai/gpt-4o-mini";
/**
* Apply CommonStack provider config during onboarding.
*
* At onboard time we don't have the full dynamic catalog yet (API key was just
* entered). We write the minimal provider entry (baseUrl + api) so the gateway
* can boot; the dynamic catalog.run will populate the full model list on first
* startup with the key.
*/
export function applyCommonstackConfig(cfg: OpenClawConfig): OpenClawConfig {
const updated = {
...cfg,
models: {
...(cfg as Record<string, unknown>).models,
providers: {
...((cfg as Record<string, unknown>).models as Record<string, unknown> | undefined)
?.providers,
commonstack: {
baseUrl: COMMONSTACK_BASE_URL,
api: "openai-completions",
models: [],
},
},
},
} as OpenClawConfig;
return applyAgentDefaultModelPrimary(updated, COMMONSTACK_DEFAULT_MODEL_REF);
}