From bc7d06d3e5fefe9bacae921935f21d0a13da0e0f Mon Sep 17 00:00:00 2001 From: RockYang Date: Sat, 21 Dec 2024 21:44:52 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E5=A4=B1=E6=95=88=E7=9A=84=20Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/go.sum | 6 ++---- web/src/utils/http.js | 2 +- web/src/views/Home.vue | 9 +++++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/api/go.sum b/api/go.sum index 269690a5..f3f6eef9 100644 --- a/api/go.sum +++ b/api/go.sum @@ -214,12 +214,10 @@ github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gt github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= +github.com/tklauser/go-sysconf v0.3.13 h1:GBUpcahXSpR2xN01jhkNAbTLRk2Yzgggk8IM08lq3r4= github.com/tklauser/go-sysconf v0.3.13/go.mod h1:zwleP4Q4OehZHGn4CYZDipCgg9usW5IJePewFCGVEa0= -github.com/tklauser/go-sysconf v0.3.14 h1:g5vzr9iPFFz24v2KZXs/pvpvh8/V9Fw6vQK5ZZb78yU= -github.com/tklauser/go-sysconf v0.3.14/go.mod h1:1ym4lWMLUOhuBOPGtRcJm7tEGX4SCYNEEEtghGG/8uY= +github.com/tklauser/numcpus v0.7.0 h1:yjuerZP127QG9m5Zh/mSO4wqurYil27tHrqwRoRjpr4= github.com/tklauser/numcpus v0.7.0/go.mod h1:bb6dMVcj8A42tSE7i32fsIUCbQNllK5iDguyOZRUzAY= -github.com/tklauser/numcpus v0.8.0 h1:Mx4Wwe/FjZLeQsK/6kt2EOepwwSl7SmJrK5bV/dXYgY= -github.com/tklauser/numcpus v0.8.0/go.mod h1:ZJZlAY+dmR4eut8epnzf0u/VwodKmryxR8txiloSqBE= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/uber/jaeger-client-go v2.30.0+incompatible h1:D6wyKGCecFaSRUpo8lCVbaOOb6ThwMmTEbhRwtKR97o= diff --git a/web/src/utils/http.js b/web/src/utils/http.js index e154094b..3329591f 100644 --- a/web/src/utils/http.js +++ b/web/src/utils/http.js @@ -28,7 +28,7 @@ axios.interceptors.response.use( response => { return response }, error => { - if (error.response.status === 401 || error.response.status === 400) { + if (error.response.status === 401) { if (error.response.request.responseURL.indexOf("/api/admin") !== -1) { removeAdminToken() } else { diff --git a/web/src/views/Home.vue b/web/src/views/Home.vue index cdd49a69..43b14161 100644 --- a/web/src/views/Home.vue +++ b/web/src/views/Home.vue @@ -223,10 +223,11 @@ const init = () => { const logout = function () { httpGet('/api/user/logout').then(() => { removeUserToken() - store.setShowLoginDialog(true) - loginUser.value = {} - // 刷新组件 - routerViewKey.value += 1 + router.push('/login'); + // store.setShowLoginDialog(true) + // loginUser.value = {} + // // 刷新组件 + // routerViewKey.value += 1 }).catch(() => { ElMessage.error('注销失败!'); }) From a2481ff1cfb45b1de7b51115bd26ae99bda09274 Mon Sep 17 00:00:00 2001 From: RockYang Date: Tue, 7 Jan 2025 11:58:16 +0800 Subject: [PATCH 2/3] update readme --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fc68f5e0..619ee4fb 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,14 @@ # GeekAI > 根据[《生成式人工智能服务管理暂行办法》](https://www.cac.gov.cn/2023-07/13/c_1690898327029107.htm)的要求,请勿对中国地区公众提供一切未经备案的生成式人工智能服务。 -**GeekAI** 基于 AI 大语言模型 API 实现的 AI 助手全套开源解决方案,自带运营管理后台,开箱即用。集成了 OpenAI, Azure, -ChatGLM,讯飞星火,文心一言等多个平台的大语言模型。集成了 MidJourney 和 Stable Diffusion AI绘画功能。 +**GeekAI** 基于 AI 大语言模型 API 实现的 AI 助手全套开源解决方案,自带运营管理后台,开箱即用。集成了 OpenAI, Claude, 通义千问,Kimi,DeepSeek,Gitee AI 等多个平台的大语言模型。集成了 MidJourney 和 Stable Diffusion AI绘画功能。 主要特性: - 完整的开源系统,前端应用和后台管理系统皆可开箱即用。 - 基于 Websocket 实现,完美的打字机体验。 - 内置了各种预训练好的角色应用,比如小红书写手,英语翻译大师,苏格拉底,孔子,乔布斯,周报助手等。轻松满足你的各种聊天和应用需求。 -- 支持 OPenAI,Azure,文心一言,讯飞星火,清华 ChatGLM等多个大语言模型。 +- 支持 OpenAI, Claude, 通义千问,Kimi,DeepSeek等多个大语言模型,**支持 Gitee AI Serverless 大模型 API**。 - 支持 Suno 文生音乐 - 支持 MidJourney / Stable Diffusion AI 绘画集成,文生图,图生图,换脸,融图。开箱即用。 - 支持使用个人微信二维码作为充值收费的支付渠道,无需企业支付通道。 From 5213bdf08ba96a15d550a92e561a29a71a3ac841 Mon Sep 17 00:00:00 2001 From: RockYang Date: Sun, 19 Jan 2025 13:08:38 +0800 Subject: [PATCH 3/3] fixed bug for calculate chat message tokens --- api/handler/chatimpl/chat_handler.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/api/handler/chatimpl/chat_handler.go b/api/handler/chatimpl/chat_handler.go index 8ea002fa..bf686d31 100644 --- a/api/handler/chatimpl/chat_handler.go +++ b/api/handler/chatimpl/chat_handler.go @@ -379,17 +379,17 @@ func (h *ChatHandler) Tokens(c *gin.Context) { } // 如果没有传入 text 字段,则说明是获取当前 reply 总的 token 消耗(带上下文) - if data.Text == "" && data.ChatId != "" { - var item model.ChatMessage - userId, _ := c.Get(types.LoginUserID) - res := h.DB.Where("user_id = ?", userId).Where("chat_id = ?", data.ChatId).Last(&item) - if res.Error != nil { - resp.ERROR(c, res.Error.Error()) - return - } - resp.SUCCESS(c, item.Tokens) - return - } + //if data.Text == "" && data.ChatId != "" { + // var item model.ChatMessage + // userId, _ := c.Get(types.LoginUserID) + // res := h.DB.Where("user_id = ?", userId).Where("chat_id = ?", data.ChatId).Last(&item) + // if res.Error != nil { + // resp.ERROR(c, res.Error.Error()) + // return + // } + // resp.SUCCESS(c, item.Tokens) + // return + //} tokens, err := utils.CalcTokens(data.Text, data.Model) if err != nil {