一键导入
ai-chat-widget
Floating AI chat widget for Next.js content sites (ChatWidget on shawnos.ai - Anthropic API, keyword RAG). NOT NioBot V3.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Floating AI chat widget for Next.js content sites (ChatWidget on shawnos.ai - Anthropic API, keyword RAG). NOT NioBot V3.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Marketing voice and content evaluation for GTME/builder-focused content. Built from analysis of 24 real LinkedIn posts. Checks for authenticity, substance, anti-AI-slop patterns, and brand safety for Shawn's Lead Alchemy brand.
[DEPRECATED 2026-04-22 — superseded by `clip` verb in the content OS] Legacy skill for pushing clean plain text to clipboard / Typefully. Do not invoke for new packs — use `/code` to dispatch, then say `clip next` to pull winning variants to clipboard.
29 structural and formatting tells that trained readers spot as AI-generated content. Runs as a secondary scan on any content before publishing.
Generate images and visual assets for social posts using Python + Pillow. Technical visualizations, not AI art. Use when the user asks to create an image/graphic for a post, or types /contentimage.
Track daily accomplishments, TODOs, and content pipeline. Auto-scans git + content folders, detects Claude Code tokens, computes weighted output scores with letter grades, generates Pillow dashboard cards. Use when the user types /tracker or asks about daily progress.
Generate authentic, non-NPC replies to LinkedIn post commenters using voice DNA. Use when the user has a LinkedIn post open and wants to reply to commenters, or types /linkedin-comments.
| name | ai-chat-widget |
| description | Floating AI chat widget for Next.js content sites (ChatWidget on shawnos.ai - Anthropic API, keyword RAG). NOT NioBot V3. |
Adds a floating AI chat widget to any Next.js content site. Visitors ask questions, get streaming answers grounded in the site's own articles. No vector DB needed — keyword retrieval against MDX frontmatter handles <100 articles cleanly.
Proven on: theplumbernyc.com (34 articles, Gemini Flash, ~$0.0005/query)
[Chat Bubble] → [Chat Panel (useChat)] → [POST /api/chat]
↓
[Keyword Retrieval]
(score articles by query)
↓
[Top 3-5 articles as context]
↓
[streamText → Gemini Flash]
↓
[Streaming response back to UI]
lib/chat-retrieval.tsKeyword retrieval engine. Customize:
SYNONYM_MAP — domain-specific term expansionsgetHowToArticles() / getNycGuides() for your content functions/blog/, /docs/, etc.)Scoring weights: Tag exact +10, Title +8, Slug +6, Category +5, Description +3, Bigram +15, Full query +20
app/api/chat/route.tsStreaming endpoint. Customize:
google("gemini-2.0-flash") is cheapest. Can swap to Haiku, GPT-4o-mini, etc.maxOutputTokens — 800 keeps responses concisetemperature — 0.7 for conversational, lower for factualcomponents/chat/chat-widget.tsxFull UI in one file. Customize:
WELCOME_MESSAGE — first message visitors seeSUGGESTED_QUESTIONS — 3 pills shown before first interactionapp/layout.tsx — add <ChatWidget /> after <Footer />.env.local — add GOOGLE_GENERATIVE_AI_API_KEYnpm install ai @ai-sdk/google @ai-sdk/react
Swap @ai-sdk/google for @ai-sdk/anthropic or @ai-sdk/openai if preferred.
These burned us. Don't repeat:
| Old (v4/v5) | New (v6) |
|---|---|
import { useChat } from "ai/react" | import { useChat } from "@ai-sdk/react" |
useChat returns input, handleInputChange, handleSubmit, isLoading | Returns sendMessage, status — manage input state yourself |
result.toDataStreamResponse() | result.toUIMessageStreamResponse() |
maxTokens | maxOutputTokens |
Messages have content: string | Messages have parts: [{type: "text", text: "..."}] |
Pass messages directly to streamText | Must await convertToModelMessages(messages) first |
useChat({ api: "/api/chat" }) | Default is /api/chat, no api option — use transport for custom endpoints |
LLMs will fabricate domains if given relative URLs. Always:
https://yourdomain.com/path)| Model | Per Query | 100/day Monthly |
|---|---|---|
| Gemini 2.0 Flash | ~$0.0005 | ~$1.50 |
| Claude Haiku 4.5 | ~$0.001 | ~$3.00 |
| GPT-4o-mini | ~$0.001 | ~$3.00 |
After implementing the chat widget, you MUST complete these steps before marking done:
vercel project ls and match the production domain. Do NOT assume the linked project is correct.vercel link --yes --project <correct-project-name>.env.local:
vercel env add <KEY> production (pipe the value from .env.local)vercel env add <KEY> previewvercel redeploy <deploy-url> to pick them upcurl -s -X POST https://<domain>/api/chat ... and verify streaming response (not an error).vercel/project.json may be linked to a stale/wrong project. Always verify with cat .vercel/project.json.| App | Vercel Project | Domain |
|---|---|---|
website/apps/shawnos | shawnos-site | shawnos.ai |
website/apps/gtmos | thegtmos-site | thegtmos.ai |
website/apps/contentos | (check with vercel project ls) | thecontentos.ai |
Full working code: ~/Desktop/nyc-plumbing-engine/
lib/chat-retrieval.tsapp/api/chat/route.tscomponents/chat/chat-widget.tsxAlso deployed: website/apps/shawnos/ (Claude Sonnet 4, RAG from all wikis)
website/packages/shared/components/ChatWidget.tsx — shared widget (inline styles)website/packages/shared/lib/chat-retrieval.ts — generic retrieval enginewebsite/apps/shawnos/app/api/chat/route.ts — Nio chat endpointwebsite/apps/shawnos/app/lib/chat-retrieval.ts — Nio-specific retrieval config