Skip to content

Commit 5751230

Browse files
committed
feat: pg support anthor models
1 parent 08e234a commit 5751230

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

playground/client.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class APIClient {
4545
thr = 100,
4646
no_cache = false,
4747
stream = false,
48+
model = "chat-tts",
4849
}) {
4950
const params = new URLSearchParams({
5051
text,
@@ -62,6 +63,7 @@ class APIClient {
6263
thr,
6364
no_cache,
6465
stream,
66+
model,
6567
});
6668
// return `${this.client.defaults.baseURL}v1/tts?${params.toString()}`;
6769

playground/stream.page.mjs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,19 @@ const StreamPageContainer = styled.div`
8989
}
9090
`;
9191

92+
const support_models = [
93+
"chat-tts",
94+
"fish-speech",
95+
"cosy-voice",
96+
"fire-red-tts",
97+
"f5-tts",
98+
"index-tts",
99+
"spark-tts",
100+
"gpt-sovits-v1",
101+
"gpt-sovits-v2",
102+
"gpt-sovits-v3",
103+
"gpt-sovits-v4",
104+
];
92105
const useStore = create((set, get) => ({
93106
params: {
94107
text: "你好,这是一个测试。你好,这是一个测试。你好,这是一个测试。你好,这是一个测试。你好,这是一个测试。你好,这是一个测试。",
@@ -100,6 +113,7 @@ const useStore = create((set, get) => ({
100113
seed: 42,
101114
format: "mp3",
102115
no_cache: false,
116+
model: "chat-tts",
103117
},
104118
setParams: (params) =>
105119
set({
@@ -136,6 +150,7 @@ const StreamForm = () => {
136150
seed,
137151
format,
138152
no_cache,
153+
model,
139154
} = params;
140155
const audio_url = client.synthesizeTTSUrl({
141156
text,
@@ -148,6 +163,7 @@ const StreamForm = () => {
148163
format,
149164
no_cache,
150165
stream: true,
166+
model,
151167
});
152168
setAudioUrl(audio_url);
153169
};
@@ -160,6 +176,14 @@ const StreamForm = () => {
160176
Text
161177
<textarea name="text" value=${params.text} onChange=${handleChange} />
162178
</label>
179+
<label>
180+
Model
181+
<select name="model" value=${params.model} onChange=${handleChange}>
182+
${support_models.map(
183+
(name) => html`<option key=${name} value=${name}>${name}</option>`
184+
)}
185+
</select>
186+
</label>
163187
<label>
164188
Speaker
165189
<select name="spk" value=${params.spk} onChange=${handleChange}>

0 commit comments

Comments
 (0)