Skip to content

Commit

Permalink
feat: support anim filter for voice search
Browse files Browse the repository at this point in the history
  • Loading branch information
darwintree committed Feb 20, 2024
1 parent 175a350 commit 538a71e
Show file tree
Hide file tree
Showing 4 changed files with 706 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2024/02/21

* feat: support anim filter for voice search

## 2024/02/17

* feat: share
Expand Down
47 changes: 35 additions & 12 deletions src/components/search/VoiceSearchPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,24 @@
clearable
/>
</NInputGroup>
<NInputGroup>
<NInputGroupLabel :style="{ width: '25%' }">Anim</NInputGroupLabel>
<n-select
v-model:value="animOptions"
placeholder="Character Anim for the Voice"
multiple
:options="availableAnimOptions"
clearable
filterable
/>
</NInputGroup>
<NInputGroup>
<NInput
v-model:value="pattern"
placeholder="Input text pattern to search"
clearable
></NInput>
<NButton type="info" :disabled="!pattern" @click="newFetch">
search
</NButton>
<NButton type="info" @click="newFetch"> search </NButton>
</NInputGroup>
</div>
<n-data-table
Expand Down Expand Up @@ -49,15 +58,8 @@ import { useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n'
import { store } from '../../store'
import { DataSource } from '../../helper/enum-interfaces'
import { EventsCollectionMeta, IndexData } from '../../helper/meta-interfaces'
import {
getRemoteImgPath,
unitList,
characters,
queryTranslatedCsv,
getIndexData,
queryVoices,
} from '../../helper/path'
import { characters, queryVoices } from '../../helper/path'
import vals from '../../helper/vals'
import { inject } from '@vercel/analytics'
inject()
Expand Down Expand Up @@ -91,6 +93,7 @@ async function fetchData(page: number) {
try {
const result = await queryVoices(
speakerOptions.value,
animOptions.value,
pattern.value,
page, // use specified page
paginationReactive.pageSize
Expand All @@ -116,7 +119,27 @@ const availableSpeakerOptions = characters
}
})
const animList = []
for (const anim of [
...vals.charAnim1,
...vals.charAnim2,
...vals.charAnim3,
...vals.charAnim4,
...vals.charAnim5,
...vals.charLipAnim,
]) {
if (animList.indexOf(anim) === -1) animList.push(anim)
}
const availableAnimOptions = animList.map((item) => {
return {
value: item,
label: item,
}
})
const speakerOptions = ref([] as string[])
const animOptions = ref([] as string[])
function getEventIdFromVoiceId(_id: string) {
const parts = _id.split('/')
Expand Down
2 changes: 2 additions & 0 deletions src/helper/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ async function queryCollectionMetaInfo(jsonUrl: string) {

async function queryVoices(
speakers: string[],
anims: string[],
pattern: string,
page = 1,
pageSize = 20
Expand All @@ -288,6 +289,7 @@ async function queryVoices(
const res = await axios.get(VOICE_SERVICE_SERVER, {
params: {
speakers,
anims,
pattern,
page,
pageSize,
Expand Down
Loading

0 comments on commit 538a71e

Please sign in to comment.