feat(wechat): add news morning draft admin UI and API routes
Expose preview/push controls for daily-news WeChat draft publishing with inline HTML body mode in the Wechat admin page.
This commit is contained in:
@@ -55,6 +55,10 @@ import type {
|
||||
WechatDeliveryLog,
|
||||
WechatDigestSubscription,
|
||||
WechatScheduleLlmConfig,
|
||||
WechatNewsMorningDraftConfig,
|
||||
WechatNewsMorningDraftPreview,
|
||||
WechatNewsMorningDraftRun,
|
||||
WechatNewsMorningDraftTemplate,
|
||||
WechatIntentRouterAdminConfig,
|
||||
WechatIntentRouterConfigState,
|
||||
WechatIntentRouterRuntimeState,
|
||||
@@ -458,6 +462,50 @@ export async function updateWechatScheduleLlmConfig(
|
||||
});
|
||||
}
|
||||
|
||||
export async function getWechatNewsMorningDraftConfig(): Promise<{
|
||||
config: WechatNewsMorningDraftConfig;
|
||||
template: WechatNewsMorningDraftTemplate;
|
||||
}> {
|
||||
return portalFetch('/admin-api/wechat/news-morning-draft/config');
|
||||
}
|
||||
|
||||
export async function patchWechatNewsMorningDraftConfig(
|
||||
patch: Partial<Omit<WechatNewsMorningDraftConfig, 'updatedAt' | 'updatedBy' | 'templateVersion'>>,
|
||||
): Promise<WechatNewsMorningDraftConfig> {
|
||||
const result = await portalFetch<{ config: WechatNewsMorningDraftConfig }>(
|
||||
'/admin-api/wechat/news-morning-draft/config',
|
||||
{
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(patch),
|
||||
},
|
||||
);
|
||||
return result.config;
|
||||
}
|
||||
|
||||
export async function previewWechatNewsMorningDraft(): Promise<WechatNewsMorningDraftPreview> {
|
||||
return portalFetch<WechatNewsMorningDraftPreview>('/admin-api/wechat/news-morning-draft/preview');
|
||||
}
|
||||
|
||||
export async function pushWechatNewsMorningDraft(options?: { dryRun?: boolean }): Promise<{
|
||||
ok?: boolean;
|
||||
dryRun?: boolean;
|
||||
draftMediaId?: string;
|
||||
preview?: WechatNewsMorningDraftPreview;
|
||||
run?: WechatNewsMorningDraftRun;
|
||||
}> {
|
||||
return portalFetch('/admin-api/wechat/news-morning-draft/push', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(options ?? {}),
|
||||
});
|
||||
}
|
||||
|
||||
export async function listWechatNewsMorningDraftRuns(limit = 20): Promise<WechatNewsMorningDraftRun[]> {
|
||||
const result = await portalFetch<{ runs: WechatNewsMorningDraftRun[] }>(
|
||||
`/admin-api/wechat/news-morning-draft/runs?limit=${encodeURIComponent(String(limit))}`,
|
||||
);
|
||||
return result.runs ?? [];
|
||||
}
|
||||
|
||||
export async function getWechatIntentRouterConfig(): Promise<WechatIntentRouterAdminConfig> {
|
||||
const result = await portalFetch<WechatIntentRouterConfigState>('/admin-api/wechat/intent-router/config');
|
||||
return result.config;
|
||||
|
||||
Reference in New Issue
Block a user