File size: 4,696 Bytes
7bdbd56
a51de86
 
 
 
7bdbd56
a51de86
7bdbd56
 
 
a51de86
7bdbd56
 
a51de86
 
 
7bdbd56
a51de86
7bdbd56
a51de86
 
 
 
 
 
 
 
 
7bdbd56
a51de86
 
 
 
 
 
7bdbd56
a51de86
 
 
 
7bdbd56
a51de86
 
 
 
 
7bdbd56
a51de86
 
 
7bdbd56
a51de86
 
 
 
7bdbd56
a51de86
 
7bdbd56
 
 
a51de86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7bdbd56
a51de86
7bdbd56
9ad9eac
 
 
a51de86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7bdbd56
a51de86
7bdbd56
a51de86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7bdbd56
a51de86
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
---
title: ChatUI Helper
emoji: πŸ’¬
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 5.37.0
app_file: app.py
pinned: true
license: gpl-3.0
short_description: Create AI chat interfaces for HuggingFace Spaces
---

# ChatUI Helper

A comprehensive tool for creating, configuring, and deploying customizable AI chat interfaces on HuggingFace Spaces. Designed for educators and developers to quickly generate pedagogically-focused AI assistants.

## 🎯 Key Features

### Configuration & Templates
- **Academic Templates**: Pre-configured templates for educational use cases
  - Socratic Research Chat
  - STEM Adventure Games
  - Course Assistant Example
  - Language Learning Partner
- **Custom Configuration**: Build from scratch with full control
- **Multi-Language Support**: Configure assistants to respond in any language
- **Theme Selection**: Choose from Gradio themes (Default, Soft, Glass, Monochrome, Base)

### URL Grounding & Context
- **Grounding URLs**: Add up to 10 reference URLs for contextual responses
  - Primary sources (URLs 1-2): 8000 character limit
  - Secondary sources (URLs 3+): 2500 character limit
- **Dynamic URL Extraction**: Automatically fetch content from URLs in user messages
- **Smart Content Processing**: HTML parsing with BeautifulSoup

### Security & Access Control
- **Access Codes**: Password-protect your Space for controlled access
- **API Key Management**: Secure handling of OpenRouter API keys
- **HuggingFace Token Integration**: Enable configuration updates without redeployment

### Preview & Testing
- **Live Preview**: Test your assistant before deployment
- **Real-time Configuration**: See changes instantly
- **File Upload Support**: Test document processing capabilities
- **Conversation Export**: Download chat history as markdown

## πŸš€ Quick Start

### Local Development
```bash
# Clone the repository
git clone https://huggingface.co/spaces/milwright/chatui-helper

# Install dependencies
pip install -r requirements.txt

# Run the application
python app.py
```

### Environment Variables (Optional)
```bash
# For preview functionality
API_KEY=sk-or-your-openrouter-key

# For HuggingFace integration
HF_TOKEN=your-huggingface-token
```

## πŸ“¦ Generated Space Contents

Each generated package includes:
- **app.py**: Complete Gradio 5.x application
- **requirements.txt**: All necessary dependencies
- **config.json**: Your configuration settings
- **README.md**: Deployment instructions

### Supported Models
Through OpenRouter integration:
- Google Gemini (Flash, Pro)
- OpenAI GPT-4, GPT-3.5
- Anthropic Claude 3 series
- Meta Llama 3 models
- Mistral/Mixtral models
- DeepSeek reasoning models
- Nvidia Llama optimizations
- Qwen multilingual models

## πŸ“š Documentation

### [πŸ“– Full Documentation](docs.md)
Complete step-by-step guide with screenshots and detailed instructions.

The application includes comprehensive built-in documentation:
- **Step 1**: Configure & Preview Your Space
  - Templates & Identity
  - System Configuration
  - Example Prompts
  - URL Grounding
  - API Configuration
  - Upload Configuration
  - Preview Testing
- **Step 2**: Generate & Deploy
  - Package Generation
  - Space Creation
  - File Upload
  - Secret Configuration
  - Verification & Iteration
- **Troubleshooting**: Common issues and solutions
- **Additional Resources**: Links to relevant documentation

## πŸ—οΈ Architecture

### Core Components
- **SpaceGenerator**: Handles configuration and package generation
- **ConfigurationManager**: Manages settings with automatic backups
- **Support Documentation**: Nested accordion interface for easy navigation
- **Template System**: String-based templating for code generation

### File Structure
```
chatui-helper/
β”œβ”€β”€ app.py                    # Main application
β”œβ”€β”€ space_template.py         # Template for generated spaces
β”œβ”€β”€ utils.py                  # Shared utilities
β”œβ”€β”€ support_docs.py          # Documentation interface
β”œβ”€β”€ academic_templates.json   # Pre-configured templates
β”œβ”€β”€ requirements.txt         # Dependencies
└── CLAUDE.md               # Development guidance
```

## 🀝 Contributing

This project is designed for educational use. Contributions that enhance pedagogical value are welcome:
- New academic templates
- Improved documentation
- Bug fixes and optimizations
- Accessibility improvements

## πŸ“„ License

GPL-3.0 - See LICENSE file for details

## πŸ”— Links

- [HuggingFace Spaces Documentation](https://huggingface.co/docs/hub/spaces-overview)
- [Gradio Documentation](https://gradio.app/docs/)
- [OpenRouter API](https://openrouter.ai/)

---

Built with ❀️ for educators and learners