






















@@ -127,7 +127,7 @@ const STORE_PATH = path.join(
127127const SESSION_KEY = "agent:main:main";
128128let findCommandByNativeName: typeof import("openclaw/plugin-sdk/command-auth").findCommandByNativeName;
129129let resolveCommandArgChoices: typeof import("openclaw/plugin-sdk/command-auth").resolveCommandArgChoices;
130-let resolveDiscordNativeChoiceContext: typeof import("./native-command-ui.js").resolveDiscordNativeChoiceContext;
130+let resolveDiscordNativeChoiceContext: typeof import("./native-command-model-picker-ui.js").resolveDiscordNativeChoiceContext;
131131132132function installProviderThinkingRegistryForTest(): void {
133133const registry = createEmptyPluginRegistry();
@@ -165,10 +165,9 @@ function installProviderThinkingRegistryForTest(): void {
165165}
166166167167async function loadDiscordThinkAutocompleteModulesForTest() {
168-vi.resetModules();
169168installProviderThinkingRegistryForTest();
170169const commandAuth = await import("openclaw/plugin-sdk/command-auth");
171-const nativeCommandUi = await import("./native-command-ui.js");
170+const nativeCommandUi = await import("./native-command-model-picker-ui.js");
172171return {
173172findCommandByNativeName: commandAuth.findCommandByNativeName,
174173resolveCommandArgChoices: commandAuth.resolveCommandArgChoices,
@@ -265,12 +264,14 @@ describe("discord native /think autocomplete", () => {
265264channel: { id: "D1", type: ChannelType.DM },
266265user: { id: "U1" },
267266guild: undefined,
268-client: {},
267+client: { fetchChannel: async () => ({ id: "D1", type: ChannelType.DM }) },
269268} as unknown as AutocompleteInteraction & {
270269respond: (choices: Array<{ name: string; value: string }>) => Promise<void>;
271270};
272271273-const command = findCommandByNativeName("think", "discord");
272+const command = findCommandByNativeName("think", "discord", {
273+includeBundledChannelFallback: false,
274+});
274275expect(command).toBeTruthy();
275276const levelArg = command?.args?.find((entry) => entry.name === "level");
276277expect(levelArg).toBeTruthy();
@@ -295,6 +296,7 @@ describe("discord native /think autocomplete", () => {
295296 cfg,
296297provider: context?.provider,
297298model: context?.model,
299+catalog: [],
298300});
299301const values = choices.map((choice) => choice.value);
300302expect(values).toContain("xhigh");
@@ -333,7 +335,7 @@ describe("discord native /think autocomplete", () => {
333335channel: { id: "C1", type: ChannelType.GuildText },
334336user: { id: "U1" },
335337guild: { id: "G1" },
336-client: {},
338+client: { fetchChannel: async () => ({ id: "C1", type: ChannelType.GuildText }) },
337339} as unknown as AutocompleteInteraction & {
338340respond: (choices: Array<{ name: string; value: string }>) => Promise<void>;
339341};
@@ -344,7 +346,9 @@ describe("discord native /think autocomplete", () => {
344346accountId: "default",
345347threadBindings: createNoopThreadBindingManager("default"),
346348});
347-const command = findCommandByNativeName("think", "discord");
349+const command = findCommandByNativeName("think", "discord", {
350+includeBundledChannelFallback: false,
351+});
348352const levelArg = command?.args?.find((entry) => entry.name === "level");
349353expect(command).toBeTruthy();
350354expect(levelArg).toBeTruthy();
@@ -358,6 +362,7 @@ describe("discord native /think autocomplete", () => {
358362 cfg,
359363provider: context?.provider,
360364model: context?.model,
365+catalog: [],
361366});
362367const values = choices.map((choice) => choice.value);
363368expect(values).toContain("max");
@@ -381,7 +386,7 @@ describe("discord native /think autocomplete", () => {
381386channel: { id: "C1", type: ChannelType.GuildText },
382387user: { id: "U1" },
383388guild: { id: "G1" },
384-client: {},
389+client: { fetchChannel: async () => ({ id: "C1", type: ChannelType.GuildText }) },
385390} as unknown as AutocompleteInteraction & {
386391respond: (choices: Array<{ name: string; value: string }>) => Promise<void>;
387392};
@@ -396,7 +401,9 @@ describe("discord native /think autocomplete", () => {
396401expect(context).toBeNull();
397402expect(ensureConfiguredBindingRouteReadyMock).toHaveBeenCalledTimes(1);
398403399-const command = findCommandByNativeName("think", "discord");
404+const command = findCommandByNativeName("think", "discord", {
405+includeBundledChannelFallback: false,
406+});
400407const levelArg = command?.args?.find((entry) => entry.name === "level");
401408expect(command).toBeTruthy();
402409expect(levelArg).toBeTruthy();
@@ -409,6 +416,7 @@ describe("discord native /think autocomplete", () => {
409416 cfg,
410417provider: context?.provider,
411418model: context?.model,
419+catalog: [],
412420});
413421const values = choices.map((choice) => choice.value);
414422expect(values).not.toContain("xhigh");
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。