npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

lychee-chat

v1.0.10

Published

A universal AI Chat component with agent system, model selection, and streaming support

Readme

Lychee Chat

A universal AI Chat component with agent system, model selection, streaming support, and full customization.

Features

  • 🤖 Agent System - Create, configure, and manage custom AI agents with tool support
  • 🧠 Model Selection - Switch between different AI model providers
  • 💬 Streaming Messages - Real-time streaming chat with progress indicators
  • 🔧 Tool Calls - Visual tool/agent call execution with expandable details
  • 🖼️ Image Support - Paste/upload images directly in chat
  • 📝 Markdown Rendering - Full markdown support with code highlighting
  • 🎨 Customizable Theme - Dark/light mode, custom colors, avatars, and more
  • 🔌 Pluggable Backend - Abstract IChatService interface for any backend
  • 📦 npm Package - Easy to integrate into any React project

Installation

npm install lychee-chat
# or
yarn add lychee-chat

Quick Start

1. Implement the Chat Service

Create a service that implements the IChatService interface:

import { IChatService, ChatCompletionParams, ChatStreamHandler } from 'lychee-chat';

class MyChatService implements IChatService {
  chatCompletion(params: ChatCompletionParams): ChatStreamHandler {
    // Connect to your AI backend and return a stream handler
    const handler: ChatStreamHandler = {
      onMessage: (callback) => {
        // Call callback(data) as tokens arrive
        // Call callback('STREAM_DONE') when complete
      },
    };
    return handler;
  }

  async stopChat(streamToken: string) { /* stop streaming */ }
  async getModelPlatList() { /* return available models */ }
  async getAgentsList() { /* return available agents */ }
  async registerAgent(config) { /* register new agent */ }
  async removeAgent(key) { /* remove agent */ }
  async agentToolCallBack(params) { /* tool call result callback */ }
  async saveAgentConfig(config) { /* save agent config */ }
  async sendCorsServer(param) { /* CORS proxy request */ }
  async getMcpServerList() { /* list MCP servers */ }
  async editOrAddMcpServer(param) { /* edit/add MCP server */ }
  async deleteMcpServer(name) { /* delete MCP server */ }
}

2. Use the Component

import { LycheeChat } from 'lychee-chat';

function App() {
  const chatService = new MyChatService();

  return (
    <div style={{ width: '100vw', height: '100vh' }}>
      <LycheeChat
        chatService={chatService}
        config={{
          welcomeMessage: 'Hello! How can I help you today?',
          placeholder: 'Ask me anything...',
          theme: { mode: 'dark' },
          showUserLogin: false,
          showModelSelect: true,
          showAgentSelect: true,
        }}
      />
    </div>
  );
}

Configuration Options

ChatConfig

| Property | Type | Default | Description | |----------|------|---------|-------------| | welcomeMessage | string \| ((userInfo?) => string) | 'Hi~' | Welcome message shown on first load | | placeholder | string | '请和我交流吧~' | Input placeholder text | | roleConfig | RoleConfig | Built-in avatars | Avatars and names for user/assistant/system | | theme | ChatTheme | Dark mode | Theme colors and mode | | maxImageAttachments | number | 5 | Max images that can be pasted/uploaded | | showUserLogin | boolean | true | Show user login section | | showModelSelect | boolean | true | Show model selection dropdown | | showAgentSelect | boolean | true | Show agent selection feature | | showClearContext | boolean | true | Show clear context button | | enableImageUpload | boolean | true | Enable image paste/upload | | enableBugRef | boolean | true | Enable bug reference feature | | className | string | - | Custom CSS class for container | | style | React.CSSProperties | - | Custom inline styles |

ChatTheme

| Property | Type | Default | Description | |----------|------|---------|-------------| | primaryColor | string | '#8f41e9' | Primary accent color | | userMessageBg | string | '#0652ee' | User message background | | assistantMessageBg | string | '#2a2a2a' | Assistant message background | | codeBlockBg | string | '#202020' | Code block background | | fontFamily | string | System fonts | Custom font family | | borderRadius | number | 2 | Message bubble border radius | | mode | 'dark' \| 'light' | 'dark' | Theme mode |

Creating Custom Agents (Tools)

import { tool, z } from 'lychee-chat';

const searchTool = tool(
  async (params) => {
    const result = await fetch(`/api/search?q=${params.query}`);
    return result.json();
  },
  {
    name: 'web_search',
    description: 'Search the web for information',
    schema: z.object({
      query: z.string().describe('Search query'),
    }),
  }
);

const myAgent = {
  key: 'searchAgent',
  name: 'Search Agent',
  desc: 'An agent that can search the web',
  prompt: 'You are a helpful search assistant...',
  tools: [searchTool],
};

Message Protocol

The component supports a rich message protocol for tool/agent calls:

| Marker | Description | |--------|-------------| | #USE_TOOL#...#USE_TOOL_END# | Tool invocation | | #TOOL_RESULT#...#TOOL_RESULT_END# | Tool result | | #USE_AGENT#...#USE_AGENT_END# | Agent delegation | | #AGENT_RESULT#...#AGENT_RESULT_END# | Agent result | | #END_RESULT# | End of visible result | | #END_RESULT_HIDE# | End of hidden result | | #BACK_ERROR# | Error indicator | | #DEAL_FAIL# | Processing failure |

License

MIT