Skip to content

Commit

Permalink
Merge pull request #705 from nature-heart-software/dev
Browse files Browse the repository at this point in the history
release
  • Loading branch information
Wurielle authored Oct 5, 2024
2 parents edba0a2 + af58af7 commit 8e1379b
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 64 deletions.
2 changes: 1 addition & 1 deletion apps/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"build": "vite build && yarn electron:build",
"build:prod": "vue-tsc && yarn build",
"dev": "vite",
"electron:build": "electron-builder --config electron-builder.config.js",
"electron:build": "electron-builder --config electron-builder.config.js --publish never",
"generate:app-icon": "npx electron-icon-builder --input=./assets/app-icon.png --output=./build --flatten && npx electron-icon-builder --input=./assets/app-icon.png --output=./public --flatten",
"lint": "vue-tsc",
"postinstall": "node bin/rebuild.js",
Expand Down
86 changes: 43 additions & 43 deletions apps/app/src/plugins/speech-engines/google-cloud/NvSettings.vue
Original file line number Diff line number Diff line change
@@ -1,85 +1,85 @@
<template>
<NvAccessBlocker
:allowed="
:allowed="
(speechStore.hasUniversalApiCredentials &&
!getProperty('useLocalCredentials')) ||
!!getProperty('apiKey', true)
"
reason="Credentials required"
reason="Credentials required"
>
<NvStack spacing="5">
<NvFormItem label="Voice">
<NvVoiceSelect />
<NvVoiceSelect/>
</NvFormItem>
<NvDivider direction="horizontal" />
<NvDivider direction="horizontal"/>
<NvFormItem label="Speaking Rate">
<NvGroup>
<NvRangeInput
:max="4"
:min="0.25"
:step="0.01"
class="!grow"
v-bind="{
:max="4"
:min="0.25"
:step="0.01"
class="!grow"
v-bind="{
modelValue: getProperty('speakingRate'),
'onUpdate:modelValue': (value) =>
setProperty('speakingRate', value),
}"
/>
<NvNumberInput
:max="4"
:min="0.25"
:step="0.01"
v-bind="{
:max="4"
:min="0.25"
:step="0.01"
v-bind="{
modelValue: getProperty('speakingRate'),
'onUpdate:modelValue': (value) =>
setProperty('speakingRate', value),
}"
/>
</NvGroup>
</NvFormItem>
<NvDivider direction="horizontal" />
<NvDivider direction="horizontal"/>
<NvFormItem label="Pitch">
<NvGroup>
<NvRangeInput
:max="20"
:min="-20"
:step="0.1"
class="!grow"
v-bind="{
:max="20"
:min="-20"
:step="0.1"
class="!grow"
v-bind="{
modelValue: getProperty('pitch'),
'onUpdate:modelValue': (value) => setProperty('pitch', value),
}"
/>
<NvNumberInput
:max="20"
:min="-20"
:step="0.1"
v-bind="{
:max="20"
:min="-20"
:step="0.1"
v-bind="{
modelValue: getProperty('pitch'),
'onUpdate:modelValue': (value) => setProperty('pitch', value),
}"
/>
</NvGroup>
</NvFormItem>
<NvDivider direction="horizontal" />
<NvFormItem label="Volume Gain (Db)">
<NvDivider direction="horizontal"/>
<NvFormItem label="Volume Gain (dB)">
<NvGroup>
<NvRangeInput
:max="16"
:min="-96"
:step="0.1"
class="!grow"
v-bind="{
:max="16"
:min="-96"
:step="0.1"
class="!grow"
v-bind="{
modelValue: getProperty('volumeGainDb'),
'onUpdate:modelValue': (value) =>
setProperty('volumeGainDb', value),
}"
/>
<NvNumberInput
:max="20"
:min="-20"
:step="0.1"
v-bind="{
:max="20"
:min="-20"
:step="0.1"
v-bind="{
modelValue: getProperty('volumeGainDb'),
'onUpdate:modelValue': (value) =>
setProperty('volumeGainDb', value),
Expand All @@ -90,33 +90,33 @@
</NvStack>
</NvAccessBlocker>
<template v-if="speechStore.hasUniversalApiCredentials">
<NvDivider direction="horizontal" />
<NvDivider direction="horizontal"/>
<NvGroup justify="apart" no-wrap spacing="5">
<NvStack>
<NvText type="label">Use my own credentials</NvText>
</NvStack>
<NvSwitch
:modelValue="getProperty('useLocalCredentials')"
@update:modelValue="
:modelValue="getProperty('useLocalCredentials')"
@update:modelValue="
(value) => setProperty('useLocalCredentials', value)
"
/>
</NvGroup>
</template>
<template
v-if="
v-if="
getProperty('useLocalCredentials') ||
!speechStore.hasUniversalApiCredentials
"
>
<NvDivider direction="horizontal" />
<NvDivider direction="horizontal"/>
<NvStack spacing="5">
<NvFormItem label="API Key">
<NvInput
:modelValue="getProperty('apiKey', true)"
show-password
type="password"
@update:modelValue="(value) => setProperty('apiKey', value, true)"
:modelValue="getProperty('apiKey', true)"
show-password
type="password"
@update:modelValue="(value) => setProperty('apiKey', value, true)"
/>
</NvFormItem>
</NvStack>
Expand Down
76 changes: 70 additions & 6 deletions apps/app/src/plugins/speech-engines/ibm-watson/NvSettings.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,69 @@
<template>
<NvAccessBlocker
:allowed="
(speechStore.hasUniversalApiCredentials && !getProperty('useLocalCredentials')) ||
(speechStore.hasUniversalApiCredentials &&
!getProperty('useLocalCredentials')) ||
[getProperty('apiKey', true), getProperty('url')].every(Boolean)
"
reason="Credentials required"
>
<NvFormItem label="Voice">
<NvVoiceSelect />
</NvFormItem>
<NvStack spacing="5">
<NvFormItem label="Voice">
<NvVoiceSelect />
</NvFormItem>
<NvDivider direction="horizontal" />
<NvFormItem label="Speaking Rate">
<NvGroup>
<NvRangeInput
:max="300"
:min="-300"
:step="1"
class="!grow"
v-bind="{
modelValue: getProperty('ratePercentage'),
'onUpdate:modelValue': (value) =>
setProperty('ratePercentage', value),
}"
/>
<NvNumberInput
:max="300"
:min="-300"
:step="1"
v-bind="{
modelValue: getProperty('ratePercentage'),
'onUpdate:modelValue': (value) =>
setProperty('ratePercentage', value),
}"
/>
</NvGroup>
</NvFormItem>
<NvDivider direction="horizontal" />
<NvFormItem label="Pitch">
<NvGroup>
<NvRangeInput
:max="300"
:min="-300"
:step="1"
class="!grow"
v-bind="{
modelValue: getProperty('pitchPercentage'),
'onUpdate:modelValue': (value) =>
setProperty('pitchPercentage', value),
}"
/>
<NvNumberInput
:max="300"
:min="-300"
:step="1"
v-bind="{
modelValue: getProperty('pitchPercentage'),
'onUpdate:modelValue': (value) =>
setProperty('pitchPercentage', value),
}"
/>
</NvGroup>
</NvFormItem>
</NvStack>
</NvAccessBlocker>
<template v-if="speechStore.hasUniversalApiCredentials">
<NvDivider direction="horizontal" />
Expand All @@ -18,11 +73,18 @@
</NvStack>
<NvSwitch
:modelValue="getProperty('useLocalCredentials')"
@update:modelValue="(value) => setProperty('useLocalCredentials', value)"
@update:modelValue="
(value) => setProperty('useLocalCredentials', value)
"
/>
</NvGroup>
</template>
<template v-if="getProperty('useLocalCredentials') || !speechStore.hasUniversalApiCredentials">
<template
v-if="
getProperty('useLocalCredentials') ||
!speechStore.hasUniversalApiCredentials
"
>
<NvDivider direction="horizontal" />
<NvStack spacing="5">
<NvFormItem label="API Key">
Expand Down Expand Up @@ -52,6 +114,8 @@ import {
NvFormItem,
NvGroup,
NvInput,
NvNumberInput,
NvRangeInput,
NvStack,
NvSwitch,
NvText,
Expand Down
11 changes: 9 additions & 2 deletions apps/app/src/plugins/speech-engines/ibm-watson/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,26 @@ registerEngine({
getCredentials,
hasCredentials() {
const speechStore = useSpeechStore()
return speechStore.hasUniversalApiCredentials || Object.values(getCredentials()).every(Boolean)
return (
speechStore.hasUniversalApiCredentials ||
Object.values(getCredentials()).every(Boolean)
)
},
getPayload({ text, translatedText, voice }) {
return {
text: translatedText || text,
voice: (voice || getSelectedVoice()).name,
ratePercentage: Number(getProperty('ratePercentage')),
pitchPercentage: Number(getProperty('pitchPercentage')),
}
},
getLanguageCode(voice) {
return (voice || getSelectedVoice()).language
},
synthesizeSpeech({ credentials, payload }) {
return api(getProperty('useLocalCredentials') ? 'local' : 'remote').post<Blob>(
return api(
getProperty('useLocalCredentials') ? 'local' : 'remote',
).post<Blob>(
'/tts/ibm-watson/synthesize-speech',
{
credentials,
Expand Down
2 changes: 2 additions & 0 deletions apps/app/src/plugins/speech-engines/ibm-watson/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ export const { setProperty, getProperty } = definePluginStore(ENGINE_ID, {
},
useLocalCredentials: false,
favoriteVoiceIds: [],
ratePercentage: 0,
pitchPercentage: 0,
})
26 changes: 14 additions & 12 deletions apps/app/src/teams/messenger/views/NvSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,20 @@
</NvStack>
</div>
<div class="settings__content flex-1 pl-4">
<div :id="id" class="h-full relative">
<!-- View -->
<router-view v-slot="{ Component }">
<Transition class="transition">
<div
:key="Component"
class="absolute inset-0 overflow-y-auto"
>
<component :is="Component" />
</div>
</Transition>
</router-view>
<div :id="id" class="h-full relative overflow-hidden">
<div class="h-full relative">
<!-- View -->
<router-view v-slot="{ Component }">
<Transition class="transition">
<div
:key="Component"
class="absolute inset-0 overflow-y-auto"
>
<component :is="Component" />
</div>
</Transition>
</router-view>
</div>
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/components/forms/Select/NvSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ const autocomplete = ref()
const { hasFocus, activate, deactivate } = useFocusTrap(inputWrapper, {
returnFocusOnDeactivate: false,
allowOutsideClick: true,
preventScroll: true,
onDeactivate() {
if (selectInput.value) selectInput.value.$el.blur()
},
Expand Down

0 comments on commit 8e1379b

Please sign in to comment.