From 34f3bc257fb56dc3dc0a8bf6c3f3b093669f4eb2 Mon Sep 17 00:00:00 2001 From: chengkun Date: Tue, 1 Aug 2023 11:12:10 +0800 Subject: [PATCH] =?UTF-8?q?hotfix=EF=BC=9A=E7=A7=BB=E9=99=A4bnyer-ai?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bnyer-services/bnyer-ai/pom.xml | 134 ------------------ .../java/com/bnyer/ai/BnyerAiApplication.java | 33 ----- .../ai/controller/ChatGptController.java | 32 ----- .../com/bnyer/ai/service/ChatGptService.java | 6 - .../ai/service/impl/ChatGptServiceImpl.java | 42 ------ .../src/main/resources/bootstrap-dev.yml | 22 --- .../src/main/resources/bootstrap-grey.yml | 26 ---- .../src/main/resources/bootstrap-prod.yml | 22 --- .../src/main/resources/bootstrap-test.yml | 22 --- .../bnyer-ai/src/main/resources/bootstrap.yml | 15 -- .../bnyer-ai/src/main/resources/logback.xml | 74 ---------- bnyer-services/pom.xml | 1 - 12 files changed, 429 deletions(-) delete mode 100644 bnyer-services/bnyer-ai/pom.xml delete mode 100644 bnyer-services/bnyer-ai/src/main/java/com/bnyer/ai/BnyerAiApplication.java delete mode 100644 bnyer-services/bnyer-ai/src/main/java/com/bnyer/ai/controller/ChatGptController.java delete mode 100644 bnyer-services/bnyer-ai/src/main/java/com/bnyer/ai/service/ChatGptService.java delete mode 100644 bnyer-services/bnyer-ai/src/main/java/com/bnyer/ai/service/impl/ChatGptServiceImpl.java delete mode 100644 bnyer-services/bnyer-ai/src/main/resources/bootstrap-dev.yml delete mode 100644 bnyer-services/bnyer-ai/src/main/resources/bootstrap-grey.yml delete mode 100644 bnyer-services/bnyer-ai/src/main/resources/bootstrap-prod.yml delete mode 100644 bnyer-services/bnyer-ai/src/main/resources/bootstrap-test.yml delete mode 100644 bnyer-services/bnyer-ai/src/main/resources/bootstrap.yml delete mode 100644 bnyer-services/bnyer-ai/src/main/resources/logback.xml diff --git a/bnyer-services/bnyer-ai/pom.xml b/bnyer-services/bnyer-ai/pom.xml deleted file mode 100644 index a8ccaf1..0000000 --- a/bnyer-services/bnyer-ai/pom.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - - 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 - - - - - 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 deleted file mode 100644 index 759eb56..0000000 --- a/bnyer-services/bnyer-ai/src/main/java/com/bnyer/ai/BnyerAiApplication.java +++ /dev/null @@ -1,33 +0,0 @@ -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 deleted file mode 100644 index f6680c3..0000000 --- a/bnyer-services/bnyer-ai/src/main/java/com/bnyer/ai/controller/ChatGptController.java +++ /dev/null @@ -1,32 +0,0 @@ -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 deleted file mode 100644 index 9b32eb3..0000000 --- a/bnyer-services/bnyer-ai/src/main/java/com/bnyer/ai/service/ChatGptService.java +++ /dev/null @@ -1,6 +0,0 @@ -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 deleted file mode 100644 index 9b76d2b..0000000 --- a/bnyer-services/bnyer-ai/src/main/java/com/bnyer/ai/service/impl/ChatGptServiceImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -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 deleted file mode 100644 index 6d55152..0000000 --- a/bnyer-services/bnyer-ai/src/main/resources/bootstrap-dev.yml +++ /dev/null @@ -1,22 +0,0 @@ -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 deleted file mode 100644 index f363f68..0000000 --- a/bnyer-services/bnyer-ai/src/main/resources/bootstrap-grey.yml +++ /dev/null @@ -1,26 +0,0 @@ -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 deleted file mode 100644 index 374941d..0000000 --- a/bnyer-services/bnyer-ai/src/main/resources/bootstrap-prod.yml +++ /dev/null @@ -1,22 +0,0 @@ -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 deleted file mode 100644 index abb20aa..0000000 --- a/bnyer-services/bnyer-ai/src/main/resources/bootstrap-test.yml +++ /dev/null @@ -1,22 +0,0 @@ -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 deleted file mode 100644 index d08964d..0000000 --- a/bnyer-services/bnyer-ai/src/main/resources/bootstrap.yml +++ /dev/null @@ -1,15 +0,0 @@ -# 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 deleted file mode 100644 index 8d81736..0000000 --- a/bnyer-services/bnyer-ai/src/main/resources/logback.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - ${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 66a49b8..fe6b3fe 100644 --- a/bnyer-services/pom.xml +++ b/bnyer-services/pom.xml @@ -14,7 +14,6 @@ bnyer-img bnyer-order bnyer-pay - bnyer-ai bnyer-services