Skip to content
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
95 changes: 95 additions & 0 deletions ngui-e2e/MODEL_CONFIGURATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Model Configuration Guide

This guide explains how to configure your own AI model for the Next Gen UI API.

## Quick Start

The API is pre-configured to work with Ollama and `llama3.2:3b`. To get started:

1. Install Ollama: https://ollama.ai/download
2. Pull the model: `ollama pull llama3.2:3b`
3. Start the server: `uvicorn main:app --reload`

## Configuration Options

### Option 1: Edit main.py directly

Open `main.py` and modify these lines:

```python
MODEL_NAME = "your-preferred-model" # Line ~39
BASE_URL = "your-api-url" # Line ~40
```

### Option 2: Use Environment Variables

Set environment variables before starting the server:

```bash
export MODEL_NAME=llama3.2:7b
export BASE_URL=http://localhost:11434/v1
uvicorn main:app --reload
```

## Supported Models

### Ollama Models (Recommended for local development)

```bash
# Lightweight - good for development
ollama pull llama3.2:3b

# Better quality - requires more RAM
ollama pull llama3.2:7b

# Balanced performance
ollama pull llama3.1:8b

# Good for code-related tasks
ollama pull codellama:7b

# Alternative option
ollama pull mistral:7b
```

### OpenAI API

```bash
export MODEL_NAME=gpt-3.5-turbo
export OPENAI_API_KEY=your-api-key
export BASE_URL= # Leave empty for OpenAI
```

### Other OpenAI-Compatible APIs

For services like LocalAI, Oobabooga, vLLM, etc.:

```bash
export MODEL_NAME=your-model-name
export BASE_URL=http://your-api-url/v1
```

## Testing Your Configuration

1. Start the server: `uvicorn main:app --reload`
2. Check the startup messages for your model configuration
3. Test with curl:

```bash
curl -X POST "http://localhost:8000/generate" \
-H "Content-Type: application/json" \
-d '{"prompt": "Tell me about Toy Story"}'
```

## Troubleshooting

- **Model not found**: Ensure your model is pulled/available
- **Connection refused**: Check if your model server is running
- **API key issues**: Verify your API key is set correctly
- **Memory issues**: Try a smaller model like `llama3.2:3b`

## Performance Tips

- For development: Use `llama3.2:3b` (fastest)
- For quality: Use `llama3.2:7b` or `llama3.1:8b`
- For production: Consider using OpenAI API or a dedicated server
24 changes: 24 additions & 0 deletions ngui-e2e/NGUI-e2e/.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?
102 changes: 102 additions & 0 deletions ngui-e2e/NGUI-e2e/NODE_UPGRADE_GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Node.js Upgrade Guide

## Issue

You're currently using Node.js v12.22.12, but this project requires Node.js 18+ to run Vite 7.

**Error you're seeing:**

```
SyntaxError: Unexpected token '.'
at Loader.moduleStrategy (internal/modules/esm/translators.js:140:18)
```

## Solution: Upgrade Node.js

### Option 1: Using Homebrew (Recommended for macOS)

```bash
# Install latest Node.js LTS
brew install node

# Verify installation
node --version
```

### Option 2: Using Node Version Manager (nvm)

```bash
# Install nvm (if not already installed)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash

# Restart terminal or run:
source ~/.bashrc

# Install and use Node.js 18 LTS
nvm install 18
nvm use 18
nvm alias default 18

# Verify installation
node --version
```

### Option 3: Download from Official Website

1. Go to [https://nodejs.org/](https://nodejs.org/)
2. Download the LTS version (18.x or 20.x)
3. Run the installer
4. Restart your terminal

## After Upgrading

1. **Verify Node.js version:**

```bash
node --version
# Should show v18.x.x or v20.x.x
```

2. **Clear npm cache (optional but recommended):**

```bash
npm cache clean --force
```

3. **Reinstall dependencies:**

```bash
cd /Users/anujrajak/Projects/research/ngui-e2e/NGUI-e2e
rm -rf node_modules package-lock.json
npm install
```

4. **Start the development server:**
```bash
npm run dev
```

## Expected Result

After upgrading, `npm run dev` should start successfully and you'll see:

```
VITE v7.x.x ready in Xms

➜ Local: http://localhost:5173/
➜ Network: use --host to expose
➜ press h + enter to show help
```

## Features Available After Fix

- βœ… Full-screen AI chatbot interface
- βœ… Dark mode toggle (sun/moon icons in header)
- βœ… Two pre-loaded mock messages
- βœ… Real-time message input with send button
- βœ… Typing indicator when AI is responding
- βœ… Auto-scroll to latest messages
- βœ… Keyboard shortcuts (Enter to send)
- βœ… Professional PatternFly styling

Your chatbot will be ready to use with all the features you requested!
Loading