mirror of
http://192.168.0.88:13333/lywsvip/openclaw-zero-token.git
synced 2026-06-02 23:23:45 +08:00
Major upgrade from e26988a38 to upstream v2026.3.28 (f9b107928).
Key changes:
- Upstream src/, ui/, extensions/ (89 bundled extensions)
- Zero-token web providers preserved in src/zero-token/
- AskOnce plugin restored and registered as CLI command
- Added missing packages: @anthropic-ai/vertex-sdk, @modelcontextprotocol/sdk
- Fixed tsconfig rootDir, skipLibCheck for plugin-sdk DTS build
- Added askonce to bundled plugin metadata and package.json exports
- Fixed AskOnce CLI command registration (missing commands metadata)
- Restored AskOnce adapter imports (correct 5-level relative paths)
- Removed stale migration artifacts from root directory
66 lines
2.0 KiB
TypeScript
66 lines
2.0 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import type { OpenClawConfig } from "../config/config.js";
|
|
import { resolveChannelModelOverride } from "./model-overrides.js";
|
|
|
|
describe("resolveChannelModelOverride", () => {
|
|
it.each([
|
|
{
|
|
name: "matches parent group id when topic suffix is present",
|
|
input: {
|
|
cfg: {
|
|
channels: {
|
|
modelByChannel: {
|
|
"demo-group": {
|
|
"-100123": "demo-provider/demo-parent-model",
|
|
},
|
|
},
|
|
},
|
|
} as unknown as OpenClawConfig,
|
|
channel: "demo-group",
|
|
groupId: "-100123:topic:99",
|
|
},
|
|
expected: { model: "demo-provider/demo-parent-model", matchKey: "-100123" },
|
|
},
|
|
{
|
|
name: "prefers topic-specific match over parent group id",
|
|
input: {
|
|
cfg: {
|
|
channels: {
|
|
modelByChannel: {
|
|
"demo-group": {
|
|
"-100123": "demo-provider/demo-parent-model",
|
|
"-100123:topic:99": "demo-provider/demo-topic-model",
|
|
},
|
|
},
|
|
},
|
|
} as unknown as OpenClawConfig,
|
|
channel: "demo-group",
|
|
groupId: "-100123:topic:99",
|
|
},
|
|
expected: { model: "demo-provider/demo-topic-model", matchKey: "-100123:topic:99" },
|
|
},
|
|
{
|
|
name: "falls back to parent session key when thread id does not match",
|
|
input: {
|
|
cfg: {
|
|
channels: {
|
|
modelByChannel: {
|
|
"demo-thread": {
|
|
"123": "demo-provider/demo-parent-model",
|
|
},
|
|
},
|
|
},
|
|
} as unknown as OpenClawConfig,
|
|
channel: "demo-thread",
|
|
groupId: "999",
|
|
parentSessionKey: "agent:main:demo-thread:channel:123:thread:456",
|
|
},
|
|
expected: { model: "demo-provider/demo-parent-model", matchKey: "123" },
|
|
},
|
|
] as const)("$name", ({ input, expected }) => {
|
|
const resolved = resolveChannelModelOverride(input);
|
|
expect(resolved?.model).toBe(expected.model);
|
|
expect(resolved?.matchKey).toBe(expected.matchKey);
|
|
});
|
|
});
|