mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-01 18:00:21 +00:00
fix: honor qqbot setup account status
This commit is contained in:
@@ -73,9 +73,11 @@ export const qqbotSetupWizard: ChannelSetupWizard = {
|
||||
unconfiguredHint: "needs AppID + AppSecret",
|
||||
configuredScore: 1,
|
||||
unconfiguredScore: 6,
|
||||
resolveConfigured: ({ cfg }) =>
|
||||
listQQBotAccountIds(cfg).some((accountId) => {
|
||||
const account = resolveQQBotAccount(cfg, accountId, { allowUnresolvedSecretRef: true });
|
||||
resolveConfigured: ({ cfg, accountId }) =>
|
||||
(accountId ? [accountId] : listQQBotAccountIds(cfg)).some((resolvedAccountId) => {
|
||||
const account = resolveQQBotAccount(cfg, resolvedAccountId, {
|
||||
allowUnresolvedSecretRef: true,
|
||||
});
|
||||
return Boolean(
|
||||
account.appId &&
|
||||
(Boolean(account.clientSecret) ||
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { createPluginSetupWizardStatus } from "../../../test/helpers/plugins/setup-wizard.js";
|
||||
import { qqbotSetupPlugin } from "./channel.setup.js";
|
||||
import { DEFAULT_ACCOUNT_ID } from "./config.js";
|
||||
import { qqbotSetupWizard } from "./setup-surface.js";
|
||||
|
||||
const getQQBotSetupStatus = createPluginSetupWizardStatus(qqbotSetupPlugin);
|
||||
|
||||
describe("qqbot setup", () => {
|
||||
it("treats SecretRef-backed default accounts as configured", () => {
|
||||
const configured = qqbotSetupWizard.status.resolveConfigured?.({
|
||||
@@ -43,6 +46,34 @@ describe("qqbot setup", () => {
|
||||
expect(configured).toBe(true);
|
||||
});
|
||||
|
||||
it("setup status honors the selected named account", async () => {
|
||||
const status = await getQQBotSetupStatus({
|
||||
cfg: {
|
||||
channels: {
|
||||
qqbot: {
|
||||
appId: "123456",
|
||||
clientSecret: {
|
||||
source: "env",
|
||||
provider: "default",
|
||||
id: "QQBOT_CLIENT_SECRET",
|
||||
},
|
||||
accounts: {
|
||||
bot2: {
|
||||
appId: "654321",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
} as OpenClawConfig,
|
||||
accountOverrides: {
|
||||
qqbot: "bot2",
|
||||
},
|
||||
});
|
||||
|
||||
expect(status.configured).toBe(false);
|
||||
expect(status.statusLines).toEqual(["QQ Bot: needs AppID + AppSecret"]);
|
||||
});
|
||||
|
||||
it("marks unresolved SecretRef accounts as configured in setup-only plugin status", () => {
|
||||
const cfg = {
|
||||
channels: {
|
||||
|
||||
Reference in New Issue
Block a user