diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4500e08 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +__pycache__/ +*.py[cod] +*$py.class +*.egg-info/ +dist/ +build/ +*.egg +.env +.venv/ +venv/ +env/ +*.exe +*.zip diff --git a/Desktop_App/app.py b/Desktop_App/app.py index c383d4a..8d3181b 100644 --- a/Desktop_App/app.py +++ b/Desktop_App/app.py @@ -4,7 +4,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__))) @@ -14,8 +14,8 @@ QApplication, QWidget, QVBoxLayout, QHBoxLayout, QLabel, QTextEdit, QLineEdit, QPushButton, QFrame, QScrollArea, QStackedWidget, QSizePolicy, QGraphicsOpacityEffect, - QTabWidget, QDialog, QDialogButtonBox, QMessageBox, - QGroupBox, QComboBox + QDialog, QDialogButtonBox, QMessageBox, + QComboBox ) from PySide6.QtCore import ( QThread, Signal, Qt, QTimer, QPointF, QRectF, QRect, @@ -339,10 +339,8 @@ def __init__(self,text,accent="#2AFFA0",parent=None): super().__init__(text,parent); self._ac=QColor(accent); self._h=0.0 self.setCursor(Qt.PointingHandCursor); self.setFixedHeight(48) 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; self.update() + def leaveEvent(self,e): self._h=0.0; self.update() def paintEvent(self,_): p=QPainter(self); p.setRenderHint(QPainter.Antialiasing) @@ -1039,7 +1037,7 @@ def __init__(self, parent=None, group_name="", existing_data=None, lock_name=Fal title="🔑 Credential Group", subtitle=None): super().__init__(parent) self.setWindowTitle(title.replace("🔑","").strip() or "Credential Group") - self.setWindowIcon("npmai.png") + self.setWindowIcon(QIcon("npmai.png")) self.setMinimumWidth(440) self.setStyleSheet(f"QDialog{{background:{P['void']};}}") self._row_widgets = [] diff --git a/Desktop_App/mcp_link.py b/Desktop_App/mcp_link.py index e1ead6c..30df3aa 100644 --- a/Desktop_App/mcp_link.py +++ b/Desktop_App/mcp_link.py @@ -1,4 +1,3 @@ -import os import json import uuid import threading @@ -13,13 +12,25 @@ 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, falling back to local cache.""" try: response = requests.get(CONFIG_URL, timeout=8) if response.status_code == 200: - return response.json() + data = response.json() + try: + CONFIG_PATH.parent.mkdir(exist_ok=True) + CONFIG_PATH.write_text(json.dumps(data)) + except Exception: + pass + return data except Exception as e: print(f"Failed to fetch remote config: {e}") + if CONFIG_PATH.exists(): + try: + return json.loads(CONFIG_PATH.read_text()) + except Exception: + pass + return {} def save_config(url: str, anon_key: str, mcp_base_url: str = None): diff --git a/Docs/app.py b/Docs/app.py deleted file mode 100644 index 8b13789..0000000 --- a/Docs/app.py +++ /dev/null @@ -1 +0,0 @@ - diff --git a/Docs/requirements.txt b/Docs/requirements.txt deleted file mode 100644 index cef5a16..0000000 --- a/Docs/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -Flask -gunicorn diff --git a/README.md b/README.md index d76f6cf..136576b 100644 --- a/README.md +++ b/README.md @@ -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.