Xin Zhang
commited on
Commit
·
797cd52
1
Parent(s):
c531bfc
[fix]: voice selection bugfix.
Browse files
frontend/src/views/Welcome/Components/PromptText.vue
CHANGED
|
@@ -140,6 +140,7 @@ watch(() => props.open, (newOpen) => {
|
|
| 140 |
v-model:open="props.open"
|
| 141 |
:title="null"
|
| 142 |
:mask-closable="false"
|
|
|
|
| 143 |
centered
|
| 144 |
@update:open="(val: boolean) => emit('update:open', val)"
|
| 145 |
>
|
|
@@ -170,7 +171,7 @@ watch(() => props.open, (newOpen) => {
|
|
| 170 |
allow-clear
|
| 171 |
class="prompt-textarea"
|
| 172 |
/>
|
| 173 |
-
<a-button key="
|
| 174 |
</div>
|
| 175 |
<div v-if="languageSegment == 'zh'" class="prompt-item">
|
| 176 |
<a-textarea
|
|
@@ -182,7 +183,7 @@ watch(() => props.open, (newOpen) => {
|
|
| 182 |
allow-clear
|
| 183 |
class="prompt-textarea"
|
| 184 |
/>
|
| 185 |
-
<a-button key="
|
| 186 |
</div>
|
| 187 |
</div>
|
| 188 |
</a-modal>
|
|
@@ -205,7 +206,7 @@ watch(() => props.open, (newOpen) => {
|
|
| 205 |
}
|
| 206 |
|
| 207 |
.prompt-content {
|
| 208 |
-
margin-top:
|
| 209 |
|
| 210 |
.prompt-title {
|
| 211 |
margin-bottom: 24px;
|
|
|
|
| 140 |
v-model:open="props.open"
|
| 141 |
:title="null"
|
| 142 |
:mask-closable="false"
|
| 143 |
+
:closable="false"
|
| 144 |
centered
|
| 145 |
@update:open="(val: boolean) => emit('update:open', val)"
|
| 146 |
>
|
|
|
|
| 171 |
allow-clear
|
| 172 |
class="prompt-textarea"
|
| 173 |
/>
|
| 174 |
+
<a-button size="small" key="reset-en" @click="handleResetPrompt('en')" style="margin-top: 16px;">Reset</a-button>
|
| 175 |
</div>
|
| 176 |
<div v-if="languageSegment == 'zh'" class="prompt-item">
|
| 177 |
<a-textarea
|
|
|
|
| 183 |
allow-clear
|
| 184 |
class="prompt-textarea"
|
| 185 |
/>
|
| 186 |
+
<a-button size="small" key="reset-zh" @click="handleResetPrompt('zh')" style="margin-top: 16px;">Reset</a-button>
|
| 187 |
</div>
|
| 188 |
</div>
|
| 189 |
</a-modal>
|
|
|
|
| 206 |
}
|
| 207 |
|
| 208 |
.prompt-content {
|
| 209 |
+
margin-top: 16px;
|
| 210 |
|
| 211 |
.prompt-title {
|
| 212 |
margin-bottom: 24px;
|
frontend/src/views/Welcome/index.vue
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
|
| 3 |
import router from "@/router.ts";
|
| 4 |
import { useSettingsStore } from "@/stores/config.ts";
|
| 5 |
-
import { onMounted, onUnmounted, ref, reactive, computed, h } from "vue";
|
| 6 |
import { Modal } from 'ant-design-vue';
|
| 7 |
import { SoundTwoTone, SoundOutlined } from "@ant-design/icons-vue";
|
| 8 |
import axios from "axios";
|
|
@@ -67,6 +67,8 @@ const modalLoading = ref<boolean>(false);
|
|
| 67 |
|
| 68 |
const handleVoiceModalCancel = () => {
|
| 69 |
voiceModelOpen.value = false;
|
|
|
|
|
|
|
| 70 |
};
|
| 71 |
|
| 72 |
const handleVoiceModalSubmit = async () => {
|
|
@@ -153,6 +155,18 @@ const filteredRoles = computed(() => {
|
|
| 153 |
return roles.filter(ro => ro['is_chinese_voice'] == is_chinese);
|
| 154 |
});
|
| 155 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
|
| 157 |
const fetchTTSRoles = async () => {
|
| 158 |
try {
|
|
@@ -318,11 +332,11 @@ const isPlaying = (id: string) => {
|
|
| 318 |
<div class="custom-popover-item" @click="togglePopover('prompt')">Prompt调试</div>
|
| 319 |
</div>
|
| 320 |
</template>
|
| 321 |
-
<img :src="setting" alt="item actions" style="width: 28px; height: 28px; margin-right:24px;margin-
|
| 322 |
</a-popover>
|
| 323 |
</div>
|
| 324 |
|
| 325 |
-
<a-modal v-model:open="voiceModelOpen" :title="null" :mask-closable="false" centered>
|
| 326 |
<template #footer>
|
| 327 |
<a-button key="back" @click="handleVoiceModalCancel">Cancel</a-button>
|
| 328 |
<a-button key="submit" type="primary" :loading="modalLoading" @click="handleVoiceModalSubmit">Submit</a-button>
|
|
@@ -385,8 +399,8 @@ const isPlaying = (id: string) => {
|
|
| 385 |
<style lang="scss" scoped>
|
| 386 |
|
| 387 |
.languages {
|
| 388 |
-
margin-top:
|
| 389 |
-
margin-bottom:
|
| 390 |
|
| 391 |
p {
|
| 392 |
font-size: 16px;
|
|
|
|
| 2 |
|
| 3 |
import router from "@/router.ts";
|
| 4 |
import { useSettingsStore } from "@/stores/config.ts";
|
| 5 |
+
import { onMounted, onUnmounted, ref, reactive, computed, watch, h } from "vue";
|
| 6 |
import { Modal } from 'ant-design-vue';
|
| 7 |
import { SoundTwoTone, SoundOutlined } from "@ant-design/icons-vue";
|
| 8 |
import axios from "axios";
|
|
|
|
| 67 |
|
| 68 |
const handleVoiceModalCancel = () => {
|
| 69 |
voiceModelOpen.value = false;
|
| 70 |
+
role.value = settingsStore.$state.role;
|
| 71 |
+
language.value = settingsStore.$state.language;
|
| 72 |
};
|
| 73 |
|
| 74 |
const handleVoiceModalSubmit = async () => {
|
|
|
|
| 155 |
return roles.filter(ro => ro['is_chinese_voice'] == is_chinese);
|
| 156 |
});
|
| 157 |
|
| 158 |
+
watch(
|
| 159 |
+
() => language.value,
|
| 160 |
+
(newLang) => {
|
| 161 |
+
// 语言切换后,自动选中第一个可用角色
|
| 162 |
+
if (filteredRoles.value.length > 0) {
|
| 163 |
+
role.value = filteredRoles.value[0]['id'];
|
| 164 |
+
} else {
|
| 165 |
+
role.value = "";
|
| 166 |
+
}
|
| 167 |
+
}
|
| 168 |
+
);
|
| 169 |
+
|
| 170 |
|
| 171 |
const fetchTTSRoles = async () => {
|
| 172 |
try {
|
|
|
|
| 332 |
<div class="custom-popover-item" @click="togglePopover('prompt')">Prompt调试</div>
|
| 333 |
</div>
|
| 334 |
</template>
|
| 335 |
+
<img :src="setting" alt="item actions" style="width: 28px; height: 28px; margin-right:24px;margin-top: 16px;">
|
| 336 |
</a-popover>
|
| 337 |
</div>
|
| 338 |
|
| 339 |
+
<a-modal v-model:open="voiceModelOpen" :title="null" :mask-closable="false" :closable="false" centered>
|
| 340 |
<template #footer>
|
| 341 |
<a-button key="back" @click="handleVoiceModalCancel">Cancel</a-button>
|
| 342 |
<a-button key="submit" type="primary" :loading="modalLoading" @click="handleVoiceModalSubmit">Submit</a-button>
|
|
|
|
| 399 |
<style lang="scss" scoped>
|
| 400 |
|
| 401 |
.languages {
|
| 402 |
+
margin-top: 24px;
|
| 403 |
+
margin-bottom: 24px;
|
| 404 |
|
| 405 |
p {
|
| 406 |
font-size: 16px;
|