Logo Json Ui

Json Ui

Tổ chứcPhổ biến
actionbook
json-ui

QUAN TRỌNG: Dùng để kết xuất và phát triển thành phần json-ui. Kích hoạt khi có: json-ui, json render, component catalog, report render, HTML report, I18nString, i18n, song ngữ, chuyển ngôn ngữ, hai ngôn ngữ, PaperHeader, AuthorList, Abstract, MetricsGrid, Section, Highlight, Zod schema, catalog.ts, cli.ts, components/index.tsx, "how to add a component", "how to render JSON", JSON 渲染, 组件目录, 报告渲染, 多语言, 中英文切换

Add to TypingMind

Tổng quan

Nhà phát hànhactionbook
Kho mãactionbook
Tên kỹ năngjson-ui
Sao
1.6K
Bản fork
120
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépApache-2.0
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Hướng dẫn có đủ mọi thứ cần thiết

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được actionbook công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Json Ui trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/actionbook/actionbook/tree/main/playground/json-ui-skill
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/actionbook/actionbook.git /tmp/actionbook
mkdir -p .claude/skills
cp -r /tmp/actionbook/playground/json-ui-skill .claude/skills/json-ui
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Json Ui trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Json Ui ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Json Ui với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

json-ui

Version: 1.0.0 | Last Updated: 2026-01-29

You are an expert at the json-ui package — a JSON-to-HTML report renderer with React component support, bilingual i18n, and a CLI tool. Help users by:

  • Writing components: Add new component types following existing patterns
  • Rendering reports: Generate HTML from JSON report definitions
  • Debugging: Fix rendering, build, or i18n issues
  • Answering questions: Explain architecture, component catalog, data flow

Quick Reference

TaskFilePattern
Define component schemasrc/catalog.tsAdd Zod schema + export in catalog object
Render component (HTML)src/cli.tsAdd case in renderNode() switch
Render component (React)src/components/index.tsxExport React FC using catalog types
Add i18n textAny JSON{ "en": "Hello", "zh": "你好" } or plain "Hello"
Buildterminalpnpm build (uses tsup, outputs ESM + DTS)
Render reportterminaljson-ui render report.json [-o out.html] [--no-open]

Documentation

Refer to local source files for detailed documentation:

  • packages/json-ui/src/catalog.ts - All Zod schemas and type definitions
  • packages/json-ui/src/cli.ts - HTML renderer and CLI entry point
  • packages/json-ui/src/components/index.tsx - React component implementations

IMPORTANT: Documentation Completeness Check

Before answering questions, Claude MUST:

  1. Read the relevant source file(s) listed above
  2. If file read fails: Inform user "本地文档不完整,建议更新"
  3. Still answer based on SKILL.md patterns + built-in knowledge

Architecture

JSON Report Format

Reports are trees of nodes:

json
{
  "type": "Report",
  "props": { "title": "My Report", "theme": "auto" },
  "children": [
    {
      "type": "Section",
      "props": { "title": "Overview", "icon": "bulb" },
      "children": [
        { "type": "Abstract", "props": { "text": "..." } }
      ]
    }
  ]
}

Three Rendering Layers

LayerFileOutputUse Case
Zod Schemascatalog.tsType definitionsValidation, type safety
HTML Renderercli.tsStatic HTML stringCLI render command
React Componentscomponents/index.tsxReact elementsEmbedded usage

Data Flow

JSON file → CLI parse → renderNode() recursion → HTML string → file write → browser open

Component Catalog (38 types)

Layout

ComponentKey PropsDescription
Reporttitle?, themeRoot wrapper, 800px max-width
Sectiontitle, icon?, collapsible?Collapsible section with header
Gridcols, gapCSS grid layout
Cardvariant, padding, shadowCard container

Paper Info

ComponentKey PropsDescription
PaperHeadertitle, arxivId, date, categories?Paper title + metadata
AuthorListauthors, layout?, maxVisible?Author names + affiliations
Abstracttext, highlights?, maxLength?Abstract with keyword highlighting
TagListtags, variantTag/category pills

Content

ComponentKey PropsDescription
ContributionListitems, numbered?Numbered contributions with badges
MethodOverviewsteps, showConnectors?Step-by-step method pipeline
Highlighttext, type, source?Blockquote (quote/important/warning/code)
KeyPointicon, title, descriptionIcon + title + description
CodeBlockcode, language, showLineNumbers?Syntax-highlighted code
ProsecontentMarkdown content block
Callouttype, title?, contentInfo/tip/warning/important/note box

Rich Content

