Skip to content

thesysdev/template-c1-component-next

Repository files navigation

C1 App Template

Template repository for a generative UI app, powered by C1 by Thesys, and bootstrapped with create-next-app

Built with Thesys

Getting Started

First, generate a new API key from Thesys Console and then set it your environment variable.

export THESYS_API_KEY=<your-api-key>

Install dependencies:

npm i

Then, run the development server:

npm run dev

Open http://localhost:3000 with your browser to see the result.

You can start editing your responses by modifying the system prompt in src/app/api/chat/route.ts.

Model Verification

This template includes a GitHub Action that automatically verifies the C1 model used in src/app/api/ask/route.ts is valid according to the Thesys API. This workflow runs on every pull request to ensure you're using a supported model.

Setting up the GitHub Action

To enable this workflow in your repository:

  1. Go to your repository's SettingsSecrets and variablesActions
  2. Add a new repository secret named THESYS_API_KEY with your Thesys API key value
  3. The workflow will now run automatically on all pull requests

The workflow will:

  • Extract the model name from src/app/api/ask/route.ts
  • Fetch the list of valid models from the Thesys API
  • Verify that your model is in the list of supported models
  • Block the PR from merging if an invalid model is detected

You can view available models by running the verification script locally:

THESYS_API_KEY=<your-api-key> .github/scripts/verify-model.sh

Making Model Verification Required (Recommended)

To require this check to pass before merging PRs:

  1. Go to your repository's SettingsBranches
  2. Add or edit a branch protection rule for your main branch (e.g., main or master)
  3. Enable Require status checks to pass before merging
  4. Search for and select Verify C1 Model in the status checks list
  5. Save the protection rule

This ensures that only valid C1 models can be merged into your main branch.

Learn More

To learn more about Thesys C1, take a look at the C1 Documentation - learn about Thesys C1.

One-Click Deploy with Vercel

Deploy with Vercel