Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Python
__pycache__/
*.py[cod]
*.pyo
*.egg-info/
dist/
build/
*.egg
*.whl

# Virtual environments
venv/
.venv/
env/
.env/

# IDE
.vscode/
.idea/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db

# User config & credentials
.npmai_agent/
Desktop_App/app_config.json

# Build artifacts
*.exe
*.zip
*.dmg

# Logs
*.log
20 changes: 10 additions & 10 deletions Desktop_App/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
THIS IS NOT YET DEPLOYED.
Here it is about Desktop APP.
"""
import sys, os, math, random, threading, json
import sys, os, math, random, json
from pathlib import Path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))

Expand Down Expand Up @@ -77,7 +77,7 @@ def _load_llm_stage_config() -> dict:
cfg = {}

for stage_key, _, _ in AGENT_STAGES:
if stage_key not in cfg: # ← only this line changed
if stage_key not in cfg:
cfg[stage_key] = {
"provider": "npmai",
"model": LLM_PROVIDERS["npmai"]["model_default"]
Expand Down Expand Up @@ -315,8 +315,8 @@ def _tick(self):
if self._pulse<=0: self._pd=1
self.update()

def enterEvent(self,e): self._h=1.0
def leaveEvent(self,e): self._h=0.0
def enterEvent(self,e): self._h=1.0; super().enterEvent(e)
def leaveEvent(self,e): self._h=0.0; super().leaveEvent(e)
def mousePressEvent(self,e): self._press=True; super().mousePressEvent(e)
def mouseReleaseEvent(self,e): self._press=False; super().mouseReleaseEvent(e)

Expand Down Expand Up @@ -345,8 +345,8 @@ def __init__(self,text,accent="#2AFFA0",parent=None):
self.setFont(QFont("Segoe UI",11,QFont.DemiBold))
QTimer(self,timeout=self.update,interval=16).start()

def enterEvent(self,e): self._h=1.0
def leaveEvent(self,e): self._h=0.0
def enterEvent(self,e): self._h=1.0; super().enterEvent(e)
def leaveEvent(self,e): self._h=0.0; super().leaveEvent(e)

def paintEvent(self,_):
p=QPainter(self); p.setRenderHint(QPainter.Antialiasing)
Expand Down Expand Up @@ -456,8 +456,8 @@ def _tick(self):
self._h+=(t-self._h)*0.1; self.update()

def set_active(self,v): self._active=v; self.update()
def enterEvent(self,e): self._hf=True
def leaveEvent(self,e): self._hf=False
def enterEvent(self,e): self._hf=True; super().enterEvent(e)
def leaveEvent(self,e): self._hf=False; super().leaveEvent(e)
def mousePressEvent(self,e): self.clicked.emit(self._idx)

def paintEvent(self,_):
Expand Down Expand Up @@ -893,8 +893,8 @@ def _log(self, html:str):
self._log_box.verticalScrollBar().setValue(self._log_box.verticalScrollBar().maximum())

def _voice_input(self):
""" If you are working with voice input kindly read the documentation of npmai_agents and this code uses
npmai_agents version 1.0.2, npmai_agents change frequently although not syntax but it will be better to read
"""If you are working with voice input kindly read the documentation of npmai_agents and this code uses
npmai_agents version 1.0.2, npmai_agents change frequently although not syntax but it will be better to read
before making any change."""
""" old VoiceTool.listen(): SpeechAITool.transcribe_realtime """
from npmai_agents.Tools_security_ai import SpeechAITool
Expand Down
2 changes: 1 addition & 1 deletion Desktop_App/app_config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"url": "https://qyxuvuhhaspkuhbognyk.supabase.co",
"annon_key": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InF5eHV2dWhoYXNwa3VoYm9nbnlrIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODQ3MDYwNzYsImV4cCI6MjEwMDI4MjA3Nn0.h3hyVr_OV38SfY2_2qQ6Hgtm6_FbvNQ31AG5YO7mVko",
"anon_key": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InF5eHV2dWhoYXNwa3VoYm9nbnlrIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODQ3MDYwNzYsImV4cCI6MjEwMDI4MjA3Nn0.h3hyVr_OV38SfY2_2qQ6Hgtm6_FbvNQ31AG5YO7mVko",
"mcp_base_url": "https://your-mcp-server.hf.space/mcp"
}
14 changes: 10 additions & 4 deletions Desktop_App/mcp_link.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import json
import uuid
import threading
Expand All @@ -13,13 +12,20 @@
CONFIG_URL = "https://raw.githubusercontent.com/npmaiecosystem/NPM-AutoCode-AI/refs/heads/main/Desktop_App/app_config.json"

def load_config() -> dict:
"""Fetch latest config from GitHub"""
"""Fetch latest config from GitHub (primary), fall back to bundled file."""
try:
response = requests.get(CONFIG_URL, timeout=8)
if response.status_code == 200:
return response.json()
except Exception as e:
print(f"Failed to fetch remote config: {e}")
bundled = Path(__file__).resolve().parent / "app_config.json"
if bundled.exists():
try:
return json.loads(bundled.read_text())
except Exception:
pass
return {}


def save_config(url: str, anon_key: str, mcp_base_url: str = None):
Expand Down Expand Up @@ -61,12 +67,12 @@ def _get_client(self):
"The 'supabase' package isn't installed. Run: pip install supabase"
)
cfg = load_config()
if not cfg.get("SUPABASE_URL") or not cfg.get("SUPABASE_ANNON_KEY"):
if not cfg.get("url") or not cfg.get("anon_key"):
raise SupabaseAuthError(
"Supabase isn't configured yet. Set SUPABASE_URL and SUPABASE_ANON_KEY "
"env vars, or call mcp_link.save_config(url, anon_key) once from Settings."
)
self._client = create_client(cfg["SUPABASE_URL"], cfg["SUPABASE_ANNON_KEY"])
self._client = create_client(cfg["url"], cfg["anon_key"])
return self._client

def sign_up(self, email: str, password: str):
Expand Down
2 changes: 2 additions & 0 deletions Desktop_App/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ langchain-community
npmai==0.1.9
npmai-agents==1.0.2
supabase
cryptography
requests
2 changes: 1 addition & 1 deletion Docs/Docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Install the app:
[Download Latest Release](https://github.com/sonuramashishnpm/NPM-AutoCode-AI/releases/download/v2.0/NPM_AutoCode_AI.zip)

1. Unzip the file.
2. Run `NPM_AutoCode_AI.exe` (Windows) or `python main.py` (Python 3.12+).
2. Run `NPM_AutoCode_AI.exe` (Windows) or `python Desktop_App/app.py` (Python 3.12+).
3. Enter your task in the input box (e.g., "Plot a sine wave").
4. Click **Generate & Execute**.
5. Watch logs and progress bar – AI generates, checks safety, executes, and fixes errors if needed.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Install the app:
[Download Latest Release](https://github.com/sonuramashishnpm/NPM-AutoCode-AI/releases/download/v2.2/NPM_AutoCode_AI.zip)

1. Unzip the file.
2. Run `NPM_AutoCode_AI.exe` (Windows) or `python main.py` (Python 3.12+).
2. Run `NPM_AutoCode_AI.exe` (Windows) or `python Desktop_App/app.py` (Python 3.12+).
3. Enter your task in the input box (e.g., "Plot a sine wave").
4. Click **Generate & Execute**.
5. Watch logs and progress bar – AI generates, checks safety, executes, and fixes errors if needed.
Expand Down
Loading