Merge pull request #394 from lfnovo/chore/remove-unused-addbutton

chore: remove unused AddButton component
This commit is contained in:
Luis Novo 2026-01-08 16:07:56 -03:00 committed by GitHub
commit 06b07df684
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 0 additions and 686 deletions

View file

@ -1,102 +0,0 @@
'use client'
import { useState } from 'react'
import { Plus, FileText, Book, ChevronDown } from 'lucide-react'
import { Button } from '@/components/ui/button'
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu'
import { AddSourceDialog } from '@/components/sources/AddSourceDialog'
interface AddButtonProps {
variant?: 'default' | 'outline' | 'ghost'
size?: 'sm' | 'default' | 'lg'
className?: string
iconOnly?: boolean
}
export function AddButton({
variant = 'default',
size = 'default',
className,
iconOnly = false
}: AddButtonProps) {
const [sourceDialogOpen, setSourceDialogOpen] = useState(false)
const handleAddSource = () => {
setSourceDialogOpen(true)
}
const handleAddNotebook = () => {
// TODO: Implement notebook creation when ready
}
if (iconOnly) {
return (
<>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
variant={variant}
size={size}
className={className}
>
<Plus className="h-4 w-4" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="start" side="right">
<DropdownMenuItem onClick={handleAddSource} className="gap-2">
<FileText className="h-4 w-4" />
Source
</DropdownMenuItem>
<DropdownMenuItem onClick={handleAddNotebook} className="gap-2">
<Book className="h-4 w-4" />
Notebook <span className="text-xs text-muted-foreground ml-auto">Coming soon</span>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
<AddSourceDialog
open={sourceDialogOpen}
onOpenChange={setSourceDialogOpen}
/>
</>
)
}
return (
<>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
variant={variant}
size={size}
className={className}
>
<Plus className="h-4 w-4 mr-2" />
Add
<ChevronDown className="h-3 w-3 ml-auto" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="start">
<DropdownMenuItem onClick={handleAddSource} className="gap-2">
<FileText className="h-4 w-4" />
Source
</DropdownMenuItem>
<DropdownMenuItem onClick={handleAddNotebook} className="gap-2">
<Book className="h-4 w-4" />
Notebook <span className="text-xs text-muted-foreground ml-auto">Coming soon</span>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
<AddSourceDialog
open={sourceDialogOpen}
onOpenChange={setSourceDialogOpen}
/>
</>
)
}

View file

