From 7ffe3242e5c32f1c3ce9008f9bdd79ca38dff443 Mon Sep 17 00:00:00 2001 From: will Date: Thu, 6 Aug 2026 00:36:06 +0800 Subject: [PATCH] =?UTF-8?q?refactor(config):=20=E9=87=8D=E6=9E=84=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6=E7=BB=93=E6=9E=84=E5=92=8C=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E5=89=8D=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将AI相关配置从application.yml移至application-dev.yml和application-prod.yml - 移除application.yml中的xxl-job配置并分别在开发和生产环境中重新定义 - 更新XxlJobConfiguration中条件注解的属性前缀路径 - 调整ZentaoReportIntegrationProperties的配置前缀从will.agent.zentao.report改为will - 优化配置文件的环境特定设置分布 --- .../framework/config/XxlJobConfiguration.java | 2 +- .../ZentaoReportIntegrationProperties.java | 2 +- wcsApp/src/main/resources/application-dev.yml | 40 ++++++++++++++++ .../src/main/resources/application-prod.yml | 45 +++++++++++++++++- wcsApp/src/main/resources/application.yml | 46 +------------------ 5 files changed, 87 insertions(+), 48 deletions(-) diff --git a/coreJob/src/main/java/com/will/coreJob/framework/config/XxlJobConfiguration.java b/coreJob/src/main/java/com/will/coreJob/framework/config/XxlJobConfiguration.java index 6e953e6..c7ae050 100644 --- a/coreJob/src/main/java/com/will/coreJob/framework/config/XxlJobConfiguration.java +++ b/coreJob/src/main/java/com/will/coreJob/framework/config/XxlJobConfiguration.java @@ -16,7 +16,7 @@ import org.springframework.util.StringUtils; @Configuration @RequiredArgsConstructor @EnableConfigurationProperties(ZentaoReportIntegrationProperties.class) -@ConditionalOnProperty(prefix = "will.agent.zentao.report.xxl-job", name = "enabled", havingValue = "true") +@ConditionalOnProperty(prefix = "will.xxl-job", name = "enabled", havingValue = "true") public class XxlJobConfiguration { private final ZentaoReportIntegrationProperties properties; diff --git a/coreJob/src/main/java/com/will/coreJob/framework/config/ZentaoReportIntegrationProperties.java b/coreJob/src/main/java/com/will/coreJob/framework/config/ZentaoReportIntegrationProperties.java index 800b71f..236cbca 100644 --- a/coreJob/src/main/java/com/will/coreJob/framework/config/ZentaoReportIntegrationProperties.java +++ b/coreJob/src/main/java/com/will/coreJob/framework/config/ZentaoReportIntegrationProperties.java @@ -4,7 +4,7 @@ import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; @Data -@ConfigurationProperties(prefix = "will.agent.zentao.report") +@ConfigurationProperties(prefix = "will") public class ZentaoReportIntegrationProperties { private XxlJob xxlJob = new XxlJob(); diff --git a/wcsApp/src/main/resources/application-dev.yml b/wcsApp/src/main/resources/application-dev.yml index 3ccbd64..90d2b38 100644 --- a/wcsApp/src/main/resources/application-dev.yml +++ b/wcsApp/src/main/resources/application-dev.yml @@ -1,7 +1,34 @@ spring: ai: + ollama: + base-url: ${OLLAMA_BASE_URL:http://localhost:11434} + chat: + options: + model: ${OLLAMA_MODEL:qwen2.5:7b} + temperature: ${OLLAMA_TEMPERATURE:0.2} + openai: + api-key: ${OPENAI_API_KEY:} + base-url: ${OPENAI_BASE_URL:https://api.openai.com} + chat: + options: + model: ${OPENAI_MODEL:gpt-4o-mini} + temperature: ${OPENAI_TEMPERATURE:0.2} zhipuai: api-key: ${ZHIPUAI_API_KEY:7980536e3ea04550b037db126899bb4f.QhE9ardDCIgT3SG3} + base-url: ${ZHIPUAI_BASE_URL:https://open.bigmodel.cn/api/coding/paas/} + chat: + options: + model: ${ZHIPUAI_MODEL:glm-4.7} + temperature: ${ZHIPUAI_TEMPERATURE:0.2} + mcp: + client: + enabled: true + type: SYNC + toolcallback: + enabled: true + request-timeout: 60s + stdio: + servers-configuration: classpath:mcp-servers.json rabbitmq: host: ${RABBITMQ_HOST:118.178.233.171} port: ${RABBITMQ_PORT:5672} @@ -39,6 +66,19 @@ spring: connection-timeout: 20000 will: + xxl-job: + enabled: ${XXL_JOB_ENABLED:true} + admin-addresses: ${XXL_JOB_ADMIN_ADDRESSES:http://118.178.233.171:8081} + admin-username: ${XXL_JOB_ADMIN_USERNAME:willsystem} + admin-password: ${XXL_JOB_ADMIN_PASSWORD:Tt123456} + access-token: ${XXL_JOB_ACCESS_TOKEN:x41TdRp1NDa75g} + job-group-id: ${XXL_JOB_GROUP_ID:3} + appname: ${XXL_JOB_APPNAME:will-system-agent} + address: ${XXL_JOB_EXECUTOR_ADDRESS:} + ip: ${XXL_JOB_EXECUTOR_IP:} + port: ${XXL_JOB_EXECUTOR_PORT:9999} + log-path: ${XXL_JOB_LOG_PATH:logs/xxl-job/jobhandler} + log-retention-days: ${XXL_JOB_LOG_RETENTION_DAYS:30} queue: enabled: false agent: diff --git a/wcsApp/src/main/resources/application-prod.yml b/wcsApp/src/main/resources/application-prod.yml index 1e8cbe8..a2be5a5 100644 --- a/wcsApp/src/main/resources/application-prod.yml +++ b/wcsApp/src/main/resources/application-prod.yml @@ -1,4 +1,34 @@ spring: + ai: + ollama: + base-url: ${OLLAMA_BASE_URL:http://localhost:11434} + chat: + options: + model: ${OLLAMA_MODEL:qwen2.5:7b} + temperature: ${OLLAMA_TEMPERATURE:0.2} + openai: + api-key: ${OPENAI_API_KEY:} + base-url: ${OPENAI_BASE_URL:https://api.openai.com} + chat: + options: + model: ${OPENAI_MODEL:gpt-4o-mini} + temperature: ${OPENAI_TEMPERATURE:0.2} + zhipuai: + api-key: ${ZHIPUAI_API_KEY} + base-url: ${ZHIPUAI_BASE_URL:https://open.bigmodel.cn/api/coding/paas/} + chat: + options: + model: ${ZHIPUAI_MODEL:glm-4.7} + temperature: ${ZHIPUAI_TEMPERATURE:0.2} + mcp: + client: + enabled: ${SPRING_AI_MCP_CLIENT_ENABLED:true} + type: SYNC + toolcallback: + enabled: true + request-timeout: 60s + stdio: + servers-configuration: classpath:mcp-servers.json rabbitmq: host: ${RABBITMQ_HOST} port: ${RABBITMQ_PORT:5672} @@ -36,6 +66,19 @@ spring: connection-timeout: 20000 will: + xxl-job: + enabled: ${XXL_JOB_ENABLED:true} + admin-addresses: ${XXL_JOB_ADMIN_ADDRESSES} + admin-username: ${XXL_JOB_ADMIN_USERNAME} + admin-password: ${XXL_JOB_ADMIN_PASSWORD} + access-token: ${XXL_JOB_ACCESS_TOKEN} + job-group-id: ${XXL_JOB_GROUP_ID:3} + appname: ${XXL_JOB_APPNAME:will-system-agent} + address: ${XXL_JOB_EXECUTOR_ADDRESS:} + ip: ${XXL_JOB_EXECUTOR_IP:} + port: ${XXL_JOB_EXECUTOR_PORT:9999} + log-path: ${XXL_JOB_LOG_PATH:logs/xxl-job/jobhandler} + log-retention-days: ${XXL_JOB_LOG_RETENTION_DAYS:30} queue: enabled: ${WILL_QUEUE_ENABLED:false} agent: @@ -47,4 +90,4 @@ will: password: ${ZENTAO_DB_PASSWORD} maximum-pool-size: ${ZENTAO_DB_MAXIMUM_POOL_SIZE:5} minimum-idle: ${ZENTAO_DB_MINIMUM_IDLE:1} - connection-timeout: 10000 \ No newline at end of file + connection-timeout: 10000 diff --git a/wcsApp/src/main/resources/application.yml b/wcsApp/src/main/resources/application.yml index c73f56d..ef095c5 100644 --- a/wcsApp/src/main/resources/application.yml +++ b/wcsApp/src/main/resources/application.yml @@ -1,36 +1,6 @@ spring: profiles: active: ${SPRING_PROFILES_ACTIVE:dev} - ai: - ollama: - base-url: ${OLLAMA_BASE_URL:http://localhost:11434} - chat: - options: - model: ${OLLAMA_MODEL:qwen2.5:7b} - temperature: ${OLLAMA_TEMPERATURE:0.2} - openai: - api-key: ${OPENAI_API_KEY:} - base-url: ${OPENAI_BASE_URL:https://api.openai.com} - chat: - options: - model: ${OPENAI_MODEL:gpt-4o-mini} - temperature: ${OPENAI_TEMPERATURE:0.2} - zhipuai: - api-key: ${ZHIPUAI_API_KEY:} - base-url: ${ZHIPUAI_BASE_URL:https://open.bigmodel.cn/api/coding/paas/} - chat: - options: - model: ${ZHIPUAI_MODEL:glm-4.7} - temperature: ${ZHIPUAI_TEMPERATURE:0.2} - mcp: - client: - enabled: true - type: SYNC - toolcallback: - enabled: true - request-timeout: 60s - stdio: - servers-configuration: classpath:mcp-servers.json will: agent: @@ -42,20 +12,6 @@ will: enabled: true zentao: enabled: true - report: - xxl-job: - enabled: ${XXL_JOB_ENABLED:true} - admin-addresses: ${XXL_JOB_ADMIN_ADDRESSES:http://118.178.233.171:8081} - admin-username: ${XXL_JOB_ADMIN_USERNAME:willsystem} - admin-password: ${XXL_JOB_ADMIN_PASSWORD:} - access-token: ${XXL_JOB_ACCESS_TOKEN:} - job-group-id: ${XXL_JOB_GROUP_ID:3} - appname: ${XXL_JOB_APPNAME:will-system-agent} - address: ${XXL_JOB_EXECUTOR_ADDRESS:} - ip: ${XXL_JOB_EXECUTOR_IP:} - port: ${XXL_JOB_EXECUTOR_PORT:9999} - log-path: ${XXL_JOB_LOG_PATH:logs/xxl-job/jobhandler} - log-retention-days: ${XXL_JOB_LOG_RETENTION_DAYS:30} sa-token: token-name: satoken @@ -72,4 +28,4 @@ mybatis-plus: map-underscore-to-camel-case: true log-impl: org.apache.ibatis.logging.stdout.StdOutImpl typeAliasesPackage: com.will.coreData.entity - mapperLocations: classpath:mapper/**/*.xml \ No newline at end of file + mapperLocations: classpath:mapper/**/*.xml