mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-30 01:38:43 +08:00 
			
		
		
		
	【优化】自动配置,适配新的千问
This commit is contained in:
		| @@ -18,11 +18,6 @@ import java.util.List; | ||||
| @Accessors | ||||
| public class QianWenOptions implements ChatOptions { | ||||
|  | ||||
|     private String appId; | ||||
|     /** | ||||
|      * 是否流式输出, 默认为否。 | ||||
|      */ | ||||
|     private Boolean stream; | ||||
|     /** | ||||
|      * 用户与模型的对话历史 | ||||
|      */ | ||||
|   | ||||
| @@ -44,13 +44,16 @@ public class YudaoAiAutoConfiguration { | ||||
|     @ConditionalOnProperty(value = "yudao.ai.qianwen.enable", havingValue = "true") | ||||
|     public QianWenChatClient qianWenChatClient(YudaoAiProperties yudaoAiProperties) { | ||||
|         YudaoAiProperties.QianWenProperties qianWenProperties = yudaoAiProperties.getQianwen(); | ||||
|         QianWenOptions qianWenOptions = new QianWenOptions(); | ||||
|         qianWenOptions.setTopK(qianWenProperties.getTopK()); | ||||
|         qianWenOptions.setTopP(qianWenProperties.getTopP()); | ||||
|         qianWenOptions.setTemperature(qianWenProperties.getTemperature()); | ||||
|         return new QianWenChatClient( | ||||
|                 new QianWenApi( | ||||
|                         qianWenProperties.getAgentKey(), | ||||
|                         qianWenProperties.getApiKey(), | ||||
|                         QianWenChatModal.QWEN_72B_CHAT | ||||
|                 ), | ||||
|                 new QianWenOptions() | ||||
|                         .setAppId(qianWenProperties.getAppId()) | ||||
|                 qianWenOptions | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -42,26 +42,15 @@ public class YudaoAiProperties { | ||||
|     @Data | ||||
|     @Accessors(chain = true) | ||||
|     public static class QianWenProperties extends ChatProperties { | ||||
|  | ||||
|         /** | ||||
|          * 阿里云:服务器接入点 | ||||
|          * api key | ||||
|          */ | ||||
|         private String endpoint = "bailian.cn-beijing.aliyuncs.com"; | ||||
|         private String apiKey; | ||||
|         /** | ||||
|          * 阿里云:权限 accessKeyId | ||||
|          * model | ||||
|          */ | ||||
|         private String accessKeyId; | ||||
|         /** | ||||
|          * 阿里云:权限 accessKeySecret | ||||
|          */ | ||||
|         private String accessKeySecret; | ||||
|         /** | ||||
|          * 阿里云:agentKey | ||||
|          */ | ||||
|         private String agentKey; | ||||
|         /** | ||||
|          * 阿里云:agentKey(相当于应用id) | ||||
|          */ | ||||
|         private String appId; | ||||
|         private YiYanChatModel model; | ||||
|  | ||||
|     } | ||||
|  | ||||
| @@ -93,5 +82,7 @@ public class YudaoAiProperties { | ||||
|          * token 刷新时间(默认 86400 = 24小时) | ||||
|          */ | ||||
|         private int refreshTokenSecondTime = 86400; | ||||
|  | ||||
|         private YiYanChatModel model; | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 cherishsince
					cherishsince