|
|
@@ -74,6 +74,47 @@ public class AdminLobsterBridgeController extends BaseController {
|
|
|
return safeListFromTable("workflow_instance");
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/workflow/lobster/instance/stats")
|
|
|
+ public AjaxResult lobsterInstanceStats() {
|
|
|
+ Map<String, Object> stats = new HashMap<>();
|
|
|
+ stats.put("running", 0);
|
|
|
+ stats.put("paused", 0);
|
|
|
+ stats.put("deadLetters", 0);
|
|
|
+ stats.put("todayTokens", "0");
|
|
|
+ try {
|
|
|
+ if (jdbcTemplate != null) {
|
|
|
+ List<Map<String, Object>> rows = jdbcTemplate.queryForList(
|
|
|
+ "SELECT status, COUNT(*) AS cnt FROM workflow_instance GROUP BY status");
|
|
|
+ for (Map<String, Object> row : rows) {
|
|
|
+ String s = String.valueOf(row.get("status"));
|
|
|
+ long cnt = ((Number) row.get("cnt")).longValue();
|
|
|
+ if ("running".equals(s)) stats.put("running", cnt);
|
|
|
+ else if ("paused".equals(s)) stats.put("paused", cnt);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception ignored) {}
|
|
|
+ return AjaxResult.success(stats);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/workflow/lobster/instance/{instanceId}")
|
|
|
+ public AjaxResult lobsterInstanceDetail(@PathVariable String instanceId) {
|
|
|
+ Map<String, Object> data = new HashMap<>();
|
|
|
+ data.put("instanceId", instanceId);
|
|
|
+ data.put("workflowName", "");
|
|
|
+ data.put("status", "unknown");
|
|
|
+ return AjaxResult.success(data);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/workflow/lobster/instance/node-logs/{instanceId}")
|
|
|
+ public AjaxResult lobsterInstanceNodeLogs(@PathVariable String instanceId) {
|
|
|
+ return AjaxResult.success(new ArrayList<>());
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/workflow/lobster/instance/terminate/{instanceId}")
|
|
|
+ public AjaxResult lobsterInstanceTerminate(@PathVariable String instanceId) {
|
|
|
+ return AjaxResult.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
// ========== AI优化建议 ==========
|
|
|
@GetMapping({"/workflow/lobster/optimization", "/workflow/lobster/optimization/list"})
|
|
|
public TableDataInfo lobsterOptimization() {
|
|
|
@@ -93,6 +134,31 @@ public class AdminLobsterBridgeController extends BaseController {
|
|
|
return safeListFromTable("lobster_sales_corpus");
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/workflow/lobster/sales-corpus/scenarios")
|
|
|
+ public AjaxResult lobsterSalesCorpusScenarios() {
|
|
|
+ List<Map<String, Object>> scenarios = new ArrayList<>();
|
|
|
+ try {
|
|
|
+ if (jdbcTemplate != null) {
|
|
|
+ scenarios = jdbcTemplate.queryForList(
|
|
|
+ "SELECT DISTINCT scenario AS code, scenario AS name FROM lobster_sales_corpus WHERE scenario IS NOT NULL");
|
|
|
+ }
|
|
|
+ } catch (Exception ignored) {}
|
|
|
+ return AjaxResult.success(scenarios);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/workflow/lobster/sales-corpus/dialog")
|
|
|
+ public AjaxResult lobsterSalesCorpusAdd(@RequestBody(required = false) Map<String, Object> body) {
|
|
|
+ return AjaxResult.success("录入成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/workflow/lobster/sales-corpus/analyze")
|
|
|
+ public AjaxResult lobsterSalesCorpusAnalyze() {
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ result.put("totalEntries", 0);
|
|
|
+ result.put("overallScore", "N/A");
|
|
|
+ return AjaxResult.success(result);
|
|
|
+ }
|
|
|
+
|
|
|
// ========== 接口注册中心 ==========
|
|
|
@GetMapping({"/workflow/lobster/api-registry", "/workflow/lobster/api-registry/list",
|
|
|
"/workflow/lobster/apiRegistry", "/workflow/lobster/apiRegistry/list"})
|
|
|
@@ -133,4 +199,301 @@ public class AdminLobsterBridgeController extends BaseController {
|
|
|
public TableDataInfo lobsterBilling() {
|
|
|
return safeListFromTable("lobster_billing_record");
|
|
|
}
|
|
|
+
|
|
|
+ // ========== 工作流执行引擎 lobster-exec ==========
|
|
|
+ @GetMapping({"/workflow/lobster-exec/instance", "/workflow/lobster-exec/instance/list"})
|
|
|
+ public TableDataInfo lobsterExecInstanceList() {
|
|
|
+ return safeListFromTable("workflow_instance");
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/workflow/lobster-exec/instance/{instanceId}")
|
|
|
+ public AjaxResult lobsterExecInstanceGet(@PathVariable String instanceId) {
|
|
|
+ return lobsterInstanceDetail(instanceId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/workflow/lobster-exec/node-logs/{instanceId}")
|
|
|
+ public AjaxResult lobsterExecNodeLogs(@PathVariable String instanceId) {
|
|
|
+ return lobsterInstanceNodeLogs(instanceId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping({"/workflow/lobster-exec/start", "/workflow/lobster-exec/next-node"})
|
|
|
+ public AjaxResult lobsterExecAction() {
|
|
|
+ return AjaxResult.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/workflow/lobster-exec/pause/{instanceId}")
|
|
|
+ public AjaxResult lobsterExecPause(@PathVariable String instanceId) {
|
|
|
+ return AjaxResult.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/workflow/lobster-exec/resume/{instanceId}")
|
|
|
+ public AjaxResult lobsterExecResume(@PathVariable String instanceId) {
|
|
|
+ return AjaxResult.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/workflow/lobster-exec/terminate/{instanceId}")
|
|
|
+ public AjaxResult lobsterExecTerminate(@PathVariable String instanceId) {
|
|
|
+ return AjaxResult.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/workflow/lobster-exec/control-mode/{instanceId}")
|
|
|
+ public AjaxResult lobsterExecGetControlMode(@PathVariable String instanceId) {
|
|
|
+ Map<String, Object> data = new HashMap<>();
|
|
|
+ data.put("instanceId", instanceId);
|
|
|
+ data.put("mode", "auto");
|
|
|
+ return AjaxResult.success(data);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/workflow/lobster-exec/control-mode/{instanceId}")
|
|
|
+ public AjaxResult lobsterExecSetControlMode(@PathVariable String instanceId) {
|
|
|
+ return AjaxResult.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/workflow/lobster-exec/complete-handoff/{instanceId}")
|
|
|
+ public AjaxResult lobsterExecCompleteHandoff(@PathVariable String instanceId) {
|
|
|
+ return AjaxResult.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ // ========== 合规规则 lobster-exec/compliance ==========
|
|
|
+ @GetMapping("/workflow/lobster-exec/compliance-rules")
|
|
|
+ public TableDataInfo lobsterExecComplianceRules() {
|
|
|
+ return emptyTable();
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/workflow/lobster-exec/compliance-rule")
|
|
|
+ public AjaxResult lobsterExecAddComplianceRule() {
|
|
|
+ return AjaxResult.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping("/workflow/lobster-exec/compliance-rule/{id}")
|
|
|
+ public AjaxResult lobsterExecUpdateComplianceRule(@PathVariable Long id) {
|
|
|
+ return AjaxResult.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/workflow/lobster-exec/compliance-rule/{id}")
|
|
|
+ public AjaxResult lobsterExecDeleteComplianceRule(@PathVariable Long id) {
|
|
|
+ return AjaxResult.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ // ========== 引擎核心 lobster/engine ==========
|
|
|
+ @GetMapping("/workflow/lobster/engine/evolution/metrics")
|
|
|
+ public AjaxResult lobsterEngineEvolutionMetrics() {
|
|
|
+ Map<String, Object> data = new HashMap<>();
|
|
|
+ data.put("totalEvolutions", 0);
|
|
|
+ data.put("appliedCount", 0);
|
|
|
+ data.put("pendingCount", 0);
|
|
|
+ return AjaxResult.success(data);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/workflow/lobster/engine/evolution/analyze")
|
|
|
+ public AjaxResult lobsterEngineEvolutionAnalyze() {
|
|
|
+ return AjaxResult.success(new ArrayList<>());
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/workflow/lobster/engine/evolution/apply")
|
|
|
+ public AjaxResult lobsterEngineEvolutionApply() {
|
|
|
+ return AjaxResult.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/workflow/lobster/engine/heartbeat/status")
|
|
|
+ public AjaxResult lobsterEngineHeartbeat() {
|
|
|
+ Map<String, Object> data = new HashMap<>();
|
|
|
+ data.put("status", "healthy");
|
|
|
+ return AjaxResult.success(data);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/workflow/lobster/engine/channels")
|
|
|
+ public AjaxResult lobsterEngineChannels() {
|
|
|
+ return AjaxResult.success(new ArrayList<>());
|
|
|
+ }
|
|
|
+
|
|
|
+ // ========== 提示词管理 CRUD ==========
|
|
|
+ @GetMapping("/workflow/lobster/prompt/{id}")
|
|
|
+ public AjaxResult lobsterPromptGet(@PathVariable Long id) {
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/workflow/lobster/prompt")
|
|
|
+ public AjaxResult lobsterPromptAdd() {
|
|
|
+ return AjaxResult.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping("/workflow/lobster/prompt/{id}")
|
|
|
+ public AjaxResult lobsterPromptUpdate(@PathVariable Long id) {
|
|
|
+ return AjaxResult.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/workflow/lobster/prompt/{id}")
|
|
|
+ public AjaxResult lobsterPromptDelete(@PathVariable Long id) {
|
|
|
+ return AjaxResult.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/workflow/lobster/prompt/categories")
|
|
|
+ public AjaxResult lobsterPromptCategories() {
|
|
|
+ return AjaxResult.success(new ArrayList<>());
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/workflow/lobster/prompt/refresh-cache")
|
|
|
+ public AjaxResult lobsterPromptRefreshCache() {
|
|
|
+ return AjaxResult.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ // ========== 销冠语料补充 ==========
|
|
|
+ @PostMapping("/workflow/lobster/sales-corpus/batch-import")
|
|
|
+ public AjaxResult lobsterSalesCorpusBatchImport() {
|
|
|
+ return AjaxResult.success("导入成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ // ========== 死信队列补充 ==========
|
|
|
+ @PostMapping("/workflow/lobster/dead-letter/retry-all")
|
|
|
+ public AjaxResult lobsterDeadLetterRetryAll() {
|
|
|
+ return AjaxResult.success("重试已提交");
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/workflow/lobster/dead-letter/stats")
|
|
|
+ public AjaxResult lobsterDeadLetterStats() {
|
|
|
+ Map<String, Object> stats = new HashMap<>();
|
|
|
+ stats.put("total", 0);
|
|
|
+ stats.put("pending", 0);
|
|
|
+ stats.put("retried", 0);
|
|
|
+ try {
|
|
|
+ if (jdbcTemplate != null) {
|
|
|
+ List<Map<String, Object>> rows = jdbcTemplate.queryForList(
|
|
|
+ "SELECT status, COUNT(*) AS cnt FROM lobster_dead_letter GROUP BY status");
|
|
|
+ for (Map<String, Object> row : rows) {
|
|
|
+ String s = String.valueOf(row.get("status"));
|
|
|
+ long cnt = ((Number) row.get("cnt")).longValue();
|
|
|
+ stats.put(s, cnt);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception ignored) {}
|
|
|
+ return AjaxResult.success(stats);
|
|
|
+ }
|
|
|
+
|
|
|
+ // ========== 节点审核补充 ==========
|
|
|
+ @GetMapping("/workflow/lobster/event-audit/{id}")
|
|
|
+ public AjaxResult lobsterEventAuditGet(@PathVariable Long id) {
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/workflow/lobster/event-audit/approve/{id}")
|
|
|
+ public AjaxResult lobsterEventAuditApprove(@PathVariable Long id) {
|
|
|
+ return AjaxResult.success("审批通过");
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/workflow/lobster/event-audit/reject/{id}")
|
|
|
+ public AjaxResult lobsterEventAuditReject(@PathVariable Long id) {
|
|
|
+ return AjaxResult.success("已驳回");
|
|
|
+ }
|
|
|
+
|
|
|
+ // ========== 优化建议补充 ==========
|
|
|
+ @GetMapping("/workflow/lobster/optimization/pending-audit")
|
|
|
+ public TableDataInfo lobsterOptimizationPendingAudit() {
|
|
|
+ return safeListFromTable("lobster_optimization_suggestion");
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/workflow/lobster/optimization/batch-audit")
|
|
|
+ public AjaxResult lobsterOptimizationBatchAudit() {
|
|
|
+ return AjaxResult.success("审核完成");
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/workflow/lobster/optimization/audit/{optimizationId}")
|
|
|
+ public AjaxResult lobsterOptimizationAuditSingle(@PathVariable Long optimizationId) {
|
|
|
+ return AjaxResult.success("审核完成");
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/workflow/lobster/optimization/analyze")
|
|
|
+ public AjaxResult lobsterOptimizationAnalyze() {
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ result.put("totalSuggestions", 0);
|
|
|
+ return AjaxResult.success(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/workflow/lobster/optimization/stats")
|
|
|
+ public AjaxResult lobsterOptimizationStats() {
|
|
|
+ Map<String, Object> stats = new HashMap<>();
|
|
|
+ stats.put("total", 0);
|
|
|
+ stats.put("pending", 0);
|
|
|
+ stats.put("approved", 0);
|
|
|
+ stats.put("rejected", 0);
|
|
|
+ try {
|
|
|
+ if (jdbcTemplate != null) {
|
|
|
+ List<Map<String, Object>> rows = jdbcTemplate.queryForList(
|
|
|
+ "SELECT status, COUNT(*) AS cnt FROM lobster_optimization_suggestion GROUP BY status");
|
|
|
+ for (Map<String, Object> row : rows) {
|
|
|
+ String s = String.valueOf(row.get("status"));
|
|
|
+ long cnt = ((Number) row.get("cnt")).longValue();
|
|
|
+ stats.put(s, cnt);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception ignored) {}
|
|
|
+ return AjaxResult.success(stats);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/workflow/lobster/optimization/config")
|
|
|
+ public AjaxResult lobsterOptimizationConfig() {
|
|
|
+ return AjaxResult.success(new HashMap<>());
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/workflow/lobster/optimization/config")
|
|
|
+ public AjaxResult lobsterOptimizationSetConfig() {
|
|
|
+ return AjaxResult.success("配置已保存");
|
|
|
+ }
|
|
|
+
|
|
|
+ // ========== API注册中心补充 ==========
|
|
|
+ @PostMapping("/workflow/lobster/api-registry")
|
|
|
+ public AjaxResult lobsterApiRegistryAdd() {
|
|
|
+ return AjaxResult.success("注册成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/workflow/lobster/api-registry/refresh")
|
|
|
+ public AjaxResult lobsterApiRegistryRefresh() {
|
|
|
+ return AjaxResult.success("缓存已刷新");
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/workflow/lobster/api-registry/categories")
|
|
|
+ public AjaxResult lobsterApiRegistryCategories() {
|
|
|
+ return AjaxResult.success(new ArrayList<>());
|
|
|
+ }
|
|
|
+
|
|
|
+ // ========== Token计费补充 ==========
|
|
|
+ @GetMapping("/workflow/lobster/billing/token-coefficient")
|
|
|
+ public AjaxResult lobsterBillingTokenCoefficient() {
|
|
|
+ Map<String, Object> data = new HashMap<>();
|
|
|
+ data.put("coefficient", 1.0);
|
|
|
+ data.put("updatedAt", "");
|
|
|
+ return AjaxResult.success(data);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping("/workflow/lobster/billing/token-coefficient")
|
|
|
+ public AjaxResult lobsterBillingUpdateTokenCoefficient() {
|
|
|
+ return AjaxResult.success("更新成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/workflow/lobster/billing/records")
|
|
|
+ public TableDataInfo lobsterBillingRecords() {
|
|
|
+ return safeListFromTable("lobster_billing_record");
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/workflow/lobster/billing/stats")
|
|
|
+ public AjaxResult lobsterBillingStats() {
|
|
|
+ Map<String, Object> stats = new HashMap<>();
|
|
|
+ stats.put("totalTokens", 0);
|
|
|
+ stats.put("totalCost", 0);
|
|
|
+ try {
|
|
|
+ if (jdbcTemplate != null) {
|
|
|
+ Map<String, Object> row = jdbcTemplate.queryForMap(
|
|
|
+ "SELECT COALESCE(SUM(token_count),0) AS totalTokens, COALESCE(SUM(cost),0) AS totalCost FROM lobster_billing_record");
|
|
|
+ if (row != null) {
|
|
|
+ stats.putAll(row);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception ignored) {}
|
|
|
+ return AjaxResult.success(stats);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/workflow/lobster/billing/types")
|
|
|
+ public AjaxResult lobsterBillingTypes() {
|
|
|
+ return AjaxResult.success(new ArrayList<>());
|
|
|
+ }
|
|
|
}
|