feat(wechat): add admin-pluggable LLM intent router separate from H5.
Memind CI / Test, build, and release guards (push) Failing after 8s
Memind CI / Test, build, and release guards (push) Failing after 8s
Give WeChat MP its own chat.general→page.generate LLM refinement layer with memindadm toggles, shadow mode, and canary openids so service account routing stays independent of the H5 chatIntentRouter. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -42,6 +42,7 @@ function plazaRouteError(res, req, error) {
|
||||
* @param {object|null} deps.plazaPosts
|
||||
* @param {object|null} deps.plazaOps
|
||||
* @param {object|null} deps.wechatAdmin
|
||||
* @param {object|null} deps.wechatIntentRouterConfigService
|
||||
*/
|
||||
export function createAdminApi({
|
||||
jsonBody,
|
||||
@@ -64,6 +65,7 @@ export function createAdminApi({
|
||||
plazaPosts,
|
||||
plazaOps,
|
||||
wechatAdmin,
|
||||
wechatIntentRouterConfigService,
|
||||
subscriptionService,
|
||||
}) {
|
||||
function requireAdmin(req, res, next) {
|
||||
@@ -838,6 +840,34 @@ export function createAdminApi({
|
||||
res.json(result);
|
||||
});
|
||||
|
||||
adminApi.get('/wechat/intent-router/config', requireAdmin, async (_req, res) => {
|
||||
if (!wechatIntentRouterConfigService?.getConfig) {
|
||||
return res.status(503).json({ message: '微信意图路由配置未启用' });
|
||||
}
|
||||
const config = await wechatIntentRouterConfigService.getConfig();
|
||||
return res.json({ config });
|
||||
});
|
||||
|
||||
adminApi.get('/wechat/intent-router/runtime', requireAdmin, async (_req, res) => {
|
||||
if (!wechatIntentRouterConfigService?.getRuntimeState) {
|
||||
return res.status(503).json({ message: '微信意图路由配置未启用' });
|
||||
}
|
||||
return res.json(await wechatIntentRouterConfigService.getRuntimeState());
|
||||
});
|
||||
|
||||
const updateWechatIntentRouterConfig = async (req, res) => {
|
||||
if (!wechatIntentRouterConfigService?.updateConfig) {
|
||||
return res.status(503).json({ message: '微信意图路由配置未启用' });
|
||||
}
|
||||
const config = await wechatIntentRouterConfigService.updateConfig(req.body ?? {}, {
|
||||
updatedBy: req.currentUser.id,
|
||||
});
|
||||
return res.json({ config });
|
||||
};
|
||||
|
||||
adminApi.put('/wechat/intent-router/config', requireAdmin, updateWechatIntentRouterConfig);
|
||||
adminApi.patch('/wechat/intent-router/config', requireAdmin, updateWechatIntentRouterConfig);
|
||||
|
||||
adminApi.get('/llm-providers/catalog', requireAdmin, (_req, res) => {
|
||||
if (!llmProviderService) return res.status(503).json({ message: '未启用 LLM 配置' });
|
||||
res.json({ catalog: llmProviderService.catalog });
|
||||
|
||||
Reference in New Issue
Block a user