n3_>?Hg0o3
zc^d*ij?f0?S2RZ;nS-3uVJ2eF>o7ByH0Ba%A~feC!V7z9Lm2D=ELMndD#&0&+6(Yz
RWdoVP4uqUcK$-=_0{~dS>6`!n
literal 0
HcmV?d00001
diff --git a/skyeye-ai/ai-common/target/maven-archiver/pom.properties b/skyeye-ai/ai-common/target/maven-archiver/pom.properties
new file mode 100644
index 00000000..9a864e59
--- /dev/null
+++ b/skyeye-ai/ai-common/target/maven-archiver/pom.properties
@@ -0,0 +1,5 @@
+#Generated by Maven
+#Sat Oct 05 12:34:57 CST 2024
+version=1.0-SNAPSHOT
+groupId=com.skyeye
+artifactId=ai-common
diff --git a/skyeye-ai/ai-common/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/skyeye-ai/ai-common/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
new file mode 100644
index 00000000..e69de29b
diff --git a/skyeye-ai/ai-common/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/skyeye-ai/ai-common/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
new file mode 100644
index 00000000..e69de29b
diff --git a/skyeye-ai/ai-pro/pom.xml b/skyeye-ai/ai-pro/pom.xml
new file mode 100644
index 00000000..73564168
--- /dev/null
+++ b/skyeye-ai/ai-pro/pom.xml
@@ -0,0 +1,62 @@
+
+
+
+ skyeye-ai
+ com.skyeye
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ ai-pro
+
+
+ UTF-8
+
+ 0.9.5.2
+ 1.0.25
+
+
+
+
+
+
+ com.skyeye
+ ai-common
+ 1.0-SNAPSHOT
+
+
+
+ org.apache.commons
+ commons-dbcp2
+ 2.1.1
+
+
+
+ com.jayway.jsonpath
+ json-path
+ 2.8.0
+
+
+
+
+ com.mchange
+ c3p0
+ ${c3p0.version}
+
+
+ com.alibaba
+ druid
+ ${druid.version}
+
+
+
+ com.baidubce
+ qianfan
+ 0.1.1
+
+
+
+
+
\ No newline at end of file
diff --git a/skyeye-ai/ai-pro/src/main/java/com/skyeye/ai/core/config/AiConfiguration.java b/skyeye-ai/ai-pro/src/main/java/com/skyeye/ai/core/config/AiConfiguration.java
new file mode 100644
index 00000000..cffcd691
--- /dev/null
+++ b/skyeye-ai/ai-pro/src/main/java/com/skyeye/ai/core/config/AiConfiguration.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
+ ******************************************************************************/
+
+package com.skyeye.ai.core.config;
+
+import com.skyeye.ai.core.factory.AiFactory;
+import com.skyeye.ai.core.factory.AiFactoryImpl;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * @ClassName: AiConfiguration
+ * @Description: AI配置类
+ * @author: skyeye云系列--卫志强
+ * @date: 2024/8/18 22:10
+ * @Copyright: 2024 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
+ * 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
+ */
+@Configuration
+@EnableConfigurationProperties(SkyeyeAiProperties.class)
+public class AiConfiguration {
+
+ @Bean
+ public AiFactory aiClientFactory() {
+ return new AiFactoryImpl();
+ }
+
+}
diff --git a/skyeye-ai/ai-pro/src/main/java/com/skyeye/ai/core/config/SkyeyeAiProperties.java b/skyeye-ai/ai-pro/src/main/java/com/skyeye/ai/core/config/SkyeyeAiProperties.java
new file mode 100644
index 00000000..bb17a871
--- /dev/null
+++ b/skyeye-ai/ai-pro/src/main/java/com/skyeye/ai/core/config/SkyeyeAiProperties.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
+ ******************************************************************************/
+
+package com.skyeye.ai.core.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * @ClassName: SkyeyeAiProperties
+ * @Description: Skyeye AI 配置类
+ * @author: skyeye云系列--卫志强
+ * @date: 2024/10/5 18:03
+ * @Copyright: 2024 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
+ * 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
+ */
+@Data
+@ConfigurationProperties(prefix = "spring.ai")
+public class SkyeyeAiProperties {
+
+ private QianfanProperties qianfan;
+
+ @Data
+ public static class QianfanProperties {
+ private String apiKey;
+ private String secretKey;
+ }
+}
diff --git a/skyeye-ai/ai-pro/src/main/java/com/skyeye/ai/core/enums/AiPlatformEnum.java b/skyeye-ai/ai-pro/src/main/java/com/skyeye/ai/core/enums/AiPlatformEnum.java
new file mode 100644
index 00000000..198fa15a
--- /dev/null
+++ b/skyeye-ai/ai-pro/src/main/java/com/skyeye/ai/core/enums/AiPlatformEnum.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
+ ******************************************************************************/
+
+package com.skyeye.ai.core.enums;
+
+import cn.hutool.core.util.StrUtil;
+import com.skyeye.common.base.classenum.SkyeyeEnumClass;
+import com.skyeye.exception.CustomException;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
+/**
+ * @ClassName: AiPlatformEnum
+ * @Description: AI 模型平台
+ * @author: skyeye云系列--卫志强
+ * @date: 2024/10/5 11:33
+ * @Copyright: 2024 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
+ * 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
+ */
+@Getter
+@NoArgsConstructor
+@AllArgsConstructor
+public enum AiPlatformEnum implements SkyeyeEnumClass {
+
+ YI_YAN("YiYan", "文心一言", "百度", true, false);
+
+ private String key;
+
+ private String value;
+
+ private String remark;
+
+ private Boolean show;
+
+ private Boolean isDefault;
+
+ public static AiPlatformEnum getName(String key) {
+ for (AiPlatformEnum bean : AiPlatformEnum.values()) {
+ if (StrUtil.equals(key, bean.getKey())) {
+ return bean;
+ }
+ }
+ throw new CustomException("非法的AI平台状态");
+ }
+
+}
diff --git a/skyeye-ai/ai-pro/src/main/java/com/skyeye/ai/core/factory/AiFactory.java b/skyeye-ai/ai-pro/src/main/java/com/skyeye/ai/core/factory/AiFactory.java
new file mode 100644
index 00000000..44f16d62
--- /dev/null
+++ b/skyeye-ai/ai-pro/src/main/java/com/skyeye/ai/core/factory/AiFactory.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
+ ******************************************************************************/
+
+package com.skyeye.ai.core.factory;
+
+import com.skyeye.ai.core.enums.AiPlatformEnum;
+
+/**
+ * @ClassName: AiFactory
+ * @Description: AI Model 模型工厂的接口类
+ * @author: skyeye云系列--卫志强
+ * @date: 2024/10/5 11:33
+ * @Copyright: 2024 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
+ * 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
+ */
+public interface AiFactory {
+
+ /**
+ * 基于指定配置,获得 ChatModel 对象
+ *
+ * 如果不存在,则进行创建
+ *
+ * @param platform 平台
+ * @param apiKey API KEY
+ * @param url API URL
+ * @return ChatModel 对象
+ */
+ Object getOrCreateChatModel(AiPlatformEnum platform, String apiKey, String secretKey, String url);
+
+ /**
+ * 基于默认配置,获得 ChatModel 对象
+ *
+ * 默认配置,指的是在 application.yaml 配置文件中的 spring.ai 相关的配置
+ *
+ * @param platform 平台
+ * @return ChatModel 对象
+ */
+ Object getDefaultChatModel(AiPlatformEnum platform);
+
+ /**
+ * 基于默认配置,获得 ImageModel 对象
+ *
+ * 默认配置,指的是在 application.yaml 配置文件中的 spring.ai 相关的配置
+ *
+ * @param platform 平台
+ * @return ImageModel 对象
+ */
+ Object getDefaultImageModel(AiPlatformEnum platform);
+
+ /**
+ * 基于指定配置,获得 ImageModel 对象
+ *
+ * 如果不存在,则进行创建
+ *
+ * @param platform 平台
+ * @param apiKey API KEY
+ * @param url API URL
+ * @return ImageModel 对象
+ */
+ Object getOrCreateImageModel(AiPlatformEnum platform, String apiKey, String url);
+
+}
diff --git a/skyeye-ai/ai-pro/src/main/java/com/skyeye/ai/core/factory/AiFactoryImpl.java b/skyeye-ai/ai-pro/src/main/java/com/skyeye/ai/core/factory/AiFactoryImpl.java
new file mode 100644
index 00000000..4288ba1f
--- /dev/null
+++ b/skyeye-ai/ai-pro/src/main/java/com/skyeye/ai/core/factory/AiFactoryImpl.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye
+ ******************************************************************************/
+
+package com.skyeye.ai.core.factory;
+
+import cn.hutool.core.lang.Singleton;
+import cn.hutool.core.lang.func.Func0;
+import cn.hutool.core.util.ArrayUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baidubce.qianfan.Qianfan;
+import com.baidubce.qianfan.core.auth.Auth;
+import com.skyeye.ai.core.config.SkyeyeAiProperties;
+import com.skyeye.ai.core.enums.AiPlatformEnum;
+import com.skyeye.exception.CustomException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * @ClassName: AiFactoryImpl
+ * @Description: AI Model 模型工厂的实现类
+ * @author: skyeye云系列--卫志强
+ * @date: 2024/10/5 14:09
+ * @Copyright: 2024 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
+ * 注意:本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
+ */
+public class AiFactoryImpl implements AiFactory {
+
+ @Autowired
+ private SkyeyeAiProperties skyeyeAiProperties;
+
+ @Override
+ public Object getOrCreateChatModel(AiPlatformEnum platform, String apiKey, String secretKey, String url) {
+ String cacheKey = buildClientCacheKey(platform, apiKey, url);
+ return Singleton.get(cacheKey, (Func0