fix:gpt优化

This commit is contained in:
zhongzb
2023-07-01 22:13:39 +08:00
parent 597e5a0361
commit e9dbeec854
6 changed files with 32 additions and 14 deletions

View File

@@ -113,7 +113,8 @@ CREATE TABLE `user` (
INDEX `idx_create_time`(`create_time`) USING BTREE, INDEX `idx_create_time`(`create_time`) USING BTREE,
INDEX `idx_update_time`(`update_time`) USING BTREE INDEX `idx_update_time`(`update_time`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户表' ROW_FORMAT = Dynamic; ) 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 -- Table structure for user_backpack
-- ---------------------------- -- ----------------------------

View File

@@ -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');

View File

@@ -25,4 +25,12 @@ oss.type=minio
oss.endpoint=http://localhost:9000 oss.endpoint=http://localhost:9000
oss.access-key=BEZ213 oss.access-key=BEZ213
oss.secret-key=Ii4vCMIXuFfds1EZ8e7RXI2342342kV oss.secret-key=Ii4vCMIXuFfds1EZ8e7RXI2342342kV
oss.bucketName=default 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

View File

@@ -25,4 +25,12 @@ oss.type=minio
oss.endpoint=http://localhost:9000 oss.endpoint=http://localhost:9000
oss.access-key=BEZ213 oss.access-key=BEZ213
oss.secret-key=Ii4vCMIXuFe241dsfEZ8e7RXI2342342kV oss.secret-key=Ii4vCMIXuFe241dsfEZ8e7RXI2342342kV
oss.bucketName=default 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

View File

@@ -12,7 +12,7 @@ mybatis-plus:
spring: spring:
profiles: profiles:
#运行的环境 #运行的环境
active: test active: my-prod
application: application:
name: mallchat name: mallchat
datasource: datasource:
@@ -37,8 +37,8 @@ spring:
database: 0 database: 0
# 连接超时时间 # 连接超时时间
timeout: 1800000 timeout: 1800000
# # 设置密码 # 设置密码
# password: ${mallchat.redis.password} password: ${mallchat.redis.password}
lettuce: lettuce:
pool: pool:
# 最大阻塞等待时间,负数表示没有限制 # 最大阻塞等待时间,负数表示没有限制
@@ -65,11 +65,12 @@ wx:
aesKey: ${mallchat.wx.aesKey} # 接口配置里的EncodingAESKey值 aesKey: ${mallchat.wx.aesKey} # 接口配置里的EncodingAESKey值
chatai: chatai:
chatgpt: chatgpt:
use: true use: ${mallchat.chatgpt.use}
AIUserId: 10452 AIUserId: ${mallchat.chatgpt.uid}
key: xxxxx key: ${mallchat.chatgpt.key}
proxyUrl: ${mallchat.chatgpt.proxyUrl}
chatglm2: chatglm2:
use: true use: ${mallchat.chatglm2.use}
url: xxxxx url: ${mallchat.chatglm2.url}
minute: 3 # 每个用户每3分钟可以请求一次 minute: 3 # 每个用户每3分钟可以请求一次
AIUserId: 10451 AIUserId: ${mallchat.chatglm2.uid}

View File

@@ -15,7 +15,6 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.util.Collections; import java.util.Collections;
@@ -25,7 +24,6 @@ import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@Slf4j @Slf4j
@Component
public abstract class AbstractChatAIHandler implements DisposableBean, InitializingBean { public abstract class AbstractChatAIHandler implements DisposableBean, InitializingBean {
public static ExecutorService EXECUTOR; public static ExecutorService EXECUTOR;