Add Feishu channel adapter with webhook and send path
This commit is contained in:
@@ -608,6 +608,33 @@ describe('configSchema — line', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('configSchema — feishu', () => {
|
||||
const minimalConfig = {
|
||||
telegram: { bot_token: 'test', allowed_chat_ids: [1] },
|
||||
models: { default: { provider: 'anthropic', model: 'claude-3' } },
|
||||
};
|
||||
|
||||
it('accepts feishu config and defaults optional fields', () => {
|
||||
const result = configSchema.parse({
|
||||
...minimalConfig,
|
||||
feishu: {
|
||||
app_id: 'cli_a1b2c3',
|
||||
app_secret: 'secret',
|
||||
},
|
||||
});
|
||||
|
||||
expect(result.feishu).toBeDefined();
|
||||
if (!result.feishu) {
|
||||
throw new Error('Expected feishu config');
|
||||
}
|
||||
expect(result.feishu.app_id).toBe('cli_a1b2c3');
|
||||
expect(result.feishu.app_secret).toBe('secret');
|
||||
expect(result.feishu.allowed_chat_ids).toEqual([]);
|
||||
expect(result.feishu.require_mention).toBe(true);
|
||||
expect(result.feishu.mention_name).toBe('flynn');
|
||||
});
|
||||
});
|
||||
|
||||
describe('configSchema — whatsapp', () => {
|
||||
const minimalConfig = {
|
||||
telegram: { bot_token: 'test', allowed_chat_ids: [1] },
|
||||
|
||||
@@ -511,6 +511,16 @@ const lineSchema = z.object({
|
||||
mention_name: z.string().default('flynn'),
|
||||
}).optional();
|
||||
|
||||
const feishuSchema = z.object({
|
||||
app_id: z.string().min(1, 'Feishu app_id is required'),
|
||||
app_secret: z.string().min(1, 'Feishu app_secret is required'),
|
||||
webhook_token: z.string().optional(),
|
||||
allowed_chat_ids: z.array(z.string()).default([]),
|
||||
require_mention: z.boolean().default(true),
|
||||
mention_name: z.string().default('flynn'),
|
||||
endpoint: z.string().url('Feishu endpoint must be a valid URL').optional(),
|
||||
}).optional();
|
||||
|
||||
const browserSchema = z.object({
|
||||
enabled: z.boolean().default(false),
|
||||
executable_path: z.string().optional(),
|
||||
@@ -691,6 +701,7 @@ export const configSchema = z.object({
|
||||
google_chat: googleChatSchema,
|
||||
bluebubbles: bluebubblesSchema,
|
||||
line: lineSchema,
|
||||
feishu: feishuSchema,
|
||||
server: serverSchema.default({}),
|
||||
models: modelsSchema,
|
||||
backends: backendsSchema.default({}),
|
||||
|
||||
Reference in New Issue
Block a user