Receber por email
← Voltar para o catálogo

thesys-generative-ui

Production-ready skill for integrating TheSys C1 Generative UI API into React applications. This skill should be used when building AI-powered interfaces that stream interactive components (forms, charts, tables) instead of plain text responses. Covers complete integration patterns for Vite+React, Next.js, and Cloudflare Workers with OpenAI, Anthropic Claude, and Cloudflare Workers AI. Includes to

15estrelas
Atualizado há 11 meses

Ver no GitHub ↗ Licença: MIT

Como adicionar

/plugin marketplace add jackspace/ClaudeSkillz

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Para o autor da skill

Cole no README do seu repo

Mostra que sua skill está catalogada na Skillteca, gera backlink e tráfego rastreável.

[![Skillteca](https://www.skillteca.com.br/api/badge/thesys-generative-ui/svg)](https://www.skillteca.com.br/skills/thesys-generative-ui)

Alerta por categoria

Receba novas skills de Design e Frontend toda segunda

1 email curto, só com as skills novas de Design e Frontend. 4 minutos de leitura, sem spam, cancela com 1 clique.

Você confirma o email no primeiro envio. Sem spam. Cancela com 1 clique.

Ler descrição completa

TheSys Generative UI Integration

Complete skill for building AI-powered interfaces with TheSys C1 Generative UI API. Convert LLM responses into streaming, interactive React components.

What is TheSys C1?

TheSys C1 is a Generative UI API that transforms Large Language Model (LLM) responses into live, interactive React components instead of plain text. Rather than displaying walls of text, your AI applications can stream forms, charts, tables, search results, and custom UI elements in real-time.

Key Innovation

Traditional LLM applications return text that developers must manually convert into UI:

LLM → Text Response → Developer Parses → Manual UI Code → Display

TheSys C1 eliminates this manual step:

LLM → C1 API → Interactive React Components → Display

Real-World Impact

  • 83% more engaging - Users prefer interactive components over text walls
  • 10x faster development - No manual text-to-UI conversion
  • 80% cheaper - Reduced development time and maintenance
  • Production-ready - Used by teams building AI-native products

When to Use This Skill

Use this skill when building:

  1. Chat Interfaces with Rich UI
  2. Conversational interfaces that need more than text
  3. Customer support chatbots with forms and actions
  4. AI assistants that show data visualizations
  1. Data Visualization Applications
  2. Analytics dashboards with AI-generated charts
  3. Business intelligence tools with dynamic tables
  4. Search interfaces with structured results
  1. Dynamic Form Generation
  2. E-commerce product configurators
  3. Multi-step workflows driven by AI
  4. Data collection with intelligent forms
  1. AI Copilots and Assistants
  2. Developer tools with code snippets and docs
  3. Educational platforms with interactive lessons
  4. Research tools with citations and references
  1. Search and Discovery
  2. Semantic search with structured results
  3. Document analysis with highlighted findings
  4. Knowledge bases with interactive answers

This Skill Prevents These Errors

  • ❌ Empty agent responses from incorrect streaming setup
  • ❌ Models ignoring system prompts due to message array issues
  • ❌ Version compatibility errors between SDK and API
  • ❌ Themes not applying without ThemeProvider
  • ❌ Streaming failures from improper response transformation
  • ❌ Tool calling bugs from invalid Zod schemas
  • ❌ Thread state loss from missing persistence
  • ❌ CSS conflicts from import order issues
  • ❌ TypeScript errors from outdated type definitions
  • ❌ CORS failures from missing headers
  • ❌ Rate limit crashes without retry logic
  • ❌ Authentication token errors from environment issues

Quick Start by Framework

Vite + React Setup

Most flexible setup for custom backends (your preferred stack).

1. Install Dependencies

npm install @thesysai/genui-sdk @crayonai/react-ui @crayonai/react-core @crayonai/stream
npm install openai zod

2. Create Chat Component

File: src/App.tsx

import "@crayonai/react-ui/styles/index.css";
import { ThemeProvider, C1Component } from "@thesysai/genui-sdk";
import { useState } from "react";

export default function App() {
  const [isLoading, setIsLoading] = useState(false);
  const [c1Response, setC1Response] = useState("");
  const [question, setQuestion] = useState("");

  const makeApiCall = async (query: string) => {
    setIsLoading(true);
    setC1Response("");

    try {
      const response = await fetch("/api/chat", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ prompt: query }),
      });

      const data = await response.json();
      setC1Response(data.response);
    } catch (error) {
      console.error("Error:", error);
    } finally {
      setIsLoading(false);
    }
  };

  return (
    <div className="container">
      <h1>AI Assistant</h1>

      <form onSubmit={(e) => {
        e.preventDefault();
        makeApiCall(question);
      }}>
        <input
          type="text"
          value={question}
          onChange={(e) => setQuestion(e.target.value)}
          placeholder="Ask me anything..."
        />
        <button type="submit" disabled={isLoading}>
          {isLoading ? "Processing..." : "Send"}
        </button>
      </form>

      {c1Response && (
        <ThemeProvider>
          <C1Component
            c1Response={c1Response}
            isStreaming={isLoading}
            updateMessage={(message) => setC1Response(message)}
            onAction={({ llmFriendlyMessage }) => {
              if (!isLoading) {
                makeApiCall(llmFriendlyMessage);
              }
            }}
          />
        </ThemeProvider>
      )}
    </div>
  );
}

