This is an automated email from the ASF dual-hosted git repository.

liuhongyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new cf7915992b [type:fix] not change singletion config (#6044)
cf7915992b is described below

commit cf7915992b6939523ede8a51f10ce7b79d4b1c55
Author: eye-gu <[email protected]>
AuthorDate: Fri Jul 4 10:01:58 2025 +0800

    [type:fix] not change singletion config (#6044)
---
 .../apache/shenyu/plugin/ai/proxy/AiProxyPlugin.java    | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git 
a/shenyu-plugin/shenyu-plugin-ai/shenyu-plugin-ai-proxy/src/main/java/org/apache/shenyu/plugin/ai/proxy/AiProxyPlugin.java
 
b/shenyu-plugin/shenyu-plugin-ai/shenyu-plugin-ai-proxy/src/main/java/org/apache/shenyu/plugin/ai/proxy/AiProxyPlugin.java
index 931276b382..0cfbcc2a45 100644
--- 
a/shenyu-plugin/shenyu-plugin-ai/shenyu-plugin-ai-proxy/src/main/java/org/apache/shenyu/plugin/ai/proxy/AiProxyPlugin.java
+++ 
b/shenyu-plugin/shenyu-plugin-ai/shenyu-plugin-ai-proxy/src/main/java/org/apache/shenyu/plugin/ai/proxy/AiProxyPlugin.java
@@ -41,6 +41,7 @@ import reactor.core.publisher.Mono;
 
 import java.util.List;
 import java.util.Objects;
+import java.util.Optional;
 
 /**
  * this is ai proxy plugin.
@@ -71,13 +72,15 @@ public class AiProxyPlugin extends AbstractShenyuPlugin {
         
         // Create final config with selector handle taking precedence
         if (Objects.nonNull(selectorHandle)) {
-            aiCommonConfig.setProvider(selectorHandle.getProvider());
-            aiCommonConfig.setBaseUrl(selectorHandle.getBaseUrl());
-            aiCommonConfig.setApiKey(selectorHandle.getApiKey());
-            aiCommonConfig.setModel(selectorHandle.getModel());
-            aiCommonConfig.setTemperature(selectorHandle.getTemperature());
-            aiCommonConfig.setMaxTokens(selectorHandle.getMaxTokens());
-            aiCommonConfig.setStream(selectorHandle.getStream());
+            AiCommonConfig tmp = new AiCommonConfig();
+            
tmp.setProvider(Optional.ofNullable(selectorHandle.getProvider()).orElse(aiCommonConfig.getProvider()));
+            
tmp.setBaseUrl(Optional.ofNullable(selectorHandle.getBaseUrl()).orElse(aiCommonConfig.getBaseUrl()));
+            
tmp.setApiKey(Optional.ofNullable(selectorHandle.getApiKey()).orElse(aiCommonConfig.getApiKey()));
+            
tmp.setModel(Optional.ofNullable(selectorHandle.getModel()).orElse(aiCommonConfig.getModel()));
+            
tmp.setTemperature(Optional.ofNullable(selectorHandle.getTemperature()).orElse(aiCommonConfig.getTemperature()));
+            
tmp.setMaxTokens(Optional.ofNullable(selectorHandle.getMaxTokens()).orElse(aiCommonConfig.getMaxTokens()));
+            
tmp.setStream(Optional.ofNullable(selectorHandle.getStream()).orElse(aiCommonConfig.getStream()));
+            aiCommonConfig = tmp;
         }
         
         if (Objects.isNull(aiCommonConfig.getBaseUrl())) {

Reply via email to