|
|
@@ -118,13 +118,17 @@ async function onDelete(row) {
|
|
|
}
|
|
|
const generating = ref(false)
|
|
|
async function genCharactor() {
|
|
|
+ if (!model.value.background) {
|
|
|
+ ElMessage.error('请先输入故事背景')
|
|
|
+ return
|
|
|
+ }
|
|
|
const { value } = await ElMessageBox.prompt('生成数量:', '生成角色', {
|
|
|
inputPattern: /^\d{1,2}$/,
|
|
|
inputErrorMessage: 'Invalid Num'
|
|
|
})
|
|
|
generating.value = true
|
|
|
try {
|
|
|
- const res = await http.post(`/game/${model.value.id}/genCharactor`, { gameId: model.value.id, num: value })
|
|
|
+ const res = await http.post(`/game/genCharactor`, { background: model.value.background, num: value })
|
|
|
generating.value = false
|
|
|
model.value.charactors = (model.value.charactors || []).concat(res)
|
|
|
} catch (error) {
|