3. Configure Backend API (Express Example)

import express from "express";
import OpenAI from "openai";
import { transformStream } from "@crayonai/stream";

const app = express();
app.use(express.json());

const client = new OpenAI({
  baseURL: "https://api.thesys.dev/v1/embed",
  apiKey: process.env.THESYS_API_KEY,
});

app.post("/api/chat", async (req, res) => {
  const { prompt } = req.body;

  const stream = await client.chat.completions.create({
    model: "c1/openai/gpt-5/v-20250930", // or any C1-compatible model
    messages: [
      { role: "system", content: "You are a helpful assistant." },
      { role: "user", content: prompt },
    ],
    stream: true,
  });

  // Transform OpenAI stream to C1 response
  const c1Stream = transformStream(stream, (chunk) => {
    return chunk.choices[0]?.delta?.content || "";
  });

  res.json({ response: await streamToString(c1Stream) });
});

async function streamToString(stream: ReadableStream) {
  const reader = stream.getReader();
  let result = "";

  while (true) {
    const { done, value } = await reader.read();
    if (done) break;
    result += value;
  }

  return result;
}

app.listen(3000);

Next.js App Router Setup

Most popular framework, full-stack with API routes.

1. Install Dependencies

npm install @thesysai/genui-sdk @crayonai/react-ui @crayonai/react-core
npm install openai

2. Create Chat Page Component

File: app/page.tsx

"use client";

import { C1Chat } from "@thesysai/genui-sdk";
import "@crayonai/react-ui/styles/index.css";

export default function Home() {
  return (
    <div className="min-h-screen">
      <C1Chat apiUrl="/api/chat" />
    </div>
  );
}

3. Create API Route Handler

File: app/api/chat/route.ts

import { NextRequest, NextResponse } from "next/server";
import OpenAI from "openai";
import { transformStream } from "@crayonai/stream";

const client = new OpenAI({
  baseURL: "https://api.thesys.dev/v1/embed",
  apiKey: process.env.THESYS_API_KEY,
});

export async function POST(req: NextRequest) {
  const { prompt } = await req.json();

  const stream = await client.chat.completions.create({
    model: "c1/openai/gpt-5/v-20250930",
    messages: [
      { role: "system", content: "You are a helpful AI assistant." },
      { role: "user", content: prompt },
    ],
    stream: true,
  });

  // Transform to C1-compatible stream
  const responseStream = transformStream(stream, (chunk) => {
    return chunk.choices[0]?.delta?.content || "";
  }) as ReadableStream<string>;

  return new NextResponse(responseStream, {
    headers: {
      "Content-Type": "text/event-stream",
      "Cache-Control": "no-cache, no-transform",
      "Connection": "keep-alive",
    },
  });
}

That's it! You now have a working Generative UI chat interface.

Cloudflare Workers + Static Assets Setup

Your stack: Workers backend with Vite+React frontend.

1. Create Worker Backend (Hono)

File: backend/src/index.ts

import { Hono } from "hono";
import { cors } from "hono/cors";

const app = new Hono();

app.use("/*", cors());

app.post("/api/
Compartilhar X LinkedIn