Open Source AI Artifacts and Code Execution

R
Renaudil y a 2 jours
0

Description

This is an open source AI app version of Anthropic's Artifacts UI in their Claude chat app.

npx boilerapp open-source-ai-artifacts

文档

Fragments by E2B

This is an open-source version of apps like Anthropic's Claude Artifacts, Vercel v0, or GPT Engineer.

Powered by the E2B SDK.

→ Try on fragments.e2b.dev

Features

  • Based on Next.js 14 (App Router, Server Actions), shadcn/ui, TailwindCSS, Vercel AI SDK.
  • Uses the E2B SDK by E2B to securely execute code generated by AI.
  • Streaming in the UI.
  • Can install and use any package from npm, pip.
  • Supported stacks (add your own):
    • 🔸 Python interpreter
    • 🔸 Next.js
    • 🔸 Vue.js
    • 🔸 Streamlit
    • 🔸 Gradio
  • Supported LLM Providers (add your own):
    • 🔸 OpenAI
    • 🔸 Anthropic
    • 🔸 Google AI
    • 🔸 Mistral
    • 🔸 Groq
    • 🔸 Fireworks
    • 🔸 Together AI
    • 🔸 Ollama
  • Integrates with Morph Apply model for token efficient, accurate and faster code editing.

Make sure to give us a star!

<img width="165" alt="Screenshot 2024-04-20 at 22 13 32" src="https://github.com/mishushakov/llm-scraper/assets/10400064/11e2a79f-a835-48c4-9f85-5c104ca7bb49">

Get started

Prerequisites

1. Clone the repository

In your terminal:

git clone https://github.com/e2b-dev/fragments.git

2. Install the dependencies

Enter the repository:

cd fragments

Run the following to install the required dependencies:

npm i

3. Set the environment variables

Create a .env.local file and set the following:

# Get your API key here - https://e2b.dev/
E2B_API_KEY="your-e2b-api-key"

# OpenAI API Key
OPENAI_API_KEY=

# Other providers
ANTHROPIC_API_KEY=
GROQ_API_KEY=
FIREWORKS_API_KEY=
TOGETHER_API_KEY=
GOOGLE_AI_API_KEY=
GOOGLE_VERTEX_CREDENTIALS=
MISTRAL_API_KEY=
XAI_API_KEY=

### Optional env vars

# (on by default) Get your MORPH key here - https://morphllm.com/dashboard/api-keys
MORPH_API_KEY=

# Domain of the site
NEXT_PUBLIC_SITE_URL=

# Rate limit
RATE_LIMIT_MAX_REQUESTS=
RATE_LIMIT_WINDOW=

# Vercel/Upstash KV (short URLs, rate limiting)
KV_REST_API_URL=
KV_REST_API_TOKEN=

# Supabase (auth)
SUPABASE_URL=
SUPABASE_ANON_KEY=

# PostHog (analytics)
NEXT_PUBLIC_POSTHOG_KEY=
NEXT_PUBLIC_POSTHOG_HOST=

### Disabling functionality (when uncommented)

# Disable API key and base URL input in the chat
# NEXT_PUBLIC_NO_API_KEY_INPUT=
# NEXT_PUBLIC_NO_BASE_URL_INPUT=

# Hide local models from the list of available models
# NEXT_PUBLIC_HIDE_LOCAL_MODELS=

4. Start the development server

npm run dev

5. Build the web app

npm run build

Customize

Adding custom personas

  1. Make sure E2B CLI is installed and you're logged in.

  2. Add a new folder under sandbox-templates/

  3. Initialize a new template using E2B CLI:

    e2b template init
    

    This will create a new file called e2b.Dockerfile.

  4. Adjust the e2b.Dockerfile

    Here's an example streamlit template:

    # You can use most Debian-based base images
    FROM python:3.19-slim
    
    RUN pip3 install --no-cache-dir streamlit pandas numpy matplotlib requests seaborn plotly
    
    # Copy the code to the container
    WORKDIR /home/user
    COPY . /home/user
    
  5. Specify a custom start command in e2b.toml:

    start_cmd = "cd /home/user && streamlit run app.py"
    
  6. Deploy the template with the E2B CLI

    e2b template build --name <template-name>
    

    After the build has finished, you should get the following message:

    ✅ Building sandbox template <template-id> <template-name> finished.
    
  7. Open lib/templates.json in your code editor.

    Add your new template to the list. Here's an example for Streamlit:

    "streamlit-developer": {
      "name": "Streamlit developer\
    

Prix

Gratuit

FREE

评论 (0)

常见问题

常见问题解答 (FAQ)

有问题?我们有答案。如果您找不到想要的答案,请随时联络我们。

Boilerapp 是一个专门用于分享 Boilerplates、入门套件(Starter Kits)和项目模版的开发者社区平台。我们的目标很简单:为您节省初始配置(Setup)的时间,让您可以专注于真正重要的代码。无论您是在寻找简单的代码库还是完整的 SaaS 项目,都能在这里找到。

还有其他问题?

我们的团队随时为您提供帮助。联络我们,我们将尽快回复。