Auto Deployer commited on
Commit
d83cbac
·
1 Parent(s): a273844

Expose enterprise agents endpoints

Browse files
Files changed (1) hide show
  1. src/index.ts +15 -6
src/index.ts CHANGED
@@ -303,7 +303,7 @@ function parseScanFindings(scanText: string) {
303
  const AGENT_VERSION = 'v1.0.0';
304
  const PROMPT_VERSION = 'v1.0.0';
305
 
306
- app.post('/api/agents/log-analysis/run', async (req: Request, res: Response, next: NextFunction) => {
307
  try {
308
  const system_name = normString(req.body?.system_name);
309
  const environment = normString(req.body?.environment);
@@ -350,9 +350,9 @@ app.post('/api/agents/log-analysis/run', async (req: Request, res: Response, nex
350
  } catch (error) {
351
  next(error);
352
  }
353
- });
354
 
355
- app.post('/api/agents/code-security/run', async (req: Request, res: Response, next: NextFunction) => {
356
  try {
357
  const repo_name = normString(req.body?.repo_name);
358
  const language = normString(req.body?.language);
@@ -406,9 +406,9 @@ app.post('/api/agents/code-security/run', async (req: Request, res: Response, ne
406
  } catch (error) {
407
  next(error);
408
  }
409
- });
410
 
411
- app.post('/api/agents/regulatory-penalty-summary/run', async (req: Request, res: Response, next: NextFunction) => {
412
  try {
413
  const topic = normString(req.body?.topic);
414
  const industry = normString(req.body?.industry);
@@ -467,7 +467,16 @@ app.post('/api/agents/regulatory-penalty-summary/run', async (req: Request, res:
467
  } catch (error) {
468
  next(error);
469
  }
470
- });
 
 
 
 
 
 
 
 
 
471
 
472
  // 挂载全局错误处理中间件
473
  app.use(errorHandler);
 
303
  const AGENT_VERSION = 'v1.0.0';
304
  const PROMPT_VERSION = 'v1.0.0';
305
 
306
+ const handleLogAnalysis = async (req: Request, res: Response, next: NextFunction) => {
307
  try {
308
  const system_name = normString(req.body?.system_name);
309
  const environment = normString(req.body?.environment);
 
350
  } catch (error) {
351
  next(error);
352
  }
353
+ };
354
 
355
+ const handleCodeSecurity = async (req: Request, res: Response, next: NextFunction) => {
356
  try {
357
  const repo_name = normString(req.body?.repo_name);
358
  const language = normString(req.body?.language);
 
406
  } catch (error) {
407
  next(error);
408
  }
409
+ };
410
 
411
+ const handleRegPenaltySummary = async (req: Request, res: Response, next: NextFunction) => {
412
  try {
413
  const topic = normString(req.body?.topic);
414
  const industry = normString(req.body?.industry);
 
467
  } catch (error) {
468
  next(error);
469
  }
470
+ };
471
+
472
+ app.post('/api/agents/log-analysis', handleLogAnalysis);
473
+ app.post('/api/agents/log-analysis/run', handleLogAnalysis);
474
+
475
+ app.post('/api/agents/code-security', handleCodeSecurity);
476
+ app.post('/api/agents/code-security/run', handleCodeSecurity);
477
+
478
+ app.post('/api/agents/regulatory-penalty-summary', handleRegPenaltySummary);
479
+ app.post('/api/agents/regulatory-penalty-summary/run', handleRegPenaltySummary);
480
 
481
  // 挂载全局错误处理中间件
482
  app.use(errorHandler);