Skip to content

Commit

Permalink
Merge branch 'master' of github.com:lichess-org/lila
Browse files Browse the repository at this point in the history
* 'master' of github.com:lichess-org/lila:
  New Crowdin updates (#12949)
  tweak audio context handling
  voice mic selector
  prevent lichess.storage race condition on init
  moveCtrl is available
  remove ui/voice `let moveCtrl` global
  move voice toggle code out of the event listener
  mic.ts: if the audio context is suspended, wait for user interaction
  use OpaqueInt+Int=OpaqueInt
  Use fullMoveNumber when writing played moves
  help modal tweaks
  remove debugger stmt
  load mic models without asset version
  remove Selectable from ui/common/common
  chessground 8.3.9 for DrawModifiers.hilite
  code golf while reviewing
  index updated pnpm-lock.yaml
  Many voice improvements
  • Loading branch information
ornicar committed Jun 4, 2023
2 parents 7b13cc3 + 8cf5e48 commit a2aba17
Show file tree
Hide file tree
Showing 40 changed files with 5,517 additions and 5,314 deletions.
79 changes: 40 additions & 39 deletions app/views/site/helpModal.scala
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ object helpModal:
)
)
)

def voiceMove(using Lang) =
import trans.keyboardMove.*
frag(
Expand All @@ -158,42 +159,41 @@ object helpModal:
li(
"Use the ",
i(dataIcon := licon.Voice),
" button to toggle voice recognition mode."
),
li(
"Your voice audio never leaves your device. Moves are sent as plain text just like those made by mouse or touch."
" button to toggle voice recognition. Moves are sent to lichess.org "
+ "as plain text. Audio does not leave your device."
),
li(
"You may speak UCI, SAN, piece names, board squares, or phrases like ",
voice("P,x,R"),
" and ",
voice("x"),
". Click ",
strong("Show me everything"),
" for a full list."
"We show arrows for multiple moves when we're not sure. Speak the color or number of a move "
+ "arrow to select it. Choose between colors or numbers in the voice ",
i(dataIcon := licon.Gear),
" menu"
),
li(
"We show colored or numbered arrows for up to 8 available moves when we're not sure. " +
"If an arrow shows a growing pie, that move will be played when the pie becomes a full circle."
),
li(
"During this countdown, you may only say ",
"If an arrow shows a sweeping arc, that move will be played when the arc becomes a full circle. "
+ "During this countdown, you may say \"",
voice("yes"),
" to play the move immediately, ",
"\" to play it immediately, \"",
voice("no"),
" to cancel, ",
voice("stop"),
" to stop the clock, or the color/number of an arrow. No other command will be recognized."
"\" to cancel, or choose a different arrow. The timer can be adjusted or turned off in the ",
i(dataIcon := licon.Gear),
" menu."
),
li(
"Higher clarity values will decrease arrows & countdowns but increase the chance of misplays."
"An increased clarity setting reduces the number of arrows shown when using a good microphone "
+ "in quiet surroundings. Decrease clarity to offer more choices if your moves are often "
+ "misheard. Try the phonetic alphabet to improve recognition. ",
phonetics()
),
li(
"Clarity, countdown, and arrow display settings are in the voice bar hamburger menu."
),
li(
"The phonetic alphabet is ",
phonetic("a,b,c,d,e,f,g,h")
"Enable \"",
strong("Hey Lichess"),
"\" in the ",
i(dataIcon := licon.Gear),
" menu to start and stop listening with your voice. Say \"",
strong("Hey Lichess"),
"\" to start listening and make a move. Say \"",
voice("stop"),
"\" to go back to sleep. We go to sleep automatically after 20 seconds without a spoken command."
)
)
)
Expand All @@ -204,29 +204,26 @@ object helpModal:
table(
tbody(
header(performAMove()),
row(frag(voice("e,4"), br, phonetic("e,4")), "Move to e4 or select a piece there"),
row(voice("N"), "Move my knight or capture a knight"),
row(frag(voice("B,h,6"), br, phonetic("B,h,6")), "Move bishop to h6"),
row(voice("e,4"), "Move to e4 or select e4 piece"),
row(voice("N"), "Select or capture a knight"),
row(voice("B,h,6"), "Move bishop to h6"),
row(voice("Q,x,R"), "Take rook with queen"),
row(
frag(voice("c,8,=,N"), br, phonetic("c,8,N")),
"Move c8 promote to knight"
),
row(voice("c,8,=,N"), "Pawn to c8 promote to knight"),
row(voice("castle"), "castle (either side)"),
row(voice("O-O-O"), "Queenside castle"),
row(frag(voice("a,7,g,1"), br, phonetic("a,7,g,1")), "Full UCI works too"),
row(voice("draw"), offerOrAcceptDraw())
row(phonetic("a,7,g,1"), "Phonetic alphabet is best"),
row(voice("draw"), offerOrAcceptDraw()),
row(voice("resign"), trans.resignTheGame()),
row(voice("takeback"), "Request a takeback")
)
),
table(
tbody(
header(otherCommands()),
row(voice("resign"), trans.resignTheGame()),
row(voice("takeback"), "Request a takeback"),
row(voice("no"), "Cancel timer or deny a request"),
row(voice("yes"), "Play preferred move or confirm something"),
row(voice("stop"), "Stop the timer but keep the arrows"),
row(voice("mic-off"), "Turn off your microphone"),
row(voice("stop"), "Sleep (if wake word enabled)"),
row(voice("mic-off"), "Turn off voice recognition"),
row(voice("next"), trans.puzzle.nextPuzzle()),
row(voice("upvote"), trans.puzzle.upVote()),
row(voice("solve"), "Show puzzle solution"),
Expand All @@ -239,3 +236,7 @@ object helpModal:
)
)
)

private def phonetics() =
for letter <- List("a", "b", "c", "d", "e", "f", "g", "h")
yield frag(s"$letter is \"", phonetic(letter), "\". ")
2 changes: 1 addition & 1 deletion bin/gen/licon.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def parse_codes():
continue
codes[name] = code_point
print('' if not warnings else f'\nWarnings:\n{"".join(warnings)}')
return codes
return dict(sorted(codes.items(), key=lambda x: x[1]))


def gen_sources(codes):
Expand Down
6 changes: 4 additions & 2 deletions modules/round/src/main/ApiMoveStream.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import lila.common.Bus
import lila.common.Json.given
import lila.game.actorApi.{ FinishGame, MoveGameEvent }
import lila.game.{ Game, GameRepo }
import chess.{ Ply, Situation }

final class ApiMoveStream(
gameRepo: GameRepo,
Expand Down Expand Up @@ -50,12 +51,13 @@ final class ApiMoveStream(
black <- c.black.lift((index + clockOffset) >> 1)
yield ByColor(white, black)
queue offer toJson(
Fen write s,
Fen write Situation
.AndFullMoveNumber(s, (game.startedAtPly + index).fullMoveNumber),
s.board.history.lastMove.map(_.uci),
clk
)
}
if (game.finished)
if game.finished then
queue offer makeGameJson(game)
queue.complete()
else
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@typescript-eslint/eslint-plugin": "^5.46.1",
"@typescript-eslint/parser": "^5.46.1",
"ab": "https://github.com/lichess-org/ab-stub",
"chessground": "^8.3.7",
"chessground": "^8.3.9",
"eslint": "^8.30.0",
"eslint-config-prettier": "^8.5.0",
"prettier": "2.8.1",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a2aba17

Please sign in to comment.