feat: wire feishu into app and cli

Signed-off-by: Asklv <boironic@gmail.com>
This commit is contained in:
Asklv
2026-03-03 10:16:00 +08:00
parent 56c6db438a
commit 0072906d9f
2 changed files with 45 additions and 2 deletions

View File

@@ -1,7 +1,8 @@
#include "serial_cli.h"
#include "mimi_config.h"
#include "wifi/wifi_manager.h"
#include "telegram/telegram_bot.h"
#include "channels/telegram/telegram_bot.h"
#include "channels/feishu/feishu_bot.h"
#include "llm/llm_proxy.h"
#include "memory/memory_store.h"
#include "memory/session_mgr.h"
@@ -72,6 +73,26 @@ static int cmd_set_tg_token(int argc, char **argv)
return 0;
}
/* --- set_feishu_creds command --- */
static struct {
struct arg_str *app_id;
struct arg_str *app_secret;
struct arg_end *end;
} feishu_creds_args;
static int cmd_set_feishu_creds(int argc, char **argv)
{
int nerrors = arg_parse(argc, argv, (void **)&feishu_creds_args);
if (nerrors != 0) {
arg_print_errors(stderr, feishu_creds_args.end, argv[0]);
return 1;
}
feishu_set_credentials(feishu_creds_args.app_id->sval[0],
feishu_creds_args.app_secret->sval[0]);
printf("Feishu credentials saved.\n");
return 0;
}
/* --- set_api_key command --- */
static struct {
struct arg_str *key;
@@ -619,6 +640,18 @@ esp_err_t serial_cli_init(void)
};
esp_console_cmd_register(&tg_token_cmd);
/* set_feishu_creds */
feishu_creds_args.app_id = arg_str1(NULL, NULL, "<app_id>", "Feishu App ID");
feishu_creds_args.app_secret = arg_str1(NULL, NULL, "<app_secret>", "Feishu App Secret");
feishu_creds_args.end = arg_end(2);
esp_console_cmd_t feishu_creds_cmd = {
.command = "set_feishu_creds",
.help = "Set Feishu app credentials (app_id app_secret)",
.func = &cmd_set_feishu_creds,
.argtable = &feishu_creds_args,
};
esp_console_cmd_register(&feishu_creds_cmd);
/* set_api_key */
api_key_args.key = arg_str1(NULL, NULL, "<key>", "LLM API key");
api_key_args.end = arg_end(1);