feat: bridge asset gateway controls to admin api
This commit is contained in:
@@ -91,6 +91,7 @@ export function createAdminApp(services) {
|
||||
const {
|
||||
userAuth,
|
||||
llmProviderService,
|
||||
assetGatewayConfigService,
|
||||
pool,
|
||||
ready,
|
||||
wechatAdmin,
|
||||
@@ -325,6 +326,33 @@ export function createAdminApp(services) {
|
||||
res.json({ config: result });
|
||||
});
|
||||
|
||||
adminApi.get('/asset-gateway/config', requireAdmin, async (_req, res) => {
|
||||
if (!assetGatewayConfigService?.getConfig) {
|
||||
return res.status(503).json({ message: '资产能力配置服务未启用' });
|
||||
}
|
||||
res.json(await assetGatewayConfigService.getConfig());
|
||||
});
|
||||
|
||||
adminApi.put('/asset-gateway/config', requireAdmin, async (req, res) => {
|
||||
if (!assetGatewayConfigService?.updateGlobalConfig) {
|
||||
return res.status(503).json({ message: '资产能力配置服务未启用' });
|
||||
}
|
||||
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 });
|
||||
res.json(result);
|
||||
});
|
||||
|
||||
adminApi.get('/memory-v2/config', requireAdmin, async (_req, res) => {
|
||||
if (!memoryV2ConfigService) return res.status(503).json({ message: 'Memory V2 配置未启用' });
|
||||
res.json(await memoryV2ConfigService.getAdminConfig());
|
||||
|
||||
@@ -29,6 +29,8 @@ export async function bootstrapAdminServices() {
|
||||
updateMindSpaceConfig,
|
||||
} = await importMemind('mindspace-config.mjs');
|
||||
const { createMemoryV2AdminConfigService } = await importMemind('memory-v2-admin-config.mjs');
|
||||
const { createAssetGatewayConfigService } = await importMemind('asset-gateway.mjs');
|
||||
const { ensureAssetGatewaySchema } = await importMemind('db.mjs');
|
||||
const { createWechatScheduleLlmConfigService } = await importMemind('wechat-schedule-llm-config.mjs');
|
||||
const { createAdminSystemTestService } = await importMemind('admin-system-tests.mjs');
|
||||
const { createOpsApi } = await importMemind('admin-routes.mjs');
|
||||
@@ -86,6 +88,8 @@ export async function bootstrapAdminServices() {
|
||||
apiTarget,
|
||||
apiSecret,
|
||||
});
|
||||
await ensureAssetGatewaySchema(pool);
|
||||
const assetGatewayConfigService = createAssetGatewayConfigService(pool, { llmProviderService });
|
||||
const memoryV2ConfigService = createMemoryV2AdminConfigService(pool, {
|
||||
env: process.env,
|
||||
});
|
||||
@@ -133,6 +137,7 @@ export async function bootstrapAdminServices() {
|
||||
pool,
|
||||
userAuth,
|
||||
llmProviderService,
|
||||
assetGatewayConfigService,
|
||||
plazaOps,
|
||||
createOpsApi,
|
||||
wechatAdmin,
|
||||
|
||||
@@ -98,6 +98,7 @@ ready
|
||||
pool,
|
||||
userAuth,
|
||||
llmProviderService,
|
||||
assetGatewayConfigService,
|
||||
plazaOps,
|
||||
createOpsApi,
|
||||
wechatAdmin,
|
||||
@@ -120,6 +121,7 @@ ready
|
||||
pool,
|
||||
userAuth,
|
||||
llmProviderService,
|
||||
assetGatewayConfigService,
|
||||
plazaOps,
|
||||
createOpsApi,
|
||||
wechatAdmin,
|
||||
|
||||
Reference in New Issue
Block a user