Commit ec7552f
authored
fix(agent): repair product grid rendering and prerender error (#482)
* feat(agent): switch assistant model to openai/gpt-5.6-luna
* feat(agent): enable shopping assistant
* fix(agent): render action bar inside CartProviderWrapper
AgentButton mounts AgentPanel (ssr:false), whose CartReconciler calls
useCart(). Rendered outside CartProviderWrapper it missed the server
fallback and threw "useCart must be used within CartProvider" on
hydration.
* fix(agent): drop reasoning chunks before pipeJsonRender
Reasoning models emit reasoning-start/delta chunks that pass through
toUIMessageStream by default; pipeJsonRender only handles text chunks,
so reasoning (and any spec JSONL emitted inside it) never became
data-spec parts and the UI never rendered.
* fix(agent): inline concrete card props instead of repeat/$item bindings
The model followed json-render's repeat/$item example, but this app's
registry components take plain props and defineRegistry passes
element.props through unresolved, so {$item:"price"} reached
parsePriceString raw and crashed inside ElementErrorBoundary — which
returns null, silently unmounting the whole grid.
Instruct the model to emit one /elements entry per card with concrete
values (and null compareAtPrice), and make parsePriceString tolerate a
non-string so a bad spec degrades instead of throwing.
* fix(cart): exclude Hydrogen request-context UUIDs from static shell
createShopifyRequestContext calls crypto.randomUUID() for requestGroupId,
uniqueToken, and visitToken. During prerender of the static shell (layout's
seedCartData and nav's CartIcon) that tripped Cache Components' blocking-
prerender-crypto error on every route. await io() before the read so the
context is created at request time instead.
* feat(agent): return six products per search instead of five
Bump the default limit from 5 to 6 in searchProducts, searchCatalog, and
browseCollection so grids render an even 3x2/2x3.
* fix(agent): return six products from recommendations and searches
getProductRecommendations hardcoded slice(0, 5). The model also passed
limit: 5 explicitly to the search tools, overriding the schema default of 6,
so add a system-prompt rule to omit limit and render every returned product.
* chore(agent): disable shopping assistant1 parent c3a2905 commit ec7552f
11 files changed
Lines changed: 21 additions & 12 deletions
File tree
- apps
- docs/content/docs/anatomy
- template
- app
- api/chat
- components/agent
- lib
- agent
- tools
- cart
- shopify/operations
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
112 | 114 | | |
113 | 115 | | |
114 | 116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
65 | 68 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
| |||
107 | 109 | | |
108 | 110 | | |
109 | 111 | | |
110 | | - | |
| 112 | + | |
111 | 113 | | |
112 | 114 | | |
113 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
75 | 77 | | |
76 | 78 | | |
77 | 79 | | |
| |||
0 commit comments