mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-17 16:56:38 +08:00
add translate api for midjourney
This commit is contained in:
parent
411335ebcb
commit
1067fa015e
@ -1,6 +1,7 @@
|
|||||||
package handler
|
package handler
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"chatplus/core"
|
||||||
"chatplus/core/types"
|
"chatplus/core/types"
|
||||||
"chatplus/store/model"
|
"chatplus/store/model"
|
||||||
"chatplus/utils/resp"
|
"chatplus/utils/resp"
|
||||||
@ -19,8 +20,10 @@ type PromptHandler struct {
|
|||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewPromptHandler(db *gorm.DB) *PromptHandler {
|
func NewPromptHandler(app *core.AppServer, db *gorm.DB) *PromptHandler {
|
||||||
return &PromptHandler{db: db}
|
h := &PromptHandler{db: db}
|
||||||
|
h.App = app
|
||||||
|
return h
|
||||||
}
|
}
|
||||||
|
|
||||||
type apiRes struct {
|
type apiRes struct {
|
||||||
|
@ -233,6 +233,7 @@
|
|||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
|
|
||||||
|
<div v-loading="loading" element-loading-background="rgba(122, 122, 122, 0.8)">
|
||||||
<div class="param-line pt">
|
<div class="param-line pt">
|
||||||
<div class="flex-row justify-between items-center">
|
<div class="flex-row justify-between items-center">
|
||||||
<div class="flex-row justify-start items-center">
|
<div class="flex-row justify-start items-center">
|
||||||
@ -257,6 +258,7 @@
|
|||||||
ref="promptRef"
|
ref="promptRef"
|
||||||
placeholder="这里输入你的英文咒语,例如:A chinese girl walking in the middle of a cobblestone street"/>
|
placeholder="这里输入你的英文咒语,例如:A chinese girl walking in the middle of a cobblestone street"/>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="param-line pt">
|
<div class="param-line pt">
|
||||||
<div class="flex-row justify-between items-center">
|
<div class="flex-row justify-between items-center">
|
||||||
@ -500,6 +502,7 @@ const router = useRouter()
|
|||||||
|
|
||||||
const socket = ref(null)
|
const socket = ref(null)
|
||||||
const imgCalls = ref(0)
|
const imgCalls = ref(0)
|
||||||
|
const loading = ref(false)
|
||||||
|
|
||||||
const connect = () => {
|
const connect = () => {
|
||||||
let host = process.env.VUE_APP_WS_HOST
|
let host = process.env.VUE_APP_WS_HOST
|
||||||
@ -569,8 +572,10 @@ const connect = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const translatePrompt = () => {
|
const translatePrompt = () => {
|
||||||
|
loading.value = true
|
||||||
httpPost("/api/prompt/translate", {"prompt": params.value.prompt}).then(res => {
|
httpPost("/api/prompt/translate", {"prompt": params.value.prompt}).then(res => {
|
||||||
params.value.prompt = res.data
|
params.value.prompt = res.data
|
||||||
|
loading.value = false
|
||||||
}).then(e => {
|
}).then(e => {
|
||||||
ElMessage.error("翻译失败:" + e.message)
|
ElMessage.error("翻译失败:" + e.message)
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user