local-ai-chat-frontend 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +199 -0
- package/bin/start.js +58 -0
- package/dist/assets/index-CB64_40G.js +71 -0
- package/dist/assets/index-ccdrjPVC.css +1 -0
- package/dist/favicon.png +0 -0
- package/dist/index.html +61 -0
- package/package.json +85 -0
- package/public/favicon.png +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 hidao80
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# local-ai-chat-frontend
|
|
2
|
+
|
|
3
|
+
[](LICENSE)
|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+
[](https://github.com/hidao80/mago-vsx/actions/workflows/npm-scan.yml)
|
|
8
|
+
[](https://deepwiki.com/hidao80/local-ai-chat-frontend)
|
|
9
|
+
|
|
10
|
+

|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
A privacy-first, browser-based chat interface for local LLMs (Ollama, GPT4ALL, LM Studio, llama.cpp) and cloud providers. No backend required.
|
|
16
|
+
|
|
17
|
+
## Issues & Reasons
|
|
18
|
+
|
|
19
|
+
Local LLM providers lack easy-to-deploy, cross-platform GUIs. local-ai-chat-frontend runs in any browser (Win/macOS/Linux/Android/iOS/iPadOS), connecting instantly to your local network providers.
|
|
20
|
+
|
|
21
|
+
<img width="30%" alt="Config Screen" src="https://github.com/user-attachments/assets/c29e1f02-bd8e-4996-af37-a130e78abf5d" /> 
|
|
22
|
+
<img width="30%" alt="Chat Screen" src="https://github.com/user-attachments/assets/e2aa651b-6ec8-4bac-90f2-299c5830523e" /> 
|
|
23
|
+
<img width="30%" alt="Chat History Menu" src="https://github.com/user-attachments/assets/132f6ac9-8b38-4799-a9b7-2c3044abeeaa" />
|
|
24
|
+
|
|
25
|
+
## Features
|
|
26
|
+
|
|
27
|
+
### Core Functionality
|
|
28
|
+
|
|
29
|
+
- **Multi-provider support** — Works with OpenAI, LM Studio, GPT4ALL, and Ollama. Point it at any OpenAI-compatible endpoint you have running.
|
|
30
|
+
- **Dynamic model selection** — Available models are fetched from the server when you select a provider. No manual configuration needed.
|
|
31
|
+
- **Reasoning model support** — For advanced reasoning models (o1, GPT-OSS, DeepSeek-R1), configure reasoning depth (low/medium/high). The app automatically detects reasoning-capable models.
|
|
32
|
+
- **System prompts per model** — System prompts are saved separately for each provider-model combination. Switch between models and your custom prompts are automatically restored.
|
|
33
|
+
|
|
34
|
+
### Chat Management
|
|
35
|
+
|
|
36
|
+
- **Chat history** — All conversations are stored in IndexedDB and persist across sessions. Browse past chats from the sidebar.
|
|
37
|
+
- **Sidebar navigation** — Desktop users see a persistent sidebar; mobile users access it via hamburger menu.
|
|
38
|
+
- **Delete with confirmation** — Remove unwanted chats with a confirmation modal to prevent accidental deletion.
|
|
39
|
+
- **Message copy** — Copy any message to clipboard with one click. Visual feedback confirms the action.
|
|
40
|
+
|
|
41
|
+
### User Experience
|
|
42
|
+
|
|
43
|
+
- **Client-side storage** — API keys and endpoint configuration are persisted in IndexedDB and never leave your device.
|
|
44
|
+
- **Markdown rendering** — AI responses are rendered as Markdown via `marked`, sanitized with DOMPurify before display, supporting code blocks, lists, and formatting.
|
|
45
|
+
- **Performance metrics** — See tokens per second and timestamp for each AI response.
|
|
46
|
+
- **Conversation minimap** — A compact minimap beside the scrollbar shows all messages color-coded by sender. Click any block to jump to that message instantly.
|
|
47
|
+
|
|
48
|
+
### Internationalization & Accessibility
|
|
49
|
+
|
|
50
|
+
- **i18n (Japanese / English)** — The UI supports Japanese and English; language preference is persisted in IndexedDB and auto-detected from the browser on first visit.
|
|
51
|
+
- **Dark mode** — Toggle between light and dark themes via the nav bar; preference is persisted in IndexedDB across sessions.
|
|
52
|
+
- **Responsive design** — Optimized layouts for mobile (hamburger menu) and desktop (persistent sidebar).
|
|
53
|
+
|
|
54
|
+
### Deployment
|
|
55
|
+
|
|
56
|
+
- **npx one-liner** — Run instantly from GitHub without cloning: `npx https://github.com/hidao80/local-ai-chat-frontend`.
|
|
57
|
+
- **Docker-ready** — Production image serves the static build via nginx; a dev compose file is included for local development.
|
|
58
|
+
|
|
59
|
+
## Tech Stack
|
|
60
|
+
|
|
61
|
+
| Layer | Technology |
|
|
62
|
+
|---|---|
|
|
63
|
+
| UI Framework | React 19 |
|
|
64
|
+
| Language | TypeScript (strict) |
|
|
65
|
+
| Bundler | Vite 7 |
|
|
66
|
+
| Styling | Tailwind CSS 4 |
|
|
67
|
+
| Markdown | marked + DOMPurify (sanitization) |
|
|
68
|
+
| Storage | IndexedDB (native) |
|
|
69
|
+
| i18n | i18next / react-i18next |
|
|
70
|
+
| Server | sirv-cli |
|
|
71
|
+
|
|
72
|
+
### Key Technologies
|
|
73
|
+
|
|
74
|
+
- **State Management**: React hooks (useState, useEffect, useRef)
|
|
75
|
+
- **Storage**: IndexedDB for chat history and system prompts
|
|
76
|
+
- **Routing**: Single-page app with conditional rendering (no router)
|
|
77
|
+
- **API Integration**: OpenAI-compatible REST APIs with fetch
|
|
78
|
+
- **Styling**: Tailwind CSS with dark mode support
|
|
79
|
+
|
|
80
|
+
## Quick Start
|
|
81
|
+
|
|
82
|
+
### Run instantly (no install)
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
npx github:hidao80/local-ai-chat-frontend
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
> `bunx` does not reliably build `devDependencies` from a raw git ref, so `npx` is the recommended way to run this project directly from GitHub. If you use Bun, clone the repo and run `bun install && bun run build && bun start` instead.
|
|
89
|
+
|
|
90
|
+
### Custom port / LAN access
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
PORT=8080 npx github:hidao80/local-ai-chat-frontend
|
|
94
|
+
HOST=0.0.0.0 PORT=3000 npx github:hidao80/local-ai-chat-frontend
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Run with Docker
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Development
|
|
101
|
+
docker compose up
|
|
102
|
+
|
|
103
|
+
# Production build
|
|
104
|
+
docker build -t local-ai-chat-frontend .
|
|
105
|
+
docker run -p 80:80 local-ai-chat-frontend
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Run with Podman
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Development
|
|
112
|
+
podman compose up
|
|
113
|
+
|
|
114
|
+
# Production build
|
|
115
|
+
podman build -t local-ai-chat-frontend .
|
|
116
|
+
podman run -p 80:80 local-ai-chat-frontend
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Development
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
bun install
|
|
123
|
+
bun run dev
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Configuration
|
|
127
|
+
|
|
128
|
+
### Supported Providers
|
|
129
|
+
|
|
130
|
+
The application supports multiple LLM providers with automatic model discovery:
|
|
131
|
+
|
|
132
|
+
| Provider | Default Endpoint | Authentication | Reasoning Support | Notes |
|
|
133
|
+
|----------|-----------------|----------------|-------------------|-------|
|
|
134
|
+
| **OpenAI** | `https://api.openai.com` | API Key required | Yes (`reasoning_effort`) | Official OpenAI API |
|
|
135
|
+
| **Ollama** | `http://localhost:11434` | No auth | Yes (`think`) | Local models via Ollama |
|
|
136
|
+
| **GPT4ALL** | `http://localhost:4891` | No auth | No | Local OpenAI-compatible endpoint |
|
|
137
|
+
| **LM Studio** | `http://localhost:1234` | Optional | Yes (`reasoning_effort`) | Local OpenAI-compatible endpoint |
|
|
138
|
+
| **llama.cpp** | `http://localhost:8080` | No auth | Yes (`reasoning_effort`) | llama-server built-in HTTP server |
|
|
139
|
+
|
|
140
|
+
### Provider-Specific Features
|
|
141
|
+
|
|
142
|
+
- **OpenAI / LM Studio / llama.cpp**: Supports `reasoning_effort` parameter (low/medium/high)
|
|
143
|
+
- **Ollama**: Supports `think` parameter for reasoning models like GPT-OSS and DeepSeek-R1
|
|
144
|
+
- **llama.cpp**: CORS enabled by default — no proxy or special configuration needed
|
|
145
|
+
|
|
146
|
+
### CORS Configuration
|
|
147
|
+
|
|
148
|
+
**GPT4ALL**: Uses Vite proxy in development mode. When running via `npx` or `bun start`, sirv-cli serves with `--cors` enabled so the browser can reach `localhost:4891` directly.
|
|
149
|
+
|
|
150
|
+
**Ollama**: Set environment variable before starting:
|
|
151
|
+
```bash
|
|
152
|
+
# Windows
|
|
153
|
+
set OLLAMA_ORIGINS=*
|
|
154
|
+
ollama serve
|
|
155
|
+
|
|
156
|
+
# Linux/Mac
|
|
157
|
+
OLLAMA_ORIGINS=* ollama serve
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**LM Studio**: Enable CORS in Server Settings
|
|
161
|
+
|
|
162
|
+
## Development
|
|
163
|
+
|
|
164
|
+
### Build
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
bun run build
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Type Check
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
bunx tsc --noEmit
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Project Structure
|
|
177
|
+
|
|
178
|
+
```
|
|
179
|
+
src/
|
|
180
|
+
├── components/
|
|
181
|
+
│ └── ChatAndSettings.tsx # Main UI components
|
|
182
|
+
├── locales/
|
|
183
|
+
│ ├── en.json # English translations
|
|
184
|
+
│ └── ja.json # Japanese translations
|
|
185
|
+
├── App.tsx # Root component
|
|
186
|
+
├── i18n.ts # i18n configuration
|
|
187
|
+
├── index.css # Global styles
|
|
188
|
+
├── main.tsx # Entry point
|
|
189
|
+
└── vite-env.d.ts # Vite type declarations
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## :handshake: Contributing
|
|
193
|
+
|
|
194
|
+
Contributions are welcome!
|
|
195
|
+
Please note that this project uses [Takumi Guard](https://github.com/flatt-security/setup-takumi-guard-npm) in CI workflows to scan dependencies for malware and ensure supply chain security. This scanning only applies to CI and does not affect your local development environment.
|
|
196
|
+
|
|
197
|
+
## :page_facing_up: License
|
|
198
|
+
|
|
199
|
+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
package/bin/start.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn, spawnSync } from 'child_process';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import { dirname, join } from 'path';
|
|
5
|
+
import { existsSync } from 'fs';
|
|
6
|
+
|
|
7
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const rootDir = join(__dirname, '..');
|
|
9
|
+
const distDir = join(rootDir, 'dist');
|
|
10
|
+
|
|
11
|
+
if (!existsSync(join(distDir, 'index.html'))) {
|
|
12
|
+
console.log(' dist/ not found, building (first run)...');
|
|
13
|
+
const build = spawnSync('npx', ['vite', 'build'], { cwd: rootDir, stdio: 'inherit', shell: true });
|
|
14
|
+
if (build.status !== 0) {
|
|
15
|
+
console.error('Build failed.');
|
|
16
|
+
process.exit(build.status || 1);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const PORT = process.env.PORT || '3000';
|
|
21
|
+
const HOST = process.env.HOST || 'localhost';
|
|
22
|
+
|
|
23
|
+
console.log('');
|
|
24
|
+
console.log(' local-ai-chat-frontend');
|
|
25
|
+
console.log(' ====================================');
|
|
26
|
+
console.log(` Server: http://${HOST}:${PORT}`);
|
|
27
|
+
console.log('');
|
|
28
|
+
console.log(' Recommended LLM provider ports:');
|
|
29
|
+
console.log(' Ollama: http://localhost:11434');
|
|
30
|
+
console.log(' GPT4ALL: http://localhost:4891');
|
|
31
|
+
console.log(' LM Studio: http://localhost:1234');
|
|
32
|
+
console.log('');
|
|
33
|
+
console.log(' Tip: Customize with environment variables');
|
|
34
|
+
console.log(' PORT=8080 npx https://github.com/hidao80/local-ai-chat-frontend');
|
|
35
|
+
console.log(' HOST=0.0.0.0 PORT=3000 npx https://github.com/hidao80/local-ai-chat-frontend (LAN access)');
|
|
36
|
+
console.log('');
|
|
37
|
+
|
|
38
|
+
const sirv = spawn(
|
|
39
|
+
'npx',
|
|
40
|
+
['sirv-cli', distDir, '--port', PORT, '--host', HOST, '--single', '--cors', '--dev'],
|
|
41
|
+
{ stdio: 'inherit', shell: true }
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
sirv.on('error', (err) => {
|
|
45
|
+
console.error('Failed to start server:', err.message);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
process.on('SIGINT', () => {
|
|
50
|
+
console.log('\n Shutting down...');
|
|
51
|
+
sirv.kill('SIGINT');
|
|
52
|
+
process.exit(0);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
process.on('SIGTERM', () => {
|
|
56
|
+
sirv.kill('SIGTERM');
|
|
57
|
+
process.exit(0);
|
|
58
|
+
});
|