mirror of
https://gitee.com/agents-flex/agents-flex.git
synced 2024-11-29 18:38:17 +08:00
优化 agents-flex-solon-plugin 适配
This commit is contained in:
parent
b54d5f4324
commit
3db2e1724d
@ -24,10 +24,10 @@ import org.noear.solon.core.Plugin;
|
||||
* @author songyinyin
|
||||
* @since 2024/10/25 下午10:18
|
||||
*/
|
||||
public class XPluginImp implements Plugin {
|
||||
public class AgentsFlexPlugin implements Plugin {
|
||||
|
||||
@Override
|
||||
public void start(AppContext context) throws Throwable {
|
||||
context.beanScan(XPluginImp.class);
|
||||
context.beanScan(AgentsFlexPlugin.class);
|
||||
}
|
||||
}
|
@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.agentsflex.solon.llm.chatglm;
|
||||
|
||||
import com.agentsflex.core.llm.Llm;
|
||||
import com.agentsflex.llm.chatglm.ChatglmLlm;
|
||||
import com.agentsflex.llm.chatglm.ChatglmLlmConfig;
|
||||
import org.noear.solon.annotation.Bean;
|
||||
@ -29,9 +30,9 @@ import org.noear.solon.annotation.Inject;
|
||||
@Condition(onClass = ChatglmLlm.class)
|
||||
public class ChatglmAutoConfiguration {
|
||||
|
||||
@Bean(typed = true)
|
||||
@Bean
|
||||
@Condition(onMissingBean = ChatglmLlm.class)
|
||||
public ChatglmLlm chatglmLlm(@Inject("${agents-flex.llm.chatglm}") ChatglmLlmConfig config) {
|
||||
public Llm chatglmLlm(@Inject("${agents-flex.llm.chatglm}") ChatglmLlmConfig config) {
|
||||
return new ChatglmLlm(config);
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.agentsflex.solon.llm.moonshot;
|
||||
|
||||
import com.agentsflex.core.llm.Llm;
|
||||
import com.agentsflex.llm.moonshot.MoonshotLlm;
|
||||
import com.agentsflex.llm.moonshot.MoonshotLlmConfig;
|
||||
import org.noear.solon.annotation.Bean;
|
||||
@ -29,9 +30,9 @@ import org.noear.solon.annotation.Inject;
|
||||
@Condition(onClass = MoonshotLlm.class)
|
||||
public class MoonshotAutoConfiguration {
|
||||
|
||||
@Bean(typed = true)
|
||||
@Bean
|
||||
@Condition(onMissingBean = MoonshotLlm.class)
|
||||
public MoonshotLlm moonshotLlm(@Inject("agents-flex.llm.moonshot") MoonshotLlmConfig config) {
|
||||
public Llm moonshotLlm(@Inject("agents-flex.llm.moonshot") MoonshotLlmConfig config) {
|
||||
return new MoonshotLlm(config);
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.agentsflex.solon.llm.openai;
|
||||
|
||||
import com.agentsflex.core.llm.Llm;
|
||||
import com.agentsflex.llm.openai.OpenAiLlm;
|
||||
import com.agentsflex.llm.openai.OpenAiLlmConfig;
|
||||
import org.noear.solon.annotation.Bean;
|
||||
@ -29,9 +30,9 @@ import org.noear.solon.annotation.Inject;
|
||||
@Condition(onClass = OpenAiLlm.class)
|
||||
public class OpenAiAutoConfiguration {
|
||||
|
||||
@Bean(typed = true)
|
||||
@Bean
|
||||
@Condition(onMissingBean = OpenAiLlm.class)
|
||||
public OpenAiLlm openAiLlm(@Inject("${agents-flex.llm.openai}") OpenAiLlmConfig config) {
|
||||
public Llm openAiLlm(@Inject("${agents-flex.llm.openai}") OpenAiLlmConfig config) {
|
||||
return new OpenAiLlm(config);
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.agentsflex.solon.llm.qwen;
|
||||
|
||||
import com.agentsflex.core.llm.Llm;
|
||||
import com.agentsflex.llm.qwen.QwenLlm;
|
||||
import com.agentsflex.llm.qwen.QwenLlmConfig;
|
||||
import org.noear.solon.annotation.Bean;
|
||||
@ -29,9 +30,9 @@ import org.noear.solon.annotation.Inject;
|
||||
@Condition(onClass = QwenLlm.class)
|
||||
public class QwenAutoConfiguration {
|
||||
|
||||
@Bean(typed = true)
|
||||
@Bean
|
||||
@Condition(onMissingBean = QwenLlm.class)
|
||||
public QwenLlm qwenLlm(@Inject("${agents-flex.llm.qwen}") QwenLlmConfig config) {
|
||||
public Llm qwenLlm(@Inject("${agents-flex.llm.qwen}") QwenLlmConfig config) {
|
||||
return new QwenLlm(config);
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.agentsflex.solon.llm.spark;
|
||||
|
||||
import com.agentsflex.core.llm.Llm;
|
||||
import com.agentsflex.llm.spark.SparkLlm;
|
||||
import com.agentsflex.llm.spark.SparkLlmConfig;
|
||||
import org.noear.solon.annotation.Bean;
|
||||
@ -29,9 +30,9 @@ import org.noear.solon.annotation.Inject;
|
||||
@Condition(onClass = SparkLlm.class)
|
||||
public class SparkAutoConfiguration {
|
||||
|
||||
@Bean(typed = true)
|
||||
@Bean
|
||||
@Condition(onMissingBean = SparkLlm.class)
|
||||
public SparkLlm sparkLlm(@Inject("${agents-flex.llm.spark}") SparkLlmConfig config) {
|
||||
public Llm sparkLlm(@Inject("${agents-flex.llm.spark}") SparkLlmConfig config) {
|
||||
return new SparkLlm(config);
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.agentsflex.solon.store.aliyun;
|
||||
|
||||
import com.agentsflex.core.store.DocumentStore;
|
||||
import com.agentsflex.store.aliyun.AliyunVectorStore;
|
||||
import com.agentsflex.store.aliyun.AliyunVectorStoreConfig;
|
||||
import org.noear.solon.annotation.Bean;
|
||||
@ -29,9 +30,9 @@ import org.noear.solon.annotation.Inject;
|
||||
@Condition(onClass = AliyunVectorStore.class)
|
||||
public class AliyunAutoConfiguration {
|
||||
|
||||
@Bean(typed = true)
|
||||
@Bean
|
||||
@Condition(onMissingBean = AliyunVectorStore.class)
|
||||
public AliyunVectorStore aliyunVectorStore(@Inject("${agents-flex.store.aliyun}") AliyunVectorStoreConfig config) {
|
||||
public DocumentStore aliyunVectorStore(@Inject("${agents-flex.store.aliyun}") AliyunVectorStoreConfig config) {
|
||||
return new AliyunVectorStore(config);
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
package com.agentsflex.solon.store.elasticsearch;
|
||||
|
||||
import co.elastic.clients.elasticsearch.ElasticsearchClient;
|
||||
import com.agentsflex.core.store.DocumentStore;
|
||||
import com.agentsflex.store.elasticsearch.ElasticSearchVectorStore;
|
||||
import com.agentsflex.store.elasticsearch.ElasticSearchVectorStoreConfig;
|
||||
import org.noear.solon.annotation.Bean;
|
||||
@ -33,10 +34,10 @@ import org.noear.solon.annotation.Inject;
|
||||
@Condition(onClass = ElasticSearchVectorStore.class)
|
||||
public class ElasticSearchAutoConfiguration {
|
||||
|
||||
@Bean(typed = true)
|
||||
@Bean
|
||||
@Condition(onMissingBean = ElasticSearchVectorStore.class)
|
||||
public ElasticSearchVectorStore elasticSearchVectorStore(@Inject("${agents-flex.store.elasticsearch}") ElasticSearchVectorStoreConfig config,
|
||||
@Inject(required = false) ElasticsearchClient client) {
|
||||
public DocumentStore elasticSearchVectorStore(@Inject("${agents-flex.store.elasticsearch}") ElasticSearchVectorStoreConfig config,
|
||||
@Inject(required = false) ElasticsearchClient client) {
|
||||
if (client != null) {
|
||||
return new ElasticSearchVectorStore(config, client);
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.agentsflex.solon.store.opensearch;
|
||||
|
||||
import com.agentsflex.core.store.DocumentStore;
|
||||
import com.agentsflex.store.opensearch.OpenSearchVectorStore;
|
||||
import com.agentsflex.store.opensearch.OpenSearchVectorStoreConfig;
|
||||
import org.noear.solon.annotation.Bean;
|
||||
@ -33,10 +34,10 @@ import org.opensearch.client.opensearch.OpenSearchClient;
|
||||
@Condition(onClass = OpenSearchVectorStore.class)
|
||||
public class OpenSearchAutoConfiguration {
|
||||
|
||||
@Bean(typed = true)
|
||||
@Bean
|
||||
@Condition(onMissingBean = OpenSearchVectorStore.class)
|
||||
public OpenSearchVectorStore openSearchVectorStore(@Inject("${agents-flex.store.opensearch}") OpenSearchVectorStoreConfig config,
|
||||
@Inject(required = false) OpenSearchClient client) {
|
||||
public DocumentStore openSearchVectorStore(@Inject("${agents-flex.store.opensearch}") OpenSearchVectorStoreConfig config,
|
||||
@Inject(required = false) OpenSearchClient client) {
|
||||
if (client != null) {
|
||||
return new OpenSearchVectorStore(config, client);
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.agentsflex.solon.store.qcloud;
|
||||
|
||||
import com.agentsflex.core.store.DocumentStore;
|
||||
import com.agentsflex.store.qcloud.QCloudVectorStore;
|
||||
import com.agentsflex.store.qcloud.QCloudVectorStoreConfig;
|
||||
import org.noear.solon.annotation.Bean;
|
||||
@ -29,9 +30,9 @@ import org.noear.solon.annotation.Inject;
|
||||
@Condition(onClass = QCloudVectorStore.class)
|
||||
public class QCloudStoreAutoConfiguration {
|
||||
|
||||
@Bean(typed = true)
|
||||
@Bean
|
||||
@Condition(onMissingBean = QCloudVectorStore.class)
|
||||
public QCloudVectorStore qCloudVectorStore(@Inject("${agents-flex.store.qcloud}") QCloudVectorStoreConfig config) {
|
||||
public DocumentStore qCloudVectorStore(@Inject("${agents-flex.store.qcloud}") QCloudVectorStoreConfig config) {
|
||||
return new QCloudVectorStore(config);
|
||||
}
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
solon.plugin=com.agentsflex.solon.XPluginImp
|
||||
solon.plugin.priority=0
|
||||
solon.plugin=com.agentsflex.solon.AgentsFlexPlugin
|
||||
solon.plugin.priority=1
|
||||
|
Loading…
Reference in New Issue
Block a user