Skip to content

Commit

Permalink
use absolute path for all routes
Browse files Browse the repository at this point in the history
  • Loading branch information
yangjian102621 committed Sep 7, 2023
1 parent 3b26735 commit f943669
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 19 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# 更新日志

## v3.1.2
1. 功能新增:新增七牛云 OSS 实现,目前已支持三种文件上传服务:Local, Minio, QiNiu OSS。
2. 功能新增:新增桌面版,使用 electron 套壳网页版。
3. Bug修复:自动去除众筹核销时候转账单号中的空格,防止复制的时候多复制了空格。
4. 功能优化:ChatPlus.vue 页面支持通过 chat_id path variable 来定位到指定的聊天。
5. 功能优化:取消导出聊天页面的授权验证
6. 功能优化:所有路由跳转都使用绝对路径

## v3.1.1
紧急修复版本,采用弹窗的方式显示验证码,解决验证码在低分辨率下被掩盖的Bug

## v3.1.0(大版本更新)
1. 功能重构:将聊天模型独立拆分,以便支持多平台模型,目前已经内置支持 OPenAI,Azure 以及 ChatGLM,用户可以在这两个平台的模型中随意切换,体验不同的模型聊天。
2. 功能重构:重写系统 API 授权机制,使用 JWT 替换传统的 session 会话授权,使得 API 授权变得更加灵活。
Expand Down
2 changes: 2 additions & 0 deletions api/core/app_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ func authorizeMiddleware(s *AppServer, client *redis.Client) gin.HandlerFunc {
c.Request.URL.Path == "/api/user/register" ||
c.Request.URL.Path == "/api/reward/notify" ||
c.Request.URL.Path == "/api/mj/notify" ||
c.Request.URL.Path == "/api/chat/history" ||
c.Request.URL.Path == "/api/chat/detail" ||
strings.HasPrefix(c.Request.URL.Path, "/api/sms/") ||
strings.HasPrefix(c.Request.URL.Path, "/api/captcha/") ||
strings.HasPrefix(c.Request.URL.Path, "/static/") ||
Expand Down
7 changes: 1 addition & 6 deletions api/handler/chat_history_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,9 @@ func (h *ChatHandler) Update(c *gin.Context) {
// History 获取聊天历史记录
func (h *ChatHandler) History(c *gin.Context) {
chatId := c.Query("chat_id") // 会话 ID
user, err := utils.GetLoginUser(c, h.db)
if err != nil {
resp.NotAuth(c)
return
}
var items []model.HistoryMessage
var messages = make([]vo.HistoryMessage, 0)
res := h.db.Where("chat_id = ? AND user_id = ?", chatId, user.Id).Find(&items)
res := h.db.Where("chat_id = ?", chatId).Find(&items)
if res.Error != nil {
resp.ERROR(c, "No history message")
return
Expand Down
2 changes: 1 addition & 1 deletion web/src/views/ChatExport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const exportChat = () => {
justify-content center
.chat-box {
max-width 800px;
width 800px;
// 变量定义
--content-font-size: 16px;
--content-color: #c1c1c1;
Expand Down
6 changes: 3 additions & 3 deletions web/src/views/ChatPlus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ onMounted(() => {
ElMessage.error("加载会话列表失败!")
})
}).catch(() => {
router.push('login')
router.push('/login')
});
const clipboard = new Clipboard('.copy-reply');
Expand Down Expand Up @@ -417,7 +417,7 @@ const newChat = function () {
// 切换会话
const changeChat = (chat) => {
router.push("/chat/"+chat.chat_id)
router.push("/chat/" + chat.chat_id)
loadChat(chat)
}
Expand Down Expand Up @@ -750,7 +750,7 @@ const logout = function () {
activelyClose.value = true;
httpGet('/api/user/logout').then(() => {
removeUserToken();
router.push('login');
router.push('/login');
}).catch(() => {
ElMessage.error('注销失败!');
})
Expand Down
2 changes: 1 addition & 1 deletion web/src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ checkSession().then(() => {
router.push("/chat")
}
}).catch(() => {
router.push("login")
router.push("/login")
})
</script>
8 changes: 4 additions & 4 deletions web/src/views/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

<el-row class="text-line">
还没有账号?
<el-link type="primary" @click="router.push('register')">注册新账号</el-link>
<el-link type="primary" @click="router.push('/register')">注册新账号</el-link>
</el-row>
</div>
</div>
Expand Down Expand Up @@ -66,9 +66,9 @@ const password = ref(process.env.VUE_APP_PASS);
checkSession().then(() => {
if (isMobile()) {
router.push('mobile')
router.push('/mobile')
} else {
router.push('chat')
router.push('/chat')
}
}).catch(() => {
})
Expand All @@ -94,7 +94,7 @@ const login = function () {
if (isMobile()) {
router.push('/mobile')
} else {
router.push('chat')
router.push('/chat')
}
}).catch((e) => {
ElMessage.error('登录失败,' + e.message)
Expand Down
4 changes: 2 additions & 2 deletions web/src/views/Register.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@

<el-row class="text-line">
已经有账号?
<el-link type="primary" @click="router.push('login')">登录</el-link>
<el-link type="primary" @click="router.push('/login')">登录</el-link>
</el-row>
</el-form>
</div>
Expand Down Expand Up @@ -144,7 +144,7 @@ const register = function () {
return ElMessage.error('请输入短信验证码');
}
httpPost('/api/user/register', formData.value).then(() => {
ElMessage.success({"message": "注册成功,即将跳转到登录页...", onClose: () => router.push("login")})
ElMessage.success({"message": "注册成功,即将跳转到登录页...", onClose: () => router.push("/login")})
}).catch((e) => {
ElMessage.error('注册失败,' + e.message)
})
Expand Down
4 changes: 2 additions & 2 deletions web/src/views/admin/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const username = ref(process.env.VUE_APP_ADMIN_USER);
const password = ref(process.env.VUE_APP_ADMIN_PASS);
checkAdminSession().then(() => {
router.push("admin")
router.push("/admin")
}).catch(() => {
})
onMounted(() => {
Expand All @@ -76,7 +76,7 @@ const login = function () {
httpPost('/api/admin/login', {username: username.value.trim(), password: password.value.trim()}).then(res => {
setAdminToken(res.data)
router.push("admin")
router.push("/admin")
}).catch((e) => {
ElMessage.error('登录失败,' + e.message)
})
Expand Down

0 comments on commit f943669

Please sign in to comment.