8000 GitHub - panickervinod/chat-playground: A low-cost approach to testing LLM chat experiences and security
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

panickervinod/chat-playground

 
 

Repository files navigation

Steve's Chat Playground

A companion project to The Developer's Playbook for Large Language Model Security, this open-source HTML/JavaScript application provides 8000 a hands-on environment for experimenting with various chat models, personalities, guardrails and user interfaces locally, quickly and with zero connectivity or cost.

▶️ Watch the Demo Video

With the rapid evolution of LLM and Generative AI technology (new models, techniques, agents, etc.), it's become increasingly challenging for developers to find a practical starting point for hands-on experimentation. This playground addresses that need by offering:

  • Multiple Models: From simple local pattern-matching to OpenAI's powerful models
  • Different Views: Various UI styles to understand how different interfaces affect user experience
  • Guardrails: Both simple local filters and advanced AI-powered content moderation
  • Zero Dependencies: Everything runs in the browser, making it easy to get started

Features a zero-dependency SimpleBot model and simple keyword-based guardrails for rapid prototyping and testing of chat experiences without external API costs, perfect for understanding the fundamental security properties of LLM interactions.

Try It Out!

The chat playground is live at: https://virtualsteve-star.github.io/chat-playground/

Try different personalities and visual styles directly in your browser - no installation required! The playground offers two tiers of functionality:

Local Experience (No API Key Required):

  • SimpleBot personalities with local pattern matching
  • Basic blocklist-based guardrails
  • All visual styles and UI features
  • Perfect for understanding fundamental concepts

Full Experience (API Key Required):

  • OpenAI-powered personalities using ChatGPT 4o-mini
  • Advanced AI-powered content moderation
  • All local features plus smarter responses
  • Great for exploring more sophisticated interactions

For the full experience including OpenAI-powered personalities and advanced guardrails, you'll need to clone and run locally with your API key.

Features

  • Clean, intuitive chat interface
  • Support for streaming token responses
  • Multiple visual styles (Vanilla, Green Screen, iMessage, iMessage Dark)
  • Local testing with SimpleBot (based on ELIZA-style pattern matching)
    • Zero external dependencies
    • Instant response times
    • Easily create new personalities with simple text files
    • Perfect for UI/UX testing and prototyping
  • Remote model support (OpenAI ChatGPT 4o-mini)
  • Thumbs up/down feedback for responses
  • Guardrails (Input & Output Filters): Blocklist-based filtering for both user input and model output, with a visual panel for managing filters

Getting Started

Prerequisites

  • A modern web browser (Chrome, Firefox, Safari, Edge)
  • An OpenAI API key (for the ChatGPT 4o-mini model)

Installation

  1. Clone the repository:
    git clone https://github.com/virtualsteve-star/chat-playground.git
    cd chat-playground
    
  2. Open index.html in your web browser or serve it using a simple HTTP server:
    python3 -m http.server
    
    Then visit http://localhost:8000 in your browser.
  3. For the OpenAI model, you'll be prompted to enter your API key when you first select a personality that uses the ChatGPT 4o-mini model.

Usage

  1. Select a personality from the dropdown menu.
  2. Type your message in the input field and press Enter or click Send.
  3. Use the style selector to switch between different visual themes.
  4. Provide feedback on responses using the thumbs up/down buttons.

Project Structure

steves-chat-playground/
├── index.html              # Main HTML file
├── README.md               # Main documentation
├── EXTENSIBILITY.md        # Extensibility guide
├── VERSION_HISTORY.md      # Version history and release notes
├── LICENSE                 # License file
├── styles/                 # CSS styles
│   ├── vanilla.css         # Default minimalist style
│   ├── green-screen.css    # Terminal-style interface
│   ├── imessage.css        # Modern messaging UI
│   └── imessage-dark.css   # Dark mode for iMessage UI
├── scripts/                # JavaScript files
│   ├── main.js             # Main application logic
│   ├── terminal_ui.js      # Green Screen (terminal) UI logic
│   ├── utils.js            # Utility functions
│   ├── filters/            # Guardrails/filter logic
│   │   ├── blocklist.js         # Blocklist filter implementation
│   │   ├── api_filter.js        # API filter base class
│   │   └── openai_moderation.js # OpenAI Moderation API filter
│   └── models/             # Chat model implementations
│       ├── simplebot.js    # SimpleBot local model
│       └── openai.js       # OpenAI remote model
├── config/                 # Configuration files
│   ├── models.properties   # Model configurations
│   ├── styles.properties   # Style configurations
│   └── personalities.properties  # Personality configurations
├── personalities/          # Personality resources
│   ├── psychotherapist.txt       # SimpleBot psychotherapist script
│   ├── tech_support_prompt.txt   # OpenAI tech support prompt
│   ├── banker_prompt.txt         # SimpleBot banker script
│   ├── researcher_prompt.txt     # OpenAI researcher prompt
│   └── angry_bot.txt             # Angry bot script
├── filters/                # Blocklist files for guardrails
│   ├── sex_blocklist.txt        # Sexual content blocklist
│   └── violence_blocklist.txt   # Violence content blocklist
├── assets/                 # Application assets
│   └── graphics/           # Image assets including feedback icons
├── tests/                  # Automated tests
│   ├── openai.test.js
│   ├── setup.js
│   ├── utils.test.js
│   ├── eliza.test.js
│   └── main.test.js
└── .gitignore, .DS_Store, etc.   # Miscellaneous and git files

Want to Extend It?

Version History


Created by Steve Wilson. LinkedIn MIT License.

About

A low-cost approach to testing LLM chat experiences and security

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 68.0%
  • CSS 25.2%
  • HTML 6.8%
0