alisa-assistant 1.0.0__tar.gz

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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Swampod Sarkar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,94 @@
1
+ Metadata-Version: 2.4
2
+ Name: alisa-assistant
3
+ Version: 1.0.0
4
+ Summary: ALISA โ€” AI desktop assistant for Windows: voice, vision, system control, free AI chat
5
+ Author: Swampod Sarkar
6
+ License: MIT
7
+ Keywords: ai-assistant,desktop-assistant,gemini,voice-assistant,windows-automation
8
+ Requires-Python: >=3.10
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: google-generativeai
12
+ Requires-Dist: pyttsx3
13
+ Requires-Dist: SpeechRecognition
14
+ Requires-Dist: screen-brightness-control
15
+ Requires-Dist: pillow
16
+ Requires-Dist: psutil
17
+ Requires-Dist: opencv-python
18
+ Requires-Dist: pytesseract
19
+ Requires-Dist: pycaw; platform_system == "Windows"
20
+ Requires-Dist: comtypes; platform_system == "Windows"
21
+ Provides-Extra: audio
22
+ Requires-Dist: PyAudio; extra == "audio"
23
+ Dynamic: license-file
24
+
25
+ # ๐Ÿ’œ ALISA โ€” AI Desktop Assistant for Windows
26
+
27
+ Your own original desktop assistant: AI chat, voice, system control, app launching and notes โ€” all in one dark futuristic dashboard.
28
+
29
+ ## โœจ Features
30
+
31
+ - ๐Ÿ’ฌ **AI chat** (OpenRouter FREE built-in, zero setup; Gemini optional)
32
+ - ๐Ÿง  **Memory** (`remember/forget/what do you remember`) ยท ๐Ÿ”ฌ **Deep research** to file
33
+ - ๐Ÿ‘ **Camera vision** (`see`) ยท ๐Ÿ–ฅ๏ธ **Screen tools** (screenshot, OCR, minimize, lock)
34
+ - ๐Ÿ”Š **Voice output** (offline) + ๐ŸŽค **mic input** (optional)
35
+ - ๐Ÿ’ป **System control**: volume up/down/mute, brightness 10โ€“100, system info
36
+ - ๐Ÿš€ **Open/close apps & sites** ยท ๐Ÿ” **search/play/news** ยท ๐Ÿ’ฌ **WhatsApp + contacts**
37
+ - ๐Ÿ“ **File ops**: notes, folders, move, rename, delete, organize, find, file info, clipboard
38
+ - ๐ŸŒ **Website scaffolder** (`website NAME [landing|blog|portfolio]`) + publish guide
39
+ - โฐ **Reminders** ยท ๐Ÿ”— **command chaining** ยท ๐ŸŒ Bangla-friendly ยท ๐Ÿ“Š status bar
40
+
41
+ ## ๐Ÿ“ฆ Install (Windows)
42
+
43
+ ```bat
44
+ cd D:\ALISA
45
+ pip install -r requirements.txt
46
+ ```
47
+
48
+ Minimum (AI chat + voice output only):
49
+
50
+ ```bat
51
+ pip install google-generativeai pyttsx3
52
+ ```
53
+
54
+ Extras:
55
+
56
+ ```bat
57
+ pip install SpeechRecognition screen-brightness-control pycaw comtypes
58
+ ```
59
+
60
+ Microphone on Windows needs PyAudio:
61
+
62
+ ```bat
63
+ pip install pipwin && pipwin install pyaudio
64
+ ```
65
+
66
+ ## ๐Ÿš€ Run
67
+
68
+ ```bat
69
+ python main.py
70
+ ```
71
+
72
+ ## ๐Ÿ”‘ Free Gemini API key (2 min)
73
+
74
+ 1. Go to **aistudio.google.com** โ†’ sign in โ†’ **Get API key**
75
+ 2. Open ALISA โ†’ **โš™ Settings** โ†’ paste key โ†’ Save
76
+ 3. Ask anything!
77
+
78
+ ## ๐Ÿ“ Structure
79
+
80
+ ```
81
+ ALISA/
82
+ โ”œโ”€โ”€ main.py โ†’ launcher (python main.py)
83
+ โ”œโ”€โ”€ requirements.txt
84
+ โ”œโ”€โ”€ config.json โ†’ created on first save (your key, local only)
85
+ โ””โ”€โ”€ alisa/
86
+ โ”œโ”€โ”€ gui.py โ†’ dashboard window
87
+ โ”œโ”€โ”€ brain.py โ†’ command parser + actions
88
+ โ”œโ”€โ”€ ai_client.py โ†’ Gemini chat
89
+ โ”œโ”€โ”€ voice.py โ†’ TTS + mic
90
+ โ”œโ”€โ”€ systemctl.py โ†’ volume/brightness
91
+ โ””โ”€โ”€ config.py โ†’ local settings
92
+ ```
93
+
94
+ ยฉ 2026 ALISA ยท Original code, MIT License.
@@ -0,0 +1,70 @@
1
+ # ๐Ÿ’œ ALISA โ€” AI Desktop Assistant for Windows
2
+
3
+ Your own original desktop assistant: AI chat, voice, system control, app launching and notes โ€” all in one dark futuristic dashboard.
4
+
5
+ ## โœจ Features
6
+
7
+ - ๐Ÿ’ฌ **AI chat** (OpenRouter FREE built-in, zero setup; Gemini optional)
8
+ - ๐Ÿง  **Memory** (`remember/forget/what do you remember`) ยท ๐Ÿ”ฌ **Deep research** to file
9
+ - ๐Ÿ‘ **Camera vision** (`see`) ยท ๐Ÿ–ฅ๏ธ **Screen tools** (screenshot, OCR, minimize, lock)
10
+ - ๐Ÿ”Š **Voice output** (offline) + ๐ŸŽค **mic input** (optional)
11
+ - ๐Ÿ’ป **System control**: volume up/down/mute, brightness 10โ€“100, system info
12
+ - ๐Ÿš€ **Open/close apps & sites** ยท ๐Ÿ” **search/play/news** ยท ๐Ÿ’ฌ **WhatsApp + contacts**
13
+ - ๐Ÿ“ **File ops**: notes, folders, move, rename, delete, organize, find, file info, clipboard
14
+ - ๐ŸŒ **Website scaffolder** (`website NAME [landing|blog|portfolio]`) + publish guide
15
+ - โฐ **Reminders** ยท ๐Ÿ”— **command chaining** ยท ๐ŸŒ Bangla-friendly ยท ๐Ÿ“Š status bar
16
+
17
+ ## ๐Ÿ“ฆ Install (Windows)
18
+
19
+ ```bat
20
+ cd D:\ALISA
21
+ pip install -r requirements.txt
22
+ ```
23
+
24
+ Minimum (AI chat + voice output only):
25
+
26
+ ```bat
27
+ pip install google-generativeai pyttsx3
28
+ ```
29
+
30
+ Extras:
31
+
32
+ ```bat
33
+ pip install SpeechRecognition screen-brightness-control pycaw comtypes
34
+ ```
35
+
36
+ Microphone on Windows needs PyAudio:
37
+
38
+ ```bat
39
+ pip install pipwin && pipwin install pyaudio
40
+ ```
41
+
42
+ ## ๐Ÿš€ Run
43
+
44
+ ```bat
45
+ python main.py
46
+ ```
47
+
48
+ ## ๐Ÿ”‘ Free Gemini API key (2 min)
49
+
50
+ 1. Go to **aistudio.google.com** โ†’ sign in โ†’ **Get API key**
51
+ 2. Open ALISA โ†’ **โš™ Settings** โ†’ paste key โ†’ Save
52
+ 3. Ask anything!
53
+
54
+ ## ๐Ÿ“ Structure
55
+
56
+ ```
57
+ ALISA/
58
+ โ”œโ”€โ”€ main.py โ†’ launcher (python main.py)
59
+ โ”œโ”€โ”€ requirements.txt
60
+ โ”œโ”€โ”€ config.json โ†’ created on first save (your key, local only)
61
+ โ””โ”€โ”€ alisa/
62
+ โ”œโ”€โ”€ gui.py โ†’ dashboard window
63
+ โ”œโ”€โ”€ brain.py โ†’ command parser + actions
64
+ โ”œโ”€โ”€ ai_client.py โ†’ Gemini chat
65
+ โ”œโ”€โ”€ voice.py โ†’ TTS + mic
66
+ โ”œโ”€โ”€ systemctl.py โ†’ volume/brightness
67
+ โ””โ”€โ”€ config.py โ†’ local settings
68
+ ```
69
+
70
+ ยฉ 2026 ALISA ยท Original code, MIT License.
File without changes
@@ -0,0 +1,154 @@
1
+ """ALISA AI clients: Gemini (primary) + OpenRouter (fallback), text + vision."""
2
+
3
+ import json
4
+ import re
5
+ import urllib.request
6
+
7
+ try:
8
+ import google.generativeai as genai
9
+ _GENAI = True
10
+ except Exception:
11
+ _GENAI = False
12
+
13
+ SYSTEM_PROMPT = (
14
+ "You are ALISA, a friendly offline-first Windows desktop assistant. "
15
+ "Your creator is Swampod Sarkar โ€” if anyone asks who made/created/developed you, "
16
+ "answer: Swampod Sarkar. "
17
+ "Answer briefly (under 80 words unless asked for detail). "
18
+ "You can open apps, control volume/brightness, search the web and save notes."
19
+ )
20
+
21
+ OPENROUTER_URL = "https://openrouter.ai/api/v1/chat/completions"
22
+ OPENROUTER_MODEL = "nvidia/nemotron-3-nano-omni-30b-a3b-reasoning:free"
23
+ OPENROUTER_VISION_MODEL = "inclusionai/ling-3.0-flash-vl:free"
24
+
25
+ # Built-in free key so the app works out of the box (user can override in Settings).
26
+ # โš ๏ธ If you publish this code publicly, regenerate the key at openrouter.ai/keys
27
+ # and replace it โ€” anyone reading the code can spend this key's quota.
28
+ DEFAULT_OR_KEY = "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"
29
+
30
+
31
+ def _assert_free(model):
32
+ if not model.endswith(":free"):
33
+ raise RuntimeError("Only free (:free) models are allowed in ALISA.")
34
+
35
+
36
+ def clean_or_key(k):
37
+ """Extract a valid key, else '' (caller falls back to built-in key)."""
38
+ m = re.search(r"sk-or-v1-[A-Za-z0-9\-_]+", k or "")
39
+ return m.group(0) if m else ""
40
+
41
+
42
+ class GeminiClient:
43
+ """Default: OpenRouter free models (no setup needed). Gemini = optional upgrade."""
44
+
45
+ def __init__(self, api_key="", or_key=""):
46
+ self.api_key = (api_key or "").strip()
47
+ self.or_key = clean_or_key(or_key) or DEFAULT_OR_KEY
48
+ self._model = None
49
+
50
+ @property
51
+ def ready(self):
52
+ return bool(self.or_key or (_GENAI and self.api_key))
53
+
54
+ @property
55
+ def provider(self):
56
+ if self.or_key:
57
+ return "OpenRouter-free"
58
+ if _GENAI and self.api_key:
59
+ return "Gemini"
60
+ return "off"
61
+
62
+ def _ensure(self):
63
+ if not _GENAI:
64
+ raise RuntimeError("Install the AI package: pip install google-generativeai")
65
+ if not self.api_key:
66
+ raise RuntimeError("No API key โ€” add your free Gemini key in Settings.")
67
+ if self._model is None:
68
+ genai.configure(api_key=self.api_key)
69
+ self._model = genai.GenerativeModel(
70
+ "gemini-2.0-flash", system_instruction=SYSTEM_PROMPT
71
+ )
72
+ return self._model
73
+
74
+ def _with_facts(self, prompt, facts):
75
+ if facts:
76
+ return "Facts you remember about the user:\n- " + "\n- ".join(facts) + f"\n\nUser: {prompt}"
77
+ return prompt
78
+
79
+ def ask(self, prompt, history=None, facts=None):
80
+ # OpenRouter free models first (zero setup) โ†’ Gemini fallback.
81
+ if self.or_key:
82
+ try:
83
+ return self._ask_openrouter(prompt, facts, history)
84
+ except Exception as e:
85
+ if not (_GENAI and self.api_key):
86
+ raise RuntimeError(f"AI error: {e}")
87
+ model = self._ensure()
88
+ chat = model.start_chat(history=history or [])
89
+ resp = chat.send_message(self._with_facts(prompt, facts))
90
+ return ((resp.text or "").strip()) or "(empty reply)"
91
+
92
+ def _ask_openrouter(self, prompt, facts=None, history=None):
93
+ if not self.or_key:
94
+ raise RuntimeError("AI error โ€” check your API key in Settings.")
95
+ _assert_free(OPENROUTER_MODEL)
96
+ messages = [{"role": "system", "content": SYSTEM_PROMPT}]
97
+ if facts:
98
+ messages.append({"role": "system", "content": "Remembered facts: " + "; ".join(facts)})
99
+ for m in (history or [])[-6:]:
100
+ role = "assistant" if m.get("role") == "model" else "user"
101
+ parts = m.get("parts", [""])
102
+ messages.append({"role": role, "content": parts[0] if parts else ""})
103
+ messages.append({"role": "user", "content": prompt})
104
+ payload = json.dumps({"model": OPENROUTER_MODEL, "messages": messages}).encode()
105
+ req = urllib.request.Request(
106
+ OPENROUTER_URL, data=payload,
107
+ headers={"Authorization": f"Bearer {self.or_key}",
108
+ "Content-Type": "application/json",
109
+ "HTTP-Referer": "https://localhost/alisa",
110
+ "X-Title": "ALISA Assistant"},
111
+ )
112
+ with urllib.request.urlopen(req, timeout=60) as r:
113
+ data = json.load(r)
114
+ return data["choices"][0]["message"]["content"].strip()
115
+
116
+ def describe_image(self, jpeg_bytes, prompt="Describe what you see briefly."):
117
+ """Vision: OpenRouter free vision model first, Gemini as fallback."""
118
+ if self.or_key:
119
+ try:
120
+ return self._describe_image_or(jpeg_bytes, prompt)
121
+ except Exception as e:
122
+ if not (_GENAI and self.api_key):
123
+ raise RuntimeError(f"Vision error: {e}")
124
+ model = self._ensure()
125
+ resp = model.generate_content([
126
+ {"mime_type": "image/jpeg", "data": jpeg_bytes},
127
+ prompt,
128
+ ])
129
+ return (resp.text or "").strip() or "(could not describe image)"
130
+
131
+ def _describe_image_or(self, jpeg_bytes, prompt):
132
+ import base64
133
+ _assert_free(OPENROUTER_VISION_MODEL)
134
+ b64 = base64.b64encode(jpeg_bytes).decode()
135
+ payload = json.dumps({
136
+ "model": OPENROUTER_VISION_MODEL,
137
+ "messages": [{
138
+ "role": "user",
139
+ "content": [
140
+ {"type": "text", "text": prompt},
141
+ {"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{b64}"}},
142
+ ],
143
+ }],
144
+ }).encode()
145
+ req = urllib.request.Request(
146
+ OPENROUTER_URL, data=payload,
147
+ headers={"Authorization": f"Bearer {self.or_key}",
148
+ "Content-Type": "application/json",
149
+ "HTTP-Referer": "https://localhost/alisa",
150
+ "X-Title": "ALISA Assistant"},
151
+ )
152
+ with urllib.request.urlopen(req, timeout=90) as r:
153
+ data = json.load(r)
154
+ return data["choices"][0]["message"]["content"].strip()