feat(social): add listening activity, shared rooms and modern chat
ci / api / api (push) Canceled after 0s
ci / module boundaries / boundaries (push) Canceled after 0s
ci / contract / contract (сгенерированный код совпадает с openapi.yaml) (push) Canceled after 11m29s
ci / db / db (push) Canceled after 11m22s
ci / mobile / mobile (Metro-бандл Android) (push) Canceled after 6m43s
ci / recommender / recommender (push) Canceled after 6m47s
ci / ts / ts (packages + web) (push) Canceled after 1s
ci / api / api (push) Canceled after 0s
ci / module boundaries / boundaries (push) Canceled after 0s
ci / contract / contract (сгенерированный код совпадает с openapi.yaml) (push) Canceled after 11m29s
ci / db / db (push) Canceled after 11m22s
ci / mobile / mobile (Metro-бандл Android) (push) Canceled after 6m43s
ci / recommender / recommender (push) Canceled after 6m47s
ci / ts / ts (packages + web) (push) Canceled after 1s
This commit is contained in:
1 parent
0a05bfe2cd
commit
11a16cd023
59 files changed
+5022
-542
No files matched your search
@@ -67,14 +67,15 @@ type Feedback struct {
|
||||
|
||||
// BatchRequest — запрос к рекомендателю.
|
||||
type BatchRequest struct {
|
||||
UserID string `json:"user_id"`
|
||||
SessionID string `json:"session_id"`
|
||||
Activity *string `json:"activity"`
|
||||
Mood *string `json:"mood"`
|
||||
Seed *Seed `json:"seed,omitempty"`
|
||||
ExcludeIDs []string `json:"exclude_ids"`
|
||||
Feedback []Feedback `json:"feedback"`
|
||||
N int `json:"n"`
|
||||
FriendTrackIDs []string `json:"friend_track_ids,omitempty"`
|
||||
UserID string `json:"user_id"`
|
||||
SessionID string `json:"session_id"`
|
||||
Activity *string `json:"activity"`
|
||||
Mood *string `json:"mood"`
|
||||
Seed *Seed `json:"seed,omitempty"`
|
||||
ExcludeIDs []string `json:"exclude_ids"`
|
||||
Feedback []Feedback `json:"feedback"`
|
||||
N int `json:"n"`
|
||||
}
|
||||
|
||||
// Seed — от чего запущена волна.
|
||||
@@ -295,6 +296,11 @@ func (h *Handler) serve(ctx context.Context, s session, fb []Feedback) (gen.Wave
|
||||
UserID: s.UserID.String(), SessionID: s.ID.String(), Activity: s.Activity, Mood: s.Mood,
|
||||
ExcludeIDs: served, Feedback: fb, N: BatchSize,
|
||||
}
|
||||
friendIDs, friendErr := h.friendCandidates(ctx, s.UserID, served)
|
||||
if friendErr != nil {
|
||||
h.log.WarnContext(ctx, "friend music unavailable", "err", friendErr)
|
||||
}
|
||||
req.FriendTrackIDs = friendIDs
|
||||
if s.SeedType != nil && s.SeedID != nil {
|
||||
req.Seed = &Seed{Type: *s.SeedType, ID: s.SeedID.String()}
|
||||
}
|
||||
@@ -311,6 +317,9 @@ func (h *Handler) serve(ctx context.Context, s session, fb []Feedback) (gen.Wave
|
||||
if picks, err = h.fallback(ctx, s, served); err != nil {
|
||||
return gen.WaveBatch{}, err
|
||||
}
|
||||
if s.SeedType == nil && len(served)%10 >= 5 {
|
||||
picks = blendFriendPick(picks, friendIDs)
|
||||
}
|
||||
}
|
||||
|
||||
ids := make([]uuid.UUID, 0, len(picks))
|
||||
|
||||
Reference in new issue
Block a user