y-gui
by luohy15
y-gui is a web-based graphical interface for AI chat interactions. It supports multiple AI models and MCP (Model Context Protocol) servers.
Last updated: N/A
y-gui š
A web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.
⨠Features
- š¬ Interactive chat interface with AI models
- š¤ Support for multiple bot configurations (any base_url/api_key/model combination)
- š MCP (Model Context Protocol) client support with multiple server configurations
- š Secure authentication with Auth0 and Google login
- š Dark/light theme support
- š All chat data stored in Cloudflare KV/R2 for easy access and sync
- š Real-time updates with SWR
- š± Responsive design for all devices
Demo
Architecture
y-gui consists of two main components:
- Frontend: React application with TypeScript, Tailwind CSS, and SWR for data fetching
- Backend: Cloudflare Workers with KV and R2 storage
flowchart TD
Client[React Client] --> Worker[Cloudflare Worker]
Worker --> KV[Cloudflare KV]
Worker --> R2[Cloudflare R2]
Worker --> AI[AI Providers]
subgraph "Frontend"
Client --> Components[React Components]
Components --> State[SWR State]
State --> API[API Layer]
end
subgraph "Backend"
Worker --> Auth[Auth Middleware]
Worker --> Storage[Storage Layer]
Worker --> Provider[Provider Layer]
end
ā” Quick Start
Prerequisites
- Node.js and npm
- Cloudflare account
- Auth0 account
- API keys for AI providers
Installation
-
Clone the repository:
git clone https://github.com/luohy15/y-gui.git cd y-gui
-
Install dependencies:
npm install
-
Configure environment variables:
- Configure Cloudflare Worker settings in
backend/wrangler.toml
- Change the auth0 settings in
frontend/src/index.tsx
andbackend/src/utils/auth.ts
- Configure Cloudflare Worker settings in
-
Build asset:
npm run build
-
Deploy cloudflare worker
npm run deploy
š ļø Development
Project Structure
y-gui/
āāā frontend/ # React frontend application
ā āāā src/
ā ā āāā components/ # React components
ā ā āāā contexts/ # React contexts
ā ā āāā utils/ # Utility functions
ā ā āāā index.tsx # Entry point
āāā backend/ # Cloudflare Worker backend
ā āāā src/
ā ā āāā api/ # API endpoints
ā ā āāā middleware/ # Middleware
ā ā āāā repository/ # Data access
ā ā āāā index.ts # Worker entry
āāā shared/ # Shared code between frontend and backend
ā āāā types/ # TypeScript type definitions
āāā memory-bank/ # Project documentation
Available Scripts
npm run dev
: Start both frontend and backend development serversnpm run dev:frontend
: Start only the frontend development servernpm run dev:backend
: Start only the backend development servernpm run build
: Build both frontend and backendnpm run deploy
: Deploy the backend to Cloudflare Workersnpm run test
: Run tests
š Authentication
y-gui uses Auth0 for authentication with the following features:
- Universal Login
- Google social login
- Token-based session management
- Secure API access
š¤ Bot Configuration
y-gui supports multiple bot configurations with the following properties:
- Name
- Model
- Base URL
- API Key
- Print Speed
- MCP Servers
- API Type
- Custom API Path
- Max Tokens
- Reasoning Effort
š MCP Server Configuration
MCP (Model Context Protocol) servers can be configured with:
- Name
- Command
- Arguments
- Environment Variables
- URL
- Token
š API Endpoints
The backend provides RESTful API endpoints for:
- Chat operations
- Bot configuration management
- MCP server configuration management
- Authentication
š Data Storage
- Chat data is stored in Cloudflare KV
- Backup data is stored in Cloudflare R2
- Bot and MCP server configurations are stored in Cloudflare R2
š§© Technologies Used
- Frontend: React, TypeScript, Tailwind CSS, SWR, Auth0
- Backend: Cloudflare Workers, KV, R2
- Build Tools: Vite, Wrangler, TypeScript
š Documentation
For more detailed documentation, see the memory-bank directory.
š¤ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
š License
This project is licensed under the MIT License - see the LICENSE file for details.