Spaces:
Running
Running
Add 3 files
Browse files- README.md +7 -5
- index.html +1146 -19
- prompts.txt +4 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: myspace
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: gray
|
| 5 |
+
colorTo: blue
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,1146 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="pt-BR">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Multi-AI Code Generator</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
.code-editor {
|
| 11 |
+
font-family: 'Fira Code', 'Courier New', monospace;
|
| 12 |
+
tab-size: 2;
|
| 13 |
+
}
|
| 14 |
+
.syntax-highlight {
|
| 15 |
+
background-color: rgba(255, 255, 255, 0.1);
|
| 16 |
+
border-radius: 3px;
|
| 17 |
+
padding: 0 2px;
|
| 18 |
+
}
|
| 19 |
+
.typewriter {
|
| 20 |
+
border-right: 2px solid rgba(255,255,255,.75);
|
| 21 |
+
animation: blink-caret 0.75s step-end infinite;
|
| 22 |
+
}
|
| 23 |
+
@keyframes blink-caret {
|
| 24 |
+
from, to { border-color: transparent }
|
| 25 |
+
50% { border-color: rgba(255,255,255,.75); }
|
| 26 |
+
}
|
| 27 |
+
.loading-dots:after {
|
| 28 |
+
content: '.';
|
| 29 |
+
animation: dots 1.5s steps(5, end) infinite;
|
| 30 |
+
}
|
| 31 |
+
@keyframes dots {
|
| 32 |
+
0%, 20% { content: '.'; }
|
| 33 |
+
40% { content: '..'; }
|
| 34 |
+
60% { content: '...'; }
|
| 35 |
+
80%, 100% { content: ''; }
|
| 36 |
+
}
|
| 37 |
+
.model-badge {
|
| 38 |
+
display: inline-flex;
|
| 39 |
+
align-items: center;
|
| 40 |
+
padding: 0.25rem 0.5rem;
|
| 41 |
+
border-radius: 9999px;
|
| 42 |
+
font-size: 0.75rem;
|
| 43 |
+
font-weight: 500;
|
| 44 |
+
}
|
| 45 |
+
pre {
|
| 46 |
+
position: relative;
|
| 47 |
+
background-color: #1a202c;
|
| 48 |
+
padding: 1rem;
|
| 49 |
+
border-radius: 0.5rem;
|
| 50 |
+
overflow-x: auto;
|
| 51 |
+
}
|
| 52 |
+
pre code {
|
| 53 |
+
display: block;
|
| 54 |
+
padding: 0;
|
| 55 |
+
background: transparent;
|
| 56 |
+
border-radius: 0;
|
| 57 |
+
}
|
| 58 |
+
.copy-btn {
|
| 59 |
+
position: absolute;
|
| 60 |
+
top: 0.5rem;
|
| 61 |
+
right: 0.5rem;
|
| 62 |
+
background-color: rgba(255, 255, 255, 0.1);
|
| 63 |
+
border: none;
|
| 64 |
+
color: white;
|
| 65 |
+
padding: 0.25rem 0.5rem;
|
| 66 |
+
border-radius: 0.25rem;
|
| 67 |
+
cursor: pointer;
|
| 68 |
+
font-size: 0.75rem;
|
| 69 |
+
}
|
| 70 |
+
.copy-btn:hover {
|
| 71 |
+
background-color: rgba(255, 255, 255, 0.2);
|
| 72 |
+
}
|
| 73 |
+
</style>
|
| 74 |
+
</head>
|
| 75 |
+
<body class="bg-gray-900 text-gray-100 min-h-screen">
|
| 76 |
+
<div class="container mx-auto px-4 py-8">
|
| 77 |
+
<!-- Header -->
|
| 78 |
+
<header class="mb-8 text-center">
|
| 79 |
+
<h1 class="text-4xl font-bold bg-gradient-to-r from-blue-400 via-purple-500 to-pink-500 bg-clip-text text-transparent mb-2">Multi-AI Code Generator</h1>
|
| 80 |
+
<p class="text-gray-400 max-w-2xl mx-auto">Descreva o que você precisa e escolha entre diversos modelos de IA para gerar o código perfeito.</p>
|
| 81 |
+
</header>
|
| 82 |
+
|
| 83 |
+
<!-- Main Content -->
|
| 84 |
+
<div class="flex flex-col lg:flex-row gap-6">
|
| 85 |
+
<!-- Input Section -->
|
| 86 |
+
<div class="flex-1">
|
| 87 |
+
<div class="bg-gray-800 rounded-xl shadow-lg overflow-hidden">
|
| 88 |
+
<div class="bg-gray-700 px-4 py-3 flex items-center justify-between">
|
| 89 |
+
<div class="flex items-center space-x-2">
|
| 90 |
+
<div class="w-3 h-3 rounded-full bg-red-500"></div>
|
| 91 |
+
<div class="w-3 h-3 rounded-full bg-yellow-500"></div>
|
| 92 |
+
<div class="w-3 h-3 rounded-full bg-green-500"></div>
|
| 93 |
+
</div>
|
| 94 |
+
<h2 class="text-sm font-semibold">DESCREVA SEU CÓDIGO</h2>
|
| 95 |
+
<div class="w-12"></div>
|
| 96 |
+
</div>
|
| 97 |
+
<div class="p-4">
|
| 98 |
+
<textarea id="promptInput" rows="6" class="w-full bg-gray-700 rounded-lg p-4 text-gray-200 focus:outline-none focus:ring-2 focus:ring-purple-500 resize-none" placeholder="Ex: Crie uma função em JavaScript que valide um CPF..."></textarea>
|
| 99 |
+
|
| 100 |
+
<div class="mt-4 grid grid-cols-1 md:grid-cols-2 gap-3">
|
| 101 |
+
<select id="languageSelect" class="bg-gray-700 text-gray-200 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-purple-500">
|
| 102 |
+
<option value="javascript">JavaScript</option>
|
| 103 |
+
<option value="python">Python</option>
|
| 104 |
+
<option value="java">Java</option>
|
| 105 |
+
<option value="csharp">C#</option>
|
| 106 |
+
<option value="php">PHP</option>
|
| 107 |
+
<option value="html">HTML</option>
|
| 108 |
+
<option value="css">CSS</option>
|
| 109 |
+
<option value="typescript">TypeScript</option>
|
| 110 |
+
<option value="go">Go</option>
|
| 111 |
+
<option value="rust">Rust</option>
|
| 112 |
+
<option value="swift">Swift</option>
|
| 113 |
+
<option value="kotlin">Kotlin</option>
|
| 114 |
+
</select>
|
| 115 |
+
|
| 116 |
+
<select id="frameworkSelect" class="bg-gray-700 text-gray-200 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-purple-500">
|
| 117 |
+
<option value="none">Sem Framework</option>
|
| 118 |
+
<option value="react">React</option>
|
| 119 |
+
<option value="vue">Vue</option>
|
| 120 |
+
<option value="angular">Angular</option>
|
| 121 |
+
<option value="django">Django</option>
|
| 122 |
+
<option value="flask">Flask</option>
|
| 123 |
+
<option value="express">Express</option>
|
| 124 |
+
<option value="laravel">Laravel</option>
|
| 125 |
+
<option value="nextjs">Next.js</option>
|
| 126 |
+
<option value="svelte">Svelte</option>
|
| 127 |
+
<option value="spring">Spring</option>
|
| 128 |
+
<option value="aspnet">ASP.NET</option>
|
| 129 |
+
</select>
|
| 130 |
+
|
| 131 |
+
<select id="modelSelect" class="bg-gray-700 text-gray-200 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-purple-500">
|
| 132 |
+
<option value="gemini">Gemini Pro</option>
|
| 133 |
+
<option value="deepseek">DeepSeek Coder</option>
|
| 134 |
+
<option value="llama">Llama 3</option>
|
| 135 |
+
<option value="gpt4">GPT-4</option>
|
| 136 |
+
<option value="claude">Claude 3</option>
|
| 137 |
+
<option value="mistral">Mistral</option>
|
| 138 |
+
<option value="codellama">CodeLlama</option>
|
| 139 |
+
<option value="phind">Phind</option>
|
| 140 |
+
</select>
|
| 141 |
+
|
| 142 |
+
<select id="toneSelect" class="bg-gray-700 text-gray-200 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-purple-500">
|
| 143 |
+
<option value="default">Tono Padrão</option>
|
| 144 |
+
<option value="concise">Conciso</option>
|
| 145 |
+
<option value="detailed">Detalhado</option>
|
| 146 |
+
<option value="professional">Profissional</option>
|
| 147 |
+
<option value="friendly">Amigável</option>
|
| 148 |
+
</select>
|
| 149 |
+
</div>
|
| 150 |
+
|
| 151 |
+
<div class="mt-6 flex flex-wrap gap-3">
|
| 152 |
+
<button id="generateBtn" class="bg-gradient-to-r from-purple-600 to-blue-500 hover:from-purple-700 hover:to-blue-600 text-white font-semibold py-3 px-6 rounded-lg flex items-center gap-2 transition-all duration-300 flex-1 min-w-[200px]">
|
| 153 |
+
<i class="fas fa-magic"></i> Gerar Código
|
| 154 |
+
</button>
|
| 155 |
+
<button id="clearBtn" class="bg-gray-700 hover:bg-gray-600 text-gray-200 font-semibold py-3 px-6 rounded-lg flex items-center gap-2 transition-all duration-300 flex-1 min-w-[120px]">
|
| 156 |
+
<i class="fas fa-trash-alt"></i> Limpar
|
| 157 |
+
</button>
|
| 158 |
+
</div>
|
| 159 |
+
</div>
|
| 160 |
+
</div>
|
| 161 |
+
|
| 162 |
+
<!-- API Key Section -->
|
| 163 |
+
<div class="mt-6 bg-gray-800 rounded-xl shadow-lg overflow-hidden">
|
| 164 |
+
<div class="bg-gray-700 px-4 py-3 flex justify-between items-center">
|
| 165 |
+
<h2 class="text-sm font-semibold flex items-center gap-2">
|
| 166 |
+
<i class="fas fa-key"></i> CONFIGURAÇÃO DA API
|
| 167 |
+
</h2>
|
| 168 |
+
<select id="apiProviderSelect" class="bg-gray-600 text-gray-200 rounded-lg px-3 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-purple-500">
|
| 169 |
+
<option value="gemini">Gemini</option>
|
| 170 |
+
<option value="openai">OpenAI</option>
|
| 171 |
+
<option value="deepseek">DeepSeek</option>
|
| 172 |
+
<option value="anthropic">Anthropic</option>
|
| 173 |
+
<option value="mistral">Mistral</option>
|
| 174 |
+
<option value="meta">Meta (Llama)</option>
|
| 175 |
+
<option value="phind">Phind</option>
|
| 176 |
+
</select>
|
| 177 |
+
</div>
|
| 178 |
+
<div class="p-4">
|
| 179 |
+
<div id="geminiApiKey" class="api-key-section">
|
| 180 |
+
<label class="block text-sm text-gray-400 mb-1">Chave API Gemini</label>
|
| 181 |
+
<input type="password" id="geminiApiKeyInput" value="AIzaSyBYKrqnytogNPk3xEG5yWZBZfM9JPBQPN0" class="w-full bg-gray-700 rounded-lg p-3 text-gray-200 focus:outline-none focus:ring-2 focus:ring-purple-500" placeholder="Cole sua chave API do Gemini aqui">
|
| 182 |
+
</div>
|
| 183 |
+
|
| 184 |
+
<div id="openaiApiKey" class="api-key-section hidden">
|
| 185 |
+
<label class="block text-sm text-gray-400 mb-1">Chave API OpenAI</label>
|
| 186 |
+
<input type="password" id="openaiApiKeyInput" class="w-full bg-gray-700 rounded-lg p-3 text-gray-200 focus:outline-none focus:ring-2 focus:ring-purple-500" placeholder="Cole sua chave API da OpenAI aqui">
|
| 187 |
+
</div>
|
| 188 |
+
|
| 189 |
+
<div id="deepseekApiKey" class="api-key-section hidden">
|
| 190 |
+
<label class="block text-sm text-gray-400 mb-1">Chave API DeepSeek</label>
|
| 191 |
+
<input type="password" id="deepseekApiKeyInput" class="w-full bg-gray-700 rounded-lg p-3 text-gray-200 focus:outline-none focus:ring-2 focus:ring-purple-500" placeholder="Cole sua chave API do DeepSeek aqui">
|
| 192 |
+
</div>
|
| 193 |
+
|
| 194 |
+
<div id="anthropicApiKey" class="api-key-section hidden">
|
| 195 |
+
<label class="block text-sm text-gray-400 mb-1">Chave API Anthropic</label>
|
| 196 |
+
<input type="password" id="anthropicApiKeyInput" class="w-full bg-gray-700 rounded-lg p-3 text-gray-200 focus:outline-none focus:ring-2 focus:ring-purple-500" placeholder="Cole sua chave API da Anthropic aqui">
|
| 197 |
+
</div>
|
| 198 |
+
|
| 199 |
+
<div id="mistralApiKey" class="api-key-section hidden">
|
| 200 |
+
<label class="block text-sm text-gray-400 mb-1">Chave API Mistral</label>
|
| 201 |
+
<input type="password" id="mistralApiKeyInput" class="w-full bg-gray-700 rounded-lg p-3 text-gray-200 focus:outline-none focus:ring-2 focus:ring-purple-500" placeholder="Cole sua chave API da Mistral aqui">
|
| 202 |
+
</div>
|
| 203 |
+
|
| 204 |
+
<div id="metaApiKey" class="api-key-section hidden">
|
| 205 |
+
<label class="block text-sm text-gray-400 mb-1">Chave API Meta (Llama)</label>
|
| 206 |
+
<input type="password" id="metaApiKeyInput" class="w-full bg-gray-700 rounded-lg p-3 text-gray-200 focus:outline-none focus:ring-2 focus:ring-purple-500" placeholder="Cole sua chave API da Meta aqui">
|
| 207 |
+
</div>
|
| 208 |
+
|
| 209 |
+
<div id="phindApiKey" class="api-key-section hidden">
|
| 210 |
+
<label class="block text-sm text-gray-400 mb-1">Chave API Phind</label>
|
| 211 |
+
<input type="password" id="phindApiKeyInput" class="w-full bg-gray-700 rounded-lg p-3 text-gray-200 focus:outline-none focus:ring-2 focus:ring-purple-500" placeholder="Cole sua chave API do Phind aqui">
|
| 212 |
+
</div>
|
| 213 |
+
|
| 214 |
+
<p class="text-xs text-gray-500 mt-2">Esta aplicação armazena suas chaves API localmente no navegador.</p>
|
| 215 |
+
</div>
|
| 216 |
+
</div>
|
| 217 |
+
|
| 218 |
+
<!-- History Section -->
|
| 219 |
+
<div class="mt-6 bg-gray-800 rounded-xl shadow-lg overflow-hidden">
|
| 220 |
+
<div class="bg-gray-700 px-4 py-3 flex justify-between items-center">
|
| 221 |
+
<h2 class="text-sm font-semibold flex items-center gap-2">
|
| 222 |
+
<i class="fas fa-history"></i> HISTÓRICO
|
| 223 |
+
</h2>
|
| 224 |
+
<button id="clearHistoryBtn" class="text-xs text-gray-400 hover:text-white">
|
| 225 |
+
<i class="fas fa-trash-alt mr-1"></i>Limpar
|
| 226 |
+
</button>
|
| 227 |
+
</div>
|
| 228 |
+
<div class="p-4">
|
| 229 |
+
<div id="historyList" class="space-y-2 max-h-60 overflow-y-auto">
|
| 230 |
+
<!-- History items will be added here -->
|
| 231 |
+
<div class="text-center text-gray-500 py-4">Nenhum histórico disponível</div>
|
| 232 |
+
</div>
|
| 233 |
+
</div>
|
| 234 |
+
</div>
|
| 235 |
+
</div>
|
| 236 |
+
|
| 237 |
+
<!-- Output Section -->
|
| 238 |
+
<div class="flex-1">
|
| 239 |
+
<div class="bg-gray-800 rounded-xl shadow-lg overflow-hidden h-full">
|
| 240 |
+
<div class="bg-gray-700 px-4 py-3 flex items-center justify-between">
|
| 241 |
+
<div class="flex items-center space-x-2">
|
| 242 |
+
<div class="w-3 h-3 rounded-full bg-red-500"></div>
|
| 243 |
+
<div class="w-3 h-3 rounded-full bg-yellow-500"></div>
|
| 244 |
+
<div class="w-3 h-3 rounded-full bg-green-500"></div>
|
| 245 |
+
</div>
|
| 246 |
+
<div class="flex items-center gap-2">
|
| 247 |
+
<h2 class="text-sm font-semibold">CÓDIGO GERADO</h2>
|
| 248 |
+
<span id="modelBadge" class="model-badge bg-purple-500 hidden">
|
| 249 |
+
<i class="fas fa-robot mr-1"></i>
|
| 250 |
+
<span class="model-name">Gemini</span>
|
| 251 |
+
</span>
|
| 252 |
+
</div>
|
| 253 |
+
<div class="flex gap-2">
|
| 254 |
+
<button id="copyBtn" class="text-gray-400 hover:text-white transition-colors" title="Copiar código">
|
| 255 |
+
<i class="far fa-copy"></i>
|
| 256 |
+
</button>
|
| 257 |
+
<button id="saveBtn" class="text-gray-400 hover:text-white transition-colors" title="Salvar código">
|
| 258 |
+
<i class="far fa-save"></i>
|
| 259 |
+
</button>
|
| 260 |
+
</div>
|
| 261 |
+
</div>
|
| 262 |
+
<div class="p-4 h-full">
|
| 263 |
+
<div id="codeOutput" class="code-editor bg-gray-900 rounded-lg p-4 h-96 overflow-auto whitespace-pre text-gray-300">
|
| 264 |
+
<div class="flex items-center justify-center h-full">
|
| 265 |
+
<div class="text-center text-gray-600">
|
| 266 |
+
<i class="fas fa-code text-4xl mb-3"></i>
|
| 267 |
+
<p>Seu código gerado aparecerá aqui</p>
|
| 268 |
+
</div>
|
| 269 |
+
</div>
|
| 270 |
+
</div>
|
| 271 |
+
|
| 272 |
+
<div class="mt-4 flex justify-between items-center">
|
| 273 |
+
<div class="flex items-center gap-2 text-sm text-gray-400">
|
| 274 |
+
<div id="statusIndicator" class="flex items-center gap-2">
|
| 275 |
+
<div class="w-2 h-2 rounded-full bg-gray-500"></div>
|
| 276 |
+
<span>Pronto</span>
|
| 277 |
+
</div>
|
| 278 |
+
</div>
|
| 279 |
+
<div class="flex gap-2">
|
| 280 |
+
<button id="downloadBtn" class="bg-gray-700 hover:bg-gray-600 text-gray-200 text-sm py-2 px-4 rounded-lg flex items-center gap-2 transition-all duration-300">
|
| 281 |
+
<i class="fas fa-download"></i> Baixar
|
| 282 |
+
</button>
|
| 283 |
+
<button id="explainBtn" class="bg-gray-700 hover:bg-gray-600 text-gray-200 text-sm py-2 px-4 rounded-lg flex items-center gap-2 transition-all duration-300">
|
| 284 |
+
<i class="fas fa-question-circle"></i> Explicar
|
| 285 |
+
</button>
|
| 286 |
+
<button id="optimizeBtn" class="bg-gray-700 hover:bg-gray-600 text-gray-200 text-sm py-2 px-4 rounded-lg flex items-center gap-2 transition-all duration-300">
|
| 287 |
+
<i class="fas fa-bolt"></i> Otimizar
|
| 288 |
+
</button>
|
| 289 |
+
</div>
|
| 290 |
+
</div>
|
| 291 |
+
</div>
|
| 292 |
+
</div>
|
| 293 |
+
</div>
|
| 294 |
+
</div>
|
| 295 |
+
|
| 296 |
+
<!-- Features Section -->
|
| 297 |
+
<div class="mt-16">
|
| 298 |
+
<h2 class="text-2xl font-bold text-center mb-8">Modelos de IA Disponíveis</h2>
|
| 299 |
+
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
|
| 300 |
+
<div class="bg-gray-800 rounded-xl p-6 hover:bg-gray-750 transition-all duration-300 group">
|
| 301 |
+
<div class="flex items-center gap-3 mb-4">
|
| 302 |
+
<div class="bg-gradient-to-r from-blue-500 to-blue-600 p-2 rounded-lg">
|
| 303 |
+
<i class="fas fa-robot text-white text-xl"></i>
|
| 304 |
+
</div>
|
| 305 |
+
<h3 class="text-xl font-semibold">Gemini Pro</h3>
|
| 306 |
+
</div>
|
| 307 |
+
<p class="text-gray-400">Modelo avançado da Google para geração de código e texto com alta precisão.</p>
|
| 308 |
+
<div class="mt-4 flex flex-wrap gap-2">
|
| 309 |
+
<span class="model-badge bg-blue-500">JavaScript</span>
|
| 310 |
+
<span class="model-badge bg-blue-500">Python</span>
|
| 311 |
+
<span class="model-badge bg-blue-500">HTML/CSS</span>
|
| 312 |
+
</div>
|
| 313 |
+
</div>
|
| 314 |
+
|
| 315 |
+
<div class="bg-gray-800 rounded-xl p-6 hover:bg-gray-750 transition-all duration-300 group">
|
| 316 |
+
<div class="flex items-center gap-3 mb-4">
|
| 317 |
+
<div class="bg-gradient-to-r from-green-500 to-green-600 p-2 rounded-lg">
|
| 318 |
+
<i class="fas fa-code text-white text-xl"></i>
|
| 319 |
+
</div>
|
| 320 |
+
<h3 class="text-xl font-semibold">DeepSeek Coder</h3>
|
| 321 |
+
</div>
|
| 322 |
+
<p class="text-gray-400">Modelo especializado em código com suporte para múltiplas linguagens e frameworks.</p>
|
| 323 |
+
<div class="mt-4 flex flex-wrap gap-2">
|
| 324 |
+
<span class="model-badge bg-green-500">React</span>
|
| 325 |
+
<span class="model-badge bg-green-500">Django</span>
|
| 326 |
+
<span class="model-badge bg-green-500">Rust</span>
|
| 327 |
+
</div>
|
| 328 |
+
</div>
|
| 329 |
+
|
| 330 |
+
<div class="bg-gray-800 rounded-xl p-6 hover:bg-gray-750 transition-all duration-300 group">
|
| 331 |
+
<div class="flex items-center gap-3 mb-4">
|
| 332 |
+
<div class="bg-gradient-to-r from-purple-500 to-purple-600 p-2 rounded-lg">
|
| 333 |
+
<i class="fas fa-brain text-white text-xl"></i>
|
| 334 |
+
</div>
|
| 335 |
+
<h3 class="text-xl font-semibold">Llama 3</h3>
|
| 336 |
+
</div>
|
| 337 |
+
<p class="text-gray-400">Modelo de código aberto da Meta com excelente desempenho em diversas tarefas.</p>
|
| 338 |
+
<div class="mt-4 flex flex-wrap gap-2">
|
| 339 |
+
<span class="model-badge bg-purple-500">Python</span>
|
| 340 |
+
<span class="model-badge bg-purple-500">Java</span>
|
| 341 |
+
<span class="model-badge bg-purple-500">C++</span>
|
| 342 |
+
</div>
|
| 343 |
+
</div>
|
| 344 |
+
|
| 345 |
+
<div class="bg-gray-800 rounded-xl p-6 hover:bg-gray-750 transition-all duration-300 group">
|
| 346 |
+
<div class="flex items-center gap-3 mb-4">
|
| 347 |
+
<div class="bg-gradient-to-r from-yellow-500 to-yellow-600 p-2 rounded-lg">
|
| 348 |
+
<i class="fas fa-bolt text-white text-xl"></i>
|
| 349 |
+
</div>
|
| 350 |
+
<h3 class="text-xl font-semibold">GPT-4</h3>
|
| 351 |
+
</div>
|
| 352 |
+
<p class="text-gray-400">O mais avançado modelo da OpenAI com capacidades excepcionais de geração de código.</p>
|
| 353 |
+
<div class="mt-4 flex flex-wrap gap-2">
|
| 354 |
+
<span class="model-badge bg-yellow-500">TypeScript</span>
|
| 355 |
+
<span class="model-badge bg-yellow-500">Swift</span>
|
| 356 |
+
<span class="model-badge bg-yellow-500">Kotlin</span>
|
| 357 |
+
</div>
|
| 358 |
+
</div>
|
| 359 |
+
</div>
|
| 360 |
+
</div>
|
| 361 |
+
|
| 362 |
+
<!-- Footer -->
|
| 363 |
+
<footer class="mt-16 text-center text-gray-500 text-sm">
|
| 364 |
+
<p>Multi-AI Code Generator © 2023 | Suporte para múltiplos modelos de IA</p>
|
| 365 |
+
<p class="mt-2">Suas chaves API são armazenadas localmente e nunca compartilhadas com terceiros.</p>
|
| 366 |
+
</footer>
|
| 367 |
+
</div>
|
| 368 |
+
|
| 369 |
+
<script>
|
| 370 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 371 |
+
// DOM Elements
|
| 372 |
+
const generateBtn = document.getElementById('generateBtn');
|
| 373 |
+
const clearBtn = document.getElementById('clearBtn');
|
| 374 |
+
const copyBtn = document.getElementById('copyBtn');
|
| 375 |
+
const saveBtn = document.getElementById('saveBtn');
|
| 376 |
+
const downloadBtn = document.getElementById('downloadBtn');
|
| 377 |
+
const explainBtn = document.getElementById('explainBtn');
|
| 378 |
+
const optimizeBtn = document.getElementById('optimizeBtn');
|
| 379 |
+
const promptInput = document.getElementById('promptInput');
|
| 380 |
+
const languageSelect = document.getElementById('languageSelect');
|
| 381 |
+
const frameworkSelect = document.getElementById('frameworkSelect');
|
| 382 |
+
const modelSelect = document.getElementById('modelSelect');
|
| 383 |
+
const toneSelect = document.getElementById('toneSelect');
|
| 384 |
+
const apiProviderSelect = document.getElementById('apiProviderSelect');
|
| 385 |
+
const codeOutput = document.getElementById('codeOutput');
|
| 386 |
+
const historyList = document.getElementById('historyList');
|
| 387 |
+
const clearHistoryBtn = document.getElementById('clearHistoryBtn');
|
| 388 |
+
const statusIndicator = document.getElementById('statusIndicator');
|
| 389 |
+
const modelBadge = document.getElementById('modelBadge');
|
| 390 |
+
|
| 391 |
+
// API Key Sections
|
| 392 |
+
const apiKeySections = {
|
| 393 |
+
gemini: document.getElementById('geminiApiKey'),
|
| 394 |
+
openai: document.getElementById('openaiApiKey'),
|
| 395 |
+
deepseek: document.getElementById('deepseekApiKey'),
|
| 396 |
+
anthropic: document.getElementById('anthropicApiKey'),
|
| 397 |
+
mistral: document.getElementById('mistralApiKey'),
|
| 398 |
+
meta: document.getElementById('metaApiKey'),
|
| 399 |
+
phind: document.getElementById('phindApiKey')
|
| 400 |
+
};
|
| 401 |
+
|
| 402 |
+
// API Key Inputs
|
| 403 |
+
const apiKeyInputs = {
|
| 404 |
+
gemini: document.getElementById('geminiApiKeyInput'),
|
| 405 |
+
openai: document.getElementById('openaiApiKeyInput'),
|
| 406 |
+
deepseek: document.getElementById('deepseekApiKeyInput'),
|
| 407 |
+
anthropic: document.getElementById('anthropicApiKeyInput'),
|
| 408 |
+
mistral: document.getElementById('mistralApiKeyInput'),
|
| 409 |
+
meta: document.getElementById('metaApiKeyInput'),
|
| 410 |
+
phind: document.getElementById('phindApiKeyInput')
|
| 411 |
+
};
|
| 412 |
+
|
| 413 |
+
// Model to API Provider mapping
|
| 414 |
+
const modelToProvider = {
|
| 415 |
+
gemini: 'gemini',
|
| 416 |
+
deepseek: 'deepseek',
|
| 417 |
+
llama: 'meta',
|
| 418 |
+
gpt4: 'openai',
|
| 419 |
+
claude: 'anthropic',
|
| 420 |
+
mistral: 'mistral',
|
| 421 |
+
codellama: 'meta',
|
| 422 |
+
phind: 'phind'
|
| 423 |
+
};
|
| 424 |
+
|
| 425 |
+
// Model display names
|
| 426 |
+
const modelDisplayNames = {
|
| 427 |
+
gemini: 'Gemini',
|
| 428 |
+
deepseek: 'DeepSeek',
|
| 429 |
+
llama: 'Llama',
|
| 430 |
+
gpt4: 'GPT-4',
|
| 431 |
+
claude: 'Claude',
|
| 432 |
+
mistral: 'Mistral',
|
| 433 |
+
codellama: 'CodeLlama',
|
| 434 |
+
phind: 'Phind'
|
| 435 |
+
};
|
| 436 |
+
|
| 437 |
+
// Model colors
|
| 438 |
+
const modelColors = {
|
| 439 |
+
gemini: 'bg-blue-500',
|
| 440 |
+
deepseek: 'bg-green-500',
|
| 441 |
+
llama: 'bg-purple-500',
|
| 442 |
+
gpt4: 'bg-yellow-500',
|
| 443 |
+
claude: 'bg-orange-500',
|
| 444 |
+
mistral: 'bg-indigo-500',
|
| 445 |
+
codellama: 'bg-purple-500',
|
| 446 |
+
phind: 'bg-pink-500'
|
| 447 |
+
};
|
| 448 |
+
|
| 449 |
+
// Initialize API keys from localStorage
|
| 450 |
+
Object.keys(apiKeyInputs).forEach(provider => {
|
| 451 |
+
const savedKey = localStorage.getItem(`${provider}ApiKey`);
|
| 452 |
+
if (savedKey) {
|
| 453 |
+
apiKeyInputs[provider].value = savedKey;
|
| 454 |
+
}
|
| 455 |
+
});
|
| 456 |
+
|
| 457 |
+
// Save API keys when changed
|
| 458 |
+
Object.keys(apiKeyInputs).forEach(provider => {
|
| 459 |
+
apiKeyInputs[provider].addEventListener('change', function() {
|
| 460 |
+
localStorage.setItem(`${provider}ApiKey`, this.value);
|
| 461 |
+
});
|
| 462 |
+
});
|
| 463 |
+
|
| 464 |
+
// Switch between API key sections
|
| 465 |
+
apiProviderSelect.addEventListener('change', function() {
|
| 466 |
+
Object.values(apiKeySections).forEach(section => {
|
| 467 |
+
section.classList.add('hidden');
|
| 468 |
+
});
|
| 469 |
+
|
| 470 |
+
const selectedProvider = this.value;
|
| 471 |
+
apiKeySections[selectedProvider].classList.remove('hidden');
|
| 472 |
+
});
|
| 473 |
+
|
| 474 |
+
// Update API provider when model changes
|
| 475 |
+
modelSelect.addEventListener('change', function() {
|
| 476 |
+
const selectedModel = this.value;
|
| 477 |
+
const provider = modelToProvider[selectedModel];
|
| 478 |
+
|
| 479 |
+
if (provider) {
|
| 480 |
+
apiProviderSelect.value = provider;
|
| 481 |
+
|
| 482 |
+
// Trigger change event to show correct API key section
|
| 483 |
+
const event = new Event('change');
|
| 484 |
+
apiProviderSelect.dispatchEvent(event);
|
| 485 |
+
}
|
| 486 |
+
});
|
| 487 |
+
|
| 488 |
+
// Generate code with selected AI model
|
| 489 |
+
generateBtn.addEventListener('click', async function() {
|
| 490 |
+
const prompt = promptInput.value.trim();
|
| 491 |
+
const language = languageSelect.value;
|
| 492 |
+
const framework = frameworkSelect.value;
|
| 493 |
+
const model = modelSelect.value;
|
| 494 |
+
const tone = toneSelect.value;
|
| 495 |
+
|
| 496 |
+
if (!prompt) {
|
| 497 |
+
showAlert('Por favor, descreva o código que deseja gerar', 'error');
|
| 498 |
+
return;
|
| 499 |
+
}
|
| 500 |
+
|
| 501 |
+
// Get the API key for the selected provider
|
| 502 |
+
const provider = modelToProvider[model];
|
| 503 |
+
const apiKey = apiKeyInputs[provider].value.trim();
|
| 504 |
+
|
| 505 |
+
if (!apiKey) {
|
| 506 |
+
showAlert(`Por favor, insira uma chave API válida para ${modelDisplayNames[model]}`, 'error');
|
| 507 |
+
return;
|
| 508 |
+
}
|
| 509 |
+
|
| 510 |
+
try {
|
| 511 |
+
setStatus('loading', `Gerando código com ${modelDisplayNames[model]}...`);
|
| 512 |
+
|
| 513 |
+
// Build the full prompt based on selections
|
| 514 |
+
let fullPrompt = `Gere um código em ${language}`;
|
| 515 |
+
if (framework !== 'none') {
|
| 516 |
+
fullPrompt += ` usando ${framework}`;
|
| 517 |
+
}
|
| 518 |
+
|
| 519 |
+
// Add tone instruction
|
| 520 |
+
const toneInstructions = {
|
| 521 |
+
default: '',
|
| 522 |
+
concise: 'Seja conciso e direto ao ponto.',
|
| 523 |
+
detailed: 'Forneça uma implementação detalhada com comentários explicativos.',
|
| 524 |
+
professional: 'Use um estilo profissional e formal.',
|
| 525 |
+
friendly: 'Use um tom amigável e acessível.'
|
| 526 |
+
};
|
| 527 |
+
|
| 528 |
+
fullPrompt += ` para: ${prompt}\n\n${toneInstructions[tone]}\n\nPor favor, retorne apenas o código, sem explicações ou comentários adicionais (a menos que solicitado no tom).`;
|
| 529 |
+
|
| 530 |
+
// Call the appropriate API based on selected model
|
| 531 |
+
let generatedCode;
|
| 532 |
+
switch(model) {
|
| 533 |
+
case 'gemini':
|
| 534 |
+
generatedCode = await callGeminiAPI(apiKey, fullPrompt);
|
| 535 |
+
break;
|
| 536 |
+
case 'deepseek':
|
| 537 |
+
generatedCode = await callDeepSeekAPI(apiKey, fullPrompt);
|
| 538 |
+
break;
|
| 539 |
+
case 'llama':
|
| 540 |
+
case 'codellama':
|
| 541 |
+
generatedCode = await callLlamaAPI(apiKey, fullPrompt);
|
| 542 |
+
break;
|
| 543 |
+
case 'gpt4':
|
| 544 |
+
generatedCode = await callOpenAIAPI(apiKey, fullPrompt);
|
| 545 |
+
break;
|
| 546 |
+
case 'claude':
|
| 547 |
+
generatedCode = await callClaudeAPI(apiKey, fullPrompt);
|
| 548 |
+
break;
|
| 549 |
+
case 'mistral':
|
| 550 |
+
generatedCode = await callMistralAPI(apiKey, fullPrompt);
|
| 551 |
+
break;
|
| 552 |
+
case 'phind':
|
| 553 |
+
generatedCode = await callPhindAPI(apiKey, fullPrompt);
|
| 554 |
+
break;
|
| 555 |
+
default:
|
| 556 |
+
throw new Error('Modelo não suportado');
|
| 557 |
+
}
|
| 558 |
+
|
| 559 |
+
// Display the generated code
|
| 560 |
+
displayGeneratedCode(generatedCode, language, framework, prompt, model);
|
| 561 |
+
|
| 562 |
+
// Add to history
|
| 563 |
+
addToHistory(prompt, generatedCode, language, framework, model);
|
| 564 |
+
|
| 565 |
+
setStatus('success', `Código gerado com ${modelDisplayNames[model]}!`);
|
| 566 |
+
|
| 567 |
+
// Show model badge
|
| 568 |
+
updateModelBadge(model);
|
| 569 |
+
} catch (error) {
|
| 570 |
+
console.error('Error generating code:', error);
|
| 571 |
+
setStatus('error', 'Erro ao gerar código');
|
| 572 |
+
showAlert(`Erro ao gerar código com ${modelDisplayNames[model]}: ${error.message}`, 'error');
|
| 573 |
+
}
|
| 574 |
+
});
|
| 575 |
+
|
| 576 |
+
// Clear inputs
|
| 577 |
+
clearBtn.addEventListener('click', function() {
|
| 578 |
+
promptInput.value = '';
|
| 579 |
+
codeOutput.innerHTML = `
|
| 580 |
+
<div class="flex items-center justify-center h-full">
|
| 581 |
+
<div class="text-center text-gray-600">
|
| 582 |
+
<i class="fas fa-code text-4xl mb-3"></i>
|
| 583 |
+
<p>Seu código gerado aparecerá aqui</p>
|
| 584 |
+
</div>
|
| 585 |
+
</div>
|
| 586 |
+
`;
|
| 587 |
+
setStatus('ready', 'Pronto');
|
| 588 |
+
modelBadge.classList.add('hidden');
|
| 589 |
+
});
|
| 590 |
+
|
| 591 |
+
// Copy code to clipboard
|
| 592 |
+
copyBtn.addEventListener('click', function() {
|
| 593 |
+
const code = codeOutput.textContent;
|
| 594 |
+
if (!code || code.includes('Seu código gerado aparecerá aqui')) {
|
| 595 |
+
showAlert('Nenhum código para copiar', 'warning');
|
| 596 |
+
return;
|
| 597 |
+
}
|
| 598 |
+
|
| 599 |
+
navigator.clipboard.writeText(code)
|
| 600 |
+
.then(() => showAlert('Código copiado para a área de transferência!', 'success'))
|
| 601 |
+
.catch(err => showAlert('Falha ao copiar código: ' + err, 'error'));
|
| 602 |
+
});
|
| 603 |
+
|
| 604 |
+
// Save code to localStorage
|
| 605 |
+
saveBtn.addEventListener('click', function() {
|
| 606 |
+
const code = codeOutput.textContent;
|
| 607 |
+
if (!code || code.includes('Seu código gerado aparecerá aqui')) {
|
| 608 |
+
showAlert('Nenhum código para salvar', 'warning');
|
| 609 |
+
return;
|
| 610 |
+
}
|
| 611 |
+
|
| 612 |
+
const savedSnippets = JSON.parse(localStorage.getItem('savedSnippets') || '[]');
|
| 613 |
+
const snippet = {
|
| 614 |
+
id: Date.now(),
|
| 615 |
+
code: code,
|
| 616 |
+
language: languageSelect.value,
|
| 617 |
+
framework: frameworkSelect.value,
|
| 618 |
+
timestamp: new Date().toISOString(),
|
| 619 |
+
model: modelSelect.value
|
| 620 |
+
};
|
| 621 |
+
|
| 622 |
+
savedSnippets.unshift(snippet);
|
| 623 |
+
localStorage.setItem('savedSnippets', JSON.stringify(savedSnippets));
|
| 624 |
+
|
| 625 |
+
showAlert('Código salvo localmente!', 'success');
|
| 626 |
+
});
|
| 627 |
+
|
| 628 |
+
// Download code
|
| 629 |
+
downloadBtn.addEventListener('click', function() {
|
| 630 |
+
const code = codeOutput.textContent;
|
| 631 |
+
if (!code || code.includes('Seu código gerado aparecerá aqui')) {
|
| 632 |
+
showAlert('Nenhum código para baixar', 'warning');
|
| 633 |
+
return;
|
| 634 |
+
}
|
| 635 |
+
|
| 636 |
+
const language = languageSelect.value;
|
| 637 |
+
const framework = frameworkSelect.value;
|
| 638 |
+
|
| 639 |
+
let extension = '';
|
| 640 |
+
switch(language) {
|
| 641 |
+
case 'javascript': extension = framework === 'none' ? '.js' : '.jsx'; break;
|
| 642 |
+
case 'python': extension = '.py'; break;
|
| 643 |
+
case 'java': extension = '.java'; break;
|
| 644 |
+
case 'csharp': extension = '.cs'; break;
|
| 645 |
+
case 'php': extension = '.php'; break;
|
| 646 |
+
case 'html': extension = '.html'; break;
|
| 647 |
+
case 'css': extension = '.css'; break;
|
| 648 |
+
case 'typescript': extension = '.ts'; break;
|
| 649 |
+
case 'go': extension = '.go'; break;
|
| 650 |
+
case 'rust': extension = '.rs'; break;
|
| 651 |
+
case 'swift': extension = '.swift'; break;
|
| 652 |
+
case 'kotlin': extension = '.kt'; break;
|
| 653 |
+
default: extension = '.txt';
|
| 654 |
+
}
|
| 655 |
+
|
| 656 |
+
const filename = `code-${language}${framework !== 'none' ? `-${framework}` : ''}-${Date.now()}${extension}`;
|
| 657 |
+
const blob = new Blob([code], { type: 'text/plain' });
|
| 658 |
+
const url = URL.createObjectURL(blob);
|
| 659 |
+
const a = document.createElement('a');
|
| 660 |
+
a.href = url;
|
| 661 |
+
a.download = filename;
|
| 662 |
+
document.body.appendChild(a);
|
| 663 |
+
a.click();
|
| 664 |
+
document.body.removeChild(a);
|
| 665 |
+
URL.revokeObjectURL(url);
|
| 666 |
+
|
| 667 |
+
showAlert(`Código baixado como ${filename}`, 'success');
|
| 668 |
+
});
|
| 669 |
+
|
| 670 |
+
// Explain code
|
| 671 |
+
explainBtn.addEventListener('click', async function() {
|
| 672 |
+
const code = codeOutput.textContent;
|
| 673 |
+
if (!code || code.includes('Seu código gerado aparecerá aqui')) {
|
| 674 |
+
showAlert('Nenhum código para explicar', 'warning');
|
| 675 |
+
return;
|
| 676 |
+
}
|
| 677 |
+
|
| 678 |
+
const model = modelSelect.value;
|
| 679 |
+
const provider = modelToProvider[model];
|
| 680 |
+
const apiKey = apiKeyInputs[provider].value.trim();
|
| 681 |
+
|
| 682 |
+
if (!apiKey) {
|
| 683 |
+
showAlert(`Por favor, insira uma chave API válida para ${modelDisplayNames[model]}`, 'error');
|
| 684 |
+
return;
|
| 685 |
+
}
|
| 686 |
+
|
| 687 |
+
try {
|
| 688 |
+
setStatus('loading', 'Gerando explicação...');
|
| 689 |
+
|
| 690 |
+
const prompt = `Explique o seguinte código passo a passo em português:\n\n${code}\n\nPor favor, organize a explicação em tópicos claros e concisos, destacando a lógica e funcionalidades principais.`;
|
| 691 |
+
|
| 692 |
+
let explanation;
|
| 693 |
+
switch(model) {
|
| 694 |
+
case 'gemini':
|
| 695 |
+
explanation = await callGeminiAPI(apiKey, prompt);
|
| 696 |
+
break;
|
| 697 |
+
case 'deepseek':
|
| 698 |
+
explanation = await callDeepSeekAPI(apiKey, prompt);
|
| 699 |
+
break;
|
| 700 |
+
case 'llama':
|
| 701 |
+
case 'codellama':
|
| 702 |
+
explanation = await callLlamaAPI(apiKey, prompt);
|
| 703 |
+
break;
|
| 704 |
+
case 'gpt4':
|
| 705 |
+
explanation = await callOpenAIAPI(apiKey, prompt);
|
| 706 |
+
break;
|
| 707 |
+
case 'claude':
|
| 708 |
+
explanation = await callClaudeAPI(apiKey, prompt);
|
| 709 |
+
break;
|
| 710 |
+
case 'mistral':
|
| 711 |
+
explanation = await callMistralAPI(apiKey, prompt);
|
| 712 |
+
break;
|
| 713 |
+
case 'phind':
|
| 714 |
+
explanation = await callPhindAPI(apiKey, prompt);
|
| 715 |
+
break;
|
| 716 |
+
default:
|
| 717 |
+
throw new Error('Modelo não suportado');
|
| 718 |
+
}
|
| 719 |
+
|
| 720 |
+
// Create a modal to show the explanation
|
| 721 |
+
showExplanationModal(explanation, model);
|
| 722 |
+
|
| 723 |
+
setStatus('success', 'Explicação gerada!');
|
| 724 |
+
} catch (error) {
|
| 725 |
+
console.error('Error generating explanation:', error);
|
| 726 |
+
setStatus('error', 'Erro ao gerar explicação');
|
| 727 |
+
showAlert('Erro ao gerar explicação: ' + error.message, 'error');
|
| 728 |
+
}
|
| 729 |
+
});
|
| 730 |
+
|
| 731 |
+
// Optimize code
|
| 732 |
+
optimizeBtn.addEventListener('click', async function() {
|
| 733 |
+
const code = codeOutput.textContent;
|
| 734 |
+
if (!code || code.includes('Seu código gerado aparecerá aqui')) {
|
| 735 |
+
showAlert('Nenhum código para otimizar', 'warning');
|
| 736 |
+
return;
|
| 737 |
+
}
|
| 738 |
+
|
| 739 |
+
const model = modelSelect.value;
|
| 740 |
+
const provider = modelToProvider[model];
|
| 741 |
+
const apiKey = apiKeyInputs[provider].value.trim();
|
| 742 |
+
|
| 743 |
+
if (!apiKey) {
|
| 744 |
+
showAlert(`Por favor, insira uma chave API válida para ${modelDisplayNames[model]}`, 'error');
|
| 745 |
+
return;
|
| 746 |
+
}
|
| 747 |
+
|
| 748 |
+
try {
|
| 749 |
+
setStatus('loading', 'Otimizando código...');
|
| 750 |
+
|
| 751 |
+
const language = languageSelect.value;
|
| 752 |
+
const framework = frameworkSelect.value;
|
| 753 |
+
|
| 754 |
+
const prompt = `Otimize o seguinte código em ${language}${framework !== 'none' ? ` usando ${framework}` : ''}:\n\n${code}\n\nPor favor, retorne apenas o código otimizado, sem explicações ou comentários adicionais. Aplique as melhores práticas para a linguagem e framework.`;
|
| 755 |
+
|
| 756 |
+
let optimizedCode;
|
| 757 |
+
switch(model) {
|
| 758 |
+
case 'gemini':
|
| 759 |
+
optimizedCode = await callGeminiAPI(apiKey, prompt);
|
| 760 |
+
break;
|
| 761 |
+
case 'deepseek':
|
| 762 |
+
optimizedCode = await callDeepSeekAPI(apiKey, prompt);
|
| 763 |
+
break;
|
| 764 |
+
case 'llama':
|
| 765 |
+
case 'codellama':
|
| 766 |
+
optimizedCode = await callLlamaAPI(apiKey, prompt);
|
| 767 |
+
break;
|
| 768 |
+
case 'gpt4':
|
| 769 |
+
optimizedCode = await callOpenAIAPI(apiKey, prompt);
|
| 770 |
+
break;
|
| 771 |
+
case 'claude':
|
| 772 |
+
optimizedCode = await callClaudeAPI(apiKey, prompt);
|
| 773 |
+
break;
|
| 774 |
+
case 'mistral':
|
| 775 |
+
optimizedCode = await callMistralAPI(apiKey, prompt);
|
| 776 |
+
break;
|
| 777 |
+
case 'phind':
|
| 778 |
+
optimizedCode = await callPhindAPI(apiKey, prompt);
|
| 779 |
+
break;
|
| 780 |
+
default:
|
| 781 |
+
throw new Error('Modelo não suportado');
|
| 782 |
+
}
|
| 783 |
+
|
| 784 |
+
// Display the optimized code
|
| 785 |
+
displayGeneratedCode(optimizedCode, language, framework, `Otimização de: ${promptInput.value}`, model);
|
| 786 |
+
|
| 787 |
+
// Add to history
|
| 788 |
+
addToHistory(`Otimização: ${promptInput.value}`, optimizedCode, language, framework, model);
|
| 789 |
+
|
| 790 |
+
setStatus('success', 'Código otimizado!');
|
| 791 |
+
|
| 792 |
+
// Show model badge
|
| 793 |
+
updateModelBadge(model);
|
| 794 |
+
} catch (error) {
|
| 795 |
+
console.error('Error optimizing code:', error);
|
| 796 |
+
setStatus('error', 'Erro ao otimizar código');
|
| 797 |
+
showAlert('Erro ao otimizar código: ' + error.message, 'error');
|
| 798 |
+
}
|
| 799 |
+
});
|
| 800 |
+
|
| 801 |
+
// Clear history
|
| 802 |
+
clearHistoryBtn.addEventListener('click', function() {
|
| 803 |
+
localStorage.removeItem('codeHistory');
|
| 804 |
+
historyList.innerHTML = `
|
| 805 |
+
<div class="text-center text-gray-500 py-4">
|
| 806 |
+
Nenhum histórico disponível
|
| 807 |
+
</div>
|
| 808 |
+
`;
|
| 809 |
+
showAlert('Histórico limpo com sucesso!', 'success');
|
| 810 |
+
});
|
| 811 |
+
|
| 812 |
+
// API Functions
|
| 813 |
+
async function callGeminiAPI(apiKey, prompt) {
|
| 814 |
+
const apiUrl = `https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=${apiKey}`;
|
| 815 |
+
|
| 816 |
+
const response = await fetch(apiUrl, {
|
| 817 |
+
method: 'POST',
|
| 818 |
+
headers: {
|
| 819 |
+
'Content-Type': 'application/json',
|
| 820 |
+
},
|
| 821 |
+
body: JSON.stringify({
|
| 822 |
+
contents: [{
|
| 823 |
+
parts: [{
|
| 824 |
+
text: prompt
|
| 825 |
+
}]
|
| 826 |
+
}]
|
| 827 |
+
})
|
| 828 |
+
});
|
| 829 |
+
|
| 830 |
+
if (!response.ok) {
|
| 831 |
+
const errorData = await response.json();
|
| 832 |
+
throw new Error(errorData.error?.message || 'Falha na chamada da API Gemini');
|
| 833 |
+
}
|
| 834 |
+
|
| 835 |
+
const data = await response.json();
|
| 836 |
+
return data.candidates?.[0]?.content?.parts?.[0]?.text || 'Nenhum código foi gerado. Por favor, tente novamente com uma descrição mais detalhada.';
|
| 837 |
+
}
|
| 838 |
+
|
| 839 |
+
async function callDeepSeekAPI(apiKey, prompt) {
|
| 840 |
+
// Simulated API call - replace with actual DeepSeek API implementation
|
| 841 |
+
return simulateAPICall(apiKey, prompt, 'DeepSeek');
|
| 842 |
+
}
|
| 843 |
+
|
| 844 |
+
async function callLlamaAPI(apiKey, prompt) {
|
| 845 |
+
// Simulated API call - replace with actual Llama API implementation
|
| 846 |
+
return simulateAPICall(apiKey, prompt, 'Llama');
|
| 847 |
+
}
|
| 848 |
+
|
| 849 |
+
async function callOpenAIAPI(apiKey, prompt) {
|
| 850 |
+
// Simulated API call - replace with actual OpenAI API implementation
|
| 851 |
+
return simulateAPICall(apiKey, prompt, 'GPT-4');
|
| 852 |
+
}
|
| 853 |
+
|
| 854 |
+
async function callClaudeAPI(apiKey, prompt) {
|
| 855 |
+
// Simulated API call - replace with actual Claude API implementation
|
| 856 |
+
return simulateAPICall(apiKey, prompt, 'Claude');
|
| 857 |
+
}
|
| 858 |
+
|
| 859 |
+
async function callMistralAPI(apiKey, prompt) {
|
| 860 |
+
// Simulated API call - replace with actual Mistral API implementation
|
| 861 |
+
return simulateAPICall(apiKey, prompt, 'Mistral');
|
| 862 |
+
}
|
| 863 |
+
|
| 864 |
+
async function callPhindAPI(apiKey, prompt) {
|
| 865 |
+
// Simulated API call - replace with actual Phind API implementation
|
| 866 |
+
return simulateAPICall(apiKey, prompt, 'Phind');
|
| 867 |
+
}
|
| 868 |
+
|
| 869 |
+
// Simulate API call for demonstration
|
| 870 |
+
async function simulateAPICall(apiKey, prompt, modelName) {
|
| 871 |
+
if (!apiKey || apiKey.length < 10) {
|
| 872 |
+
throw new Error(`Chave API ${modelName} inválida`);
|
| 873 |
+
}
|
| 874 |
+
|
| 875 |
+
// Simulate API delay
|
| 876 |
+
await new Promise(resolve => setTimeout(resolve, 1500 + Math.random() * 1000));
|
| 877 |
+
|
| 878 |
+
// Simulate different responses based on model
|
| 879 |
+
const responses = {
|
| 880 |
+
'DeepSeek': `// Código gerado pelo DeepSeek Coder\n// ${prompt.substring(0, 50)}...\n\nfunction generatedCode() {\n // Implementação simulada\n return "Hello from DeepSeek";\n}`,
|
| 881 |
+
'Llama': `// Código Llama 3\n// ${prompt.substring(0, 50)}...\n\nconst llamaCode = () => {\n // Código eficiente\n return "Llama power";\n};`,
|
| 882 |
+
'GPT-4': `// GPT-4 Generated Code\n// ${prompt.substring(0, 50)}...\n\ndef gpt4_code():\n """Advanced implementation"""\n return "GPT-4 magic"`,
|
| 883 |
+
'Claude': `// Claude's Implementation\n// ${prompt.substring(0, 50)}...\n\nclass ClaudeCode {\n method() {\n return "Claude's approach";\n }\n}`,
|
| 884 |
+
'Mistral': `// Mistral Generated\n// ${prompt.substring(0, 50)}...\n\nfn mistral_code() -> String {\n // Efficient Rust code\n "Mistral winds".to_string()\n}`,
|
| 885 |
+
'Phind': `// Phind Solution\n// ${prompt.substring(0, 50)}...\n\npublic class PhindCode {\n public static void main(String[] args) {\n System.out.println("Phind answer");\n }\n}`
|
| 886 |
+
};
|
| 887 |
+
|
| 888 |
+
return responses[modelName] || `// Código gerado\n// ${prompt.substring(0, 50)}...\n\n// Implementação básica\nconsole.log("Hello World");`;
|
| 889 |
+
}
|
| 890 |
+
|
| 891 |
+
// Display generated code
|
| 892 |
+
function displayGeneratedCode(code, language, framework, prompt, model) {
|
| 893 |
+
// Create a pre element with syntax highlighting
|
| 894 |
+
const pre = document.createElement('pre');
|
| 895 |
+
const codeElement = document.createElement('code');
|
| 896 |
+
|
| 897 |
+
// Set the code content
|
| 898 |
+
codeElement.textContent = code;
|
| 899 |
+
|
| 900 |
+
// Add language class for syntax highlighting (you would need a library like Prism.js for real highlighting)
|
| 901 |
+
codeElement.className = `language-${language}`;
|
| 902 |
+
|
| 903 |
+
// Create a copy button
|
| 904 |
+
const copyButton = document.createElement('button');
|
| 905 |
+
copyButton.className = 'copy-btn';
|
| 906 |
+
copyButton.innerHTML = '<i class="far fa-copy"></i>';
|
| 907 |
+
copyButton.title = 'Copiar código';
|
| 908 |
+
copyButton.addEventListener('click', () => {
|
| 909 |
+
navigator.clipboard.writeText(code)
|
| 910 |
+
.then(() => showAlert('Código copiado!', 'success'))
|
| 911 |
+
.catch(err => console.error('Failed to copy:', err));
|
| 912 |
+
});
|
| 913 |
+
|
| 914 |
+
// Append elements
|
| 915 |
+
pre.appendChild(codeElement);
|
| 916 |
+
pre.appendChild(copyButton);
|
| 917 |
+
|
| 918 |
+
// Clear and set the output
|
| 919 |
+
codeOutput.innerHTML = '';
|
| 920 |
+
codeOutput.appendChild(pre);
|
| 921 |
+
}
|
| 922 |
+
|
| 923 |
+
// Add to history
|
| 924 |
+
function addToHistory(prompt, code, language, framework, model) {
|
| 925 |
+
// Load history from localStorage
|
| 926 |
+
const history = JSON.parse(localStorage.getItem('codeHistory') || '[]');
|
| 927 |
+
|
| 928 |
+
// Create history item if list is empty
|
| 929 |
+
if (historyList.firstChild?.textContent?.includes('Nenhum histórico disponível')) {
|
| 930 |
+
historyList.innerHTML = '';
|
| 931 |
+
}
|
| 932 |
+
|
| 933 |
+
const historyItem = {
|
| 934 |
+
id: Date.now(),
|
| 935 |
+
prompt: prompt,
|
| 936 |
+
code: code,
|
| 937 |
+
language: language,
|
| 938 |
+
framework: framework,
|
| 939 |
+
model: model,
|
| 940 |
+
timestamp: new Date().toISOString()
|
| 941 |
+
};
|
| 942 |
+
|
| 943 |
+
// Add to beginning of array (newest first)
|
| 944 |
+
history.unshift(historyItem);
|
| 945 |
+
|
| 946 |
+
// Limit to 10 items
|
| 947 |
+
if (history.length > 10) {
|
| 948 |
+
history.pop();
|
| 949 |
+
}
|
| 950 |
+
|
| 951 |
+
// Save to localStorage
|
| 952 |
+
localStorage.setItem('codeHistory', JSON.stringify(history));
|
| 953 |
+
|
| 954 |
+
// Update UI
|
| 955 |
+
renderHistoryList(history);
|
| 956 |
+
}
|
| 957 |
+
|
| 958 |
+
// Render history list
|
| 959 |
+
function renderHistoryList(history) {
|
| 960 |
+
historyList.innerHTML = '';
|
| 961 |
+
|
| 962 |
+
if (history.length === 0) {
|
| 963 |
+
historyList.innerHTML = `
|
| 964 |
+
<div class="text-center text-gray-500 py-4">
|
| 965 |
+
Nenhum histórico disponível
|
| 966 |
+
</div>
|
| 967 |
+
`;
|
| 968 |
+
return;
|
| 969 |
+
}
|
| 970 |
+
|
| 971 |
+
history.forEach(item => {
|
| 972 |
+
const historyItem = document.createElement('div');
|
| 973 |
+
historyItem.className = 'bg-gray-700 rounded-lg p-3 cursor-pointer hover:bg-gray-600 transition-colors';
|
| 974 |
+
historyItem.innerHTML = `
|
| 975 |
+
<div class="flex justify-between items-start">
|
| 976 |
+
<div class="truncate flex-1">${item.prompt}</div>
|
| 977 |
+
<div class="text-xs text-gray-400 ml-2 whitespace-nowrap">${new Date(item.timestamp).toLocaleTimeString()}</div>
|
| 978 |
+
</div>
|
| 979 |
+
<div class="flex justify-between items-center mt-1">
|
| 980 |
+
<div class="text-xs text-gray-400">${item.language}${item.framework !== 'none' ? ` + ${item.framework}` : ''}</div>
|
| 981 |
+
<span class="model-badge text-xs ${modelColors[item.model] || 'bg-gray-500'}">
|
| 982 |
+
${modelDisplayNames[item.model] || 'AI'}
|
| 983 |
+
</span>
|
| 984 |
+
</div>
|
| 985 |
+
`;
|
| 986 |
+
|
| 987 |
+
historyItem.addEventListener('click', () => {
|
| 988 |
+
displayGeneratedCode(item.code, item.language, item.framework, item.prompt, item.model);
|
| 989 |
+
setStatus('info', 'Código carregado do histórico');
|
| 990 |
+
updateModelBadge(item.model);
|
| 991 |
+
});
|
| 992 |
+
|
| 993 |
+
historyList.appendChild(historyItem);
|
| 994 |
+
});
|
| 995 |
+
}
|
| 996 |
+
|
| 997 |
+
// Update model badge
|
| 998 |
+
function updateModelBadge(model) {
|
| 999 |
+
if (!model) {
|
| 1000 |
+
modelBadge.classList.add('hidden');
|
| 1001 |
+
return;
|
| 1002 |
+
}
|
| 1003 |
+
|
| 1004 |
+
modelBadge.className = `model-badge ${modelColors[model] || 'bg-purple-500'} flex items-center`;
|
| 1005 |
+
modelBadge.innerHTML = `
|
| 1006 |
+
<i class="fas fa-robot mr-1"></i>
|
| 1007 |
+
<span class="model-name">${modelDisplayNames[model] || 'AI'}</span>
|
| 1008 |
+
`;
|
| 1009 |
+
modelBadge.classList.remove('hidden');
|
| 1010 |
+
}
|
| 1011 |
+
|
| 1012 |
+
// Set status indicator
|
| 1013 |
+
function setStatus(state, message) {
|
| 1014 |
+
const indicator = statusIndicator.querySelector('div');
|
| 1015 |
+
const text = statusIndicator.querySelector('span');
|
| 1016 |
+
|
| 1017 |
+
indicator.className = 'w-2 h-2 rounded-full';
|
| 1018 |
+
text.textContent = message;
|
| 1019 |
+
|
| 1020 |
+
switch(state) {
|
| 1021 |
+
case 'loading':
|
| 1022 |
+
indicator.classList.add('bg-yellow-500', 'animate-pulse');
|
| 1023 |
+
break;
|
| 1024 |
+
case 'success':
|
| 1025 |
+
indicator.classList.add('bg-green-500');
|
| 1026 |
+
break;
|
| 1027 |
+
case 'error':
|
| 1028 |
+
indicator.classList.add('bg-red-500');
|
| 1029 |
+
break;
|
| 1030 |
+
case 'ready':
|
| 1031 |
+
indicator.classList.add('bg-gray-500');
|
| 1032 |
+
break;
|
| 1033 |
+
case 'info':
|
| 1034 |
+
indicator.classList.add('bg-blue-500');
|
| 1035 |
+
break;
|
| 1036 |
+
}
|
| 1037 |
+
}
|
| 1038 |
+
|
| 1039 |
+
// Show alert
|
| 1040 |
+
function showAlert(message, type) {
|
| 1041 |
+
// Remove existing alerts
|
| 1042 |
+
const existingAlert = document.querySelector('.custom-alert');
|
| 1043 |
+
if (existingAlert) existingAlert.remove();
|
| 1044 |
+
|
| 1045 |
+
const alert = document.createElement('div');
|
| 1046 |
+
alert.className = `custom-alert fixed top-4 right-4 px-4 py-3 rounded-lg shadow-lg z-50 flex items-center gap-3 ${
|
| 1047 |
+
type === 'error' ? 'bg-red-600' :
|
| 1048 |
+
type === 'success' ? 'bg-green-600' :
|
| 1049 |
+
type === 'warning' ? 'bg-yellow-600' : 'bg-blue-600'
|
| 1050 |
+
}`;
|
| 1051 |
+
|
| 1052 |
+
alert.innerHTML = `
|
| 1053 |
+
<i class="fas ${
|
| 1054 |
+
type === 'error' ? 'fa-exclamation-circle' :
|
| 1055 |
+
type === 'success' ? 'fa-check-circle' :
|
| 1056 |
+
type === 'warning' ? 'fa-exclamation-triangle' : 'fa-info-circle'
|
| 1057 |
+
}"></i>
|
| 1058 |
+
<span>${message}</span>
|
| 1059 |
+
`;
|
| 1060 |
+
|
| 1061 |
+
document.body.appendChild(alert);
|
| 1062 |
+
|
| 1063 |
+
setTimeout(() => {
|
| 1064 |
+
alert.style.opacity = '0';
|
| 1065 |
+
setTimeout(() => alert.remove(), 300);
|
| 1066 |
+
}, 3000);
|
| 1067 |
+
}
|
| 1068 |
+
|
| 1069 |
+
// Show explanation modal
|
| 1070 |
+
function showExplanationModal(explanation, model) {
|
| 1071 |
+
const modal = document.createElement('div');
|
| 1072 |
+
modal.className = 'fixed inset-0 bg-black bg-opacity-70 flex items-center justify-center z-50 p-4';
|
| 1073 |
+
modal.innerHTML = `
|
| 1074 |
+
<div class="bg-gray-800 rounded-xl max-w-2xl w-full max-h-[80vh] overflow-hidden flex flex-col">
|
| 1075 |
+
<div class="bg-gray-700 px-4 py-3 flex items-center justify-between">
|
| 1076 |
+
<div class="flex items-center gap-2">
|
| 1077 |
+
<h3 class="font-semibold">Explicação do Código</h3>
|
| 1078 |
+
<span class="model-badge ${modelColors[model] || 'bg-purple-500'} text-xs">
|
| 1079 |
+
${modelDisplayNames[model] || 'AI'}
|
| 1080 |
+
</span>
|
| 1081 |
+
</div>
|
| 1082 |
+
<button class="text-gray-400 hover:text-white" id="closeExplanation">
|
| 1083 |
+
<i class="fas fa-times"></i>
|
| 1084 |
+
</button>
|
| 1085 |
+
</div>
|
| 1086 |
+
<div class="p-4 overflow-y-auto flex-1">
|
| 1087 |
+
<div class="whitespace-pre-line text-gray-300">${explanation}</div>
|
| 1088 |
+
</div>
|
| 1089 |
+
<div class="bg-gray-700 px-4 py-3 flex justify-end gap-2">
|
| 1090 |
+
<button class="bg-gray-600 hover:bg-gray-500 text-white px-4 py-2 rounded-lg" id="copyExplanation">
|
| 1091 |
+
<i class="far fa-copy mr-2"></i>Copiar
|
| 1092 |
+
</button>
|
| 1093 |
+
<button class="bg-purple-600 hover:bg-purple-700 text-white px-4 py-2 rounded-lg" id="saveExplanation">
|
| 1094 |
+
<i class="far fa-save mr-2"></i>Salvar
|
| 1095 |
+
</button>
|
| 1096 |
+
</div>
|
| 1097 |
+
</div>
|
| 1098 |
+
`;
|
| 1099 |
+
|
| 1100 |
+
document.body.appendChild(modal);
|
| 1101 |
+
|
| 1102 |
+
// Close button
|
| 1103 |
+
modal.querySelector('#closeExplanation').addEventListener('click', () => {
|
| 1104 |
+
modal.remove();
|
| 1105 |
+
});
|
| 1106 |
+
|
| 1107 |
+
// Copy explanation button
|
| 1108 |
+
modal.querySelector('#copyExplanation').addEventListener('click', () => {
|
| 1109 |
+
navigator.clipboard.writeText(explanation)
|
| 1110 |
+
.then(() => showAlert('Explicação copiada!', 'success'))
|
| 1111 |
+
.catch(err => showAlert('Falha ao copiar explicação: ' + err, 'error'));
|
| 1112 |
+
});
|
| 1113 |
+
|
| 1114 |
+
// Save explanation button
|
| 1115 |
+
modal.querySelector('#saveExplanation').addEventListener('click', () => {
|
| 1116 |
+
const savedExplanations = JSON.parse(localStorage.getItem('savedExplanations') || '[]');
|
| 1117 |
+
const explanationItem = {
|
| 1118 |
+
id: Date.now(),
|
| 1119 |
+
explanation: explanation,
|
| 1120 |
+
model: model,
|
| 1121 |
+
timestamp: new Date().toISOString()
|
| 1122 |
+
};
|
| 1123 |
+
|
| 1124 |
+
savedExplanations.unshift(explanationItem);
|
| 1125 |
+
localStorage.setItem('savedExplanations', JSON.stringify(savedExplanations));
|
| 1126 |
+
|
| 1127 |
+
showAlert('Explicação salva localmente!', 'success');
|
| 1128 |
+
});
|
| 1129 |
+
|
| 1130 |
+
// Close when clicking outside
|
| 1131 |
+
modal.addEventListener('click', (e) => {
|
| 1132 |
+
if (e.target === modal) {
|
| 1133 |
+
modal.remove();
|
| 1134 |
+
}
|
| 1135 |
+
});
|
| 1136 |
+
}
|
| 1137 |
+
|
| 1138 |
+
// Load history on startup
|
| 1139 |
+
const savedHistory = JSON.parse(localStorage.getItem('codeHistory') || '[]');
|
| 1140 |
+
if (savedHistory.length > 0) {
|
| 1141 |
+
renderHistoryList(savedHistory);
|
| 1142 |
+
}
|
| 1143 |
+
});
|
| 1144 |
+
</script>
|
| 1145 |
+
<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=pedro21062013space/myspace" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 1146 |
+
</html>
|
prompts.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gerador de codigo com ia
|
| 2 |
+
tem que gerar use a chave API do gemini:AIzaSyBYKrqnytogNPk3xEG5yWZBZfM9JPBQPN0
|
| 3 |
+
tem que ter como selecionar os modelos e escolher o editor da chave API tenha varios modelos para selecionar de varios editores deepseek, llama, chat openai, gemini entre outros
|
| 4 |
+
tem que se comunicar com a chave API e tem que funcionar
|