diff --git a/docs/mallchat.sql b/docs/mallchat.sql index 3a21d4b..9a94090 100644 --- a/docs/mallchat.sql +++ b/docs/mallchat.sql @@ -113,7 +113,8 @@ CREATE TABLE `user` ( INDEX `idx_create_time`(`create_time`) USING BTREE, INDEX `idx_update_time`(`update_time`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户表' ROW_FORMAT = Dynamic; - +INSERT INTO `mallchat`.`user` (`id`, `name`, `avatar`, `sex`, `open_id`, `last_opt_time`, `ip_info`, `item_id`, `status`, `create_time`, `update_time`) VALUES (10001, 'ChatGPT', 'https://img1.baidu.com/it/u=3613958228,3522035000&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500', 0, '??', '2023-06-29 17:03:03.357', NULL, NULL, 0, '2023-06-29 17:03:03.357', '2023-07-01 14:56:10.271'); +INSERT INTO `mallchat`.`user` (`id`, `name`, `avatar`, `sex`, `open_id`, `last_opt_time`, `ip_info`, `item_id`, `status`, `create_time`, `update_time`) VALUES (10002, 'ChatGLM2', 'http://mms1.baidu.com/it/u=1979830414,2984779047&fm=253&app=138&f=JPEG&fmt=auto&q=75?w=500&h=500', NULL, '450', '2023-07-01 11:58:24.605', NULL, NULL, 0, '2023-07-01 11:58:24.605', '2023-07-01 12:02:56.900'); -- ---------------------------- -- Table structure for user_backpack -- ---------------------------- diff --git a/docs/version/2023-07-01.sql b/docs/version/2023-07-01.sql new file mode 100644 index 0000000..847dbeb --- /dev/null +++ b/docs/version/2023-07-01.sql @@ -0,0 +1,2 @@ +INSERT INTO `mallchat`.`user` (`id`, `name`, `avatar`, `sex`, `open_id`, `last_opt_time`, `ip_info`, `item_id`, `status`, `create_time`, `update_time`) VALUES (10001, 'ChatGPT', 'https://img1.baidu.com/it/u=3613958228,3522035000&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500', 0, '??', '2023-06-29 17:03:03.357', NULL, NULL, 0, '2023-06-29 17:03:03.357', '2023-07-01 14:56:10.271'); +INSERT INTO `mallchat`.`user` (`id`, `name`, `avatar`, `sex`, `open_id`, `last_opt_time`, `ip_info`, `item_id`, `status`, `create_time`, `update_time`) VALUES (10002, 'ChatGLM2', 'http://mms1.baidu.com/it/u=1979830414,2984779047&fm=253&app=138&f=JPEG&fmt=auto&q=75?w=500&h=500', NULL, '450', '2023-07-01 11:58:24.605', NULL, NULL, 0, '2023-07-01 11:58:24.605', '2023-07-01 12:02:56.900'); \ No newline at end of file diff --git a/mallchat-common/src/main/resources/application-pro.properties b/mallchat-common/src/main/resources/application-pro.properties index 3b71009..c6a31b5 100644 --- a/mallchat-common/src/main/resources/application-pro.properties +++ b/mallchat-common/src/main/resources/application-pro.properties @@ -25,4 +25,12 @@ oss.type=minio oss.endpoint=http://localhost:9000 oss.access-key=BEZ213 oss.secret-key=Ii4vCMIXuFfds1EZ8e7RXI2342342kV -oss.bucketName=default \ No newline at end of file +oss.bucketName=default +##################gpt配置################## +mallchat.chatgpt.use=false +mallchat.chatgpt.uid=10001 +mallchat.chatgpt.key=sk-wvWM0xGcxFfsddfsgxixbXK5tHovM +mallchat.chatgpt.proxyUrl=https://123.cc +mallchat.chatglm2.use=false +mallchat.chatglm2.url=http://v32134.cc +mallchat.chatglm2.uid=10002 \ No newline at end of file diff --git a/mallchat-common/src/main/resources/application-test.properties b/mallchat-common/src/main/resources/application-test.properties index 45e7793..a4967ae 100644 --- a/mallchat-common/src/main/resources/application-test.properties +++ b/mallchat-common/src/main/resources/application-test.properties @@ -25,4 +25,12 @@ oss.type=minio oss.endpoint=http://localhost:9000 oss.access-key=BEZ213 oss.secret-key=Ii4vCMIXuFe241dsfEZ8e7RXI2342342kV -oss.bucketName=default \ No newline at end of file +oss.bucketName=default +##################gpt配置################## +mallchat.chatgpt.use=false +mallchat.chatgpt.uid=10001 +mallchat.chatgpt.key=sk-wvWM0xGcxFfsddfsgxixbXK5tHovM +mallchat.chatgpt.proxyUrl=https://123.cc +mallchat.chatglm2.use=false +mallchat.chatglm2.url=http://v32134.cc +mallchat.chatglm2.uid=10002 \ No newline at end of file diff --git a/mallchat-common/src/main/resources/application.yml b/mallchat-common/src/main/resources/application.yml index 6f13a61..2f2ab12 100644 --- a/mallchat-common/src/main/resources/application.yml +++ b/mallchat-common/src/main/resources/application.yml @@ -12,7 +12,7 @@ mybatis-plus: spring: profiles: #运行的环境 - active: test + active: my-prod application: name: mallchat datasource: @@ -37,8 +37,8 @@ spring: database: 0 # 连接超时时间 timeout: 1800000 -# # 设置密码 -# password: ${mallchat.redis.password} + # 设置密码 + password: ${mallchat.redis.password} lettuce: pool: # 最大阻塞等待时间,负数表示没有限制 @@ -65,11 +65,12 @@ wx: aesKey: ${mallchat.wx.aesKey} # 接口配置里的EncodingAESKey值 chatai: chatgpt: - use: true - AIUserId: 10452 - key: xxxxx + use: ${mallchat.chatgpt.use} + AIUserId: ${mallchat.chatgpt.uid} + key: ${mallchat.chatgpt.key} + proxyUrl: ${mallchat.chatgpt.proxyUrl} chatglm2: - use: true - url: xxxxx + use: ${mallchat.chatglm2.use} + url: ${mallchat.chatglm2.url} minute: 3 # 每个用户每3分钟可以请求一次 - AIUserId: 10451 + AIUserId: ${mallchat.chatglm2.uid} diff --git a/mallchat-custom-server/src/main/java/com/abin/mallchat/custom/chatai/handler/AbstractChatAIHandler.java b/mallchat-custom-server/src/main/java/com/abin/mallchat/custom/chatai/handler/AbstractChatAIHandler.java index 04e5a6e..183f4e3 100644 --- a/mallchat-custom-server/src/main/java/com/abin/mallchat/custom/chatai/handler/AbstractChatAIHandler.java +++ b/mallchat-custom-server/src/main/java/com/abin/mallchat/custom/chatai/handler/AbstractChatAIHandler.java @@ -15,7 +15,6 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import java.util.Collections; @@ -25,7 +24,6 @@ import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; @Slf4j -@Component public abstract class AbstractChatAIHandler implements DisposableBean, InitializingBean { public static ExecutorService EXECUTOR;