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:
1 parent
02af4bde09
commit
54a7b36aae
12 files changed
+105
-4
No files matched your search
@@ -1479,6 +1479,10 @@ class Handler(BaseHTTPRequestHandler):
|
||||
time_of_day = body.get("time_of_day")
|
||||
if time_of_day not in {"morning", "day", "evening", "night"}:
|
||||
time_of_day = None
|
||||
taste_profile = body.get("taste_profile") or None
|
||||
if taste_profile not in reco.TASTE_PROFILES and taste_profile is not None:
|
||||
self._error(400, "unknown taste profile")
|
||||
return
|
||||
mood, results = reco.recommend(
|
||||
con, mood,
|
||||
allowed_statuses=allowed,
|
||||
@@ -1489,6 +1493,7 @@ class Handler(BaseHTTPRequestHandler):
|
||||
feedback_key=key,
|
||||
session=session,
|
||||
time_of_day=time_of_day,
|
||||
taste_profile=taste_profile,
|
||||
)
|
||||
ids = [g["appid"] for g in results]
|
||||
details = details_map(con, ids)
|
||||
|
||||
@@ -1142,6 +1142,7 @@ async function runRecommend(scroll = true) {
|
||||
min_review: Number($("#optReview").value),
|
||||
session: $("#optSession").value || null,
|
||||
time_of_day: $("#optTimeOfDay").value || null,
|
||||
taste_profile: $("#optTaste").value || null,
|
||||
limit: 36,
|
||||
};
|
||||
state.recommendContext = { preset: state.preset, mood: state.preset ? null : text };
|
||||
|
||||
@@ -295,6 +295,13 @@ try {
|
||||
<option value="night">ночь</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="range">вкус
|
||||
<select id="optTaste" aria-label="Профиль вкуса">
|
||||
<option value="">весь</option>
|
||||
<option value="solo">соло</option>
|
||||
<option value="coop">с друзьями</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<button id="recommendBtn" class="primary">Подобрать</button>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user