fix: rely on vibe fatigue instead of artist counters
This commit is contained in:
@@ -13,10 +13,6 @@ interface ActivePlan {
|
||||
servedTrackIds?: string[];
|
||||
/** Explicit feedback targets (skip, dislike, completion, promotion). */
|
||||
excludedTrackIds?: string[];
|
||||
/** Main artists already heard in this Vibe; they get a mild rank penalty. */
|
||||
servedArtistIds?: string[];
|
||||
/** Artists explicitly skipped/disliked; they receive the stronger penalty. */
|
||||
downrankedArtistIds?: string[];
|
||||
}
|
||||
|
||||
const PLAN_TTL_SEC = 2 * 3600;
|
||||
@@ -43,13 +39,6 @@ function sessionExclusions(active: ActivePlan): string[] {
|
||||
])];
|
||||
}
|
||||
|
||||
function sessionArtistPenalties(active: ActivePlan): Map<string, number> {
|
||||
const penalties = new Map<string, number>();
|
||||
for (const artistId of active.servedArtistIds ?? []) penalties.set(artistId, 0.2);
|
||||
for (const artistId of active.downrankedArtistIds ?? []) penalties.set(artistId, 0.75);
|
||||
return penalties;
|
||||
}
|
||||
|
||||
export default async function v2Routes(fastify: FastifyInstance, options: { dbService: DbService; sessionDirector: SessionDirector }) {
|
||||
const { dbService, sessionDirector: director } = options;
|
||||
|
||||
@@ -154,15 +143,6 @@ export default async function v2Routes(fastify: FastifyInstance, options: { dbSe
|
||||
|
||||
const next = active.plan.shift()!;
|
||||
active.servedTrackIds = appendUniqueId(active.servedTrackIds, next.trackId);
|
||||
const artistResult = await dbService.pgClient.query<{ artist_id: string }>(
|
||||
`SELECT artist_id FROM track_artists_v2
|
||||
WHERE track_id = $1 AND role = 'main'
|
||||
ORDER BY confidence DESC NULLS LAST LIMIT 1`,
|
||||
[next.trackId]
|
||||
);
|
||||
if (artistResult.rows[0]?.artist_id) {
|
||||
active.servedArtistIds = appendUniqueId(active.servedArtistIds, artistResult.rows[0].artist_id);
|
||||
}
|
||||
// Enrich with track details
|
||||
const track = await dbService.getTrackById(next.trackId);
|
||||
|
||||
@@ -174,7 +154,7 @@ export default async function v2Routes(fastify: FastifyInstance, options: { dbSe
|
||||
active.plan,
|
||||
[next.trackId],
|
||||
active.seedTrackId ?? undefined,
|
||||
{ excludedTrackIds: sessionExclusions(active), artistPenalties: sessionArtistPenalties(active) }
|
||||
{ excludedTrackIds: sessionExclusions(active) }
|
||||
);
|
||||
active.plan = refill;
|
||||
}
|
||||
@@ -239,17 +219,6 @@ export default async function v2Routes(fastify: FastifyInstance, options: { dbSe
|
||||
// Feedback may race /next or arrive after a client-side prefetch. In all
|
||||
// cases its track becomes ineligible for the rest of this session.
|
||||
active.excludedTrackIds = appendUniqueId(active.excludedTrackIds, trackId);
|
||||
if (action === 'skipped' || action === 'disliked') {
|
||||
const artistResult = await dbService.pgClient.query<{ artist_id: string }>(
|
||||
`SELECT artist_id FROM track_artists_v2
|
||||
WHERE track_id = $1 AND role = 'main'
|
||||
ORDER BY confidence DESC NULLS LAST LIMIT 1`,
|
||||
[trackId]
|
||||
);
|
||||
if (artistResult.rows[0]?.artist_id) {
|
||||
active.downrankedArtistIds = appendUniqueId(active.downrankedArtistIds, artistResult.rows[0].artist_id);
|
||||
}
|
||||
}
|
||||
const sessionTrackIds = sessionExclusions(active);
|
||||
const refill = await director.replan(
|
||||
userId,
|
||||
@@ -257,7 +226,7 @@ export default async function v2Routes(fastify: FastifyInstance, options: { dbSe
|
||||
active.plan,
|
||||
[trackId],
|
||||
active.seedTrackId ?? undefined,
|
||||
{ excludedTrackIds: sessionTrackIds, artistPenalties: sessionArtistPenalties(active) }
|
||||
{ excludedTrackIds: sessionTrackIds }
|
||||
);
|
||||
active.plan = refill;
|
||||
await setActivePlan(userId, active);
|
||||
|
||||
Reference in New Issue
Block a user