Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/hooks/useConversationEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,15 @@ export function useConversationEngine(opts: ConversationEngineOptions) {
localConversationId: string,
bot1StartsFirst: boolean,
) => {
// De-burst synchronized starts: when many participants click Start on the
// same cue (e.g. instructor says "go"), a short random delay before the
// first turn fans the initial requests out across the shared key instead of
// all hitting on the same beat. Only the opening turn of a run is staggered.
if (repetitionIndex === 0) {
await new Promise<void>(resolve => setTimeout(resolve, Math.round(Math.random() * 1200)));
if (isStoppedRef.current) { setIsLoading(false); return; }
}

const dbConversationId = await createConversationRecord(userMsg, localConversationId);

trackEvent(opts.userId, 'conversation_started', {
Expand Down
Loading