diff --git a/api/handler/prompt_handler.go b/api/handler/prompt_handler.go index 2bf59f00..8d0b1b5c 100644 --- a/api/handler/prompt_handler.go +++ b/api/handler/prompt_handler.go @@ -1,6 +1,7 @@ package handler import ( + "chatplus/core" "chatplus/core/types" "chatplus/store/model" "chatplus/utils/resp" @@ -19,8 +20,10 @@ type PromptHandler struct { db *gorm.DB } -func NewPromptHandler(db *gorm.DB) *PromptHandler { - return &PromptHandler{db: db} +func NewPromptHandler(app *core.AppServer, db *gorm.DB) *PromptHandler { + h := &PromptHandler{db: db} + h.App = app + return h } type apiRes struct { diff --git a/web/src/views/ImageMj.vue b/web/src/views/ImageMj.vue index 1c0c0517..9b7be159 100644 --- a/web/src/views/ImageMj.vue +++ b/web/src/views/ImageMj.vue @@ -233,29 +233,31 @@ -
-
-
- 提示词: - - - +
+
+
+
+ 提示词: + + + + + +
+ + + - + 翻译 +
- - - - - 翻译 -
-
-
- +
+ +
@@ -268,12 +270,12 @@
- - - - - - + + + + + +
@@ -500,6 +502,7 @@ const router = useRouter() const socket = ref(null) const imgCalls = ref(0) +const loading = ref(false) const connect = () => { let host = process.env.VUE_APP_WS_HOST @@ -569,10 +572,12 @@ const connect = () => { } const translatePrompt = () => { - httpPost("/api/prompt/translate",{"prompt":params.value.prompt}).then(res => { + loading.value = true + httpPost("/api/prompt/translate", {"prompt": params.value.prompt}).then(res => { params.value.prompt = res.data + loading.value = false }).then(e => { - ElMessage.error("翻译失败:"+e.message) + ElMessage.error("翻译失败:" + e.message) }) }