diff --git a/bnyer-services/bnyer-ai/pom.xml b/bnyer-services/bnyer-ai/pom.xml
new file mode 100644
index 0000000..cb26171
--- /dev/null
+++ b/bnyer-services/bnyer-ai/pom.xml
@@ -0,0 +1,140 @@
+
+
+
+ bnyer-services
+ com.dimensionalnode
+ 1.0.0
+
+ 4.0.0
+
+ bnyer-ai
+
+
+ bnyer-ai服务
+
+
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-discovery
+
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-config
+
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-sentinel
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+
+
+ io.springfox
+ springfox-swagger-ui
+ ${swagger.fox.version}
+
+
+
+
+ mysql
+ mysql-connector-java
+
+
+
+
+ com.dimensionalnode
+ bnyer-common-datasource
+
+
+
+
+ com.dimensionalnode
+ bnyer-common-datascope
+
+
+
+
+ com.dimensionalnode
+ bnyer-common-log
+
+
+
+
+ com.dimensionalnode
+ bnyer-common-core
+
+
+
+
+ com.dimensionalnode
+ bnyer-common-swagger
+
+
+
+
+ com.baomidou
+ mybatis-plus-boot-starter
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ com.github.plexpt
+ chatgpt
+ 4.0.5
+
+
+
+
+
+ ${project.artifactId}
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ 2.6.2
+
+
+
+ repackage
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/bnyer-services/bnyer-ai/src/main/java/com/bnyer/ai/BnyerAiApplication.java b/bnyer-services/bnyer-ai/src/main/java/com/bnyer/ai/BnyerAiApplication.java
new file mode 100644
index 0000000..759eb56
--- /dev/null
+++ b/bnyer-services/bnyer-ai/src/main/java/com/bnyer/ai/BnyerAiApplication.java
@@ -0,0 +1,33 @@
+package com.bnyer.ai;
+
+import com.bnyer.common.security.annotation.EnableCustomConfig;
+import com.bnyer.common.security.annotation.EnableRyFeignClients;
+import com.bnyer.common.swagger.annotation.EnableCustomSwagger2;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.scheduling.annotation.EnableAsync;
+
+/**
+ * ai模块
+ *
+ * @author penny
+ */
+@EnableCustomConfig
+@EnableCustomSwagger2
+@EnableRyFeignClients
+@SpringBootApplication
+@EnableAsync
+public class BnyerAiApplication
+{
+ public static void main(String[] args)
+ {
+ SpringApplication.run(BnyerAiApplication.class, args);
+ System.out.println("(♥◠‿◠)ノ゙ bnyerAi服务启动成功 ლ(´ڡ`ლ)゙ \n" +
+ "__________ \n" +
+ "\\______ \\ ____ ___.__. ___________ \n" +
+ " | | _// < | |/ __ \\_ __ \\\n" +
+ " | | \\ | \\___ \\ ___/| | \\/\n" +
+ " |______ /___| / ____|\\___ >__| \n" +
+ " \\/ \\/\\/ \\/ \n");
+ }
+}
diff --git a/bnyer-services/bnyer-ai/src/main/java/com/bnyer/ai/controller/ChatGptController.java b/bnyer-services/bnyer-ai/src/main/java/com/bnyer/ai/controller/ChatGptController.java
new file mode 100644
index 0000000..f6680c3
--- /dev/null
+++ b/bnyer-services/bnyer-ai/src/main/java/com/bnyer/ai/controller/ChatGptController.java
@@ -0,0 +1,32 @@
+package com.bnyer.ai.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.bnyer.ai.service.ChatGptService;
+import com.bnyer.common.core.domain.Feedback;
+import com.bnyer.common.core.dto.FeedBackDto;
+import com.bnyer.common.core.web.domain.AjaxResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Api(value = "【AI】接口",tags = "【AI】接口")
+@RestController
+@RequestMapping("/ai")
+public class ChatGptController {
+
+ @Autowired
+ private ChatGptService chatGptService;
+
+ @ApiOperation(value="chat")
+ @PostMapping(value = "/chatWithGpt")
+ public AjaxResult chatWithGpt(){
+ chatGptService.talkWithChatGpt();
+ return AjaxResult.success();
+ }
+}
diff --git a/bnyer-services/bnyer-ai/src/main/java/com/bnyer/ai/service/ChatGptService.java b/bnyer-services/bnyer-ai/src/main/java/com/bnyer/ai/service/ChatGptService.java
new file mode 100644
index 0000000..9b32eb3
--- /dev/null
+++ b/bnyer-services/bnyer-ai/src/main/java/com/bnyer/ai/service/ChatGptService.java
@@ -0,0 +1,6 @@
+package com.bnyer.ai.service;
+
+public interface ChatGptService {
+
+ void talkWithChatGpt();
+}
diff --git a/bnyer-services/bnyer-ai/src/main/java/com/bnyer/ai/service/impl/ChatGptServiceImpl.java b/bnyer-services/bnyer-ai/src/main/java/com/bnyer/ai/service/impl/ChatGptServiceImpl.java
new file mode 100644
index 0000000..9b76d2b
--- /dev/null
+++ b/bnyer-services/bnyer-ai/src/main/java/com/bnyer/ai/service/impl/ChatGptServiceImpl.java
@@ -0,0 +1,42 @@
+package com.bnyer.ai.service.impl;
+
+import com.bnyer.ai.service.ChatGptService;
+import com.plexpt.chatgpt.ChatGPT;
+import com.plexpt.chatgpt.entity.chat.ChatCompletion;
+import com.plexpt.chatgpt.entity.chat.ChatCompletionResponse;
+import com.plexpt.chatgpt.entity.chat.Message;
+import com.plexpt.chatgpt.util.Proxys;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import java.net.Proxy;
+import java.util.Arrays;
+
+@Service
+@Slf4j
+public class ChatGptServiceImpl implements ChatGptService {
+ @Override
+ public void talkWithChatGpt() {
+ Proxy proxy = Proxys.http("18.179.21.104", 21584);
+ ChatGPT chatGPT = ChatGPT.builder()
+ .apiKey("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")
+ .proxy(proxy)
+ .timeout(100000)
+ .apiHost("https://api.openai.com/") //反向代理地址
+ .build()
+ .init();
+
+ Message system = Message.ofSystem("你现在是一个诗人,专门写七言绝句");
+ Message message = Message.of("写一段七言绝句诗,题目是:火锅!");
+
+ ChatCompletion chatCompletion = ChatCompletion.builder()
+ .model(ChatCompletion.Model.GPT_3_5_TURBO.getName())
+ .messages(Arrays.asList(system, message))
+ .maxTokens(3000)
+ .temperature(0.9)
+ .build();
+ ChatCompletionResponse response = chatGPT.chatCompletion(chatCompletion);
+ Message res = response.getChoices().get(0).getMessage();
+ System.out.println(res);
+ }
+}
diff --git a/bnyer-services/bnyer-ai/src/main/resources/bootstrap-dev.yml b/bnyer-services/bnyer-ai/src/main/resources/bootstrap-dev.yml
new file mode 100644
index 0000000..6d55152
--- /dev/null
+++ b/bnyer-services/bnyer-ai/src/main/resources/bootstrap-dev.yml
@@ -0,0 +1,22 @@
+spring:
+ cloud:
+ nacos:
+ discovery:
+ # 服务注册地址
+ server-addr: http://117.50.61.7:8848
+ # 命名空间地址
+ namespace: c4f53d8c-0a91-4249-a804-f16f543ec3b0
+ # 命名空间分组
+ group: dev
+ config:
+ # 配置中心地址
+ server-addr: http://117.50.61.7:8848
+ # 配置文件格式
+ file-extension: yml
+ # 命名空间地址
+ namespace: c4f53d8c-0a91-4249-a804-f16f543ec3b0
+ # 命名空间分组
+ group: dev
+ # 共享配置
+ shared-configs:
+ - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
diff --git a/bnyer-services/bnyer-ai/src/main/resources/bootstrap-grey.yml b/bnyer-services/bnyer-ai/src/main/resources/bootstrap-grey.yml
new file mode 100644
index 0000000..f363f68
--- /dev/null
+++ b/bnyer-services/bnyer-ai/src/main/resources/bootstrap-grey.yml
@@ -0,0 +1,26 @@
+spring:
+ cloud:
+ nacos:
+ discovery:
+ # 解决部署在不同服务器访问不到的问题,需暴露外网ip
+ ip: 81.69.47.31
+ # 部署在不同服务器上的指定端口
+ port: 9102
+ # 服务注册地址
+ server-addr: http://175.24.122.142:8848
+ # 命名空间地址
+ namespace: abfe8ee6-161b-4f8f-b61f-51663bbfa4f9
+ # 命名空间分组
+ group: grey
+ config:
+ # 配置中心地址
+ server-addr: http://175.24.122.142:8848
+ # 配置文件格式
+ file-extension: yml
+ # 命名空间地址
+ namespace: abfe8ee6-161b-4f8f-b61f-51663bbfa4f9
+ # 命名空间分组
+ group: grey
+ # 共享配置
+ shared-configs:
+ - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
diff --git a/bnyer-services/bnyer-ai/src/main/resources/bootstrap-prod.yml b/bnyer-services/bnyer-ai/src/main/resources/bootstrap-prod.yml
new file mode 100644
index 0000000..374941d
--- /dev/null
+++ b/bnyer-services/bnyer-ai/src/main/resources/bootstrap-prod.yml
@@ -0,0 +1,22 @@
+spring:
+ cloud:
+ nacos:
+ discovery:
+ # 服务注册地址
+ server-addr: http://192.168.3.100:6001
+ # 命名空间地址
+ namespace: b133c9e5-9f8d-4ed4-9ebd-95557802889f
+ # 命名空间分组
+ group: prod
+ config:
+ # 配置中心地址
+ server-addr: http://192.168.3.100:6001
+ # 配置文件格式
+ file-extension: yml
+ # 命名空间地址
+ namespace: b133c9e5-9f8d-4ed4-9ebd-95557802889f
+ # 命名空间分组
+ group: prod
+ # 共享配置
+ shared-configs:
+ - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
diff --git a/bnyer-services/bnyer-ai/src/main/resources/bootstrap-test.yml b/bnyer-services/bnyer-ai/src/main/resources/bootstrap-test.yml
new file mode 100644
index 0000000..abb20aa
--- /dev/null
+++ b/bnyer-services/bnyer-ai/src/main/resources/bootstrap-test.yml
@@ -0,0 +1,22 @@
+spring:
+ cloud:
+ nacos:
+ discovery:
+ # 服务注册地址
+ server-addr: http://117.50.61.7:8848
+ # 命名空间地址
+ namespace: 1bf94455-a046-41e3-b7e4-c12fd11c3690
+ # 命名空间分组
+ group: test
+ config:
+ # 配置中心地址
+ server-addr: http://117.50.61.7:8848
+ # 配置文件格式
+ file-extension: yml
+ # 命名空间地址
+ namespace: 1bf94455-a046-41e3-b7e4-c12fd11c3690
+ # 命名空间分组
+ group: test
+ # 共享配置
+ shared-configs:
+ - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
diff --git a/bnyer-services/bnyer-ai/src/main/resources/bootstrap.yml b/bnyer-services/bnyer-ai/src/main/resources/bootstrap.yml
new file mode 100644
index 0000000..d08964d
--- /dev/null
+++ b/bnyer-services/bnyer-ai/src/main/resources/bootstrap.yml
@@ -0,0 +1,15 @@
+# Tomcat
+server:
+ port: 9105
+
+# Spring
+spring:
+ main:
+ #解决循环依赖问题
+ allow-circular-references: true
+ application:
+ # 应用名称
+ name: bnyer-ai
+ profiles:
+ # 环境配置
+ active: dev
diff --git a/bnyer-services/bnyer-ai/src/main/resources/logback.xml b/bnyer-services/bnyer-ai/src/main/resources/logback.xml
new file mode 100644
index 0000000..8d81736
--- /dev/null
+++ b/bnyer-services/bnyer-ai/src/main/resources/logback.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+ ${log.pattern}
+
+
+
+
+
+ ${log.path}/info.log
+
+
+
+ ${log.path}/info.%d{yyyy-MM-dd}.log
+
+ 20
+
+
+ ${log.pattern}
+
+
+
+ INFO
+
+ ACCEPT
+
+ DENY
+
+
+
+
+ ${log.path}/error.log
+
+
+
+ ${log.path}/error.%d{yyyy-MM-dd}.log
+
+ 20
+
+
+ ${log.pattern}
+
+
+
+ ERROR
+
+ ACCEPT
+
+ DENY
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/bnyer-services/pom.xml b/bnyer-services/pom.xml
index fe6b3fe..66a49b8 100644
--- a/bnyer-services/pom.xml
+++ b/bnyer-services/pom.xml
@@ -14,6 +14,7 @@
bnyer-img
bnyer-order
bnyer-pay
+ bnyer-ai
bnyer-services