!18 增加 solon 插件

* 复用配置文件
* add solon plugin. add licenses
* add solon plugin
This commit is contained in:
读钓 2024-10-26 02:39:50 +00:00 committed by Michael Yang
parent 3a403c2556
commit cdc2183035
13 changed files with 504 additions and 0 deletions

View File

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.agentsflex</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-beta.12</version>
</parent>
<artifactId>agents-flex-solon-plugin</artifactId>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.noear</groupId>
<artifactId>solon-parent</artifactId>
<version>${solon.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- solon 内核 -->
<dependency>
<groupId>org.noear</groupId>
<artifactId>solon</artifactId>
</dependency>
<dependency>
<groupId>com.agentsflex</groupId>
<artifactId>agents-flex-core</artifactId>
<version>${agents-flex.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--llm start-->
<dependency>
<groupId>com.agentsflex</groupId>
<artifactId>agents-flex-llm-chatglm</artifactId>
<version>${agents-flex.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.agentsflex</groupId>
<artifactId>agents-flex-llm-ollama</artifactId>
<version>${agents-flex.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.agentsflex</groupId>
<artifactId>agents-flex-llm-openai</artifactId>
<version>${agents-flex.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.agentsflex</groupId>
<artifactId>agents-flex-llm-qwen</artifactId>
<version>${agents-flex.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.agentsflex</groupId>
<artifactId>agents-flex-llm-spark</artifactId>
<version>${agents-flex.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.agentsflex</groupId>
<artifactId>agents-flex-llm-moonshot</artifactId>
<version>${agents-flex.version}</version>
<optional>true</optional>
</dependency>
<!--llm end-->
<!--store start-->
<dependency>
<groupId>com.agentsflex</groupId>
<artifactId>agents-flex-store-aliyun</artifactId>
<version>${agents-flex.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.agentsflex</groupId>
<artifactId>agents-flex-store-qcloud</artifactId>
<version>${agents-flex.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.agentsflex</groupId>
<artifactId>agents-flex-store-elasticsearch</artifactId>
<version>${agents-flex.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.agentsflex</groupId>
<artifactId>agents-flex-store-opensearch</artifactId>
<version>${agents-flex.version}</version>
<optional>true</optional>
</dependency>
<!--store end-->
</dependencies>
</project>

View File

@ -0,0 +1,33 @@
/*
* Copyright (c) 2023-2025, Agents-Flex (fuhai999@gmail.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.agentsflex.solon;
import org.noear.solon.core.AppContext;
import org.noear.solon.core.Plugin;
/**
* agents flex solon plugin
*
* @author songyinyin
* @since 2024/10/25 下午10:18
*/
public class XPluginImp implements Plugin {
@Override
public void start(AppContext context) throws Throwable {
context.beanScan(XPluginImp.class);
}
}

View File

@ -0,0 +1,37 @@
/*
* Copyright (c) 2023-2025, Agents-Flex (fuhai999@gmail.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.agentsflex.solon.llm.chatglm;
import com.agentsflex.llm.chatglm.ChatglmLlm;
import com.agentsflex.llm.chatglm.ChatglmLlmConfig;
import org.noear.solon.annotation.Bean;
import org.noear.solon.annotation.Condition;
import org.noear.solon.annotation.Configuration;
import org.noear.solon.annotation.Inject;
/**
* 智谱清言 自动配置
*/
@Configuration
@Condition(onClass = ChatglmLlm.class)
public class ChatglmAutoConfiguration {
@Bean(typed = true)
@Condition(onMissingBean = ChatglmLlm.class)
public ChatglmLlm chatglmLlm(@Inject("${agents-flex.llm.chatglm}") ChatglmLlmConfig config) {
return new ChatglmLlm(config);
}
}

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2023-2025, Agents-Flex (fuhai999@gmail.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.agentsflex.solon.llm.moonshot;
import com.agentsflex.llm.moonshot.MoonshotLlm;
import com.agentsflex.llm.moonshot.MoonshotLlmConfig;
import org.noear.solon.annotation.Bean;
import org.noear.solon.annotation.Condition;
import org.noear.solon.annotation.Configuration;
import org.noear.solon.annotation.Inject;
/**
* 月之暗面 自动配置
*/
@Configuration
@Condition(onClass = MoonshotLlm.class)
public class MoonshotAutoConfiguration {
@Bean(typed = true)
@Condition(onMissingBean = MoonshotLlm.class)
public MoonshotLlm moonshotLlm(@Inject("agents-flex.llm.moonshot") MoonshotLlmConfig config) {
return new MoonshotLlm(config);
}
}

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2023-2025, Agents-Flex (fuhai999@gmail.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.agentsflex.solon.llm.openai;
import com.agentsflex.llm.openai.OpenAiLlm;
import com.agentsflex.llm.openai.OpenAiLlmConfig;
import org.noear.solon.annotation.Bean;
import org.noear.solon.annotation.Condition;
import org.noear.solon.annotation.Configuration;
import org.noear.solon.annotation.Inject;
/**
* openai 自动配置
*/
@Configuration
@Condition(onClass = OpenAiLlm.class)
public class OpenAiAutoConfiguration {
@Bean(typed = true)
@Condition(onMissingBean = OpenAiLlm.class)
public OpenAiLlm openAiLlm(@Inject("${agents-flex.llm.openai}") OpenAiLlmConfig config) {
return new OpenAiLlm(config);
}
}

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2023-2025, Agents-Flex (fuhai999@gmail.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.agentsflex.solon.llm.qwen;
import com.agentsflex.llm.qwen.QwenLlm;
import com.agentsflex.llm.qwen.QwenLlmConfig;
import org.noear.solon.annotation.Bean;
import org.noear.solon.annotation.Condition;
import org.noear.solon.annotation.Configuration;
import org.noear.solon.annotation.Inject;
/**
* 通义千问 自动配置
*/
@Configuration
@Condition(onClass = QwenLlm.class)
public class QwenAutoConfiguration {
@Bean(typed = true)
@Condition(onMissingBean = QwenLlm.class)
public QwenLlm qwenLlm(@Inject("${agents-flex.llm.qwen}") QwenLlmConfig config) {
return new QwenLlm(config);
}
}

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2023-2025, Agents-Flex (fuhai999@gmail.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.agentsflex.solon.llm.spark;
import com.agentsflex.llm.spark.SparkLlm;
import com.agentsflex.llm.spark.SparkLlmConfig;
import org.noear.solon.annotation.Bean;
import org.noear.solon.annotation.Condition;
import org.noear.solon.annotation.Configuration;
import org.noear.solon.annotation.Inject;
/**
* 讯飞星火 自动配置
*/
@Configuration
@Condition(onClass = SparkLlm.class)
public class SparkAutoConfiguration {
@Bean(typed = true)
@Condition(onMissingBean = SparkLlm.class)
public SparkLlm sparkLlm(@Inject("${agents-flex.llm.spark}") SparkLlmConfig config) {
return new SparkLlm(config);
}
}

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2023-2025, Agents-Flex (fuhai999@gmail.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.agentsflex.solon.store.aliyun;
import com.agentsflex.store.aliyun.AliyunVectorStore;
import com.agentsflex.store.aliyun.AliyunVectorStoreConfig;
import org.noear.solon.annotation.Bean;
import org.noear.solon.annotation.Condition;
import org.noear.solon.annotation.Configuration;
import org.noear.solon.annotation.Inject;
/**
* 阿里云向量存储 自动配置
*/
@Configuration
@Condition(onClass = AliyunVectorStore.class)
public class AliyunAutoConfiguration {
@Bean(typed = true)
@Condition(onMissingBean = AliyunVectorStore.class)
public AliyunVectorStore aliyunVectorStore(@Inject("${agents-flex.store.aliyun}") AliyunVectorStoreConfig config) {
return new AliyunVectorStore(config);
}
}

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) 2023-2025, Agents-Flex (fuhai999@gmail.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.agentsflex.solon.store.elasticsearch;
import co.elastic.clients.elasticsearch.ElasticsearchClient;
import com.agentsflex.store.elasticsearch.ElasticSearchVectorStore;
import com.agentsflex.store.elasticsearch.ElasticSearchVectorStoreConfig;
import org.noear.solon.annotation.Bean;
import org.noear.solon.annotation.Condition;
import org.noear.solon.annotation.Configuration;
import org.noear.solon.annotation.Inject;
/**
* es向量存储 自动配置
*
* @author songyinyin
* @since 2024/8/13 上午11:26
*/
@Configuration
@Condition(onClass = ElasticSearchVectorStore.class)
public class ElasticSearchAutoConfiguration {
@Bean(typed = true)
@Condition(onMissingBean = ElasticSearchVectorStore.class)
public ElasticSearchVectorStore elasticSearchVectorStore(@Inject("${agents-flex.store.elasticsearch}") ElasticSearchVectorStoreConfig config,
@Inject(required = false) ElasticsearchClient client) {
if (client != null) {
return new ElasticSearchVectorStore(config, client);
}
return new ElasticSearchVectorStore(config);
}
}

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) 2023-2025, Agents-Flex (fuhai999@gmail.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.agentsflex.solon.store.opensearch;
import com.agentsflex.store.opensearch.OpenSearchVectorStore;
import com.agentsflex.store.opensearch.OpenSearchVectorStoreConfig;
import org.noear.solon.annotation.Bean;
import org.noear.solon.annotation.Condition;
import org.noear.solon.annotation.Configuration;
import org.noear.solon.annotation.Inject;
import org.opensearch.client.opensearch.OpenSearchClient;
/**
* opensearch向量存储 自动配置
*
* @author songyinyin
* @since 2024/8/13 上午11:26
*/
@Configuration
@Condition(onClass = OpenSearchVectorStore.class)
public class OpenSearchAutoConfiguration {
@Bean(typed = true)
@Condition(onMissingBean = OpenSearchVectorStore.class)
public OpenSearchVectorStore openSearchVectorStore(@Inject("${agents-flex.store.opensearch}") OpenSearchVectorStoreConfig config,
@Inject(required = false) OpenSearchClient client) {
if (client != null) {
return new OpenSearchVectorStore(config, client);
}
return new OpenSearchVectorStore(config);
}
}

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2023-2025, Agents-Flex (fuhai999@gmail.com).
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.agentsflex.solon.store.qcloud;
import com.agentsflex.store.qcloud.QCloudVectorStore;
import com.agentsflex.store.qcloud.QCloudVectorStoreConfig;
import org.noear.solon.annotation.Bean;
import org.noear.solon.annotation.Condition;
import org.noear.solon.annotation.Configuration;
import org.noear.solon.annotation.Inject;
/**
* 腾讯云向量存储 自动配置
*/
@Configuration
@Condition(onClass = QCloudVectorStore.class)
public class QCloudStoreAutoConfiguration {
@Bean(typed = true)
@Condition(onMissingBean = QCloudVectorStore.class)
public QCloudVectorStore qCloudVectorStore(@Inject("${agents-flex.store.qcloud}") QCloudVectorStoreConfig config) {
return new QCloudVectorStore(config);
}
}

View File

@ -0,0 +1,2 @@
solon.plugin=com.agentsflex.solon.XPluginImp
solon.plugin.priority=0

View File

@ -47,6 +47,7 @@
<module>agents-flex-llm</module>
<module>agents-flex-store</module>
<module>agents-flex-document-parser</module>
<module>agents-flex-solon-plugin</module>
<module>agents-flex-spring-boot-starter</module>
<module>agents-flex-chain</module>
<module>agents-flex-chain/agents-flex-chain-qlexpress</module>
@ -61,6 +62,7 @@
<junit.version>4.13.2</junit.version>
<okhttp.version>4.9.3</okhttp.version>
<fastjson.version>2.0.47</fastjson.version>
<solon.version>3.0.2</solon.version>
<spring-boot.version>2.7.18</spring-boot.version>
<agents-flex.version>1.0.0-beta.12</agents-flex.version>
</properties>