feat: add solo and co-op taste profiles

Filter recommendation candidates and taste weights by play context, with taste_profile in the API, --taste in the CLI and a selector in the UI.
This commit is contained in:
strsv committed 2026-11-07 00:53:18 +03:00
1 parent 02af4bde09
commit 54a7b36aae
12 files changed
+105 -4

No files matched your search

+27
View File
@@ -118,6 +118,33 @@ class MoodTests(RecoFixture):
reco.load_mood(self.con)
class TasteProfileTests(RecoFixture):
def _add_context_tags(self):
self.con.executemany(
"INSERT INTO tag_names (tag_id, name) VALUES (?,?)",
[(10, "Singleplayer"), (11, "Co-op"), (12, "Online Co-Op")])
self.con.executemany(
"INSERT INTO game_tags (appid, tag_id) VALUES (?,?)",
[(1, 10), (2, 10), (3, 11), (4, 12)])
self.con.commit()
def test_profile_appids(self):
self._add_context_tags()
self.assertEqual(reco.taste_profile_appids(self.con, "solo"), {1, 2})
self.assertEqual(reco.taste_profile_appids(self.con, "coop"), {3, 4})
def test_profiles_filter_candidates(self):
self._add_context_tags()
_, solo = reco.recommend(self.con, self.mood(), taste_profile="solo", limit=10)
self.assertEqual(set(self.names(solo)), {"Alpha", "Beta"})
_, coop = reco.recommend(self.con, self.mood(), taste_profile="coop", limit=10)
self.assertEqual(set(self.names(coop)), {"Gamma", "Delta"})
def test_unknown_profile(self):
with self.assertRaises(ValueError):
reco.recommend(self.con, self.mood(), taste_profile="party")
class RecommendTests(RecoFixture):
def test_default_excludes_unknown_ignored_and_non_games(self):
_, results = reco.recommend(self.con, self.mood(), limit=10)