mirror of
https://github.com/moltbot/moltbot.git
synced 2026-03-08 06:54:24 +00:00
Feishu: honor configured default account
This commit is contained in:
committed by
Peter Steinberger
parent
ddd71bc9f6
commit
4e4a100038
@@ -33,11 +33,26 @@ describe("resolveDefaultFeishuAccountId", () => {
|
||||
expect(resolveDefaultFeishuAccountId(cfg as never)).toBe("router-d");
|
||||
});
|
||||
|
||||
it("falls back to literal default account id when preferred is missing", () => {
|
||||
it("keeps configured defaultAccount even when not present in accounts map", () => {
|
||||
const cfg = {
|
||||
channels: {
|
||||
feishu: {
|
||||
defaultAccount: "router-d",
|
||||
accounts: {
|
||||
default: { appId: "cli_default", appSecret: "secret_default" },
|
||||
zeta: { appId: "cli_zeta", appSecret: "secret_zeta" },
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
expect(resolveDefaultFeishuAccountId(cfg as never)).toBe("router-d");
|
||||
});
|
||||
|
||||
it("falls back to literal default account id when present", () => {
|
||||
const cfg = {
|
||||
channels: {
|
||||
feishu: {
|
||||
defaultAccount: "missing",
|
||||
accounts: {
|
||||
default: { appId: "cli_default", appSecret: "secret_default" },
|
||||
zeta: { appId: "cli_zeta", appSecret: "secret_zeta" },
|
||||
|
||||
@@ -37,10 +37,10 @@ export function listFeishuAccountIds(cfg: ClawdbotConfig): string[] {
|
||||
export function resolveDefaultFeishuAccountId(cfg: ClawdbotConfig): string {
|
||||
const preferredRaw = (cfg.channels?.feishu as FeishuConfig | undefined)?.defaultAccount?.trim();
|
||||
const preferred = preferredRaw ? normalizeAccountId(preferredRaw) : undefined;
|
||||
const ids = listFeishuAccountIds(cfg);
|
||||
if (preferred && ids.includes(preferred)) {
|
||||
if (preferred) {
|
||||
return preferred;
|
||||
}
|
||||
const ids = listFeishuAccountIds(cfg);
|
||||
if (ids.includes(DEFAULT_ACCOUNT_ID)) {
|
||||
return DEFAULT_ACCOUNT_ID;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user