Skip to content

Commit f943669

Browse files
use absolute path for all routes
1 parent 3b26735 commit f943669

File tree

9 files changed

+27
-19
lines changed

9 files changed

+27
-19
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# 更新日志
22

3+
## v3.1.2
4+
1. 功能新增:新增七牛云 OSS 实现,目前已支持三种文件上传服务:Local, Minio, QiNiu OSS。
5+
2. 功能新增:新增桌面版,使用 electron 套壳网页版。
6+
3. Bug修复:自动去除众筹核销时候转账单号中的空格,防止复制的时候多复制了空格。
7+
4. 功能优化:ChatPlus.vue 页面支持通过 chat_id path variable 来定位到指定的聊天。
8+
5. 功能优化:取消导出聊天页面的授权验证
9+
6. 功能优化:所有路由跳转都使用绝对路径
10+
11+
## v3.1.1
12+
紧急修复版本,采用弹窗的方式显示验证码,解决验证码在低分辨率下被掩盖的Bug
13+
314
## v3.1.0(大版本更新)
415
1. 功能重构:将聊天模型独立拆分,以便支持多平台模型,目前已经内置支持 OPenAI,Azure 以及 ChatGLM,用户可以在这两个平台的模型中随意切换,体验不同的模型聊天。
516
2. 功能重构:重写系统 API 授权机制,使用 JWT 替换传统的 session 会话授权,使得 API 授权变得更加灵活。

api/core/app_server.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ func authorizeMiddleware(s *AppServer, client *redis.Client) gin.HandlerFunc {
145145
c.Request.URL.Path == "/api/user/register" ||
146146
c.Request.URL.Path == "/api/reward/notify" ||
147147
c.Request.URL.Path == "/api/mj/notify" ||
148+
c.Request.URL.Path == "/api/chat/history" ||
149+
c.Request.URL.Path == "/api/chat/detail" ||
148150
strings.HasPrefix(c.Request.URL.Path, "/api/sms/") ||
149151
strings.HasPrefix(c.Request.URL.Path, "/api/captcha/") ||
150152
strings.HasPrefix(c.Request.URL.Path, "/static/") ||

api/handler/chat_history_handler.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,9 @@ func (h *ChatHandler) Update(c *gin.Context) {
3535
// History 获取聊天历史记录
3636
func (h *ChatHandler) History(c *gin.Context) {
3737
chatId := c.Query("chat_id") // 会话 ID
38-
user, err := utils.GetLoginUser(c, h.db)
39-
if err != nil {
40-
resp.NotAuth(c)
41-
return
42-
}
4338
var items []model.HistoryMessage
4439
var messages = make([]vo.HistoryMessage, 0)
45-
res := h.db.Where("chat_id = ? AND user_id = ?", chatId, user.Id).Find(&items)
40+
res := h.db.Where("chat_id = ?", chatId).Find(&items)
4641
if res.Error != nil {
4742
resp.ERROR(c, "No history message")
4843
return

web/src/views/ChatExport.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ const exportChat = () => {
102102
justify-content center
103103
104104
.chat-box {
105-
max-width 800px;
105+
width 800px;
106106
// 变量定义
107107
--content-font-size: 16px;
108108
--content-color: #c1c1c1;

web/src/views/ChatPlus.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ onMounted(() => {
356356
ElMessage.error("加载会话列表失败!")
357357
})
358358
}).catch(() => {
359-
router.push('login')
359+
router.push('/login')
360360
});
361361
362362
const clipboard = new Clipboard('.copy-reply');
@@ -417,7 +417,7 @@ const newChat = function () {
417417
418418
// 切换会话
419419
const changeChat = (chat) => {
420-
router.push("/chat/"+chat.chat_id)
420+
router.push("/chat/" + chat.chat_id)
421421
loadChat(chat)
422422
}
423423
@@ -750,7 +750,7 @@ const logout = function () {
750750
activelyClose.value = true;
751751
httpGet('/api/user/logout').then(() => {
752752
removeUserToken();
753-
router.push('login');
753+
router.push('/login');
754754
}).catch(() => {
755755
ElMessage.error('注销失败!');
756756
})

web/src/views/Home.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ checkSession().then(() => {
1717
router.push("/chat")
1818
}
1919
}).catch(() => {
20-
router.push("login")
20+
router.push("/login")
2121
})
2222
2323
</script>

web/src/views/Login.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
<el-row class="text-line">
3636
还没有账号?
37-
<el-link type="primary" @click="router.push('register')">注册新账号</el-link>
37+
<el-link type="primary" @click="router.push('/register')">注册新账号</el-link>
3838
</el-row>
3939
</div>
4040
</div>
@@ -66,9 +66,9 @@ const password = ref(process.env.VUE_APP_PASS);
6666
6767
checkSession().then(() => {
6868
if (isMobile()) {
69-
router.push('mobile')
69+
router.push('/mobile')
7070
} else {
71-
router.push('chat')
71+
router.push('/chat')
7272
}
7373
}).catch(() => {
7474
})
@@ -94,7 +94,7 @@ const login = function () {
9494
if (isMobile()) {
9595
router.push('/mobile')
9696
} else {
97-
router.push('chat')
97+
router.push('/chat')
9898
}
9999
}).catch((e) => {
100100
ElMessage.error('登录失败,' + e.message)

web/src/views/Register.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575

7676
<el-row class="text-line">
7777
已经有账号?
78-
<el-link type="primary" @click="router.push('login')">登录</el-link>
78+
<el-link type="primary" @click="router.push('/login')">登录</el-link>
7979
</el-row>
8080
</el-form>
8181
</div>
@@ -144,7 +144,7 @@ const register = function () {
144144
return ElMessage.error('请输入短信验证码');
145145
}
146146
httpPost('/api/user/register', formData.value).then(() => {
147-
ElMessage.success({"message": "注册成功,即将跳转到登录页...", onClose: () => router.push("login")})
147+
ElMessage.success({"message": "注册成功,即将跳转到登录页...", onClose: () => router.push("/login")})
148148
}).catch((e) => {
149149
ElMessage.error('注册失败,' + e.message)
150150
})

web/src/views/admin/Login.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const username = ref(process.env.VUE_APP_ADMIN_USER);
5555
const password = ref(process.env.VUE_APP_ADMIN_PASS);
5656
5757
checkAdminSession().then(() => {
58-
router.push("admin")
58+
router.push("/admin")
5959
}).catch(() => {
6060
})
6161
onMounted(() => {
@@ -76,7 +76,7 @@ const login = function () {
7676
7777
httpPost('/api/admin/login', {username: username.value.trim(), password: password.value.trim()}).then(res => {
7878
setAdminToken(res.data)
79-
router.push("admin")
79+
router.push("/admin")
8080
}).catch((e) => {
8181
ElMessage.error('登录失败,' + e.message)
8282
})

0 commit comments

Comments
 (0)