zassistant-1.0 1.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.
- zassistant_1_0-1.0/PKG-INFO +5 -0
- zassistant_1_0-1.0/setup.cfg +4 -0
- zassistant_1_0-1.0/setup.py +48 -0
- zassistant_1_0-1.0/zassistant/__init__.py +0 -0
- zassistant_1_0-1.0/zassistant/main.py +86 -0
- zassistant_1_0-1.0/zassistant_1.0.egg-info/PKG-INFO +5 -0
- zassistant_1_0-1.0/zassistant_1.0.egg-info/SOURCES.txt +9 -0
- zassistant_1_0-1.0/zassistant_1.0.egg-info/dependency_links.txt +1 -0
- zassistant_1_0-1.0/zassistant_1.0.egg-info/entry_points.txt +2 -0
- zassistant_1_0-1.0/zassistant_1.0.egg-info/requires.txt +1 -0
- zassistant_1_0-1.0/zassistant_1.0.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
from setuptools.command.install import install
|
|
3
|
+
import time
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
def custom_loading_ui():
|
|
7
|
+
print("Checking python version...")
|
|
8
|
+
time.sleep(1)
|
|
9
|
+
|
|
10
|
+
steps = [
|
|
11
|
+
("main.py", "Installing main.py..."),
|
|
12
|
+
("__init__.py", "Installing __init__.py..."),
|
|
13
|
+
("zassistant/", "Installing zassistant/...")
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
for file_id, label in steps:
|
|
17
|
+
for i in range(0, 101, 10):
|
|
18
|
+
chars = ["|", "/", "-", "\\"]
|
|
19
|
+
for char in chars:
|
|
20
|
+
sys.stdout.write(f"\r{label} {char} {i}%")
|
|
21
|
+
sys.stdout.flush()
|
|
22
|
+
time.sleep(0.04)
|
|
23
|
+
# Replaces percentage with "success"
|
|
24
|
+
sys.stdout.write(f"\r{label} success \n")
|
|
25
|
+
sys.stdout.flush()
|
|
26
|
+
|
|
27
|
+
print("Checking all downloaded files...", end="", flush=True)
|
|
28
|
+
time.sleep(1)
|
|
29
|
+
print(" checking success")
|
|
30
|
+
print("\033[92mDownload success.\033[0m")
|
|
31
|
+
|
|
32
|
+
class CustomInstall(install):
|
|
33
|
+
def run(self):
|
|
34
|
+
custom_loading_ui()
|
|
35
|
+
install.run(self)
|
|
36
|
+
|
|
37
|
+
setup(
|
|
38
|
+
name="zassistant_1.0",
|
|
39
|
+
version="1.0",
|
|
40
|
+
packages=find_packages(),
|
|
41
|
+
install_requires=['google-genai'],
|
|
42
|
+
entry_points={
|
|
43
|
+
'console_scripts': [
|
|
44
|
+
'start_zassistant=zassistant.main:main',
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
cmdclass={'install': CustomInstall},
|
|
48
|
+
)
|
|
File without changes
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import time
|
|
3
|
+
import subprocess
|
|
4
|
+
import sys
|
|
5
|
+
from google import genai
|
|
6
|
+
from google.genai import types, errors
|
|
7
|
+
|
|
8
|
+
# --- 1. CONFIGURATION (Add both keys here) ---
|
|
9
|
+
API_KEYS = ["AIzaSyB2lVccgq6Vbk0B__jcAqPeDDTEPzc9FqY", "AIzaSyBavbqf2UxtUzHQ1zyuYnfl9Hyy1CIdMpQ"]
|
|
10
|
+
MODEL_ID = "gemini-2.5-flash"
|
|
11
|
+
|
|
12
|
+
# Track which key we are using
|
|
13
|
+
current_key_index = 0
|
|
14
|
+
|
|
15
|
+
def get_client():
|
|
16
|
+
return genai.Client(api_key=API_KEYS[current_key_index])
|
|
17
|
+
|
|
18
|
+
client = get_client()
|
|
19
|
+
|
|
20
|
+
# --- 2. THE TYPEWRITER (Fast: 0.05 delay) ---
|
|
21
|
+
def typewriter(text: str, delay: float = 0.05):
|
|
22
|
+
for char in text:
|
|
23
|
+
sys.stdout.write(char)
|
|
24
|
+
sys.stdout.flush()
|
|
25
|
+
time.sleep(delay)
|
|
26
|
+
print()
|
|
27
|
+
|
|
28
|
+
# --- 3. THE TOOL ---
|
|
29
|
+
def sys_action(cmd: str) -> str:
|
|
30
|
+
try:
|
|
31
|
+
res = subprocess.run(cmd, shell=True, capture_output=True, text=True, timeout=15)
|
|
32
|
+
return (res.stdout + res.stderr).strip() or "Done."
|
|
33
|
+
except Exception as e:
|
|
34
|
+
return f"Error: {str(e)}"
|
|
35
|
+
|
|
36
|
+
# --- 4. THE MAIN LOOP ---
|
|
37
|
+
def main():
|
|
38
|
+
global current_key_index, client
|
|
39
|
+
is_active = False
|
|
40
|
+
print("\033[94m--- Zassistant - easist Assistant in CMD ---\033[0m")
|
|
41
|
+
|
|
42
|
+
chat = client.chats.create(
|
|
43
|
+
model=MODEL_ID,
|
|
44
|
+
config=types.GenerateContentConfig(
|
|
45
|
+
tools=[sys_action],
|
|
46
|
+
system_instruction="You are Zassistant. Use sys_action for all commands. Be brief."
|
|
47
|
+
)
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
while True:
|
|
51
|
+
if not is_active:
|
|
52
|
+
user_input = input("\033[92mZassistant > \033[0m").strip().lower()
|
|
53
|
+
if user_input == "start_zassistant":
|
|
54
|
+
is_active = True
|
|
55
|
+
print("\033[94m[System Online]\033[0m")
|
|
56
|
+
elif user_input in ["end_zassistant", "shutdown_zassistant"]:
|
|
57
|
+
break
|
|
58
|
+
continue
|
|
59
|
+
|
|
60
|
+
user_input = input("\033[92mUser > \033[0m").strip().lower()
|
|
61
|
+
if not user_input: continue
|
|
62
|
+
if user_input in ["end", "shutdown"]:
|
|
63
|
+
break
|
|
64
|
+
|
|
65
|
+
success = False
|
|
66
|
+
while not success:
|
|
67
|
+
try:
|
|
68
|
+
response = chat.send_message(user_input)
|
|
69
|
+
if response.text:
|
|
70
|
+
print("\nAI: ", end="")
|
|
71
|
+
typewriter(response.text, 0.05)
|
|
72
|
+
success = True
|
|
73
|
+
except errors.ClientError as e:
|
|
74
|
+
if "429" in str(e):
|
|
75
|
+
# SWITCH KEYS
|
|
76
|
+
current_key_index = (current_key_index + 1) % len(API_KEYS)
|
|
77
|
+
print(f"\n\033[93m[Quota] Switching to API Key #{current_key_index + 1}...\033[0m")
|
|
78
|
+
client = get_client()
|
|
79
|
+
# Re-create chat with the new key
|
|
80
|
+
chat = client.chats.create(model=MODEL_ID, config=types.GenerateContentConfig(tools=[sys_action]))
|
|
81
|
+
else:
|
|
82
|
+
print(f"\nAPI Error: {e}")
|
|
83
|
+
success = True
|
|
84
|
+
|
|
85
|
+
if __name__ == "__main__":
|
|
86
|
+
main()
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
setup.py
|
|
2
|
+
zassistant/__init__.py
|
|
3
|
+
zassistant/main.py
|
|
4
|
+
zassistant_1.0.egg-info/PKG-INFO
|
|
5
|
+
zassistant_1.0.egg-info/SOURCES.txt
|
|
6
|
+
zassistant_1.0.egg-info/dependency_links.txt
|
|
7
|
+
zassistant_1.0.egg-info/entry_points.txt
|
|
8
|
+
zassistant_1.0.egg-info/requires.txt
|
|
9
|
+
zassistant_1.0.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
google-genai
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
zassistant
|