mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-15 06:12:18 +00:00
Try not to return bad voices by random
This commit is contained in:
1 parent
fab8b14bec
commit
c5aa6529a9
1 file changed
+11
-2
+11
-2
@@ -50,8 +50,17 @@ export function VoiceCountLabel(props: Props) {
|
||||
});
|
||||
|
||||
const selectRandomVoice = () => {
|
||||
// TODO: Prefer to select a random *good* voice or *popular* voice.
|
||||
const randomVoice = GetRandomArrayValue(possibleVoices);
|
||||
let randomVoice = undefined;
|
||||
for (let i = 0; i < 10; i++) {
|
||||
// We're going to try to find a *good* voice.
|
||||
randomVoice = GetRandomArrayValue(possibleVoices);
|
||||
if (randomVoice.user_ratings.positive_count > randomVoice.user_ratings.negative_count) {
|
||||
break; // First "mostly good" voice is good.
|
||||
}
|
||||
if (i % 3 === 2 && randomVoice.user_ratings.total_count === 0) {
|
||||
break; // Sometimes we'll return a voice that hasn't been rated.
|
||||
}
|
||||
}
|
||||
if (randomVoice !== undefined) {
|
||||
props.setMaybeSelectedTtsModel(randomVoice);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user