feat: add optional asset gateway control plane

This commit is contained in:
john
2026-07-12 09:51:13 +08:00
parent 03a79322e4
commit f4d9897072
8 changed files with 449 additions and 1 deletions
+28
View File
@@ -42,6 +42,7 @@ export function createAdminApi({
ready,
userAuth,
llmProviderService,
assetGatewayConfigService,
memoryV2ConfigService,
adminSystemTestService,
plazaPosts,
@@ -91,6 +92,33 @@ export function createAdminApi({
res.json({ summary: { ...summary, llm } });
});
adminApi.get('/asset-gateway/config', requireAdmin, async (_req, res) => {
if (!assetGatewayConfigService?.getConfig) {
return res.status(503).json({ message: '资产能力配置服务未启用' });
}
return res.json(await assetGatewayConfigService.getConfig());
});
adminApi.put('/asset-gateway/config', requireAdmin, async (req, res) => {
if (!assetGatewayConfigService?.updateGlobalConfig) {
return res.status(503).json({ message: '资产能力配置服务未启用' });
}
return res.json(await assetGatewayConfigService.updateGlobalConfig(req.body ?? {}, {
updatedBy: req.currentUser.id,
}));
});
adminApi.put('/asset-gateway/plugins/:pluginId', requireAdmin, async (req, res) => {
if (!assetGatewayConfigService?.updatePluginConfig) {
return res.status(503).json({ message: '资产能力配置服务未启用' });
}
const result = await assetGatewayConfigService.updatePluginConfig(req.params.pluginId, req.body ?? {}, {
updatedBy: req.currentUser.id,
});
if (!result.ok) return res.status(400).json({ message: result.message });
return res.json(result);
});
adminApi.get('/memory-v2/config', requireAdmin, async (_req, res) => {
if (!memoryV2ConfigService?.getAdminConfig) {
return res.status(503).json({ message: 'Memory V2 配置服务未启用' });