From cfac4126d837fdd8c1febaf4551e2a5ee60101af Mon Sep 17 00:00:00 2001 From: 0007 <0007@qq.com> Date: Wed, 27 Aug 2025 19:58:04 +0800 Subject: [PATCH] Add File --- .../llm/spark/SparkAutoConfiguration.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 agents-flex-spring-boot-starter/src/main/java/com/agentsflex/spring/boot/llm/spark/SparkAutoConfiguration.java diff --git a/agents-flex-spring-boot-starter/src/main/java/com/agentsflex/spring/boot/llm/spark/SparkAutoConfiguration.java b/agents-flex-spring-boot-starter/src/main/java/com/agentsflex/spring/boot/llm/spark/SparkAutoConfiguration.java new file mode 100644 index 0000000..bf10aba --- /dev/null +++ b/agents-flex-spring-boot-starter/src/main/java/com/agentsflex/spring/boot/llm/spark/SparkAutoConfiguration.java @@ -0,0 +1,33 @@ +package com.agentsflex.spring.boot.llm.spark; + +import com.agentsflex.llm.spark.SparkLlm; +import com.agentsflex.llm.spark.SparkLlmConfig; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Agents-Flex 大语言模型自动配置。 + * + * @author 王帅 + * @since 2024-04-10 + */ +@ConditionalOnClass(SparkLlm.class) +@Configuration(proxyBeanMethods = false) +@EnableConfigurationProperties(SparkProperties.class) +public class SparkAutoConfiguration { + + @Bean + @ConditionalOnMissingBean + public SparkLlm sparkLlm(SparkProperties properties) { + SparkLlmConfig config = new SparkLlmConfig(); + config.setAppId(properties.getAppId()); + config.setApiKey(properties.getApiKey()); + config.setApiSecret(properties.getApiSecret()); + config.setVersion(properties.getVersion()); + return new SparkLlm(config); + } + +}