【增加】Dall 生成中 按钮控制

This commit is contained in:
cherishsince 2024-05-28 10:27:57 +08:00
parent 91fc46691e
commit c87713f040

View File

@ -87,8 +87,13 @@
</el-space>
</div>
<div class="btns">
<!-- <el-button size="large" round>重置内容</el-button>-->
<el-button type="primary" size="large" round @click="handlerGenerateImage">生成内容</el-button>
<el-button type="primary"
size="large"
round
:loading="drawIn"
@click="handlerGenerateImage">
{{drawIn ? '生成中' : '生成内容'}}
</el-button>
</div>
</template>
<script setup lang="ts">
@ -109,6 +114,7 @@ interface ImageSizeVO {
//
const prompt = ref<string>('') //
const drawIn = ref<boolean>(false) //
const selectHotWord = ref<string>('') //
const hotWords = ref<string[]>(['中国旗袍', '古装美女', '卡通头像', '机甲战士', '童话小屋', '中国长城']) //
const selectModel = ref<any>({}) //
@ -216,19 +222,25 @@ const handlerSizeClick = async (imageSize: ImageSizeVO) => {
* 图片生产
*/
const handlerGenerateImage = async () => {
// todo @
console.log('prompt.value', prompt)
console.log('prompt.value', prompt.value)
const form = {
prompt: prompt.value, //
model: selectModel.value.key, //
style: selectImageStyle.value.key, //
size: selectImageSize.value.key, // size
} as ImageDallReqVO
//
await ImageApi.dall(form)
//
emits('onDrawComplete', selectModel.value.key)
try {
//
drawIn.value = true
//
emits('onDrawStart', selectModel.value.key)
const form = {
prompt: prompt.value, //
model: selectModel.value.key, //
style: selectImageStyle.value.key, //
size: selectImageSize.value.key, // size
} as ImageDallReqVO
//
await ImageApi.dall(form)
} finally {
//
emits('onDrawComplete', selectModel.value.key)
//
drawIn.value = false
}
}
</script>