ComponentKey PropsDescription
Imagesrc, alt?, caption?, width?Single image
Figureimages, caption?, label?Multi-image figure
Formulalatex, block?, label?LaTeX formula
DefinitionListitemsTerm-definition pairs
Theoremtype, number?, title?, contentTheorem/lemma/proposition
Algorithmtitle, steps, caption?Algorithm pseudocode
ResultsTablecolumns, rows, highlights?Results with best-cell highlighting

Data Display

ComponentKey PropsDescription
Metriclabel, value, trend?, icon?Single metric card
MetricsGridmetrics, cols?Grid of metric cards
Tablecolumns, rows, striped?, caption?Data table

Interactive

ComponentKey PropsDescription
LinkButtonhref, label, icon?, external?Styled link button
LinkGrouplinks, layout?Group of link buttons

Brand

ComponentKey PropsDescription
BrandHeaderbadge?, poweredBy?, showBadge?AI-generated badge header
BrandFootertimestamp, attribution?, disclaimer?Footer with attribution

I18n System

Backward-Compatible Bilingual Strings

The I18nString type accepts both plain strings and bilingual objects:

typescript
// catalog.ts
export const I18nString = z.union([
  z.string(),
  z.object({ en: z.string(), zh: z.string() }),
]);

JSON Usage

json
// Plain string (backward compatible)
{ "title": "Hello World" }

// Bilingual object
{ "title": { "en": "Hello World", "zh": "你好世界" } }

HTML Rendering (cli.ts)

For HTML output, i18n strings render as dual spans:

typescript
// renderI18n() outputs:
<span class="i18n-en">Hello</span><span class="i18n-zh">你好</span>

// CSS controls visibility:
html[lang="en"] .i18n-zh { display: none; }
html[lang="zh"] .i18n-en { display: none; }

For HTML attributes (alt, title) where only a plain string works:

typescript
// resolveI18n() picks one language:
const alt = resolveI18n(props.alt, 'en'); // returns plain string

React Rendering (components/index.tsx)

typescript
// Use <I18nText> component for JSX:
<I18nText value={props.title} />

// Use resolveI18nStr() for plain string contexts:
const altText = resolveI18nStr(props.alt, 'en');

Language Switcher

  • Fixed top-right button: EN | 中文
  • Toggles <html lang="en|zh"> attribute
  • Persists choice via localStorage.getItem('json-ui-lang')

Key Patterns

Pattern 1: Adding a New Component

  1. Define schema in catalog.ts:
typescript
export const MyWidgetSchema = z.object({
  label: I18nString,        // Use I18nString for user-visible text
  count: z.number(),        // Use z.string()/z.number() for data
  variant: VariantType.default('default'),
});

// Add to catalog object:
export const catalog = {
  // ...existing...
  MyWidget: MyWidgetSchema,
} as const;

// Export type:
export type MyWidgetProps = z.infer<typeof MyWidgetSchema>;
  1. Add HTML renderer in cli.ts renderNode() switch:
typescript
case 'MyWidget': {
  const { label, count, variant } = props;
  return `<div class="my-widget ${variant}">
    <span>${renderI18n(label)}</span>
    <strong>${escapeHtml(String(count))}</strong>
  </div>`;
}
  1. Add React component in components/index.tsx:
typescript
export const MyWidget: React.FC<MyWidgetProps> = ({ label, count, variant = 'default' }) => (
  <div className={`my-widget ${variant}`}>
    <span><I18nText value={label} /></span>
    <strong>{count}</strong>
  </div>
);

Pattern 2: Handling I18n in Special Cases

For text that needs processing (e.g., Abstract highlights):

typescript
// HTML (cli.ts) - process each language separately:
if (isI18n(text)) {
  return `<span class="i18n-en">${processText(text.en)}</span>
          <span class="i18n-zh">${processText(text.zh)}</span>`;
} else {
  return processText(String(text));
}

// React (components/index.tsx):
if (typeof text === 'object' && 'en' in text && 'zh' in text) {
  return (
    <>
      <span className="i18n-en" dangerouslySetInnerHTML={{ __html: processText(text.en) }} />
      <span className="i18n-zh" dangerouslySetInnerHTML={{ __html: processText(text.zh) }} />
    </>
  );
}

Common Errors

ErrorCauseSolution
Type 'I18nStringType' is not assignable to 'ReactNode'Passing i18n object directly to JSXWrap with <I18nText value={...} />
Property 'length' does not exist on type 'I18nStringType'Calling string methods on i18n valueUse type guard: typeof text === 'string' ? text : text.en
Images not loading from arxivcrossorigin="anonymous" on <img>Remove crossorigin; keep only referrerpolicy="no-referrer"
Language switcher not workingMissing CSS rules or JSEnsure html[lang] .i18n-* CSS rules and toggle JS are in template
Build fails with type errorsSchema changed but components not updatedUpdate all three files: catalog, cli, components

