使用 qwen 进行语音识别,加入 tag

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-04-29 20:10:08 +08:00
co-authored by Copilot
parent 040273586b
commit 206a561ee7
26 changed files with 3720 additions and 443 deletions
+40
View File
@@ -0,0 +1,40 @@
export const ASR_CONTENT_TAGS = [
"美女",
"游戏",
"时政",
"美食",
"旅行",
"体育",
"科技",
"教育",
"宠物",
"音乐",
"影视",
"财经",
"生活",
"其他",
] as const;
export type AsrContentTag = (typeof ASR_CONTENT_TAGS)[number];
const asrContentTagSet = new Set<string>(ASR_CONTENT_TAGS);
export function isAsrContentTag(value: string): value is AsrContentTag {
return asrContentTagSet.has(value);
}
export function normalizeAsrContentTags(tags: unknown): AsrContentTag[] {
const rawTags = Array.isArray(tags)
? tags
: typeof tags === "string"
? tags.split(/[、,,\s]+/).filter(Boolean)
: [];
const normalized = rawTags.filter(
(tag): tag is AsrContentTag =>
typeof tag === "string" && isAsrContentTag(tag),
);
const uniqueTags = [...new Set(normalized)].slice(0, 3);
return uniqueTags.length > 0 ? uniqueTags : ["其他"];
}