|
1 | 1 | <script setup lang="ts"> |
2 | | -import {onMounted, ref, watch} from "vue"; |
| 2 | +import { onMounted, ref, watch } from "vue"; |
3 | 3 | import ParamForm from "../../../components/common/ParamForm.vue"; |
4 | 4 | import ServerContentInfoAction from "../../../components/Server/ServerContentInfoAction.vue"; |
5 | 5 | import ServerSelector from "../../../components/Server/ServerSelector.vue"; |
6 | | -import {t} from "../../../lang"; |
7 | | -import {Dialog} from "../../../lib/dialog"; |
8 | | -import {StorageUtil} from "../../../lib/storage"; |
9 | | -import {StorageService} from "../../../service/StorageService"; |
10 | | -import {useServerStore} from "../../../store/modules/server"; |
11 | | -import {EnumServerStatus} from "../../../types/Server"; |
| 6 | +import { t } from "../../../lang"; |
| 7 | +import { Dialog } from "../../../lib/dialog"; |
| 8 | +import { StorageUtil } from "../../../lib/storage"; |
| 9 | +import { StorageService } from "../../../service/StorageService"; |
| 10 | +import { useServerStore } from "../../../store/modules/server"; |
| 11 | +import { EnumServerStatus } from "../../../types/Server"; |
12 | 12 | import SoundPromptDialog from "./SoundPromptDialog.vue"; |
13 | 13 | import SoundPromptSelector from "./SoundPromptSelector.vue"; |
14 | 14 |
|
@@ -123,8 +123,30 @@ const getValue = async (): Promise<SoundGenerateParamType | undefined> => { |
123 | 123 | return data; |
124 | 124 | }; |
125 | 125 |
|
| 126 | +const setValue = (data: Partial<SoundGenerateParamType>) => { |
| 127 | + if (data.type !== undefined) { |
| 128 | + formData.value.type = data.type; |
| 129 | + } |
| 130 | + if (data.ttsServerKey !== undefined) { |
| 131 | + formData.value.ttsServerKey = data.ttsServerKey; |
| 132 | + } |
| 133 | + if (data.cloneServerKey !== undefined) { |
| 134 | + formData.value.cloneServerKey = data.cloneServerKey; |
| 135 | + } |
| 136 | + if (data.promptId !== undefined) { |
| 137 | + formData.value.promptId = data.promptId; |
| 138 | + } |
| 139 | + if (data.ttsParam !== undefined) { |
| 140 | + ttsParamForm.value?.setValue(data.ttsParam); |
| 141 | + } |
| 142 | + if (data.cloneParam !== undefined) { |
| 143 | + cloneParamForm.value?.setValue(data.cloneParam); |
| 144 | + } |
| 145 | +}; |
| 146 | +
|
126 | 147 | defineExpose({ |
127 | 148 | getValue, |
| 149 | + setValue, |
128 | 150 | }); |
129 | 151 | </script> |
130 | 152 |
|
|
0 commit comments