@y-bi/movie-recommendations
v0.1.0
Published
React component for ChatGPT Apps Custom UX that renders movie recommendations from tool `structuredContent`.
Readme
Movie Recommendations React Component
React component for ChatGPT Apps Custom UX that renders movie recommendations from tool structuredContent.
Build
npm i(orpnpm i)npm run build→ outputs:- Stylesheet:
dist/index.css - Widget (self-boot):
dist/movie-recommendations.widget.js
- Stylesheet:
Local Preview
npm run buildnpm run preview→ servespreview/index.htmlat http://localhost:5173- The preview loads
dist/index.cssanddist/movie-recommendations.widget.jsand mounts using inlinestructured-contentJSON.
Release & CDN (npm + jsDelivr)
- CI publishes only
dist/to npm when you push av*tag. - Prerequisite: repository secret
NPM_TOKENwith publish rights (already configured).
Release examples
- First 0.1.0 release (package.json already 0.1.0):
git tag v0.1.0git push origin v0.1.0- Verify after CI:
npm view @y-bi/movie-recommendations version→ should be0.1.0- JS:
https://cdn.jsdelivr.net/npm/@y-bi/[email protected]/dist/movie-recommendations.widget.js - CSS:
https://cdn.jsdelivr.net/npm/@y-bi/[email protected]/dist/index.css
- Subsequent releases (automatically bump, commit, and tag):
- Patch:
npm version patch→ bumpsx.y.z→x.y.(z+1)and createsvX.Y.Ztag - Minor/Major:
npm version minor/npm version major - Push:
git push origin --follow-tags - Explicit set (optional):
npm version 0.1.1then push tags as above
- Patch:
Notes
npm versionrequires a clean working tree and automatically creates a commit and avX.Y.Ztag.- Tags should be immutable; avoid reusing or moving an existing tag to prevent CDN cache issues.
jsDelivr URLs (pin version)
- JS:
https://cdn.jsdelivr.net/npm/@y-bi/movie-recommendations@<version>/dist/movie-recommendations.widget.js - CSS:
https://cdn.jsdelivr.net/npm/@y-bi/movie-recommendations@<version>/dist/index.css
Environment variables (example)
MOVIE_RECS_JS_URL=https://cdn.jsdelivr.net/npm/@y-bi/[email protected]/dist/movie-recommendations.widget.jsMOVIE_RECS_CSS_URL=https://cdn.jsdelivr.net/npm/@y-bi/[email protected]/dist/index.css
Integration (Apps)
- Use the widget script and include a
<script id="structured-content" type="application/json">containing the tool output. Alternatively setwindow.openai.toolOutput.
StructuredContent contract
{
query?: string,
items?: Array<{
public_code?: string,
title?: string,
description?: string,
thumbnail_url?: string,
poster_url?: string,
rating?: number,
badges?: string[],
price?: string,
is_new?: boolean
}>
}Placeholders
- Missing
rating→ render placeholder stars - Missing
badges→ render字+吹placeholder chips - Missing
price→ renderP 399円~placeholder chip
Notes
preview/index.htmlis provided for local preview only and is not part of the production bundle.- The MCP server exposes an HTML template resource
ui://widget/movie-recommendations.html(text/html+skybridge) and sets_meta.openai/outputTemplateto this URI; the HTML references the CDN JS/CSS. - If an item includes
public_code, clicking its poster openshttps://video.unext.jp/?td=PUBLIC_CODEin the same tab.
References
- Apps SDK MCP Server: https://developers.openai.com/apps-sdk/build/mcp-server
- Apps SDK Custom UX: https://developers.openai.com/apps-sdk/build/custom-ux
- Apps SDK Examples (Pizzaz): https://developers.openai.com/apps-sdk/build/examples
