Skip to content
This repository was archived by the owner on Jul 17, 2026. It is now read-only.

Commit d847cf5

Browse files
🐞 fix: Fuck AI Mode
1 parent e7f8609 commit d847cf5

2 files changed

Lines changed: 15 additions & 19 deletions

File tree

src/core/player/SongManager.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { QualityType, type SongType } from "@/types/main";
1111
import { isLogin } from "@/utils/auth";
1212
import { isElectron } from "@/utils/env";
1313
import { formatSongsList } from "@/utils/format";
14+
import { AI_AUDIO_LEVELS } from "@/utils/meta";
1415
import { handleSongQuality } from "@/utils/helper";
1516
import { openUserLogin } from "@/utils/modal";
1617

@@ -120,7 +121,13 @@ class SongManager {
120121
*/
121122
public getOnlineUrl = async (id: number, isPc: boolean = false): Promise<AudioSource> => {
122123
const settingStore = useSettingStore();
123-
const level = isPc ? "exhigh" : settingStore.songLevel;
124+
let level = isPc ? "exhigh" : settingStore.songLevel;
125+
126+
// Fuck AI Mode: 如果开启,且请求的 level 是 AI 音质,降级为 hires
127+
if (settingStore.disableAiAudio && AI_AUDIO_LEVELS.includes(level)) {
128+
level = "hires";
129+
}
130+
124131
const res = await songUrl(id, level);
125132
console.log(`🌐 ${id} music data:`, res);
126133
const songData = res.data?.[0];

src/utils/helper.ts

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -426,25 +426,14 @@ export const handleSongQuality = (
426426
"standard": QualityType.LQ,
427427
};
428428

429-
// Fuck AI Filter
430-
if (disableAiAudio && typeof song === "object" && song) {
431-
if ("level" in song) {
432-
if (AI_AUDIO_LEVELS.includes(song.level)) {
433-
return QualityType.HiRes;
434-
}
435-
}
436-
if ("privilege" in song) {
437-
const p = song.privilege;
438-
const level = p?.playMaxBrLevel ?? p?.plLevel;
439-
if (AI_AUDIO_LEVELS.includes(level)) {
440-
const quality = levelQualityMap["hires"];
441-
if (quality) return quality;
442-
}
443-
}
444-
}
429+
// Fuck AI Filter: 如果是 AI 音质,跳过 level 属性判断,让后续遍历逻辑来确定真正的最高音质
430+
const isAiLevel = disableAiAudio && typeof song === "object" && song && (
431+
("level" in song && AI_AUDIO_LEVELS.includes(song.level)) ||
432+
("privilege" in song && AI_AUDIO_LEVELS.includes(song.privilege?.playMaxBrLevel ?? song.privilege?.plLevel))
433+
);
445434

446-
if (typeof song === "object" && song) {
447-
// 含有 level 特殊处理
435+
if (typeof song === "object" && song && !isAiLevel) {
436+
// 含有 level 特殊处理(仅在非 AI 音质时使用)
448437
if ("level" in song) {
449438
const quality = levelQualityMap[song.level];
450439
if (quality) return quality;

0 commit comments

Comments
 (0)