opt: change the relative path with absolute path for midjourney image uploading

This commit is contained in:
RockYang 2024-03-31 17:45:22 +08:00
parent 9e9bc52737
commit a5299b52d4
2 changed files with 13 additions and 0 deletions

View File

@ -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

View File

@ -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;