Skip to content

Commit f4f6131

Browse files
committed
feat: time util showMs default false
1 parent a077bea commit f4f6131

File tree

5 files changed

+72
-43
lines changed

5 files changed

+72
-43
lines changed

changelog.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
1-
## v1.4.0
2-
3-
- 新增:声音合成设备显存大小支持显示
4-
- 新增:声音合成模型失败增加继续尝试操作
5-
- 优化:模型连续运行速度优化,避免每次启动带来的损耗
6-
- 优化:自启动模型状态显示区分(蓝色未运行,绿色运行中)
7-
- 修复:模型服务自启动类型设置状态异常修复
8-
- 修复:模型删除重新加在配置缓存问题
91

102
## v1.3.0 直播支持384模型,文生图、图生图模型支持
113

4+
- 新增:声音合成设备显存大小支持显示
5+
- 新增:声音合成模型失败增加继续尝试操作
126
- 新增:声音合成优化配置,支持声音合成时自动替换文字
137
- 新增:设置支持大模型提示词自定义
148
- 新增:直播模型支持选择不同版本
@@ -17,6 +11,10 @@
1711
- 新增:文生图、图生图模型
1812
- 新增:声音合成内容支持大模型直接生成
1913
- 优化:本地无可用模型时下拉选择提示
14+
- 优化:模型连续运行速度优化,避免每次启动带来的损耗
15+
- 优化:自启动模型状态显示区分(蓝色未运行,绿色运行中)
16+
- 修复:模型服务自启动类型设置状态异常修复
17+
- 修复:模型删除重新加在配置缓存问题
2018
- 修复:大模型请求地址异常问题
2119
- 修复:内置大模型开关不生效问题
2220

src/components/common/ParamForm.vue

