import { callQiaoqiaoAgentApi } from "../tools-common/qiaoqiao-api.js"; import type { ResolvedQiaoqiaoAccount } from "../types.js"; import type { QiaoqiaoDashboardParams } from "./schemas.js"; export async function runDashboardAction( account: ResolvedQiaoqiaoAccount, params: QiaoqiaoDashboardParams, ): Promise { const action = params.action ?? "overview"; const path = action === "comment_stats" ? "/dashboard/comments/stats" : "/dashboard"; const accountConfig = account.config as { apiBase?: string }; const apiBase = accountConfig.apiBase; const data = await callQiaoqiaoAgentApi({ method: "GET", path, appId: account.appId!, appSecret: account.appSecret!, apiBase, }); if (action === "comment_stats") { return { ok: true, action, stats: data, }; } return { ok: true, action, dashboard: data, }; }