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