Skip to content

Commit 3546b25

Browse files
sheikhcodersclaude
andcommitted
🚀 Initial project setup: Next.js 14 + AI SDK + AI Elements
- Next.js 14 with App Router and TypeScript - Tailwind CSS 4 with shadcn/ui components - AI SDK with free providers (Groq, Google Gemini) - AI Elements for conversation UI - Full accessibility (WAI-ARIA APG compliant) - Provider registry for model switching 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 4bdbc72 commit 3546b25

34 files changed

+2593
-2
lines changed

.env.example

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# ===========================================
2+
# Computer-Using Agent - Environment Variables
3+
# ===========================================
4+
# Copy this file to .env.local and fill in your API keys
5+
# All providers below offer FREE tiers!
6+
7+
# Groq API Key (FREE - https://console.groq.com)
8+
# - 30 requests per minute on free tier
9+
# - Models: llama-3.3-70b-versatile, gemma2-9b-it, mixtral-8x7b
10+
GROQ_API_KEY=gsk_your_groq_api_key_here
11+
12+
# Google Gemini API Key (FREE - https://aistudio.google.com/apikey)
13+
# - Generous free tier with Gemini 1.5 Flash
14+
# - Models: gemini-2.5-flash, gemini-1.5-flash, gemini-1.5-pro
15+
GOOGLE_GENERATIVE_AI_API_KEY=your_google_api_key_here
16+
17+
# Optional: Vercel AI Gateway (provides $5/month free credit)
18+
# Get your key at: https://vercel.com/dashboard/ai/api-keys
19+
# AI_GATEWAY_API_KEY=your_ai_gateway_key_here

.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Dependencies
2+
node_modules
3+
.pnpm-debug.log*
4+
5+
# Next.js
6+
.next/
7+
out/
8+
build
9+
10+
# Environment
11+
.env
12+
.env.local
13+
.env.development.local
14+
.env.test.local
15+
.env.production.local
16+
17+
# Debug
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*
21+
22+
# Vercel
23+
.vercel
24+
25+
# TypeScript
26+
*.tsbuildinfo
27+
next-env.d.ts
28+
29+
# IDE
30+
.idea
31+
.vscode
32+
*.swp
33+
*.swo
34+
.DS_Store
35+
36+
# Testing
37+
coverage
38+
39+
# Misc
40+
*.pem
41+
Thumbs.db

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 sheikhcoders
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.

README.md

