mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 14:00:47 +00:00
perf(test): avoid bundled channel fallback in model override tests
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { setActivePluginRegistry } from "../plugins/runtime.js";
|
||||
import { resetPluginRuntimeStateForTest, setActivePluginRegistry } from "../plugins/runtime.js";
|
||||
import { createTestRegistry } from "../test-utils/channel-plugins.js";
|
||||
import { createSessionConversationTestRegistry } from "../test-utils/session-conversation-registry.js";
|
||||
import { resolveChannelModelOverride } from "./model-overrides.js";
|
||||
|
||||
describe("resolveChannelModelOverride", () => {
|
||||
beforeEach(() => {
|
||||
resetPluginRuntimeStateForTest();
|
||||
setActivePluginRegistry(createSessionConversationTestRegistry());
|
||||
});
|
||||
|
||||
|
||||
@@ -68,15 +68,15 @@ function buildChannelCandidates(
|
||||
normalizeMessageChannel(params.channel ?? "") ??
|
||||
normalizeOptionalLowercaseString(params.channel);
|
||||
const groupId = normalizeOptionalString(params.groupId);
|
||||
const sessionConversation = resolveSessionConversationRef(params.parentSessionKey);
|
||||
const rawParentConversation = parseRawSessionConversationRef(params.parentSessionKey);
|
||||
const channelPlugin = normalizedChannel ? getChannelPlugin(normalizedChannel) : undefined;
|
||||
const parentOverrideFallbacks =
|
||||
(normalizedChannel
|
||||
? getChannelPlugin(
|
||||
normalizedChannel,
|
||||
)?.conversationBindings?.buildModelOverrideParentCandidates?.({
|
||||
parentConversationId: sessionConversation?.rawId,
|
||||
})
|
||||
: null) ?? [];
|
||||
channelPlugin?.conversationBindings?.buildModelOverrideParentCandidates?.({
|
||||
parentConversationId: rawParentConversation?.rawId,
|
||||
}) ?? [];
|
||||
const sessionConversation = resolveSessionConversationRef(params.parentSessionKey, {
|
||||
bundledFallback: parentOverrideFallbacks.length === 0,
|
||||
});
|
||||
const groupConversationKind =
|
||||
normalizeChatType(params.groupChatType ?? undefined) === "channel"
|
||||
? "channel"
|
||||
|
||||
@@ -54,6 +54,7 @@ function resolveMatrixSingleAccountPromotionTarget(params: {
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
resetPluginRuntimeStateForTest();
|
||||
setActivePluginRegistry(
|
||||
createTestRegistry([
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user