diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a198d7f..ab0c5c2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,18 @@ # 更新日志 ## v3.1.8 + 1. 功能新增:新增会员套餐充值,点卡充值,订单系统,集成支付宝支付通道 -2. Bug修复:修复 MidJourney API 参数版本更新导致调用失败的 Bug -3. 功能优化:将聊天报错信息定义为统一常量,方便修改 +2. Bug修复:修复 MidJourney API 参数版本更新导致调用失败问题 +3. Bug修复:修复 Stable Diffusion 调用后没有更新绘图调用次数问题 +4. Bug修复:修复七牛云上传报错 expired token +5. Bug修复:修复高权重模型导致的对话次数为负数的漏洞 +6. 功能优化:将聊天报错信息定义为统一常量,方便修改 +7. 功能优化:优化 markdown 表格显示样式,覆写 Element-Plus 表格样式 +8. 功能优化:增加倒数计时组件,定期自动清理未支付的订单 ## v3.1.7 + 1. 功能新增:支持文心4.0 AI 模型 2. 功能新增:可以在管理后台为用户绑定指定的 AI 模型,如只给某个用户使用 GPT-4 模型 3. 功能新增:模型新增权重字段,不同的模型每次调用耗费的点数可以设置不同,比如GPT4是GPT3.5的10倍 @@ -13,6 +20,7 @@ 5. 功能优化:优化 MidJourney 专业绘画页面图片预览样式 ## v3.1.6 + 1. 功能新增:新增AI 绘画照片墙功能页面,供用户查看所有的 AI 绘画作品 2. 功能新增:新增 AI 角色应用功能页面,用户可以添加自己感兴趣的应用 3. 功能优化:优化瀑布流组件的页面布局 diff --git a/README.md b/README.md index 95dee9ce..fe1b691b 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,8 @@ ChatGLM,讯飞星火,文心一言等多个平台的大语言模型。集成了 * 支持 MidJourney / Stable Diffusion AI 绘画集成,开箱即用。 * 支持使用个人微信二维码作为充值收费的支付渠道,无需企业支付通道。 * 已集成支付宝支付功能,支持多种会员套餐和点卡购买功能。 -* 集成插件 API 功能,可结合大语言模型的 function 功能开发各种强大的插件,已内置实现了微博热搜,今日头条,今日早报和 AI 绘画函数插件。 +* 集成插件 API 功能,可结合大语言模型的 function 功能开发各种强大的插件,已内置实现了微博热搜,今日头条,今日早报和 AI + 绘画函数插件。 ## 功能截图 @@ -23,17 +24,28 @@ ChatGLM,讯飞星火,文心一言等多个平台的大语言模型。集成了 ![ChatGPT new Chat Page](/docs/imgs/chat-new.png) ### MidJourney 专业绘画界面 + ![mid-journey](/docs/imgs/mj_image.jpg) ### Stable-Diffusion 专业绘画页面 + ![Stable-Diffusion](/docs/imgs/sd_image.jpg) ![Stable-Diffusion](/docs/imgs/sd_image_detail.jpg) + ### 绘图作品展 + ![ChatGPT image_list](/docs/imgs/image-list.png) + ### AI应用列表 + ![ChatGPT-app-list](/docs/imgs/app-list.jpg) +### 会员充值 + +![会员充值](/docs/imgs/alipay.png) + ### 自动调用函数插件 + ![ChatGPT function plugin](/docs/imgs/plugin.png) ![ChatGPT function plugin](/docs/imgs/mj.jpg) diff --git a/api/service/sd/service.go b/api/service/sd/service.go index e1f88920..a0ddadf3 100644 --- a/api/service/sd/service.go +++ b/api/service/sd/service.go @@ -287,7 +287,8 @@ func (s *Service) callback(data CBReq) { if data.Progress < 100 && data.ImageData != "" { jobVo.ImgURL = data.ImageData } - + // 扣减绘图次数 + s.db.Where("id = ?", jobVo.UserId).UpdateColumn("img_calls", gorm.Expr("img_calls - ?", 1)) // 推送任务到前端 if client != nil { utils.ReplyChunkMessage(client, jobVo) diff --git a/api/service/xxl_job_service.go b/api/service/xxl_job_service.go index dea9a677..7120f9fc 100644 --- a/api/service/xxl_job_service.go +++ b/api/service/xxl_job_service.go @@ -38,13 +38,13 @@ func NewXXLJobExecutor(config *types.AppConfig, db *gorm.DB) *XXLJobExecutor { } func (e *XXLJobExecutor) Run() error { - e.executor.RegTask("ClearOrder", e.ClearOrder) + e.executor.RegTask("ClearOrders", e.ClearOrders) e.executor.RegTask("ResetVipCalls", e.ResetVipCalls) return e.executor.Run() } -// ClearOrder 清理未支付的订单,如果没有抛出异常则表示执行成功 -func (e *XXLJobExecutor) ClearOrder(cxt context.Context, param *xxl.RunReq) (msg string) { +// ClearOrders 清理未支付的订单,如果没有抛出异常则表示执行成功 +func (e *XXLJobExecutor) ClearOrders(cxt context.Context, param *xxl.RunReq) (msg string) { logger.Debug("执行清理未支付订单...") var sysConfig model.Config res := e.db.Where("marker", "system").First(&sysConfig) diff --git a/database/update-v3.1.8.sql b/database/update-v3.1.8.sql index fbdbf498..1d121f1f 100644 --- a/database/update-v3.1.8.sql +++ b/database/update-v3.1.8.sql @@ -17,20 +17,6 @@ CREATE TABLE `chatgpt_orders` ( `deleted_at` datetime DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='充值订单表'; --- --- 转存表中的数据 `chatgpt_orders` --- -INSERT INTO `chatgpt_orders` (`id`, `user_id`, `product_id`, `mobile`, `order_no`, `subject`, `amount`, `status`, `remark`, `pay_time`, `created_at`, `updated_at`, `deleted_at`) VALUES - (4, 4, 1, '18575670125', '202308317102915300416290816', '会员1个月', '0.01', 2, '{\"days\":30,\"calls\":500,\"name\":\"会员1个月\",\"discount\":10.99}', 1693466990, '2023-08-31 15:29:33', '2023-08-31 15:29:51', NULL), - (5, 4, 5, '18575670125', '202308317102946758199607296', '100次点卡', '0.30', 2, '{\"days\":0,\"calls\":100,\"name\":\"100次点卡\"}', 1693466990, '2023-08-31 17:34:34', '2023-08-31 17:34:34', NULL), - (6, 4, 5, '18575670125', '202308317102946843595636736', '100次点卡', '0.03', 2, '{\"days\":0,\"calls\":100,\"name\":\"100次点卡\"}', 1693474722, '2023-08-31 17:34:54', '2023-08-31 17:38:43', NULL), - (7, 4, 1, '18575670125', '202309017103252664456052736', '会员1个月', '0.01', 2, '{\"days\":30,\"calls\":0,\"name\":\"会员1个月\"}', 1693466990, '2023-09-01 13:50:07', '2023-09-01 13:50:07', NULL), - (8, 4, 1, '18575670125', '202309017103252894391992320', '会员1个月', '0.01', 2, '{\"days\":30,\"calls\":0,\"name\":\"会员1个月\"}', 1693466990, '2023-09-01 13:51:02', '2023-09-01 13:51:02', NULL), - (9, 4, 5, '18575670125', '202309017103254657538981888', '100次点卡', '0.03', 2, '{\"days\":0,\"calls\":100,\"name\":\"100次点卡\"}', 1693474722, '2023-09-01 13:58:02', '2023-09-01 13:58:02', NULL), - (10, 4, 1, '18575670125', '202309017103259375405367296', '会员1个月', '0.01', 2, '{\"days\":30,\"calls\":0,\"name\":\"会员1个月\"}', 1693474722, '2023-09-01 14:16:47', '2023-09-01 14:16:47', NULL), - (11, 4, 3, '18575670125', '202309017103290730432430080', '会员6个月', '190.00', 2, '{\"days\":180,\"calls\":0,\"name\":\"会员6个月\",\"price\":290,\"discount\":100}', 1693474722, '2023-09-01 16:21:23', '2023-09-01 16:21:23', NULL), - (12, 4, 4, '18575670125', '202309017103291707520712704', '会员12个月', '380.00', 2, '{\"days\":365,\"calls\":0,\"name\":\"会员12个月\",\"price\":580,\"discount\":200}', 1693466990, '2023-09-01 16:25:16', '2023-09-01 16:25:16', NULL); - -- 创建索引 ALTER TABLE `chatgpt_orders` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `order_no` (`order_no`); ALTER TABLE `chatgpt_orders` MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13; @@ -57,4 +43,6 @@ INSERT INTO `chatgpt_products` (`id`, `name`, `price`, `discount`, `days`, `call (5, '100次点卡', '10.03', '10.00', 0, 100, 1, 0, 0, '2023-08-28 10:55:08', '2023-08-31 17:34:43'); ALTER TABLE `chatgpt_products` ADD PRIMARY KEY (`id`); -ALTER TABLE `chatgpt_products` MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; \ No newline at end of file +ALTER TABLE `chatgpt_products` MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6; + +ALTER TABLE `chatgpt_orders` ADD `pay_way` VARCHAR(20) DEFAULT '0' NOT NULL COMMENT '支付方式' AFTER `pay_time`; \ No newline at end of file diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index c6091d5a..7689bfde 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -11,6 +11,7 @@ services: - CONFIG_FILE=config.toml ports: - "5678:5678" + - "9999:9999" volumes: - /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime - ./conf/config.toml:/var/www/app/config.toml diff --git a/docker/dockerfile-vue b/docker/dockerfile-vue index 217a327a..086c7331 100644 --- a/docker/dockerfile-vue +++ b/docker/dockerfile-vue @@ -1,5 +1,5 @@ # 前端 Vue 项目构建 -FROM nginx:1.20 +FROM nginx:1.20.2 MAINTAINER yangjian @@ -8,4 +8,4 @@ COPY ./web/dist /var/www/app/dist EXPOSE 80 EXPOSE 443 -EXPOSE 8080 \ No newline at end of file +EXPOSE 8080 diff --git a/docs/imgs/alipay.png b/docs/imgs/alipay.png index 79d2e611..d1966432 100644 Binary files a/docs/imgs/alipay.png and b/docs/imgs/alipay.png differ diff --git a/web/src/components/CountDown.vue b/web/src/components/CountDown.vue index f21a31b4..abe584a0 100644 --- a/web/src/components/CountDown.vue +++ b/web/src/components/CountDown.vue @@ -8,6 +8,7 @@ import {onMounted, ref, watch} from "vue"; +// eslint-disable-next-line no-undef const props = defineProps({ second: Number, type: { @@ -16,6 +17,7 @@ const props = defineProps({ } }); +// eslint-disable-next-line no-undef const emits = defineEmits(['timeout']); const counter = ref(props.second) const timerStr = ref("") @@ -34,7 +36,7 @@ const resetTimer = () => { if (handler.value) { clearInterval(handler.value) } - + counter.value = props.second formatTimer(counter.value) handler.value = setInterval(() => { @@ -80,6 +82,7 @@ const formatTimer = (secs) => { timerStr.value = timer.join("") } +// eslint-disable-next-line no-undef defineExpose({resetTimer}) diff --git a/web/src/components/ItemList.vue b/web/src/components/ItemList.vue index 551f1b8a..ef9d9ca6 100644 --- a/web/src/components/ItemList.vue +++ b/web/src/components/ItemList.vue @@ -47,7 +47,7 @@ onMounted(() => { const computeSize = () => { const w = container.value.offsetWidth - 8 // 减去滚动条的宽度 let cols = Math.floor(w / props.width) - itemWidth.value = Math.floor(w / cols) + itemWidth.value = Math.ceil(w / cols) } window.onresize = () => { diff --git a/web/src/views/Member.vue b/web/src/views/Member.vue index d615592f..d0b4be23 100644 --- a/web/src/views/Member.vue +++ b/web/src/views/Member.vue @@ -1,75 +1,82 @@