Repository navigation
Voice orders the cart, and the kitchen still needs a finger - #38
Merged
Merged
Conversation
sridharkalaibala
force-pushed
the
feat/voice-orders-the-cart
branch
from
September 11, 2026 18:08
9428a54 to
0af737a
Compare
sridharkalaibala
force-pushed
the
feat/voice-orders-the-cart
branch
from
September 11, 2026 18:12
0af737a to
3155ced
Compare
Owner: "as soon as you heard text you need to convert as cart and what said need to show the cart. if user say add 2 chicken briyani cart needs to get added. if user says remove 2 chicken briyani remove it. if user say send to kitchen. place order." A WAITER TALKS IN VERBS. voice-order.js gains commands(): add, remove, set, place, clear and show, each with the ways people actually say it, on top of the tolerant dish matching it already had. Words before any verb are an addition, because that is what reading an order off a table is. A verb owns every dish until the next one. "send to kitchen" is carried out last wherever it was said, "clear" first. Removal is the shorter, more careful list: an extra way to say add that is wrong costs a line somebody deletes; an extra way to say remove that is wrong costs a dish the table asked for. "without" and "no" are notes on a dish, not removals. WHAT IS SAID GOES INTO THE CART, through updateQuantity - the same function the menu's own buttons use, so stock rules are one rule however an item arrives. The panel shows the cart as it now stands with the changed lines marked; every quantity is a stepper, every line can be struck, and a dish that could not be placed stays on screen by name with a Search button rather than vanishing. Words are read as they arrive, so "2 Coffee" is visible forming while somebody is still talking. ONE THING IS NOT DONE ON A WORD. "send it to the kitchen" puts a button on the panel and a person presses it. A cart can be corrected; a ticket on the pass cannot. It goes through kioskPlaceOrder(), so voice and thumb place an order the same way. THE PANEL IS BESIDE THE WORK. Owner: "bottom buttons are in active when showing voice to text." No backdrop; it sits above the bill bar, measured, so the menu and the bill button keep working. HOW IT LOOKS. Owner: no blue gradient, corporate. Every colour and size is a design.css token with the same value as fallback. One accent on the one thing to press. The mic is ink on surface; listening, it breathes with a red ring (prefers-reduced-motion honoured) and five bars follow the voice. WHO READS. Every shop gets the local parser. A shop with an AI provider gets the model through POST /sales/voiceIntent on the till, falling back to local after three seconds because a waiter is waiting. THE TABLE NUMBER. Owner: "existing table numbers not listed. when focus out from table number input box keep saying enter table number its cleared." Not focus-out: the poll rebuilt the list and innerHTML threw away what was typed into Other; Next then read an empty box and nagged. The choice is captured before any rebuild and restored after, and a rebuild that would change nothing is skipped. Tests: 13 new parser tests (two found a comma glued to the previous word hiding "send to kitchen"), the UI test file rewritten to the new contract with 20 tests, 158 in the suite.
The panel sat on top of .bill-bar. On main the product page has no
.bill-bar - its bottom bar is a fixed footer holding #next-btn - so the
panel took bottom:0 and covered the Next button, which is precisely the
complaint this panel exists to fix ("bottom buttons are in active").
So every fixed ancestor of the Next button and the bill bar are
candidates, and the first one actually on screen at the bottom edge sets
the offset. A bill bar slid away below the viewport is not a bar to sit
on top of, and is skipped. With no bar at all the panel sits on the
floor, which the test pins.
The browser spec still drove the sheet this replaced - #posnic-voice-sheet, its Add button, the HUD - so CI failed on every test that spoke. It is rewritten to the panel's contract: words move the cart the moment they are heard, "send to kitchen" offers a button and sends nothing by itself, the bill button keeps working while the panel is up, a rough match is flagged on its line, and the gestures are unchanged. Running it found two real things. The bill bar slides up over 220ms when the first item lands, and the panel was placed the instant the words were applied - while the bar was still mid-slide and measured as off-screen. The panel took bottom:0 and the bar arrived underneath it, covering the bill button: the exact complaint the panel exists to fix, reproduced by its own test. A bar that has declared where it is going (.is-up) is now measured by its height, and a transitionend on it re-places the panel. And ADD becomes a stepper once a dish is on the bill (menu.spec pins that), so a spec that clicked ADD twice waited for ever on the second. The rough-match flag - "heard 'chicken briyani', check this one" - had been dropped in the rewrite. It is back on the cart row, and settles when the dish is said cleanly again, which is what repeating is for. Unit test added for that; 46 pass. The two specs that failed pass in a real browser.
sridharkalaibala
force-pushed
the
feat/voice-orders-the-cart
branch
from
September 11, 2026 18:35
18d86ca to
382030d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What the owner asked for
A waiter talks in verbs
voice-order.jsgainscommands(): a fixed list of verbs and what follows each one, on top of the tolerant dish matching it already had.Words before any verb are an addition, because that is what reading an order off a table is. A verb starts a new command and owns every dish until the next one.
placeis carried out last wherever it was said;clearfirst. Filler ("can you please … for the table") is stripped after verbs are found, so "i want" is still a verb. "without" and "no" are deliberately not removals: biryani without onion is a note on a dish.Removal is the shorter, more careful list. An extra way to say "add" that is wrong costs a line somebody deletes; an extra way to say "remove" that is wrong costs a dish the table asked for.
What is said goes into the cart
voice-order-ui.jsis rewritten. A spoken add adds and a spoken take-off takes off - throughupdateQuantity, the same function the menu's own buttons use, so stock limits and negative-stock rules are one rule however an item arrives. The panel then shows the cart as it now stands with the changed lines marked, every quantity a stepper, every line strikeable, and anything that could not be placed on the menu kept on screen by name with a Search button rather than dropped.Words are read as they arrive: while you are still talking the panel shows "add 2 Coffee" forming, so you stop when it is right.
One thing is not done on a word
"send it to the kitchen" puts a Send 5 items to kitchen button on the panel and a person presses it. A cart can be corrected; a ticket on the pass cannot, and the failure worse than not hearing an order is confidently firing the wrong one. It goes through
kioskPlaceOrder(), so voice and thumb place an order the same way.The panel is beside the work, not over it
Owner: "bottom buttons are in active when showing voice to text". The old sheet dimmed the whole screen. This one has no backdrop and sits above the bill bar, measured, so the menu and the bill button keep working while it is up.
How it looks
Owner: "dont design with your usual blue gradient stuff … very corporate 20 years experienced UX person". Every colour and size is a token from
design.css, with the same values as fallbacks. No gradients. The one accent is on the one thing to press. The mic is ink on surface with a hairline border; while it listens it breathes with a red ring (honouringprefers-reduced-motion) and five bars follow the voice.Who does the reading
Every shop gets the local parser: no key, no network. A shop that has configured an AI provider gets the model instead through
POST /sales/voiceIntenton the till (companion PR in Posnic/POS), which reads accents and local-language dish names better; if the till does not answer in three seconds the local reading is used, because a waiter is standing at a table. Same command shape either way, one code path carries it out.The table number
Owner: "existing table numbers not listed. when focus out from table number input box keep saying enter table number its cleared." Not focus-out: the poll rebuilt the list every few seconds and
container.innerHTML = …threw away whatever was typed into "Other"; Next then read an empty box and nagged. What a person has typed or picked is now captured before any rebuild and restored after, and a rebuild that would change nothing is skipped.Tests
voice-order.test.js: 13 new, 25 total. Two of them found a real bug while being written - a comma glued to the previous word (kitchen,) hid "send to kitchen" and the order went in as three dishes, one of them a kitchen.voice-order-ui.test.js: rewritten to the new contract, 20 tests, including that a spoken "send" never places without the button, that the panel is not a full-screen overlay, and that the stylesheet carries no gradient and no hard-coded blue.Not covered here:
discount.htmlhas no unit test harness; the fix is a captured-and-restored value around the existing rebuild and was syntax-checked.