From 63b01db83d9aad8a15276b4236a9a22e4aeef065 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期二, 05 五月 2026 12:30:59 +0800
Subject: [PATCH] # Agent数据分析V3.0.1.7
---
src/main/java/com/zy/ai/controller/LlmRouteConfigController.java | 44 +++++++++++++++++++++++++++++---------------
1 files changed, 29 insertions(+), 15 deletions(-)
diff --git a/src/main/java/com/zy/ai/controller/LlmRouteConfigController.java b/src/main/java/com/zy/ai/controller/LlmRouteConfigController.java
index 43c7453..8753554 100644
--- a/src/main/java/com/zy/ai/controller/LlmRouteConfigController.java
+++ b/src/main/java/com/zy/ai/controller/LlmRouteConfigController.java
@@ -1,6 +1,6 @@
package com.zy.ai.controller;
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.core.annotations.ManagerAuth;
import com.core.common.R;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -33,9 +33,9 @@
@GetMapping("/list/auth")
@ManagerAuth
public R list() {
- EntityWrapper<LlmRouteConfig> wrapper = new EntityWrapper<>();
- wrapper.orderBy("priority", true).orderBy("id", true);
- List<LlmRouteConfig> list = llmRouteConfigService.selectList(wrapper);
+ QueryWrapper<LlmRouteConfig> wrapper = new QueryWrapper<>();
+ wrapper.orderBy(true, true, "priority").orderBy(true, true, "id");
+ List<LlmRouteConfig> list = llmRouteConfigService.list(wrapper);
return R.ok(list);
}
@@ -52,9 +52,9 @@
if (config.getId() == null) {
llmRoutingService.fillAndNormalize(config, true);
- llmRouteConfigService.insert(config);
+ llmRouteConfigService.save(config);
} else {
- LlmRouteConfig db = llmRouteConfigService.selectById(config.getId());
+ LlmRouteConfig db = llmRouteConfigService.getById(config.getId());
if (db == null) {
return R.error("閰嶇疆涓嶅瓨鍦�");
}
@@ -87,7 +87,7 @@
if (id == null) {
return R.error("id涓嶈兘涓虹┖");
}
- llmRouteConfigService.deleteById(id);
+ llmRouteConfigService.removeById(id);
llmRoutingService.evictCache();
return R.ok();
}
@@ -98,7 +98,7 @@
if (id == null) {
return R.error("id涓嶈兘涓虹┖");
}
- LlmRouteConfig cfg = llmRouteConfigService.selectById(id);
+ LlmRouteConfig cfg = llmRouteConfigService.getById(id);
if (cfg == null) {
return R.error("閰嶇疆涓嶅瓨鍦�");
}
@@ -121,7 +121,7 @@
}
Map<String, Object> data = llmRoutingService.testRoute(config);
if (Boolean.TRUE.equals(data.get("ok")) && config.getId() != null) {
- LlmRouteConfig db = llmRouteConfigService.selectById(config.getId());
+ LlmRouteConfig db = llmRouteConfigService.getById(config.getId());
if (db != null) {
db.setCooldownUntil(null);
db.setConsecutiveFailCount(0);
@@ -136,9 +136,9 @@
@GetMapping("/export/auth")
@ManagerAuth
public R exportConfig() {
- EntityWrapper<LlmRouteConfig> wrapper = new EntityWrapper<>();
- wrapper.orderBy("priority", true).orderBy("id", true);
- List<LlmRouteConfig> list = llmRouteConfigService.selectList(wrapper);
+ QueryWrapper<LlmRouteConfig> wrapper = new QueryWrapper<>();
+ wrapper.orderBy(true, true, "priority").orderBy(true, true, "id");
+ List<LlmRouteConfig> list = llmRouteConfigService.list(wrapper);
List<Map<String, Object>> routes = new ArrayList<>();
if (list != null) {
for (LlmRouteConfig cfg : list) {
@@ -198,9 +198,16 @@
}
cfg.setName(trim(cfg.getName()));
+ cfg.setProviderType(trim(cfg.getProviderType()));
+ cfg.setProtocolType(trim(cfg.getProtocolType()));
cfg.setBaseUrl(trim(cfg.getBaseUrl()));
+ cfg.setEndpointPath(trim(cfg.getEndpointPath()));
cfg.setApiKey(trim(cfg.getApiKey()));
+ cfg.setAuthType(trim(cfg.getAuthType()));
+ cfg.setAuthHeaderName(trim(cfg.getAuthHeaderName()));
cfg.setModel(trim(cfg.getModel()));
+ cfg.setCapabilities(trim(cfg.getCapabilities()));
+ cfg.setRequestOptions(trim(cfg.getRequestOptions()));
cfg.setMemo(trim(cfg.getMemo()));
if (isBlank(cfg.getBaseUrl()) || isBlank(cfg.getApiKey()) || isBlank(cfg.getModel())) {
skipped++;
@@ -216,12 +223,12 @@
}
if (replace) {
- llmRouteConfigService.delete(new EntityWrapper<LlmRouteConfig>());
+ llmRouteConfigService.remove(new QueryWrapper<LlmRouteConfig>());
}
HashMap<Long, LlmRouteConfig> dbById = new HashMap<>();
if (!replace) {
- List<LlmRouteConfig> current = llmRouteConfigService.selectList(new EntityWrapper<>());
+ List<LlmRouteConfig> current = llmRouteConfigService.list(new QueryWrapper<>());
if (current != null) {
for (LlmRouteConfig item : current) {
if (item != null && item.getId() != null) {
@@ -269,7 +276,7 @@
cfg.setLastUsedTime(null);
cfg.setLastError(null);
llmRoutingService.fillAndNormalize(cfg, true);
- llmRouteConfigService.insert(cfg);
+ llmRouteConfigService.save(cfg);
inserted++;
}
@@ -295,9 +302,16 @@
LinkedHashMap<String, Object> row = new LinkedHashMap<>();
row.put("id", cfg.getId());
row.put("name", cfg.getName());
+ row.put("providerType", cfg.getProviderType());
+ row.put("protocolType", cfg.getProtocolType());
row.put("baseUrl", cfg.getBaseUrl());
+ row.put("endpointPath", cfg.getEndpointPath());
row.put("apiKey", cfg.getApiKey());
+ row.put("authType", cfg.getAuthType());
+ row.put("authHeaderName", cfg.getAuthHeaderName());
row.put("model", cfg.getModel());
+ row.put("capabilities", cfg.getCapabilities());
+ row.put("requestOptions", cfg.getRequestOptions());
row.put("thinking", cfg.getThinking());
row.put("priority", cfg.getPriority());
row.put("status", cfg.getStatus());
--
Gitblit v1.9.1