Skip to content

Commit

Permalink
style: prettier formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Wurielle authored and actions-user committed Dec 26, 2023
1 parent aded36f commit a79449e
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 162 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<NvSelect :options="options" v-bind="$attrs"/>
<NvSelect :options="options" v-bind="$attrs" />
</template>
<script lang="ts" setup>
import { NvSelect } from '@packages/ui'
Expand All @@ -11,21 +11,24 @@ import { capitalize } from '@/utils/text'
const { engines } = useSpeechEngineManager()
const options = computed(() =>
groupOptions(orderBy(
engines.value.map((engine) => {
const disabled = engine.hasCredentials ? !engine.hasCredentials() : false
return {
disabled,
label: engine.name,
value: engine.id,
category: capitalize(engine.category),
attrs: {
title: disabled ? 'Requires credentials' : '',
},
}
}),
['disabled', 'label'],
['asc', 'asc'],
), 'category'),
groupOptions(
orderBy(
engines.value.map((engine) => {
const disabled = engine.hasCredentials ? !engine.hasCredentials() : false
return {
disabled,
label: engine.name,
value: engine.id,
category: capitalize(engine.category),
attrs: {
title: disabled ? 'Requires credentials' : '',
},
}
}),
['disabled', 'label'],
['asc', 'asc'],
),
'category',
),
)
</script>
2 changes: 1 addition & 1 deletion apps/app/src/plugins/speech-engines/custom/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ registerEngine({
synthesizeSpeech({ payload, credentials }) {
const endpoint = getProperty('endpoint')
return axios.post<Blob>(
`${ endpoint.endsWith('/') ? endpoint.slice(0, -1) : endpoint }/synthesize-speech`,
`${endpoint.endsWith('/') ? endpoint.slice(0, -1) : endpoint}/synthesize-speech`,
{
credentials,
payload,
Expand Down
10 changes: 5 additions & 5 deletions apps/app/src/plugins/speech-engines/microsoft-azure/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ registerEngine({
let expression
const commandString = newText.split(' ')[0] || ''
if (commandString.startsWith('/')) {
const command = commands(voice).find(({ name }) => commandString.startsWith(`/${ name }`))
const command = commands(voice).find(({ name }) => commandString.startsWith(`/${name}`))
newText = newText.replace(commandString, '')
if (command) {
expression = command.value
}
}
const ssml = expression
? `<speak xmlns="http://www.w3.org/2001/10/synthesis" xmlns:mstts="http://www.w3.org/2001/mstts" xmlns:emo="http://www.w3.org/2009/10/emotionml" version="1.0" xml:lang="en-US"><voice name="${
voice.ShortName
}"><mstts:express-as style="${ expression }">${
translatedText || newText
}</mstts:express-as></voice></speak>`
voice.ShortName
}"><mstts:express-as style="${expression}">${
translatedText || newText
}</mstts:express-as></voice></speak>`
: null
return {
ssml,
Expand Down
6 changes: 3 additions & 3 deletions apps/app/src/utils/select.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { groupBy, ValueIteratee } from 'lodash'

export const groupOptions = <L extends any[]>(options: L, iteratee: ValueIteratee<L[number]>) => {
const groups = groupBy(options, iteratee);
return Object.keys(groups).map(category => ({
const groups = groupBy(options, iteratee)
return Object.keys(groups).map((category) => ({
label: category,
children: groups[category],
}));
}))
}
9 changes: 5 additions & 4 deletions apps/app/src/utils/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ export function copyTextToClipboard(text: string) {
}

export function capitalize(str: string): string {
return str.split(' ')
.map(word => capitalizeWord(word))
.join(' ');
return str
.split(' ')
.map((word) => capitalizeWord(word))
.join(' ')

function capitalizeWord(word: string): string {
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()
}
}
Loading

0 comments on commit a79449e

Please sign in to comment.