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
|
||||
|
||||
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 {
|
||||
|
@ -233,6 +233,7 @@
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
<div v-loading="loading" element-loading-background="rgba(122, 122, 122, 0.8)">
|
||||
<div class="param-line pt">
|
||||
<div class="flex-row justify-between items-center">
|
||||
<div class="flex-row justify-start items-center">
|
||||
@ -257,6 +258,7 @@
|
||||
ref="promptRef"
|
||||
placeholder="这里输入你的英文咒语,例如:A chinese girl walking in the middle of a cobblestone street"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="param-line pt">
|
||||
<div class="flex-row justify-between items-center">
|
||||
@ -268,12 +270,12 @@
|
||||
</el-icon>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<!-- <el-button type="success">-->
|
||||
<!-- <el-icon style="margin-right: 6px;font-size: 18px;">-->
|
||||
<!-- <Refresh/>-->
|
||||
<!-- </el-icon>-->
|
||||
<!-- 翻译-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <el-button type="success">-->
|
||||
<!-- <el-icon style="margin-right: 6px;font-size: 18px;">-->
|
||||
<!-- <Refresh/>-->
|
||||
<!-- </el-icon>-->
|
||||
<!-- 翻译-->
|
||||
<!-- </el-button>-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user