feat(chat): show nine welcome questions and move the logo to the header (AMUL-72) - #166
Conversation
…er (AMUL-72) Per the change request, the welcome screen drops the tomato-only APMC question and gains four: monthly earnings, milk union / Gujarat / India scheme details, multi-commodity APMC prices, and mandali bonus calculation. The list is now 2 pinned -> FAQ card -> those four -> 3 random, so nine questions plus the FAQ card. To fit them on a phone, the pulsating logo and the "Amul AI" wordmark move out of the welcome panel and into the sticky header (the doctor persona keeps its plain-text title), and the greeting and cards use a tighter type scale below the sm breakpoint. Desktop is unchanged. `fixedQuestion` becomes `fixedQuestions` (array). The icon keyword map is reordered so the money and scheme rows match before the broad "પશુ"/"દૂધ" cow keywords that the new questions also contain. Measured over CDP at real mobile viewports: all ten rows are fully visible at 360x640, 375x667, 390x780 and 412x915 (was 2 of 5 at 360x640). 320x568 fits six. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017nqpBEd3wDnLv5mqkmQpJv
KDwevedi
left a comment
There was a problem hiding this comment.
Approving — the FE work is clean and honestly documented. Verified locally on the merge head: tsc -b clean, vitest 28/28, eslint src 0 errors (only the pre-existing no-unused-vars warnings on untouched files), vite build OK. Id sequencing after the fixedQuestion → fixedQuestions change is still unique (1–2 pinned, 3 FAQ, 4–7 fixed, 8–10 random) and randomCount (10 − 2 − 1 − 4 = 3) is right.
Merging to dev so it can be exercised, but the following need to be settled before this is promoted to prod.
1. The schemes card is not answerable by the current backend
"…દૂધ સંઘ, ગુજરાત સરકાર અને ભારત સરકારની બધી યોજનાઓની વિગતવાર માહિતી આપો" asks for three tiers, and no tier is reliably served today:
- Union tier —
prepare_get_union_scheme_datahides the tool unless the farmer resolves to banas/kutch/sumul/surendranagar. ~98% of cached farmer records have an emptyunionName, and dudhsagar dominates the rest, so for most farmers the tool is not even in the schema. - Central tier —
get_vistaar_scheme_infois registered on both envs (ENABLE_NETWORK=true), but it's onescheme_codeper call from a closed 15-codeLiteral, none of which is animal husbandry (પશુપાલન). Measured on the #221 dev re-run: across all 39get_union_scheme_datacallsresolve_scheme_codereturnedNoneevery time, and 0 of 16 open-ended "what schemes can I get" answers mentioned a single central scheme. The BV BPP has no generic scheme search, so no free-text phrasing reaches it. - Gujarat state tier — no tool at all; only iKhedut PDFs via
search_documents, which is the known mojibake → invented-₹-amount path.
There's also a routing trap: the "for a central scheme use get_vistaar_scheme_info" redirect lives inside get_union_scheme_data's docstring, which prepare deletes from the schema in exactly the unsupported-union case where the model most needs it. And on the signed-out path the 08-12 run caught the model stating "1.80 લાખ" for a dairy scheme with no tool output behind it.
The question itself is a good demand signal — it matches the ~31 withheld scheme attempts/day we already measure. But pinning it puts a one-tap fabrication risk on the landing screen for every farmer. Please exercise this card on dev across signed-in (banas + dudhsagar) and signed-out, and let's look at the answers before #165 goes to prod.
2. English earnings card draws a random emoji
KEYWORD_ICON_MAP has earning/income, but the en string is "How much have I earned in total…" — no substring match, and nothing else in that sentence hits any rule, so pickIconForQuestion falls through to randomPick and the icon changes on every render. gu (કમાણી) and hi (कमाई) are fine. One-word fix: add earned to the wheat keyword list.
3. Three of the four new cards resolve to wheat = 💰
Earnings, APMC prices and bonus all match the wheat row, so the list shows three identical money bags. Distinct icons were the point of the map reorder — worth splitting a money vs market row.
4. mr.json loses fixedQuestion with no replacement
Marathi isn't in this repo's config.json languages so there's no Amul impact, but LanguageProvider falls back to English per key, so any bh-*/Vistaar build that enables mr will render these four cards in English. Either add an mr array or note it as intentional.
5. No test covers buildQuickActions
The 28 passing tests are smoke/persona/markdown. This logic just went from one fixed question to N with three interacting counts; I checked id uniqueness and randomCount by hand, but nothing guards a regression. A small unit test over buildQuickActions with a stub t would be cheap.
Also noting for the promotion, not this PR: #164 (feat/split-faq-landing-cards) reworks the same landing cards on amul-dev and will conflict; and #157 (the Send-icon backmerge) is still open, which is why this branch's diff differs slightly from #165's.
Author-disclosed and fine by me: 320×568 fits only 6 of 10; the gu earnings question overlaps a random-pool question so both can co-occur; the four new questions aren't in the FAQ drawer.
Implements the AMUL-72 change request. Same change as #165 (which targets
amul-prod); this is theamul-devcopy, cherry-picked onto this branch becauseamul-prodandamul-devhave diverged.Content
fixedQuestion).The welcome list is now 2 pinned → FAQ card → those four → 3 random, i.e. nine questions plus the FAQ card (
QUICK_ACTION_COUNT5 → 10).fixedQuestionbecomesfixedQuestions(array); ids stay unique across both the static and template branches.The icon keyword map is reordered so the money and scheme rows match before the broad
પશુ/દૂધcow keywords that the new questions also contain — otherwise the schemes card would have drawn 🐮, and the new cards would have picked a random emoji.Layout
Per the annotated mock, the pulsating logo and the red "Amul AI" wordmark move out of the welcome panel and into the sticky header. The doctor persona keeps its plain-text title. The greeting and the cards use a tighter type scale below the
smbreakpoint; desktop is unchanged.Difference from #165
One conflict, in
welcome-panel.tsx:amul-prodmarks the FAQ-opener card with aSendicon (AMUL-62),amul-devdoes not. Resolved in favour of this branch — the card keeps no send icon here, and theSendimport stays absent. Everything else is identical to #165.Verification
Layout measured over the Chrome DevTools Protocol at real mobile viewports (throwaway harness rendering the real
ChatHeader/WelcomePanel/ChatInput):320×568 (iPhone SE 1st gen) is the one size that does not reach nine.
eslint(0 errors) andvitest(28 passed) pass.tsc -bandvite buildcould not be completed locally:html2pdf.jsis declared inpackage.jsonbut absent fromnode_modules, andnpm installcannot resolve it here (the repo is on bun). This fails identically on cleanorigin/amul-dev, inhtml-document-artifact.tsx, a file this PR does not touch — please confirm CI is green.Reviewer notes
યોજનનોની; corrected toયોજનાઓની. Stray spaces before commas and question marks were normalised. Wording is otherwise verbatim.ગયા મહિના અને ચાલુ મહિના... આવક અને કપાતis still in the random pool and overlaps the new earnings question, so both can occasionally appear together. Left in place — the change request did not ask to remove it.🤖 Generated with Claude Code
https://claude.ai/code/session_017nqpBEd3wDnLv5mqkmQpJv