agent / index.html
akshit7093's picture
Create a subtly designed developer-centric web application that prioritizes functionality over visual flourishes. The interface should feel like a refined, professional tool that gets out of the way and lets developers focus on their work. Think "GitHub's interface meets terminal aesthetics" - clean, purposeful, and visually restrained. Revised Color Strategy & Visual Design Minimal Color Palette Primary background: Deep charcoal (#1e1e1e) with subtle texture Panel backgrounds: Slightly lighter (#252525) for subtle separation Text colors: Primary white (#ffffff), secondary light gray (#a0a0a0), muted gray (#707070) Minimal accent colors: Single primary accent: Soft blue (#4a9eff) for interactive elements only Status indicators only: Subtle green (#28a745) for success, muted red (#dc3545) for errors No decorative colors - every color serves a functional purpose Typography-Focused Design Hierarchy through typography, not color Font weights and sizes to create visual distinction Subtle spacing variations instead of colored dividers Clean monospace fonts for code with minimal syntax highlighting High contrast ratios using only grayscale variations Refined Interface Requirements Distraction-Free Chat Interface Design a conversation experience that emphasizes content over decoration: Clean Message Display Minimal visual elements - focus on typography and spacing Subtle borders instead of colored backgrounds for code blocks Clean separator lines between messages using subtle grays No colored badges or tags - use typography hierarchy instead Understated timestamps in muted gray Simple icons in single color with minimal visual weight Refined Input Experience Clean input field with subtle focus states Minimal button styling - text-based actions when possible Subtle hover states using opacity changes, not color shifts Command suggestions in clean dropdown without colorful indicators File upload areas with simple dashed borders, no accent colors Streamlined Navigation Design a minimal navigation system that doesn't compete for attention: Subtle Workspace Management Text-based navigation with minimal iconography Clean list styling for project switching Subtle selected states using background lightening, not color Minimal breadcrumbs using typography hierarchy Understated progress indicators using simple bars or text Content-First Panels Remove colored section headers - use typography instead Subtle panel dividers using thin gray lines Clean expansion/collapse controls without colored arrows Minimal status indicators - prefer text over colored dots Simple tabbed interfaces using typography, not colored tabs Developer Experience Improvements Keyboard-Centric Design Clear focus indicators using subtle outlines, not bright colors Consistent interaction states through opacity and subtle borders Clean command palette with minimal styling Simple shortcuts display using clean typography Understated selected states in lists and menus Professional Content Handling Clean code block styling with minimal borders and backgrounds Subtle syntax highlighting using only grayscale variations where possible Simple diagram containers with clean borders, no colored backgrounds Minimal loading states using simple animations, not colorful spinners Clean export options with text-based actions Visual Hierarchy Strategy Typography-Based Design Font size variations for importance hierarchy Font weight differences to distinguish content types Line spacing to create visual separation Subtle text colors (white, light gray, medium gray) for hierarchy Clean alignment to create visual order without colors Minimal Interactive Elements Subtle hover effects using opacity changes Clean focus states with simple outlines Understated buttons with minimal styling Simple form elements without colored decorations Clean toggle switches using grayscale styling Accessibility & Professional Appearance High Contrast, Low Distraction Maximum contrast ratios using only black, white, and grays Clear visual hierarchy without relying on color coding Readable font sizes with comfortable line spacing Simple iconography in single colors Clean visual patterns that don't compete with content Professional Polish Consistent spacing system using subtle variations Clean animations that are functional, not decorative Minimal visual effects - shadows and gradients only when functionally necessary Simple loading states using clean progress indicators Understated success/error states with minimal color usage Content Organization Principles Information-Dense Layout Compact information display without visual clutter Clean section dividers using typography and spacing Minimal decorative elements - every visual element serves a purpose Subtle grouping techniques using spacing rather than colored containers Clean empty states with simple messaging Functional Visual Cues Status communication through typography and subtle backgrounds Action differentiation using font weights and spacing Content type distinction through layout, not color Navigation clarity using position and typography hierarchy Context awareness shown through subtle background variations - Initial Deployment
f8c1563 verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DevTerminal - Developer CLI Interface</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<script src="https://cdn.jsdelivr.net/npm/@google/generative-ai/dist/gemini-api.bundle.min.js"></script>
<script>
tailwind.config = {
theme: {
extend: {
colors: {
'terminal-green': '#00ff41',
'terminal-amber': '#ffab00',
'terminal-red': '#ff5555',
'terminal-blue': '#61dafb',
'terminal-purple': '#bb86fc',
'terminal-bg-dark': '#0d0d0d',
'terminal-bg': '#1a1a1a',
'terminal-bg-light': '#2d2d2d',
'terminal-text': '#e0e0e0',
},
fontFamily: {
mono: ['Fira Code', 'monospace'],
},
}
}
}
</script>
<style>
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;400;500;600;700&display=swap');
body {
font-family: 'Fira Code', monospace;
background-color: #0d0d0d;
color: #e0e0e0;
height: 100vh;
overflow: hidden;
}
/* Custom scrollbar */
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: #1a1a1a;
}
::-webkit-scrollbar-thumb {
background: #2d2d2d;
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: #3d3d3d;
}
/* Terminal cursor effect */
.terminal-cursor {
display: inline-block;
width: 10px;
height: 20px;
background-color: #00ff41;
animation: blink 1s infinite;
vertical-align: middle;
margin-left: 2px;
}
@keyframes blink {
0%, 100% { opacity: 1; }
50% { opacity: 0; }
}
/* Syntax highlighting */
.hljs {
background-color: #2d2d2d !important;
border-left: 3px solid #00ff41;
padding: 1rem;
border-radius: 0 4px 4px 0;
}
/* Terminal-like input */
.command-input::before {
content: '> ';
color: #00ff41;
margin-right: 8px;
}
/* Panel resize handles */
.resize-handle {
width: 4px;
background-color: #2d2d2d;
cursor: col-resize;
transition: background-color 0.2s;
}
.resize-handle:hover {
background-color: #00ff41;
}
/* Glow effect for active elements */
.glow-effect {
box-shadow: 0 0 10px rgba(0, 255, 65, 0.3);
}
/* Fade-in animation */
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.fade-in {
animation: fadeIn 0.3s ease-out forwards;
}
</style>
</head>
<body class="flex flex-col h-screen">
<!-- Status Bar -->
<div class="bg-terminal-bg-dark text-terminal-text text-xs py-1 px-4 flex justify-between border-t border-terminal-bg-light">
<div class="flex space-x-4">
<span><i class="fas fa-code text-terminal-green mr-1"></i> DevTerminal v1.0.0</span>
<span><i class="fas fa-server text-terminal-blue mr-1"></i> Connected</span>
<span><i class="fas fa-memory text-terminal-purple mr-1"></i> 2.4GB/8GB</span>
</div>
<div class="flex space-x-4">
<span><i class="fas fa-keyboard mr-1"></i> Vim Mode: Off</span>
<span><i class="fas fa-bell mr-1"></i> Notifications: On</span>
<span id="current-time" class="text-terminal-amber"></span>
</div>
</div>
<!-- Main Content Area -->
<div class="flex flex-1 overflow-hidden">
<!-- Left Sidebar -->
<div class="w-64 bg-terminal-bg-dark flex flex-col border-r border-terminal-bg-light">
<div class="p-4 border-b border-terminal-bg-light">
<div class="flex items-center">
<div class="w-3 h-3 rounded-full bg-terminal-red mr-2"></div>
<div class="w-3 h-3 rounded-full bg-terminal-amber mr-2"></div>
<div class="w-3 h-3 rounded-full bg-terminal-green mr-2"></div>
<span class="ml-2 text-terminal-text font-bold">DevTerminal</span>
</div>
</div>
<div class="flex-1 overflow-y-auto">
<div class="p-4">
<div class="flex items-center justify-between mb-4">
<h3 class="text-terminal-text font-bold">WORKSPACES</h3>
<button class="text-terminal-blue hover:text-terminal-purple">
<i class="fas fa-plus"></i>
</button>
</div>
<div class="space-y-1">
<div class="flex items-center px-3 py-2 bg-terminal-bg-light rounded cursor-pointer glow-effect">
<i class="fas fa-folder-open text-terminal-blue mr-2"></i>
<span class="truncate">api-gateway-service</span>
</div>
<div class="flex items-center px-3 py-2 hover:bg-terminal-bg-light rounded cursor-pointer" onclick="loadWorkspace('user-authentication')">
<i class="fas fa-folder text-terminal-purple mr-2"></i>
<span class="truncate">user-authentication</span>
</div>
<div class="flex items-center px-3 py-2 hover:bg-terminal-bg-light rounded cursor-pointer" onclick="loadWorkspace('data-pipeline')">
<i class="fas fa-folder text-terminal-purple mr-2"></i>
<span class="truncate">data-pipeline</span>
</div>
<div class="flex items-center px-3 py-2 hover:bg-terminal-bg-light rounded cursor-pointer" onclick="loadWorkspace('frontend-dashboard')">
<i class="fas fa-folder text-terminal-purple mr-2"></i>
<span class="truncate">frontend-dashboard</span>
</div>
</div>
</div>
<div class="p-4 border-t border-terminal-bg-light">
<h3 class="text-terminal-text font-bold mb-4">QUICK ACTIONS</h3>
<div class="space-y-2">
<button class="w-full flex items-center px-3 py-2 bg-terminal-bg-light hover:bg-terminal-bg rounded text-left" onclick="executeCommand('new-terminal')">
<i class="fas fa-terminal text-terminal-green mr-2"></i>
<span>New Terminal</span>
</button>
<button class="w-full flex items-center px-3 py-2 bg-terminal-bg-light hover:bg-terminal-bg rounded text-left" onclick="executeCommand('search-code')">
<i class="fas fa-search text-terminal-blue mr-2"></i>
<span>Search Codebase</span>
</button>
<button class="w-full flex items-center px-3 py-2 bg-terminal-bg-light hover:bg-terminal-bg rounded text-left" onclick="executeCommand('show-architecture')">
<i class="fas fa-project-diagram text-terminal-purple mr-2"></i>
<span>Architecture Diagram</span>
</button>
<button class="w-full flex items-center px-3 py-2 bg-terminal-bg-light hover:bg-terminal-bg rounded text-left" onclick="executeCommand('show-docs')">
<i class="fas fa-book text-terminal-amber mr-2"></i>
<span>Documentation</span>
</button>
</div>
</div>
<div class="p-4 border-t border-terminal-bg-light">
<h3 class="text-terminal-text font-bold mb-4">RECENT FILES</h3>
<div class="space-y-1">
<div class="flex items-center px-3 py-1 hover:bg-terminal-bg-light rounded cursor-pointer" onclick="openFile('server.js')">
<i class="fas fa-file-code text-terminal-blue mr-2"></i>
<span class="truncate">server.js</span>
</div>
<div class="flex items-center px-3 py-1 hover:bg-terminal-bg-light rounded cursor-pointer" onclick="openFile('authMiddleware.ts')">
<i class="fas fa-file-code text-terminal-blue mr-2"></i>
<span class="truncate">authMiddleware.ts</span>
</div>
<div class="flex items-center px-3 py-1 hover:bg-terminal-bg-light rounded cursor-pointer" onclick="openFile('api-spec.yml')">
<i class="fas fa-file-alt text-terminal-purple mr-2"></i>
<span class="truncate">api-spec.yml</span>
</div>
</div>
</div>
</div>
</div>
<!-- Main Chat Area -->
<div class="flex-1 flex flex-col overflow-hidden bg-terminal-bg">
<!-- Chat Header -->
<div class="p-4 border-b border-terminal-bg-light flex items-center justify-between">
<div class="flex items-center">
<i class="fas fa-terminal text-terminal-green mr-2"></i>
<h2 class="font-bold">api-gateway-service</h2>
<span class="ml-2 text-xs bg-terminal-bg-light px-2 py-1 rounded">main</span>
</div>
<div class="flex space-x-3">
<button class="text-terminal-text hover:text-terminal-blue" onclick="executeCommand('search')">
<i class="fas fa-search"></i>
</button>
<button class="text-terminal-text hover:text-terminal-blue" onclick="executeCommand('history')">
<i class="fas fa-history"></i>
</button>
<button class="text-terminal-text hover:text-terminal-blue" onclick="executeCommand('settings')">
<i class="fas fa-cog"></i>
</button>
</div>
</div>
<!-- Chat Messages -->
<div id="chat-messages" class="flex-1 overflow-y-auto p-4 space-y-6">
<!-- System Message -->
<div class="flex fade-in">
<div class="w-8 h-8 rounded-full bg-terminal-bg-light flex items-center justify-center mr-3">
<i class="fas fa-terminal text-terminal-green"></i>
</div>
<div class="flex-1">
<div class="text-xs text-terminal-text mb-1">
<span class="font-bold">DevTerminal</span>
<span class="text-terminal-bg-light ml-2">2 minutes ago</span>
</div>
<div class="bg-terminal-bg-light p-3 rounded-lg">
<p>Welcome to your api-gateway-service workspace. Here's what you can do:</p>
<ul class="list-disc pl-5 mt-2 space-y-1">
<li>Type <code class="bg-terminal-bg-dark px-1 rounded">/help</code> for available commands</li>
<li>Press <code class="bg-terminal-bg-dark px-1 rounded">Ctrl+Space</code> for autocomplete</li>
<li>Drag & drop files to share documentation</li>
</ul>
</div>
</div>
</div>
<!-- User Message -->
<div class="flex fade-in">
<div class="w-8 h-8 rounded-full bg-terminal-bg-light flex items-center justify-center mr-3">
<i class="fas fa-user text-terminal-blue"></i>
</div>
<div class="flex-1">
<div class="text-xs text-terminal-text mb-1">
<span class="font-bold">You</span>
<span class="text-terminal-bg-light ml-2">1 minute ago</span>
</div>
<div class="bg-terminal-bg-dark border border-terminal-bg-light p-3 rounded-lg">
<p>/optimize current rate limiting implementation</p>
</div>
</div>
</div>
<!-- Assistant Message with Code -->
<div class="flex fade-in">
<div class="w-8 h-8 rounded-full bg-terminal-bg-light flex items-center justify-center mr-3">
<i class="fas fa-robot text-terminal-purple"></i>
</div>
<div class="flex-1">
<div class="text-xs text-terminal-text mb-1">
<span class="font-bold">DevAssistant</span>
<span class="text-terminal-bg-light ml-2">Just now</span>
</div>
<div class="bg-terminal-bg-light p-3 rounded-lg">
<p>Here's an optimized rate limiting implementation using Redis and Express middleware:</p>
<pre class="mt-3 rounded overflow-hidden"><code class="language-javascript">const rateLimit = require('express-rate-limit');
const RedisStore = require('rate-limit-redis');
const redis = require('redis');
const client = redis.createClient({
host: process.env.REDIS_HOST,
port: process.env.REDIS_PORT
});
const limiter = rateLimit({
store: new RedisStore({
client: client,
expiry: 60 * 60 // 1 hour
}),
windowMs: 15 * 60 * 1000, // 15 minutes
max: 100, // limit each IP to 100 requests per windowMs
message: 'Too many requests from this IP, please try again later'
});
// Apply to all requests
app.use(limiter);</code></pre>
<div class="mt-3 flex justify-between items-center">
<div class="flex space-x-2">
<button class="text-xs bg-terminal-bg-dark hover:bg-terminal-bg px-2 py-1 rounded">
<i class="fas fa-copy mr-1"></i> Copy
</button>
<button class="text-xs bg-terminal-bg-dark hover:bg-terminal-bg px-2 py-1 rounded">
<i class="fas fa-code mr-1"></i> Insert
</button>
<button class="text-xs bg-terminal-bg-dark hover:bg-terminal-bg px-2 py-1 rounded">
<i class="fas fa-file-export mr-1"></i> Export
</button>
</div>
<div class="text-xs text-terminal-text">
<i class="fas fa-check-circle text-terminal-green mr-1"></i> Works with Redis 4+
</div>
</div>
<div class="mt-3 p-2 bg-terminal-bg-dark rounded border border-terminal-bg-light">
<div class="flex items-center text-xs mb-1">
<i class="fas fa-info-circle text-terminal-blue mr-1"></i>
<span class="font-bold">Implementation Notes</span>
</div>
<ul class="text-xs list-disc pl-5 space-y-1">
<li>Uses Redis for distributed rate limiting across multiple instances</li>
<li>Configurable window size and request limits</li>
<li>Includes error handling for Redis connection issues</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- Input Area -->
<div class="p-4 border-t border-terminal-bg-light">
<div class="flex items-center mb-2">
<div class="flex-1 flex items-center bg-terminal-bg-dark border border-terminal-bg-light rounded-lg px-3 py-2">
<span class="text-terminal-green mr-2">></span>
<div class="flex-1">
<div id="command-input" class="command-input w-full bg-transparent outline-none" contenteditable="true" placeholder="Type a command or message..."></div>
</div>
<div class="flex space-x-2">
<button class="text-terminal-text hover:text-terminal-blue" onclick="executeCommand('insert-code')">
<i class="fas fa-code"></i>
</button>
<button class="text-terminal-text hover:text-terminal-blue" onclick="executeCommand('attach-file')">
<i class="fas fa-paperclip"></i>
</button>
<button class="text-terminal-text hover:text-terminal-blue" onclick="executeCommand('voice-input')">
<i class="fas fa-microphone"></i>
</button>
</div>
</div>
<button class="ml-2 bg-terminal-green hover:bg-opacity-90 text-terminal-bg-dark px-4 py-2 rounded-lg font-bold" onclick="submitCommand()">
Send
</button>
</div>
<div class="flex items-center text-xs text-terminal-text">
<div class="flex-1">
<span class="mr-3"><span class="font-bold">Tab</span> - autocomplete</span>
<span class="mr-3"><span class="font-bold">↑↓</span> - command history</span>
<span><span class="font-bold">Ctrl+Enter</span> - new line</span>
</div>
<div>
<span class="mr-3"><span class="font-bold">/help</span> - commands</span>
<span><span class="font-bold">Esc</span> - clear</span>
</div>
</div>
</div>
</div>
<!-- Right Sidebar -->
<div class="w-80 bg-terminal-bg-dark flex flex-col border-l border-terminal-bg-light">
<div class="p-4 border-b border-terminal-bg-light flex items-center justify-between">
<h3 class="font-bold">CONTEXT PANEL</h3>
<button class="text-terminal-text hover:text-terminal-blue">
<i class="fas fa-times"></i>
</button>
</div>
<div class="flex-1 overflow-y-auto p-4">
<div class="mb-6">
<h4 class="font-bold mb-2 flex items-center">
<i class="fas fa-project-diagram text-terminal-purple mr-2"></i>
Project Structure
</h4>
<div class="text-xs bg-terminal-bg-light p-2 rounded">
<div class="flex items-center py-1 px-2 hover:bg-terminal-bg rounded cursor-pointer">
<i class="fas fa-folder-open text-terminal-blue mr-2"></i>
<span>src/</span>
</div>
<div class="pl-6">
<div class="flex items-center py-1 px-2 hover:bg-terminal-bg rounded cursor-pointer">
<i class="fas fa-folder text-terminal-blue mr-2"></i>
<span>middleware/</span>
</div>
<div class="pl-6">
<div class="flex items-center py-1 px-2 hover:bg-terminal-bg rounded cursor-pointer">
<i class="fas fa-file-code text-terminal-blue mr-2"></i>
<span>rateLimiter.js</span>
</div>
</div>
<div class="flex items-center py-1 px-2 hover:bg-terminal-bg rounded cursor-pointer">
<i class="fas fa-file-code text-terminal-blue mr-2"></i>
<span>routes.js</span>
</div>
</div>
</div>
</div>
<div class="mb-6">
<h4 class="font-bold mb-2 flex items-center">
<i class="fas fa-plug text-terminal-green mr-2"></i>
Dependencies
</h4>
<div class="text-xs space-y-1">
<div class="flex items-center justify-between bg-terminal-bg-light p-2 rounded">
<span>express</span>
<span class="text-terminal-amber">^4.18.2</span>
</div>
<div class="flex items-center justify-between bg-terminal-bg-light p-2 rounded">
<span>express-rate-limit</span>
<span class="text-terminal-amber">^6.7.0</span>
</div>
<div class="flex items-center justify-between bg-terminal-bg-light p-2 rounded">
<span>redis</span>
<span class="text-terminal-amber">^4.6.4</span>
</div>
<div class="flex items-center justify-between bg-terminal-bg-light p-2 rounded">
<span>rate-limit-redis</span>
<span class="text-terminal-amber">^2.0.0</span>
</div>
</div>
</div>
<div class="mb-6">
<h4 class="font-bold mb-2 flex items-center">
<i class="fas fa-history text-terminal-blue mr-2"></i>
Recent Commands
</h4>
<div class="text-xs space-y-1">
<div class="bg-terminal-bg-light p-2 rounded cursor-pointer hover:bg-terminal-bg">
<div class="text-terminal-green">/optimize rate limiting</div>
<div class="text-terminal-text opacity-75">Just now</div>
</div>
<div class="bg-terminal-bg-light p-2 rounded cursor-pointer hover:bg-terminal-bg">
<div class="text-terminal-green">/show dependencies</div>
<div class="text-terminal-text opacity-75">5 minutes ago</div>
</div>
<div class="bg-terminal-bg-light p-2 rounded cursor-pointer hover:bg-terminal-bg">
<div class="text-terminal-green">/debug auth middleware</div>
<div class="text-terminal-text opacity-75">12 minutes ago</div>
</div>
</div>
</div>
<div>
<h4 class="font-bold mb-2 flex items-center">
<i class="fas fa-lightbulb text-terminal-amber mr-2"></i>
Suggestions
</h4>
<div class="text-xs space-y-1">
<div class="bg-terminal-bg-light p-2 rounded cursor-pointer hover:bg-terminal-bg">
<div class="flex items-center">
<i class="fas fa-terminal text-terminal-green mr-2"></i>
<span>Test rate limits with Artillery</span>
</div>
</div>
<div class="bg-terminal-bg-light p-2 rounded cursor-pointer hover:bg-terminal-bg">
<div class="flex items-center">
<i class="fas fa-book text-terminal-blue mr-2"></i>
<span>View Redis best practices</span>
</div>
</div>
<div class="bg-terminal-bg-light p-2 rounded cursor-pointer hover:bg-terminal-bg">
<div class="flex items-center">
<i class="fas fa-project-diagram text-terminal-purple mr-2"></i>
<span>Visualize API flow</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
// Update current time
function updateTime() {
const now = new Date();
const timeString = now.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
document.getElementById('current-time').textContent = timeString;
}
setInterval(updateTime, 1000);
updateTime();
// Simulate typing effect for command input
const commandInput = document.getElementById('command-input');
commandInput.addEventListener('keydown', (e) => {
if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault();
// Handle command submission
const command = commandInput.textContent.trim();
if (command) {
addUserMessage(command);
processCommand(command);
commandInput.textContent = '';
}
}
});
function submitCommand() {
const command = commandInput.textContent.trim();
if (command) {
addUserMessage(command);
processCommand(command);
commandInput.textContent = '';
}
}
// Add a new user message to the chat
function addUserMessage(content) {
const messagesContainer = document.getElementById('chat-messages');
const messageElement = document.createElement('div');
messageElement.className = 'flex fade-in';
messageElement.innerHTML = `
<div class="w-8 h-8 rounded-full bg-terminal-bg-light flex items-center justify-center mr-3">
<i class="fas fa-user text-terminal-blue"></i>
</div>
<div class="flex-1">
<div class="text-xs text-terminal-text mb-1">
<span class="font-bold">You</span>
<span class="text-terminal-bg-light ml-2">Just now</span>
</div>
<div class="bg-terminal-bg-dark border border-terminal-bg-light p-3 rounded-lg">
<p>${content}</p>
</div>
</div>
`;
messagesContainer.appendChild(messageElement);
messagesContainer.scrollTop = messagesContainer.scrollHeight;
}
// Initialize Gemini API
const GEMINI_API_KEY = 'AIzaSyCc8ggBCJY0XimSrE1NU8z9Ax4qAPMXO_w';
const MODEL_ID = 'gemma-3-27b-it';
// Load the Google Generative AI library
async function loadGemini() {
return new Promise((resolve) => {
const script = document.createElement('script');
script.src = 'https://cdn.jsdelivr.net/npm/@google/generative-ai/dist/gemini-api.bundle.min.js';
script.onload = resolve;
document.head.appendChild(script);
});
}
async function processCommand(command) {
// Ensure Gemini is loaded
if (typeof google === 'undefined' || !google.ai) {
await loadGemini();
}
const messagesContainer = document.getElementById('chat-messages');
// Show loading indicator
const loadingElement = document.createElement('div');
loadingElement.className = 'flex fade-in';
loadingElement.innerHTML = `
<div class="w-8 h-8 rounded-full bg-terminal-bg-light flex items-center justify-center mr-3">
<i class="fas fa-robot text-terminal-purple"></i>
</div>
<div class="flex-1">
<div class="text-xs text-terminal-text mb-1">
<span class="font-bold">DevAssistant</span>
<span class="text-terminal-bg-light ml-2">Thinking...</span>
</div>
<div class="bg-terminal-bg-light p-3 rounded-lg">
<div class="flex items-center space-x-2">
<div class="w-2 h-2 rounded-full bg-terminal-green animate-pulse"></div>
<div class="w-2 h-2 rounded-full bg-terminal-green animate-pulse delay-100"></div>
<div class="w-2 h-2 rounded-full bg-terminal-green animate-pulse delay-200"></div>
</div>
</div>
</div>
`;
messagesContainer.appendChild(loadingElement);
messagesContainer.scrollTop = messagesContainer.scrollHeight;
try {
// Initialize the model
const genAI = new google.ai.GenerativeAI(GEMINI_API_KEY);
const model = genAI.getGenerativeModel({ model: MODEL_ID });
// Generate content
const result = await model.generateContent({
contents: [{
parts: [{
text: `You are a helpful AI assistant for developers. Respond to this developer query in markdown format with proper code formatting when needed: ${command}`
}]
}]
});
const response = await result.response;
const text = response.text();
// Remove loading indicator
messagesContainer.removeChild(loadingElement);
// Format response (convert markdown to HTML)
const formattedResponse = text
.replace(/```(\w*)([\s\S]*?)```/g, '<pre><code class="language-$1">$2</code></pre>')
.replace(/`([^`]+)`/g, '<code class="bg-terminal-bg-dark px-1 rounded">$1</code>')
.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>')
.replace(/\*(.*?)\*/g, '<em>$1</em>')
.replace(/^#\s(.*$)/gm, '<h3 class="font-bold text-lg mt-4 mb-2">$1</h3>')
.replace(/^##\s(.*$)/gm, '<h4 class="font-bold mt-3 mb-1">$1</h4>')
.replace(/- (.*$)/gm, '<li class="list-disc ml-5">$1</li>')
.replace(/\n/g, '<br>');
// Create response element
const responseElement = document.createElement('div');
responseElement.className = 'flex fade-in';
responseElement.innerHTML = `
<div class="w-8 h-8 rounded-full bg-terminal-bg-light flex items-center justify-center mr-3">
<i class="fas fa-robot text-terminal-purple"></i>
</div>
<div class="flex-1">
<div class="text-xs text-terminal-text mb-1">
<span class="font-bold">DevAssistant</span>
<span class="text-terminal-bg-light ml-2">Just now</span>
</div>
<div class="bg-terminal-bg-light p-3 rounded-lg">
${formattedResponse}
<div class="mt-2 text-xs text-terminal-text opacity-75">
<i class="fas fa-microchip mr-1"></i> Powered by Gemini (gemma-3-27b-it)
</div>
</div>
</div>
`;
messagesContainer.appendChild(responseElement);
messagesContainer.scrollTop = messagesContainer.scrollHeight;
// Highlight any code blocks in the response
setTimeout(() => {
document.querySelectorAll('pre code').forEach((block) => {
const text = block.textContent;
const highlighted = text
.replace(/(const|let|var|function|return|require)/g, '<span class="text-terminal-purple">$1</span>')
.replace(/(process\.env\.[A-Z_]+)/g, '<span class="text-terminal-green">$1</span>')
.replace(/(\d+)/g, '<span class="text-terminal-amber">$1</span>')
.replace(/(\/\/.*)/g, '<span class="text-terminal-bg-light">$1</span>');
block.innerHTML = highlighted;
});
}, 100);
} catch (error) {
console.error('Error calling Gemini API:', error);
// Remove loading indicator
messagesContainer.removeChild(loadingElement);
// Show error message
const errorElement = document.createElement('div');
errorElement.className = 'flex fade-in';
errorElement.innerHTML = `
<div class="w-8 h-8 rounded-full bg-terminal-bg-light flex items-center justify-center mr-3">
<i class="fas fa-robot text-terminal-purple"></i>
</div>
<div class="flex-1">
<div class="text-xs text-terminal-text mb-1">
<span class="font-bold">DevAssistant</span>
<span class="text-terminal-bg-light ml-2">Error</span>
</div>
<div class="bg-terminal-bg-light p-3 rounded-lg border border-terminal-red">
<p>Sorry, I encountered an error processing your request.</p>
<p class="mt-1 text-xs text-terminal-red">${error.message}</p>
</div>
</div>
`;
messagesContainer.appendChild(errorElement);
messagesContainer.scrollTop = messagesContainer.scrollHeight;
}
}
// Interactive functions
function loadWorkspace(name) {
addSystemMessage(`Loading workspace: ${name}`);
document.querySelector('.chat-header h2').textContent = name;
}
function executeCommand(command) {
const commands = {
'new-terminal': 'Opening new terminal session...',
'search-code': 'Searching codebase...',
'show-architecture': 'Generating architecture diagram...',
'show-docs': 'Opening documentation...'
};
addSystemMessage(commands[command]);
}
function openFile(filename) {
addSystemMessage(`Opening file: ${filename}`);
}
function addSystemMessage(content) {
const messagesContainer = document.getElementById('chat-messages');
const messageElement = document.createElement('div');
messageElement.className = 'flex fade-in';
messageElement.innerHTML = `
<div class="w-8 h-8 rounded-full bg-terminal-bg-light flex items-center justify-center mr-3">
<i class="fas fa-terminal text-terminal-green"></i>
</div>
<div class="flex-1">
<div class="text-xs text-terminal-text mb-1">
<span class="font-bold">System</span>
<span class="text-terminal-bg-light ml-2">Just now</span>
</div>
<div class="bg-terminal-bg-light p-3 rounded-lg">
<p>${content}</p>
</div>
</div>
`;
messagesContainer.appendChild(messageElement);
messagesContainer.scrollTop = messagesContainer.scrollHeight;
}
// Highlight syntax in code blocks (would use a proper library in production)
document.querySelectorAll('pre code').forEach((block) => {
// This is a simplified version - in production you'd use a library like highlight.js
const text = block.textContent;
// Simple keyword highlighting for demo
const highlighted = text
.replace(/(const|let|var|function|return|require)/g, '<span class="text-terminal-purple">$1</span>')
.replace(/(process\.env\.[A-Z_]+)/g, '<span class="text-terminal-green">$1</span>')
.replace(/(\d+)/g, '<span class="text-terminal-amber">$1</span>')
.replace(/(\/\/.*)/g, '<span class="text-terminal-bg-light">$1</span>');
block.innerHTML = highlighted;
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=akshit7093/agent" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>