another fix for human choices
This commit is contained in:
@@ -269,7 +269,8 @@ async function getBotResponse(
|
||||
// before the SSE event tells the frontend to fetch it (fixes race condition
|
||||
// where frontend fetched before pending was set → no choices shown)
|
||||
const start = Date.now()
|
||||
const resultPromise = waitForHumanResponse(fightId, bot.id, challenge, roundNumber)
|
||||
const { promise: resultPromise, choices } = waitForHumanResponse(fightId, bot.id, challenge, roundNumber)
|
||||
// Include choices directly in SSE so frontend never depends on a secondary fetch
|
||||
emit(fightId, 'human_challenge', {
|
||||
botId: bot.id,
|
||||
round: roundNumber,
|
||||
@@ -278,6 +279,7 @@ async function getBotResponse(
|
||||
prompt: challenge.prompt,
|
||||
timeoutMs: challenge.timeout_ms,
|
||||
scoring: challenge.scoring,
|
||||
choices,
|
||||
})
|
||||
const result = await resultPromise
|
||||
const elapsed = Date.now() - start
|
||||
|
||||
Reference in New Issue
Block a user