Onboarding: mark GigaChat 2 Max image-capable
This commit is contained in:
parent
6e1e4b23da
commit
8fdece2b52
68
src/commands/onboard-auth.config-core.gigachat.test.ts
Normal file
68
src/commands/onboard-auth.config-core.gigachat.test.ts
Normal file
@ -0,0 +1,68 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { resolveAgentModelPrimaryValue } from "../config/model-input.js";
|
||||
import { applyGigachatConfig, applyGigachatProviderConfig } from "./onboard-auth.config-core.js";
|
||||
import {
|
||||
buildGigachatModelDefinition,
|
||||
GIGACHAT_BASE_URL,
|
||||
GIGACHAT_DEFAULT_CONTEXT_WINDOW,
|
||||
GIGACHAT_DEFAULT_COST,
|
||||
GIGACHAT_DEFAULT_MAX_TOKENS,
|
||||
GIGACHAT_DEFAULT_MODEL_ID,
|
||||
GIGACHAT_DEFAULT_MODEL_REF,
|
||||
} from "./onboard-auth.models.js";
|
||||
|
||||
const emptyCfg: OpenClawConfig = {};
|
||||
|
||||
describe("GigaChat provider config", () => {
|
||||
describe("buildGigachatModelDefinition", () => {
|
||||
it("marks GigaChat 2 Max as image-capable", () => {
|
||||
const model = buildGigachatModelDefinition();
|
||||
|
||||
expect(model.id).toBe(GIGACHAT_DEFAULT_MODEL_ID);
|
||||
expect(model.name).toBe("GigaChat 2 Max");
|
||||
expect(model.reasoning).toBe(false);
|
||||
expect(model.input).toEqual(["text", "image"]);
|
||||
expect(model.contextWindow).toBe(GIGACHAT_DEFAULT_CONTEXT_WINDOW);
|
||||
expect(model.maxTokens).toBe(GIGACHAT_DEFAULT_MAX_TOKENS);
|
||||
expect(model.cost).toEqual(GIGACHAT_DEFAULT_COST);
|
||||
});
|
||||
});
|
||||
|
||||
describe("applyGigachatProviderConfig", () => {
|
||||
it("registers the image-capable default model", () => {
|
||||
const result = applyGigachatProviderConfig(emptyCfg);
|
||||
const provider = result.models?.providers?.gigachat;
|
||||
const model = provider?.models?.find((entry) => entry.id === GIGACHAT_DEFAULT_MODEL_ID);
|
||||
|
||||
expect(provider?.baseUrl).toBe(GIGACHAT_BASE_URL);
|
||||
expect(provider?.api).toBe("openai-completions");
|
||||
expect(model?.input).toEqual(["text", "image"]);
|
||||
});
|
||||
|
||||
it("sets the default GigaChat alias without changing the selected primary model", () => {
|
||||
const cfg: OpenClawConfig = {
|
||||
agents: {
|
||||
defaults: {
|
||||
model: { primary: "openai/gpt-5" },
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const result = applyGigachatProviderConfig(cfg);
|
||||
|
||||
expect(result.agents?.defaults?.models?.[GIGACHAT_DEFAULT_MODEL_REF]?.alias).toBe("GigaChat");
|
||||
expect(resolveAgentModelPrimaryValue(result.agents?.defaults?.model)).toBe("openai/gpt-5");
|
||||
});
|
||||
});
|
||||
|
||||
describe("applyGigachatConfig", () => {
|
||||
it("sets GigaChat as the default model", () => {
|
||||
const result = applyGigachatConfig(emptyCfg);
|
||||
|
||||
expect(resolveAgentModelPrimaryValue(result.agents?.defaults?.model)).toBe(
|
||||
GIGACHAT_DEFAULT_MODEL_REF,
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -234,7 +234,7 @@ export function buildGigachatModelDefinition(): ModelDefinitionConfig {
|
||||
id: GIGACHAT_DEFAULT_MODEL_ID,
|
||||
name: "GigaChat 2 Max",
|
||||
reasoning: false,
|
||||
input: ["text"],
|
||||
input: ["text", "image"],
|
||||
cost: GIGACHAT_DEFAULT_COST,
|
||||
contextWindow: GIGACHAT_DEFAULT_CONTEXT_WINDOW,
|
||||
maxTokens: GIGACHAT_DEFAULT_MAX_TOKENS,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user