CRITICAL: Image Handling

Do NOT use crossorigin="anonymous" on <img> tags.

Sites like arxiv.org do not send CORS headers. Adding crossorigin="anonymous" causes the browser to require CORS, which fails and blocks the image.

html
<!-- WRONG - breaks images from arxiv and similar sites -->
<img src="..." referrerpolicy="no-referrer" crossorigin="anonymous" />

<!-- CORRECT -->
<img src="..." referrerpolicy="no-referrer" />

Chinese Translation Guidelines

When writing Chinese translations for ML/AI papers:

WrongCorrectReason
评论器价值函数(critic)Standard ML term
运行估计滑动估计Running estimate = 滑动估计
重加权因子加权系数More natural Chinese
不断演化的动态更新的Clearer meaning
简单修复改动小Academic tone

Build & CLI

bash
# Build (ESM + DTS via tsup)
cd packages/json-ui && pnpm build

# Render report to HTML
node dist/cli.js render example-report-rich.json

# With options
node dist/cli.js render report.json -o output.html --no-open

When Writing Code

  1. Always use I18nString for user-visible text properties in schemas
  2. Always handle both string and {en, zh} forms in renderers
  3. Never use crossorigin="anonymous" on img tags
  4. Keep referrerpolicy="no-referrer" on img tags for privacy
  5. Test with pnpm build after any schema or component changes
  6. Update all three layers (catalog, cli, components) when adding components

Câu hỏi thường gặp

Kỹ năng AI Json Ui làm được gì?

QUAN TRỌNG: Dùng để kết xuất và phát triển thành phần json-ui. Kích hoạt khi có: json-ui, json render, component catalog, report render, HTML report, I18nString, i18n, song ngữ, chuyển ngôn ngữ, hai ngôn ngữ, PaperHeader, AuthorList, Abstract, MetricsGrid, Section, Highlight, Zod schema, catalog.ts, cli.ts, components/index.tsx, "how to add a component", "how to render JSON", JSON 渲染, 组件目录, 报告渲染, 多语言, 中英文切换

Vì sao nên dùng Json Ui trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Json Ui là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Json Ui trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/actionbook/actionbook/tree/main/playground/json-ui-skill. TypingMind đọc tệp SKILL.md rồi cài đặt kỹ năng để bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Json Ui?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Json Ui với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Json Ui với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Json Ui có miễn phí không?

Có. Kỹ năng này được actionbook phát hành trên GitHub theo giấy phép Apache-2.0. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả
Logo của JuliusBrussee

Caveman Explore

JuliusBrussee
Cộng đồngPhổ biến

Công cụ khám phá kho lưu trữ ở chế độ chỉ đọc, dùng để làm quen nhanh khi bắt đầu, định vị trên nhiều tệp hoặc khi tìm kiếm trực tiếp không thành công. Bỏ qua nếu đã biết chính xác tên tệp hoặc ký hiệu. Chỉ trả về trích dẫn dạng đường_dẫn:dòng…

6.2K
106.3K
2 tệp
Xem
Logo của paperclipai

Delegate Work

paperclipai
Tổ chứcPhổ biến

Delegate user-requested work to an existing Paperclip agent, with a durable task reference and clear execution expectations.

16.9K
100.4K
Hướng dẫn
Xem
Logo của nexu-io

Html Ppt Zhangzara Vellum

nexu-io
Tổ chứcPhổ biến

Bài giảng về nhân văn: phép phối cảnh tuyến tính thời Phục Hưng đã định hình lại ngành bản đồ học sơ kỳ như thế nào — tư liệu, luận điểm và bằng chứng. Được xây dựng thành bộ slide nghiên cứu học thuật hỗ trợ ra quyết định cho giảng viên và hội thảo sau đại học.

11.5K
98.9K
2 tệp
Xem
Logo của nexu-io

Kami Deck

nexu-io
Tổ chứcPhổ biến

Bộ slide cho buổi họp nhóm nghiên cứu về mối liên hệ giữa hệ vi sinh đường ruột và chất lượng giấc ngủ — gồm thiết kế nghiên cứu, kết quả, những điểm cần lưu ý và thí nghiệm tiếp theo. Được xây dựng thành bộ slide nghiên cứu học thuật đủ cơ sở để đưa ra quyết định, dành cho nhóm nghiên cứu và PI.

11.5K
98.9K
1 tệp
Xem

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