@ -1,260 +0,0 @@
# Quick Start - Local & Private (5 minutes)
Get Open Notebook running with **100% local AI** using Ollama. No cloud API keys needed, completely private.
## Prerequisites
1. **Docker Desktop** installed
- [Download here](https://www.docker.com/products/docker-desktop/)
- Already have it? Skip to step 2
2. **Ollama** installed (for local LLM)
- [Download here](https://ollama.ai/)
- Or use Docker image (easier): `ollama/ollama`
## Step 1: Choose Your Setup (1 min)
### 🏠 Local Machine (Same Computer)
Everything runs on your machine. Recommended for testing/learning.
### 🌐 Remote Server (Raspberry Pi, NAS, Cloud VM)
Run on a different computer, access from another. Needs network configuration.
---
## Step 2: Create Configuration (1 min)
Create a new folder `open-notebook-local` and add this file:
**docker-compose.yml**:
```yaml
services:
surrealdb:
image: surrealdb/surrealdb:v2
command: start --user root --pass password --bind 0.0.0.0:8000 memory
ports:
- "8000:8000"
open_notebook:
image: lfnovo/open_notebook:v1-latest-single
ports:
- "8502:8502" # Web UI (React frontend)
- "5055:5055" # API (required!)
environment:
# NO API KEYS NEEDED - Using Ollama (free, local)
- OLLAMA_API_BASE=http://ollama:11434
# Database (required)
- SURREAL_URL=ws://surrealdb:8000/rpc
- SURREAL_USER=root
- SURREAL_PASSWORD=password
- SURREAL_NAMESPACE=open_notebook
- SURREAL_DATABASE=open_notebook
volumes:
- ./notebook_data:/app/data
- ./surreal_data:/mydata
depends_on:
- surrealdb
restart: always
ollama:
image: ollama/ollama:latest
ports:
- "11434:11434"
volumes:
- ./ollama_models:/root/.ollama
environment:
# Optional: set GPU support if available
- OLLAMA_NUM_GPU=0
restart: always
```
**That's it!** No API keys, no secrets, completely private.
---
## Step 3: Start Services (1 min)
Open terminal in your `open-notebook-local` folder:
```bash
docker compose up -d
```
Wait 10-15 seconds for all services to start.
---
## Step 4: Download a Model (2-3 min)
Ollama needs at least one language model. Pick one:
```bash
# Fastest & smallest (recommended for testing)
docker exec open_notebook-ollama-1 ollama pull mistral
# OR: Better quality but slower
docker exec open_notebook-ollama-1 ollama pull neural-chat
# OR: Even better quality, more VRAM needed
docker exec open_notebook-ollama-1 ollama pull llama2
```
This downloads the model (will take 1-5 minutes depending on your internet).
---
## Step 5: Access Open Notebook (instant)
Open your browser:
```
http://localhost:8502
```
You should see the Open Notebook interface.
---
## Step 6: Configure Local Model (1 min)
1. Click **Settings** (top right) → **Models**
2. Set:
- **Language Model**: `ollama/mistral` (or whichever model you downloaded)
- **Embedding Model**: `ollama/nomic-embed-text` (auto-downloads if missing)
3. Click **Save**
---
## Step 7: Create Your First Notebook (1 min)
1. Click **New Notebook**
2. Name: "My Private Research"
3. Click **Create**
---
## Step 8: Add Local Content (1 min)
1. Click **Add Source**
2. Choose **Text**
3. Paste some text or a local document
4. Click **Add**
---
## Step 9: Chat With Your Content (1 min)
1. Go to **Chat**
2. Type: "What did you learn from this?"
3. Click **Send**
4. Watch as the local Ollama model responds!
---
## Verification Checklist
- [ ] Docker is running
- [ ] You can access `http://localhost:8502`
- [ ] Models are configured
- [ ] You created a notebook
- [ ] Chat works with local model
**All checked?** 🎉 You have a completely **private, offline** research assistant!
---
## Advantages of Local Setup
**No API costs** - Free forever
**No internet required** - True offline capability
**Privacy first** - Your data never leaves your machine
**No subscriptions** - No monthly bills
**Trade-off:** Slower than cloud models (depends on your CPU/GPU)
---
## Troubleshooting
### "ollama: command not found"
Docker image name might be different:
```bash
docker ps # Find the Ollama container name
docker exec <container_name> ollama pull mistral
```
### Model Download Stuck
Check internet connection and restart:
```bash
docker compose restart ollama
```
Then retry the model pull command.
### "Address already in use" Error
```bash
docker compose down
docker compose up -d
```
### Low Performance
Check if GPU is available:
```bash
# Show available GPUs
docker exec open_notebook-ollama-1 ollama ps
# Enable GPU in docker-compose.yml:
# - OLLAMA_NUM_GPU=1
```
Then restart: `docker compose restart ollama`
### Adding More Models
```bash
# List available models
docker exec open_notebook-ollama-1 ollama list
# Pull additional model
docker exec open_notebook-ollama-1 ollama pull neural-chat
```
---
## Next Steps
**Now that it's running:**
1. **Add Your Own Content**: PDFs, documents, articles (see 3-USER-GUIDE)
2. **Explore Features**: Podcasts, transformations, search
3. **Full Documentation**: [See all features](../3-USER-GUIDE/index.md)
4. **Scale Up**: Deploy to a server with better hardware for faster responses
5. **Benchmark Models**: Try different models to find the speed/quality tradeoff you prefer
---
## Going Further
- **Switch models**: Change in Settings → Models anytime
- **Add more models**: Run `ollama pull <model>` and they'll appear in Settings
- **Deploy to server**: Same docker-compose.yml works anywhere
- **Use cloud hybrid**: Keep some local models, add OpenAI/Anthropic for complex tasks
---
## Common Model Choices
| Model | Speed | Quality | VRAM | Best For |
|-------|-------|---------|------|----------|
| **mistral** | Fast | Good | 4GB | Testing, general use |
| **neural-chat** | Medium | Better | 6GB | Balanced, recommended |
| **llama2** | Slow | Best | 8GB+ | Complex reasoning |
| **phi** | Very Fast | Fair | 2GB | Minimal hardware |
---
**Need Help?** Join our [Discord community](https://discord.gg/37XJPXfz2w) - many users run local setups!

View file

@ -1,324 +0,0 @@
# Docker Compose Installation (Recommended)
Multi-container setup with separate services. **Best for most users.**
## Prerequisites
- **Docker Desktop** installed ([Download](https://www.docker.com/products/docker-desktop/))
- **5-10 minutes** of your time
- **API key** for at least one AI provider (OpenAI recommended for beginners)
## Step 1: Get an API Key (2 min)
Choose at least one AI provider. **OpenAI or OpenRouter recommended if you're unsure:**
```
OpenAI: https://platform.openai.com/api-keys
Anthropic: https://console.anthropic.com/
Google: https://aistudio.google.com/
Groq: https://console.groq.com/
```
Add at least $5 in credits to your account.
(Skip this if using Ollama for free local models)
---
## Step 2: Create Configuration (2 min)
Create a folder `open-notebook` and add this file:
**docker-compose.yml**:
```yaml
services:
surrealdb:
image: surrealdb/surrealdb:v2
command: start --user root --pass password --bind 0.0.0.0:8000 memory
ports:
- "8000:8000"
volumes:
- surreal_data:/mydata
api:
image: lfnovo/open_notebook:v1-latest
ports:
- "5055:5055"
environment:
# AI Provider (choose ONE)
- OPENAI_API_KEY=sk-... # Your OpenAI key
# - ANTHROPIC_API_KEY=sk-ant-... # Or Anthropic
# - GOOGLE_API_KEY=... # Or Google
# Database
- SURREAL_URL=ws://surrealdb:8000/rpc
- SURREAL_USER=root
- SURREAL_PASSWORD=password
- SURREAL_NAMESPACE=open_notebook
- SURREAL_DATABASE=open_notebook
# API Configuration
- API_URL=http://localhost:5055
depends_on:
- surrealdb
volumes:
- ./data:/app/data
restart: always
frontend:
image: lfnovo/open_notebook-frontend:v1-latest
ports:
- "3000:3000"
environment:
- NEXT_PUBLIC_API_URL=http://localhost:5055
depends_on:
- api
restart: always
volumes:
surreal_data:
```
**Edit the file:**
- Replace `sk-...` with your actual OpenAI API key
- (Or use Anthropic, Google, Groq keys instead)
- If you have multiple keys, uncomment the ones you want
---
## Step 3: Start Services (2 min)
Open terminal in the `open-notebook` folder:
```bash
docker compose up -d
```
Wait 15-20 seconds for all services to start:
```
✅ surrealdb running on :8000
✅ api running on :5055
✅ frontend running on :3000
```
Check status:
```bash
docker compose ps
```
---
## Step 4: Verify Installation (1 min)
**API Health:**
```bash
curl http://localhost:5055/health
# Should return: {"status": "healthy"}
```
**Frontend Access:**
Open browser to:
```
http://localhost:3000
```
You should see the Open Notebook interface!
---
## Step 5: First Notebook (2 min)
1. Click **New Notebook**
2. Name: "My Research"
3. Description: "Getting started"
4. Click **Create**
Done! You now have a fully working Open Notebook instance. 🎉
---
## Configuration
### Using Different AI Providers
Change `environment` section in `docker-compose.yml`:
```yaml
# For Anthropic (Claude)
- ANTHROPIC_API_KEY=sk-ant-...
# For Google Gemini
- GOOGLE_API_KEY=...
# For Groq (fast, free tier available)
- GROQ_API_KEY=...
# For local Ollama (free, offline)
- OLLAMA_BASE_URL=http://ollama:11434
```
### Adding Ollama (Free Local Models)
Add to `docker-compose.yml`:
```yaml
ollama:
image: ollama/ollama:latest
ports:
- "11434:11434"
volumes:
- ollama_models:/root/.ollama
restart: always
volumes:
surreal_data:
ollama_models:
```
Then update API service:
```yaml
environment:
- OLLAMA_BASE_URL=http://ollama:11434
```
Restart and pull a model:
```bash
docker compose restart
docker exec open_notebook-ollama-1 ollama pull mistral
```
---
## Environment Variables Reference
| Variable | Purpose | Example |
|----------|---------|---------|
| `OPENAI_API_KEY` | OpenAI API key | `sk-proj-...` |
| `ANTHROPIC_API_KEY` | Anthropic/Claude key | `sk-ant-...` |
| `SURREAL_URL` | Database connection | `ws://surrealdb:8000/rpc` |
| `SURREAL_USER` | Database user | `root` |
| `SURREAL_PASSWORD` | Database password | `password` |
| `SURREAL_NAMESPACE` | The namespace | `open_notebook` |
| `SURREAL_DATABASE` | The database to use | `open_notebook` |
| `API_URL` | API external URL | `http://localhost:5055` |
| `NEXT_PUBLIC_API_URL` | Frontend API URL | `http://localhost:5055` |
---
## Common Tasks
### Stop Services
```bash
docker compose down
```
### View Logs
```bash
# All services
docker compose logs -f
# Specific service
docker compose logs -f api
```
### Restart Services
```bash
docker compose restart
```
### Update to Latest Version
```bash
docker compose down
docker compose pull
docker compose up -d
```
### Remove All Data
```bash
docker compose down -v
```
---
## Troubleshooting
### "Cannot connect to API" Error
1. Check if Docker is running:
```bash
docker ps
```
2. Check if services are running:
```bash
docker compose ps
```
3. Check API logs:
```bash
docker compose logs api
```
4. Wait longer - services can take 20-30 seconds to start on first run
---
### Port Already in Use
If you get "Port 3000 already in use", change the port:
```yaml
ports:
- "3001:3000" # Use 3001 instead
```
Then access at `http://localhost:3001`
---
### API Key Not Working
1. Double-check your API key in the file (no extra spaces)
2. Verify key is valid at provider's website
3. Check you added credits to your account
4. Restart: `docker compose restart api`
---
### Database Connection Issues
Check SurrealDB is running:
```bash
docker compose logs surrealdb
```
Reset database:
```bash
docker compose down -v
docker compose up -d
```
---
## Next Steps
1. **Add Content**: Sources, notebooks, documents
2. **Configure Models**: Settings → Models (choose your preferences)
3. **Explore Features**: Chat, search, transformations
4. **Read Guide**: [User Guide](../3-USER-GUIDE/index.md)
---
## Production Deployment
For production use, see:
- [Security Hardening](https://github.com/lfnovo/open-notebook/blob/main/docs/deployment/security.md)
- [Reverse Proxy](https://github.com/lfnovo/open-notebook/blob/main/docs/deployment/reverse-proxy.md)
---
## Getting Help
- **Discord**: [Community support](https://discord.gg/37XJPXfz2w)
- **Issues**: [GitHub Issues](https://github.com/lfnovo/open-notebook/issues)
- **Docs**: [Full documentation](../index.md)