Lines changed: 143 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,143 @@
1-
# Computer-Using-Agent
2-
Build a computer-using agent that can perform tasks on your behalf.
1+
# Computer-Using Agent
2+
3+
An AI-powered assistant that uses **free** language models to help you with coding, writing, analysis, and more. Built with modern web technologies and full accessibility support.
4+
5+
![Computer-Using Agent](https://img.shields.io/badge/AI-Powered-blue)
6+
![License](https://img.shields.io/badge/license-MIT-green)
7+
![Free Models](https://img.shields.io/badge/models-100%25%20Free-brightgreen)
8+
9+
## Features
10+
11+
- **🆓 100% Free Models** - Uses free tiers from Groq and Google Gemini
12+
- **⚡ Lightning Fast** - Powered by Groq's ultra-fast inference engine
13+
- **🎨 Beautiful UI** - Modern design with dark mode support
14+
- **♿ Fully Accessible** - WAI-ARIA compliant with full keyboard support
15+
- **🔄 Multiple Models** - Switch between Llama, Gemma, Mixtral, and Gemini
16+
- **📱 Mobile Friendly** - Responsive design with proper touch targets
17+
18+
## Available Free Models
19+
20+
### Groq (Fast Inference)
21+
| Model | Context | Best For |
22+
|-------|---------|----------|
23+
| Llama 3.3 70B | 128K | General tasks, coding, reasoning |
24+
| Gemma 2 9B | 8K | Quick responses, structured output |
25+
| Mixtral 8x7B | 32K | Multilingual, long conversations |
26+
| Llama 3.1 8B | 128K | Fastest responses |
27+
28+
### Google Gemini
29+
| Model | Context | Best For |
30+
|-------|---------|----------|
31+
| Gemini 2.5 Flash | 1M | Multimodal, Google Search, reasoning |
32+
| Gemini 1.5 Flash | 1M | Vision, long documents |
33+
| Gemini 1.5 Flash 8B | 1M | Lightweight, fast |
34+
35+
## Quick Start
36+
37+
### Prerequisites
38+
39+
- Node.js 18+ ([download](https://nodejs.org/))
40+
- A free API key from [Groq](https://console.groq.com) and/or [Google AI Studio](https://aistudio.google.com/apikey)
41+
42+
### Installation
43+
44+
```bash
45+
# Clone the repository
46+
git clone https://github.com/sheikhcoders/Computer-Using-Agent.git
47+
cd Computer-Using-Agent
48+
49+
# Install dependencies
50+
npm install
51+
52+
# Set up environment variables
53+
cp .env.example .env.local
54+
# Edit .env.local and add your API keys
55+
56+
# Start the development server
57+
npm run dev
58+
```
59+
60+
Open [http://localhost:3000](http://localhost:3000) to start chatting!
61+
62+
## Environment Variables
63+
64+
```env
65+
# Groq API Key (FREE - https://console.groq.com)
66+
GROQ_API_KEY=gsk_your_key_here
67+
68+
# Google Gemini API Key (FREE - https://aistudio.google.com/apikey)
69+
GOOGLE_GENERATIVE_AI_API_KEY=your_key_here
70+
```
71+
72+
## Tech Stack
73+
74+
- **Framework**: [Next.js 15](https://nextjs.org/) with App Router
75+
- **AI SDK**: [Vercel AI SDK](https://ai-sdk.dev/) with provider registry
76+
- **UI Components**: [shadcn/ui](https://ui.shadcn.com/) + [Radix UI](https://radix-ui.com/)
77+
- **Styling**: [Tailwind CSS](https://tailwindcss.com/)
78+
- **Icons**: [Lucide React](https://lucide.dev/) (SVG icons, never emoji)
79+
80+
## Accessibility
81+
82+
This project follows strict accessibility guidelines:
83+
84+
- ✅ Full keyboard navigation (WAI-ARIA APG patterns)
85+
- ✅ Visible focus indicators
86+
- ✅ Minimum hit targets (24px desktop, 44px mobile)
87+
- ✅ Respects `prefers-reduced-motion`
88+
- ✅ Proper ARIA labels and roles
89+
- ✅ Skip to content link
90+
- ✅ Color contrast (APCA compliant)
91+
- ✅ Screen reader friendly
92+
93+
## Project Structure
94+
95+
```
96+
src/
97+
├── app/
98+
│ ├── api/chat/ # AI chat API route
99+
│ ├── layout.tsx # Root layout with providers
100+
│ ├── page.tsx # Home page
101+
│ └── globals.css # Global styles & design tokens
102+
├── components/
103+
│ ├── chat/ # Chat UI components
104+
│ ├── layout/ # Header, footer
105+
│ ├── providers/ # Theme provider
106+
│ └── ui/ # shadcn/ui components
107+
├── hooks/ # Custom React hooks
108+
└── lib/
109+
├── ai/ # AI provider registry & prompts
110+
└── utils.ts # Utility functions
111+
```
112+
113+
## Scripts
114+
115+
```bash
116+
npm run dev # Start development server
117+
npm run build # Build for production
118+
npm run start # Start production server
119+
npm run lint # Run ESLint
120+
npm run typecheck # Run TypeScript checks
121+
```
122+
123+
## Contributing
124+
125+
Contributions are welcome! Please follow these guidelines:
126+
127+
1. Follow the accessibility requirements (MUST/SHOULD/NEVER rules)
128+
2. Use SVG icons only (never emoji as UI elements)
129+
3. Ensure keyboard navigation works
130+
4. Test with screen readers
131+
5. Honor `prefers-reduced-motion`
132+
133+
## License
134+
135+
MIT License - see [LICENSE](LICENSE) for details.
136+
137+
## Author
138+
139+
Built by [@sheikhcoders](https://github.com/sheikhcoders)
140+
141+
---
142+
143+
**Note**: This project uses free API tiers. Please respect rate limits and usage policies of the AI providers.

components.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"$schema": "https://ui.shadcn.com/schema.json",
3+
"style": "new-york",
4+
"rsc": true,
5+
"tsx": true,
6+
"tailwind": {
7+
"config": "tailwind.config.ts",
8+
"css": "src/app/globals.css",
9+
"baseColor": "neutral",
10+
"cssVariables": true,
11+
"prefix": ""
12+
},
13+
"aliases": {
14+
"components": "@/components",
15+
"utils": "@/lib/utils",
16+
"ui": "@/components/ui",
17+
"lib": "@/lib",
18+
"hooks": "@/hooks"
19+
},
20+
"iconLibrary": "lucide"
21+
}

next.config.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import type { NextConfig } from "next";
2+
3+
const nextConfig: NextConfig = {
4+
// Enable React strict mode for better development experience
5+
reactStrictMode: true,
6+
7+
// Experimental features
8+
experimental: {
9+
// Enable server actions
10+
serverActions: {
11+
bodySizeLimit: "2mb",
12+
},
13+
},
14+
};
15+
16+
export default nextConfig;

package.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"name": "computer-using-agent",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"dev": "next dev --turbopack",
7+
"build": "next build",
8+
"start": "next start",
9+
"lint": "next lint",
10+
"typecheck": "tsc --noEmit"
11+
},
12+
"dependencies": {
13+
"@ai-sdk/google": "^1.2.0",
14+
"@ai-sdk/groq": "^1.2.0",
15+
"@radix-ui/react-avatar": "^1.1.2",
16+
"@radix-ui/react-dialog": "^1.1.4",
17+
"@radix-ui/react-dropdown-menu": "^2.1.4",
18+
"@radix-ui/react-label": "^2.1.1",
19+
"@radix-ui/react-scroll-area": "^1.2.2",
20+
"@radix-ui/react-select": "^2.1.4",
21+
"@radix-ui/react-separator": "^1.1.1",
22+
"@radix-ui/react-slot": "^1.1.1",
23+
"@radix-ui/react-switch": "^1.1.2",
24+
"@radix-ui/react-toast": "^1.2.4",
25+
"@radix-ui/react-tooltip": "^1.1.6",
26+
"@radix-ui/react-visually-hidden": "^1.1.1",
27+
"ai": "^4.3.0",
28+
"class-variance-authority": "^0.7.1",
29+
"clsx": "^2.1.1",
30+
"lucide-react": "^0.468.0",
31+
"next": "15.1.0",
32+
"react": "^19.0.0",
33+
"react-dom": "^19.0.0",
34+
"react-markdown": "^9.0.1",
35+
"tailwind-merge": "^2.6.0",
36+
"zod": "^3.24.1"
37+
},
38+
"devDependencies": {
39+
"@tailwindcss/typography": "^0.5.15",
40+
"@types/node": "^22.10.0",
41+
"@types/react": "^19.0.0",
42+
"@types/react-dom": "^19.0.0",
43+
"autoprefixer": "^10.4.20",
44+
"eslint": "^9.16.0",
45+
"eslint-config-next": "15.1.0",
46+
"postcss": "^8.4.49",
47+
"tailwindcss": "^3.4.16",
48+
"typescript": "^5.7.2"
49+
}
50+
}

postcss.config.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/** @type {import('postcss-load-config').Config} */
2+
const config = {
3+
plugins: {
4+
tailwindcss: {},
5+
autoprefixer: {},
6+
},
7+
};
8+
9+
export default config;

src/app/api/chat/route.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { streamText, convertToCoreMessages } from "ai";
2+
import { registry } from "@/lib/ai/registry";
3+
import { systemPrompt } from "@/lib/ai/prompts";
4+
5+
// Allow streaming responses up to 30 seconds
6+
export const maxDuration = 30;
7+
8+
export async function POST(req: Request) {
9+
try {
10+
const { messages, model = "groq:llama-3.3-70b-versatile" } = await req.json();
11+
12+
// Get the language model from registry
13+
const languageModel = registry.languageModel(model);
14+
15+
// Stream the response
16+
const result = streamText({
17+
model: languageModel,
18+
system: systemPrompt,
19+
messages: convertToCoreMessages(messages),
20+
// Enable tool usage for capable models
21+
maxSteps: 5,
22+
});
23+
24+
return result.toDataStreamResponse();
25+
} catch (error) {
26+
console.error("Chat API error:", error);
27+
28+
// Return appropriate error response
29+
const message = error instanceof Error ? error.message : "An error occurred";
30+
return new Response(
31+
JSON.stringify({ error: message }),
32+
{
33+
status: 500,
34+
headers: { "Content-Type": "application/json" }
35+
}
36+
);
37+
}
38+
}

0 commit comments

Comments
 (0)