diff --git a/api/handler/mj_handler.go b/api/handler/mj_handler.go index d2f9a107..f1b5e3e1 100644 --- a/api/handler/mj_handler.go +++ b/api/handler/mj_handler.go @@ -145,6 +145,13 @@ func (h *MidJourneyHandler) Image(c *gin.Context) { prompt = fmt.Sprintf("%s:%s", data.TaskType, strings.Join(data.ImgArr, ",")) } + // 如果本地图片上传的是相对地址,处理成绝对地址 + for k, v := range data.ImgArr { + if !strings.HasPrefix(v, "http") { + data.ImgArr[k] = fmt.Sprintf("http://localhost:5678/%s", strings.TrimLeft(v, "/")) + } + } + idValue, _ := c.Get(types.LoginUserID) userId := utils.IntValue(utils.InterfaceToString(idValue), 0) // generate task id diff --git a/web/src/views/ChatPlus.vue b/web/src/views/ChatPlus.vue index 0914358f..8dfdcd63 100644 --- a/web/src/views/ChatPlus.vue +++ b/web/src/views/ChatPlus.vue @@ -479,9 +479,15 @@ const changeChat = (chat) => { } const loadChat = function (chat) { + if (!isLogin.value) { + showLoginDialog.value = true + return; + } + if (activeChat.value['chat_id'] === chat.chat_id) { return; } + activeChat.value = chat newChatItem.value = null; roleId.value = chat.role_id;