Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: browser chat streaming example using vite+tailwind #31

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions chat-streaming-minimal/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
47 changes: 47 additions & 0 deletions chat-streaming-minimal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Chat Streaming (Minimal)

Lightweight streaming chat application powered by Transformers.js, Vite, and Tailwind CSS.

## Getting Started

Follow the steps below to set up and run the application locally.

### 1. Clone the Repository

Clone the project repository from GitHub:

```sh
git clone https://github.com/huggingface/transformers.js-examples.git
```

### 2. Navigate to the Project Directory

Change your working directory to the `chat-stream-minimal` folder:

```sh
cd transformers.js-examples/chat-stream-minimal
```

### 3. Install Dependencies

Install all required dependencies using npm:

```sh
npm install
```

### 4. Run the Development Server

Start the development server to launch the application:

```sh
npm run dev
```

The application should now be running. Open your browser and go to `http://localhost:5173` to access it.

## Features

- **Streaming Chat**: Real-time message updates with minimal latency.
- **Web Workers**: Leverages Web Workers for parallel inference streaming.
- **Lightweight Setup**: Built with Vite and Tailwind CSS for a simple and minimal development experience.
14 changes: 14 additions & 0 deletions chat-streaming-minimal/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/robot.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="/dist/styles.css" rel="stylesheet">
<title>Chat Streaming</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
22 changes: 22 additions & 0 deletions chat-streaming-minimal/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "chat-streaming",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
},
"devDependencies": {
"autoprefixer": "^10.4.20",
"postcss": "^8.5.1",
"typescript": "~5.6.2",
"vite": "^6.0.5"
},
"dependencies": {
"@huggingface/transformers": "^3.3.2",
"@tailwindcss/vite": "^4.0.0",
"tailwindcss": "^4.0.0"
}
}
Loading