Lines changed: 48 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
<script setup lang="ts">
22
import {cloneDeep} from "lodash-es";
3-
import {ref, watch} from "vue";
3+
import {nextTick, ref, watch} from "vue";
44
import {t} from "../../lang";
55
import {Dialog} from "../../lib/dialog";
66
import SpeakerSelector from "./SpeakerSelector.vue";
7+
import SoundPromptSelector from "../../pages/Sound/components/SoundPromptSelector.vue";
78
89
type FieldBasicType = {
910
name: string;
1011
title: string;
1112
icon: string;
12-
type: "select" | "input" | "inputNumber" | "switch" | "slider" | "speaker";
13+
type: "select"
14+
| "input"
15+
| "inputNumber"
16+
| "switch"
17+
| "slider"
18+
| "speaker";
1319
defaultValue: any;
1420
placeholder: string;
1521
required: boolean;
@@ -42,10 +48,10 @@ watch(
4248
value => {
4349
formData.value = value?.map(item => {
4450
const itemClone = cloneDeep(item);
45-
if (itemClone.type === "speaker") {
46-
itemClone["speakerParam"] = [];
47-
itemClone["speakerParamValue"] = {};
48-
}
51+
// if (itemClone.type === "speaker") {
52+
// itemClone["speakerParam"] = [];
53+
// itemClone["speakerParamValue"] = {};
54+
// }
4955
let value = itemClone.defaultValue;
5056
if (item.opt) {
5157
if (item.opt.includes('randomValue')) {
@@ -70,16 +76,21 @@ watch(
7076
deep: true,
7177
}
7278
);
79+
watch(() => formData.value, () => {
80+
nextTick(() => {
81+
emit('change', getValue());
82+
})
83+
}, {immediate: false, deep: true});
7384
7485
const getValue = () => {
7586
const result = {};
7687
formData.value.forEach(item => {
7788
result[item.name] = item.value;
7889
result['_' + item.name] = item.title;
7990
if (item.type === "speaker") {
80-
for (const k in item["speakerParamValue"]) {
81-
result[k] = item["speakerParamValue"][k];
82-
}
91+
// for (const k in item["speakerParamValue"]) {
92+
// result[k] = item["speakerParamValue"][k];
93+
// }
8394
result[`__${item.name}`] = item["speaker"]?.["title"] || item.value;
8495
}
8596
});
@@ -104,24 +115,26 @@ const validate = () => {
104115
return true;
105116
};
106117
107-
const onSpeakerDataUpdate = (name, data) => {
108-
const {param, speaker} = data;
109-
const item = formData.value.find(item => item.name === name);
110-
if (item) {
111-
item["speaker"] = speaker;
112-
item["speakerParam"] = param;
113-
const value = {};
114-
param.forEach(paramItem => {
115-
value[paramItem.name] = null;
116-
if (!paramItem.type || paramItem.type === "select") {
117-
if (paramItem.option && paramItem.option.length > 0) {
118-
value[paramItem.name] = paramItem.option[0].value;
119-
}
120-
}
121-
});
122-
item["speakerParamValue"] = value;
123-
}
124-
};
118+
const emit = defineEmits(['change']);
119+
120+
// const onSpeakerDataUpdate = (name, data) => {
121+
// const {param, speaker} = data;
122+
// const item = formData.value.find(item => item.name === name);
123+
// if (item) {
124+
// item["speaker"] = speaker;
125+
// item["speakerParam"] = param;
126+
// const value = {};
127+
// param.forEach(paramItem => {
128+
// value[paramItem.name] = null;
129+
// if (!paramItem.type || paramItem.type === "select") {
130+
// if (paramItem.option && paramItem.option.length > 0) {
131+
// value[paramItem.name] = paramItem.option[0].value;
132+
// }
133+
// }
134+
// });
135+
// item["speakerParamValue"] = value;
136+
// }
137+
// };
125138
126139
defineExpose({
127140
getValue,
@@ -183,10 +196,15 @@ defineExpose({
183196
<a-slider v-model="item.value" :marks="item.sliderMarks" show-tooltip :min="item.min" :max="item.max"
184197
:disabled="props.disabled" :step="item.step"/>
185198
</div>
186-
<div v-else-if="item.type === 'speaker'" class="w-48 mr-3">
199+
<div v-else-if="item.type === 'speaker'" class="mr-3">
187200
<SpeakerSelector v-model="item.value" :speakers="item['speakers']" :disabled="props.disabled"
188-
@on-data-update="onSpeakerDataUpdate(item.name, $event)"/>
201+
/>
202+
<!-- @on-data-update="onSpeakerDataUpdate(item.name, $event)" -->
203+
</div>
204+
<div v-else-if="item.type === 'soundPromptId'">
205+
<SoundPromptSelector v-model="item.value" :disabled="props.disabled"/>
189206
</div>
207+
<!--
190208
<div v-for="speakerParam in item['speakerParam']">
191209
<div v-if="!speakerParam.type || speakerParam.type === 'select'" class="mr-3">
192210
<a-select size="small" :disabled="props.disabled"
@@ -197,6 +215,7 @@ defineExpose({
197215
</a-select>
198216
</div>
199217
</div>
218+
-->
200219
</div>
201220
</template>
202221

src/lib/util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export const TimeUtil = {
103103
datetimeString() {
104104
return dayjs().format("YYYYMMDD_HHmmss");
105105
},
106-
secondsToTime(seconds: number, alwaysShowMs: boolean = false) {
106+
secondsToTime(seconds: number, showMs: boolean = false) {
107107
const sec = Math.floor(seconds);
108108
const ms = Math.floor((seconds - sec) * 1000);
109109
let h: any = Math.floor(sec / 3600);
@@ -113,7 +113,7 @@ export const TimeUtil = {
113113
if (m < 10) m = "0" + m;
114114
if (s < 10) s = "0" + s;
115115
const result = "00" == h ? `${m}:${s}` : `${h}:${m}:${s}`;
116-
if (ms > 0 || alwaysShowMs) {
116+
if (showMs) {
117117
let f: any = ms;
118118
if (f < 10) f = "00" + f;
119119
else if (f < 100) f = "0" + f;

src/pages/Sound/components/SoundPromptSelector.vue

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,30 @@ const props = defineProps({
1818
required: true,
1919
default: 0,
2020
},
21+
disabled: {
22+
type: Boolean,
23+
default: false,
24+
},
2125
});
2226
const emit = defineEmits(["update:modelValue"]);
2327
const onSelect = (id: number) => {
2428
emit("update:modelValue", id);
2529
};
30+
const doSelect = () => {
31+
if (props.disabled) {
32+
return;
33+
}
34+
soundPromptDialog.value?.show();
35+
};
2636
</script>
2737

2838
<template>
2939
<div class="flex items-center">
3040
<div
31-
@click="soundPromptDialog?.show()"
32-
class="mr-1 h-8 leading-8 px-3 rounded-lg cursor-pointer truncate bg-gray-100 hover:bg-gray-200 min-w-64">
41+
@click="doSelect()"
42+
class="mr-1 h-8 leading-8 px-3 rounded-lg cursor-pointer truncate bg-gray-100 hover:bg-gray-200 min-w-64"
43+
:class="disabled ? 'cursor-not-allowed bg-gray-50 hover:bg-gray-50 text-gray-400' : ''"
44+
>
3345
{{ records.find(s => s.id === props.modelValue)?.title || "选择音色" }}
3446
</div>
3547
<AudioPlayerButton

src/store/modules/live.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {mapError} from "../../lib/error";
1414
const serverStore = useServerStore();
1515

1616
export const liveModels = [
17-
{value: "wav2lip256", title: "Wav2Lip标准版"},
17+
{value: "wav2lip", title: "Wav2Lip标准版"},
1818
{value: "wav2lip384", title: "Wav2Lip清晰版"},
1919
]
2020

@@ -91,7 +91,7 @@ export const liveStore = defineStore("live", {
9191
}[],
9292
},
9393
localConfig: {
94-
model: "wav2lip256" as typeof liveModels[number]["value"],
94+
model: "wav2lip" as typeof liveModels[number]["value"],
9595
mode: "avatar" as "avatar" | "audio",
9696
avatar: {
9797
width: 720,

0 commit comments

Comments
 (0)