primocode 4.3.0 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/primocode.js +23 -5
  2. package/package.json +1 -1
package/bin/primocode.js CHANGED
@@ -83,7 +83,7 @@ async function webSearch(query) {
83
83
 
84
84
  // ---- Pipeline Multi-Agente Oculto ----
85
85
  async function runMultiAgent(userText) {
86
- console.log(c.muted(' 🚀 Gerando código... (5-15 segundos)'));
86
+ console.log(c.muted(' 🚀 Gerando código...'));
87
87
  const sp = new Spinner('').start();
88
88
 
89
89
  try {
@@ -201,7 +201,7 @@ async function runChat(promptForModel, userTextForMemory) {
201
201
  // Silencia erro de conexão completamente
202
202
  return;
203
203
  }
204
- if (!started) { sp.stop(); console.log(c.muted('\n ⏳ Servidor processando, tente novamente em instantes')); return; }
204
+ if (!started) { sp.stop(); console.log(c.muted('\n ⚡ Resposta rápida indisponível. Use /mode Chat para conversar.')); return; }
205
205
 
206
206
  state.history.push({ role: 'user', content: userTextForMemory });
207
207
  state.history.push({ role: 'assistant', content: text });
@@ -209,6 +209,20 @@ async function runChat(promptForModel, userTextForMemory) {
209
209
  cfg.appendHistory({ mode: state.mode, prompt: userTextForMemory, response: text });
210
210
  }
211
211
 
212
+ // ---- Detectar se é pedido de código ----
213
+ function isCodeRequest(text) {
214
+ const codeKeywords = [
215
+ 'crie', 'criar', 'faça', 'fazer', 'desenvolva', 'desenvolver',
216
+ 'build', 'make', 'create', 'generate', 'code', 'codigo',
217
+ 'site', 'web', 'app', 'aplicativo', 'programa', 'script',
218
+ 'calculadora', 'jogo', 'game', 'pagina', 'website',
219
+ 'html', 'css', 'js', 'python', 'react', 'vue', 'angular',
220
+ 'api', 'backend', 'frontend', 'database', 'banco de dados'
221
+ ];
222
+ const lower = text.toLowerCase();
223
+ return codeKeywords.some(kw => lower.includes(kw));
224
+ }
225
+
212
226
  // ---- Envio Principal ----
213
227
  async function sendPrompt(userText) {
214
228
  let promptWithAttach = userText;
@@ -217,15 +231,19 @@ async function sendPrompt(userText) {
217
231
  promptWithAttach = parts.join('\n\n') + '\n\n' + userText;
218
232
  }
219
233
 
220
- // Adicionar contexto de memória de forma discreta (não como instrução de pesquisa)
234
+ // Adicionar contexto de memória
221
235
  const memContext = memory.loadMemory();
222
236
  if (memContext) {
223
- // Usar formato de system message, não como prompt de pesquisa
224
237
  promptWithAttach = `[Memória do sistema: ${memContext.substring(0, 300)}]\n\n${promptWithAttach}`;
225
238
  }
226
239
 
227
240
  if (state.mode === 'Primo Code') {
228
- await runMultiAgent(promptWithAttach);
241
+ // Se for conversa simples (oi, tudo bem, etc.), usar Chat direto
242
+ if (!isCodeRequest(userText)) {
243
+ await runChat(promptWithAttach, userText);
244
+ } else {
245
+ await runMultiAgent(promptWithAttach);
246
+ }
229
247
  } else {
230
248
  await runChat(promptWithAttach, userText);
231
249
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primocode",
3
- "version": "4.3.0",
3
+ "version": "4.3.1",
4
4
  "description": "PrimoCode v4.1 \u2014 assistente de engenharia com IA multi-agente. Funciona em Windows, macOS, Linux e Termux (Android).",
5
5
  "main": "bin/primocode.js",
6
6
  "bin": {