fix(import): 无匹配渠道时回退兼容渠道 (#523)

This commit is contained in:
tbphp authored and GitHub committed 2026-09-01 19:04:52 +08:00
1 parent 182367f4d3
commit 91173361a3
1 file changed
+7 -1
@@ -150,11 +150,17 @@ const rankedMatches = computed<ChannelMatch[]>(() => {
if (!normalizedQuery) {
return otherChannels.value.map((channel) => ({ channel, rank: 0, reason: '' }))
}
return activeChannels.value
const matches = activeChannels.value
.map((channel, index) => ({ index, match: matchChannel(channel, normalizedQuery) }))
.filter((row): row is { index: number; match: ChannelMatch } => row.match !== null)
.sort((a, b) => b.match.rank - a.match.rank || a.index - b.index)
.map((row) => row.match)
if (matches.length > 0) return matches
const compatible = activeChannels.value.find(
(channel) => channel.channel_id === 'openai_compatible',
)
return compatible ? [{ channel: compatible, rank: 0, reason: '' }] : []
})
watch(rankedMatches, () => {