neiroweb 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.
- neiroweb-1.0.0/PKG-INFO +180 -0
- neiroweb-1.0.0/README.md +148 -0
- neiroweb-1.0.0/neiroweb/__init__.py +68 -0
- neiroweb-1.0.0/neiroweb/__main__.py +9 -0
- neiroweb-1.0.0/neiroweb/__version__.py +39 -0
- neiroweb-1.0.0/neiroweb/cli.py +107 -0
- neiroweb-1.0.0/neiroweb/interactive.py +348 -0
- neiroweb-1.0.0/neiroweb.egg-info/PKG-INFO +180 -0
- neiroweb-1.0.0/neiroweb.egg-info/SOURCES.txt +12 -0
- neiroweb-1.0.0/neiroweb.egg-info/dependency_links.txt +1 -0
- neiroweb-1.0.0/neiroweb.egg-info/requires.txt +1 -0
- neiroweb-1.0.0/neiroweb.egg-info/top_level.txt +1 -0
- neiroweb-1.0.0/setup.cfg +4 -0
- neiroweb-1.0.0/setup.py +39 -0
neiroweb-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: neiroweb
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Python CLI Package made for AI Access
|
|
5
|
+
Home-page: https://github.com/CyberPlugger/aibot
|
|
6
|
+
Author: Andrew Sergeevich
|
|
7
|
+
Author-email: jumpki11@hotmail.com
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Requires-Python: >=3.7
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
Requires-Dist: requests
|
|
23
|
+
Dynamic: author
|
|
24
|
+
Dynamic: author-email
|
|
25
|
+
Dynamic: classifier
|
|
26
|
+
Dynamic: description
|
|
27
|
+
Dynamic: description-content-type
|
|
28
|
+
Dynamic: home-page
|
|
29
|
+
Dynamic: requires-dist
|
|
30
|
+
Dynamic: requires-python
|
|
31
|
+
Dynamic: summary
|
|
32
|
+
|
|
33
|
+
# 🤖 AIBOT
|
|
34
|
+
|
|
35
|
+
AIBOT is a Python AI CLI + GUI tool powered by Pollinations AI.
|
|
36
|
+
|
|
37
|
+
It allows you to interact with AI using:
|
|
38
|
+
- Terminal commands
|
|
39
|
+
- Interactive chat mode
|
|
40
|
+
- Graphical Tkinter chat interface
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## 🚀 Installation
|
|
45
|
+
|
|
46
|
+
Install via pip:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install aibot
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 💻 CLI Usage
|
|
55
|
+
|
|
56
|
+
Show help:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
aibot
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Ask AI:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
aibot ask "Hello!"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Start terminal chat:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
aibot chat
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Start graphical chat:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
aibot graphical_chat
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 🧠 History System
|
|
83
|
+
|
|
84
|
+
Show history:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
aibot history
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Reset history:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
aibot history --reset
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Set history manually:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
aibot history --set "['hello']"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## 🖥 Graphical Chat
|
|
105
|
+
|
|
106
|
+
To start the graphical AI chat interface:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
aibot graphical_chat
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Python usage
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from aibot.interactive import GraphicChat
|
|
116
|
+
|
|
117
|
+
app = GraphicChat()
|
|
118
|
+
app.run()
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## ⚙️ API
|
|
124
|
+
|
|
125
|
+
This project uses:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
https://text.pollinations.ai
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## 📁 Project Structure
|
|
134
|
+
|
|
135
|
+
```text
|
|
136
|
+
aibot/
|
|
137
|
+
├── __init__.py
|
|
138
|
+
├── __main__.py
|
|
139
|
+
├── cli.py
|
|
140
|
+
├── interactive.py
|
|
141
|
+
├── __version__.py
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## 🔧 Requirements
|
|
147
|
+
|
|
148
|
+
- Python 3.8+
|
|
149
|
+
- requests
|
|
150
|
+
- tkinter (built-in)
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 👤 Author
|
|
155
|
+
|
|
156
|
+
Andrey Sergeevich Cherepennikov
|
|
157
|
+
Aliases:
|
|
158
|
+
- vito
|
|
159
|
+
- CyberPlugger
|
|
160
|
+
- jumpkill
|
|
161
|
+
|
|
162
|
+
Age: 11
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## 📌 Run as module
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
python -m aibot
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## 🔮 Future ideas
|
|
175
|
+
|
|
176
|
+
- Streaming responses
|
|
177
|
+
- Plugin system
|
|
178
|
+
- Voice input/output
|
|
179
|
+
- Multi-session memory
|
|
180
|
+
- EXE build via PyInstaller
|
neiroweb-1.0.0/README.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# 🤖 AIBOT
|
|
2
|
+
|
|
3
|
+
AIBOT is a Python AI CLI + GUI tool powered by Pollinations AI.
|
|
4
|
+
|
|
5
|
+
It allows you to interact with AI using:
|
|
6
|
+
- Terminal commands
|
|
7
|
+
- Interactive chat mode
|
|
8
|
+
- Graphical Tkinter chat interface
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 🚀 Installation
|
|
13
|
+
|
|
14
|
+
Install via pip:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install aibot
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 💻 CLI Usage
|
|
23
|
+
|
|
24
|
+
Show help:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
aibot
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Ask AI:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
aibot ask "Hello!"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Start terminal chat:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
aibot chat
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Start graphical chat:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
aibot graphical_chat
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 🧠 History System
|
|
51
|
+
|
|
52
|
+
Show history:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
aibot history
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Reset history:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
aibot history --reset
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Set history manually:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
aibot history --set "['hello']"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 🖥 Graphical Chat
|
|
73
|
+
|
|
74
|
+
To start the graphical AI chat interface:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
aibot graphical_chat
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Python usage
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
from aibot.interactive import GraphicChat
|
|
84
|
+
|
|
85
|
+
app = GraphicChat()
|
|
86
|
+
app.run()
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## ⚙️ API
|
|
92
|
+
|
|
93
|
+
This project uses:
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
https://text.pollinations.ai
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## 📁 Project Structure
|
|
102
|
+
|
|
103
|
+
```text
|
|
104
|
+
aibot/
|
|
105
|
+
├── __init__.py
|
|
106
|
+
├── __main__.py
|
|
107
|
+
├── cli.py
|
|
108
|
+
├── interactive.py
|
|
109
|
+
├── __version__.py
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## 🔧 Requirements
|
|
115
|
+
|
|
116
|
+
- Python 3.8+
|
|
117
|
+
- requests
|
|
118
|
+
- tkinter (built-in)
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## 👤 Author
|
|
123
|
+
|
|
124
|
+
Andrey Sergeevich Cherepennikov
|
|
125
|
+
Aliases:
|
|
126
|
+
- vito
|
|
127
|
+
- CyberPlugger
|
|
128
|
+
- jumpkill
|
|
129
|
+
|
|
130
|
+
Age: 11
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## 📌 Run as module
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
python -m aibot
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## 🔮 Future ideas
|
|
143
|
+
|
|
144
|
+
- Streaming responses
|
|
145
|
+
- Plugin system
|
|
146
|
+
- Voice input/output
|
|
147
|
+
- Multi-session memory
|
|
148
|
+
- EXE build via PyInstaller
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
3
|
+
try:
|
|
4
|
+
from .__version__ import *
|
|
5
|
+
from . import __version__ as _vv
|
|
6
|
+
except ImportError:
|
|
7
|
+
from __version__ import *
|
|
8
|
+
import __version__ as _vv
|
|
9
|
+
|
|
10
|
+
history = []
|
|
11
|
+
BASE_URL = "https://text.pollinations.ai"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def ask(user_query="hello", model="openai", cache=False, url=BASE_URL):
|
|
15
|
+
"""
|
|
16
|
+
sends a query to the pollinations.ai API, stores it in history and returns the reply
|
|
17
|
+
:param user_query:
|
|
18
|
+
:param model:
|
|
19
|
+
:param cache:
|
|
20
|
+
:param url:
|
|
21
|
+
:return:
|
|
22
|
+
"""
|
|
23
|
+
global history
|
|
24
|
+
|
|
25
|
+
history.append({"role": "user", "content": user_query})
|
|
26
|
+
|
|
27
|
+
payload = {
|
|
28
|
+
"messages": history,
|
|
29
|
+
"model": model,
|
|
30
|
+
"cache": cache
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
try:
|
|
34
|
+
r = requests.post(url, json=payload, timeout=9999)
|
|
35
|
+
|
|
36
|
+
if r.status_code == 200:
|
|
37
|
+
reply = r.text
|
|
38
|
+
history.append({"role": "assistant", "content": reply})
|
|
39
|
+
return reply
|
|
40
|
+
|
|
41
|
+
return f"Error {r.status_code}: {r.text}"
|
|
42
|
+
except requests.exceptions.InvalidSchema:
|
|
43
|
+
return f'Message not sent. Try turning off your vpn.'
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def reset_history():
|
|
47
|
+
global history
|
|
48
|
+
history.clear()
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def get_history():
|
|
52
|
+
"""
|
|
53
|
+
Returns history list
|
|
54
|
+
"""
|
|
55
|
+
return history
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def set_history(new_history: list):
|
|
59
|
+
"""
|
|
60
|
+
fully edits the history
|
|
61
|
+
"""
|
|
62
|
+
global history
|
|
63
|
+
history = new_history
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
if __name__ == '__main__':
|
|
67
|
+
for i in _vv.__all__:
|
|
68
|
+
print(i + ':', getattr(_vv, i))
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""
|
|
2
|
+
aibot version information and package metadata.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
# Package version (PEP 440 compatible)
|
|
6
|
+
__version__ = "1.0.0"
|
|
7
|
+
|
|
8
|
+
# Package information
|
|
9
|
+
__title__ = "aibot"
|
|
10
|
+
__description__ = "AI CLI tool powered by Pollinations API"
|
|
11
|
+
|
|
12
|
+
# Author information
|
|
13
|
+
__author__ = "Cherepennikov Andrew Sergeevich"
|
|
14
|
+
__age__ = 11
|
|
15
|
+
|
|
16
|
+
# Internet aliases
|
|
17
|
+
__aliases__ = [
|
|
18
|
+
"vito",
|
|
19
|
+
"CyberPlugger",
|
|
20
|
+
"jumpkill"
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
# Package license
|
|
24
|
+
__license__ = "MIT"
|
|
25
|
+
|
|
26
|
+
# Project status
|
|
27
|
+
__status__ = "stable"
|
|
28
|
+
|
|
29
|
+
# Exported names
|
|
30
|
+
__all__ = [
|
|
31
|
+
"__version__",
|
|
32
|
+
"__title__",
|
|
33
|
+
"__description__",
|
|
34
|
+
"__author__",
|
|
35
|
+
"__age__",
|
|
36
|
+
"__aliases__",
|
|
37
|
+
"__license__",
|
|
38
|
+
"__status__"
|
|
39
|
+
]
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import sys
|
|
3
|
+
import ast
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
from . import ask, history, reset_history
|
|
7
|
+
from . import interactive
|
|
8
|
+
except ImportError:
|
|
9
|
+
from __init__ import ask, history, reset_history
|
|
10
|
+
import interactive
|
|
11
|
+
|
|
12
|
+
HELP_TEXT = """
|
|
13
|
+
aibot - AI CLI tool
|
|
14
|
+
|
|
15
|
+
USAGE:
|
|
16
|
+
aibot ask "Hello!" → send a prompt to the AI
|
|
17
|
+
aibot chat → start interactive chat mode
|
|
18
|
+
aibot history → show conversation history
|
|
19
|
+
aibot history --reset → clear conversation history
|
|
20
|
+
aibot history --set "[...]" → manually set history
|
|
21
|
+
|
|
22
|
+
EXAMPLES:
|
|
23
|
+
aibot ask "Hello!"
|
|
24
|
+
aibot chat
|
|
25
|
+
aibot history --reset
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def main():
|
|
30
|
+
# If no arguments are provided, show help message
|
|
31
|
+
if len(sys.argv) == 1:
|
|
32
|
+
print(HELP_TEXT)
|
|
33
|
+
return
|
|
34
|
+
|
|
35
|
+
# Create argument parser
|
|
36
|
+
parser = argparse.ArgumentParser(prog="neiroweb")
|
|
37
|
+
subparsers = parser.add_subparsers(dest="command")
|
|
38
|
+
|
|
39
|
+
# ---------------- ASK COMMAND ----------------
|
|
40
|
+
ask_parser = subparsers.add_parser("ask")
|
|
41
|
+
ask_parser.add_argument("text", nargs="+", help="Prompt text for the AI")
|
|
42
|
+
ask_parser.add_argument("--model", default="openai", help="AI model name")
|
|
43
|
+
|
|
44
|
+
# ---------------- CHAT COMMAND ----------------
|
|
45
|
+
subparsers.add_parser("chat", help="Start interactive chat mode")
|
|
46
|
+
subparsers.add_parser('graphical_chat', help='Activates graphical interface of an AI ChatBot')
|
|
47
|
+
|
|
48
|
+
# ---------------- HISTORY COMMAND ----------------
|
|
49
|
+
history_parser = subparsers.add_parser("history", help="Manage chat history")
|
|
50
|
+
history_parser.add_argument("--reset", action="store_true", help="Clear history")
|
|
51
|
+
history_parser.add_argument("--set", dest="set_history", help="Set custom history list")
|
|
52
|
+
|
|
53
|
+
args = parser.parse_args()
|
|
54
|
+
|
|
55
|
+
# ---------------- ASK HANDLER ----------------
|
|
56
|
+
if args.command == "ask":
|
|
57
|
+
prompt = " ".join(args.text)
|
|
58
|
+
result = ask(prompt, model=args.model)
|
|
59
|
+
print(result)
|
|
60
|
+
return
|
|
61
|
+
|
|
62
|
+
# ---------------- CHAT HANDLER ----------------
|
|
63
|
+
if args.command == "chat":
|
|
64
|
+
print("Starting interactive chat mode...")
|
|
65
|
+
interactive.chat()
|
|
66
|
+
return
|
|
67
|
+
|
|
68
|
+
if args.command == 'graphical_chat':
|
|
69
|
+
print('Graphical interface should start')
|
|
70
|
+
interactive.GraphicChat().run()
|
|
71
|
+
return
|
|
72
|
+
|
|
73
|
+
# ---------------- HISTORY HANDLER ----------------
|
|
74
|
+
if args.command == "history":
|
|
75
|
+
|
|
76
|
+
# Reset history
|
|
77
|
+
if args.reset:
|
|
78
|
+
reset_history()
|
|
79
|
+
print("History cleared successfully.")
|
|
80
|
+
return
|
|
81
|
+
|
|
82
|
+
# Set history manually
|
|
83
|
+
if args.set_history:
|
|
84
|
+
try:
|
|
85
|
+
new_history = ast.literal_eval(args.set_history)
|
|
86
|
+
|
|
87
|
+
if isinstance(new_history, list):
|
|
88
|
+
history.clear()
|
|
89
|
+
history.extend(new_history)
|
|
90
|
+
print("History updated successfully.")
|
|
91
|
+
else:
|
|
92
|
+
print("Error: history must be a list.")
|
|
93
|
+
|
|
94
|
+
except Exception as e:
|
|
95
|
+
print(f"Invalid format: {e}")
|
|
96
|
+
|
|
97
|
+
return
|
|
98
|
+
|
|
99
|
+
# Print current history
|
|
100
|
+
print(history)
|
|
101
|
+
return
|
|
102
|
+
|
|
103
|
+
# Default help fallback
|
|
104
|
+
parser.print_help()
|
|
105
|
+
|
|
106
|
+
if __name__ == '__main__':
|
|
107
|
+
main()
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import tkinter as tk
|
|
4
|
+
|
|
5
|
+
from tkinter import ttk, scrolledtext
|
|
6
|
+
import threading
|
|
7
|
+
|
|
8
|
+
try:
|
|
9
|
+
from . import ask, reset_history
|
|
10
|
+
except ImportError:
|
|
11
|
+
from __init__ import ask, reset_history
|
|
12
|
+
|
|
13
|
+
IS_WINDOWS = os.name == 'nt'
|
|
14
|
+
|
|
15
|
+
class ColorPrinter:
|
|
16
|
+
|
|
17
|
+
@staticmethod
|
|
18
|
+
def supports_color():
|
|
19
|
+
if IS_WINDOWS:
|
|
20
|
+
try:
|
|
21
|
+
os.system('')
|
|
22
|
+
return True
|
|
23
|
+
except:
|
|
24
|
+
return False
|
|
25
|
+
return sys.stdout.isatty()
|
|
26
|
+
|
|
27
|
+
@staticmethod
|
|
28
|
+
def red(text):
|
|
29
|
+
return f"\033[91m{text}\033[0m" if ColorPrinter.supports_color() else text
|
|
30
|
+
|
|
31
|
+
@staticmethod
|
|
32
|
+
def green(text):
|
|
33
|
+
return f"\033[92m{text}\033[0m" if ColorPrinter.supports_color() else text
|
|
34
|
+
|
|
35
|
+
@staticmethod
|
|
36
|
+
def yellow(text):
|
|
37
|
+
return f"\033[93m{text}\033[0m" if ColorPrinter.supports_color() else text
|
|
38
|
+
|
|
39
|
+
@staticmethod
|
|
40
|
+
def blue(text):
|
|
41
|
+
return f"\033[94m{text}\033[0m" if ColorPrinter.supports_color() else text
|
|
42
|
+
|
|
43
|
+
@staticmethod
|
|
44
|
+
def cyan(text):
|
|
45
|
+
return f"\033[96m{text}\033[0m" if ColorPrinter.supports_color() else text
|
|
46
|
+
|
|
47
|
+
@staticmethod
|
|
48
|
+
def bold(text):
|
|
49
|
+
return f"\033[1m{text}\033[0m" if ColorPrinter.supports_color() else text
|
|
50
|
+
|
|
51
|
+
@staticmethod
|
|
52
|
+
def white(text):
|
|
53
|
+
return text
|
|
54
|
+
|
|
55
|
+
def chat():
|
|
56
|
+
|
|
57
|
+
title = ColorPrinter.bold(ColorPrinter.cyan(r'''
|
|
58
|
+
o __o__ o__ __o o__ __o ____o__ __o____
|
|
59
|
+
<|> | <| v\ /v v\ / \ / \
|
|
60
|
+
/ \ / \ / \ <\ /> <\ \o/
|
|
61
|
+
o/ \o \o/ \o/ o/ o/ \o |
|
|
62
|
+
<|__ __|> | |__ _<| <| |> < >
|
|
63
|
+
/ \ < > | \ \\ // |
|
|
64
|
+
o/ \o | <o> / \ / o
|
|
65
|
+
/v v\ o | o o o <|
|
|
66
|
+
/> <\ __|>_ / \ __/> <\__ __/> / \
|
|
67
|
+
|
|
68
|
+
'''))
|
|
69
|
+
|
|
70
|
+
os.system('cls' if os.name == 'nt' else 'clear')
|
|
71
|
+
print(title)
|
|
72
|
+
|
|
73
|
+
x = {
|
|
74
|
+
'A': 'green',
|
|
75
|
+
'I': 'red',
|
|
76
|
+
'B': 'yellow',
|
|
77
|
+
'O': 'white',
|
|
78
|
+
'T': 'blue',
|
|
79
|
+
' Interactive ': 'white',
|
|
80
|
+
'chat ': 'yellow',
|
|
81
|
+
'(type ': 'white',
|
|
82
|
+
'exit ': 'red',
|
|
83
|
+
'to exit, ': 'white',
|
|
84
|
+
'reset ': 'red',
|
|
85
|
+
'to reset AI\'s memory and ': 'white',
|
|
86
|
+
'clear ': 'blue',
|
|
87
|
+
'to clear the console)': 'white',
|
|
88
|
+
'\n': 'white'
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
for i in x:
|
|
92
|
+
print(
|
|
93
|
+
getattr(
|
|
94
|
+
ColorPrinter,
|
|
95
|
+
x[i]
|
|
96
|
+
)(
|
|
97
|
+
i
|
|
98
|
+
),
|
|
99
|
+
end=''
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
while True:
|
|
103
|
+
user_input = input(ColorPrinter.green("You: "))
|
|
104
|
+
|
|
105
|
+
if user_input.lower() == "exit":
|
|
106
|
+
os.system('cls' if os.name == 'nt' else 'clear')
|
|
107
|
+
break
|
|
108
|
+
|
|
109
|
+
if user_input.lower() == "reset":
|
|
110
|
+
reset_history()
|
|
111
|
+
print("Memory cleared.")
|
|
112
|
+
continue
|
|
113
|
+
|
|
114
|
+
if user_input.lower() == 'clear':
|
|
115
|
+
os.system('cls' if os.name == 'nt' else 'clear')
|
|
116
|
+
print(title)
|
|
117
|
+
continue
|
|
118
|
+
|
|
119
|
+
response = ask(user_input)
|
|
120
|
+
print(ColorPrinter.blue(f'AI: {response}'))
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
class GraphicChat:
|
|
124
|
+
"""
|
|
125
|
+
Graphical AI chat interface using tkinter.
|
|
126
|
+
Similar to aibot.interactive.chat but with GUI support.
|
|
127
|
+
"""
|
|
128
|
+
|
|
129
|
+
def __init__(self):
|
|
130
|
+
|
|
131
|
+
# Create main window
|
|
132
|
+
self.root = tk.Tk()
|
|
133
|
+
self.root.title("AIBOT Chat")
|
|
134
|
+
self.root.geometry("900x650")
|
|
135
|
+
|
|
136
|
+
# Theme state
|
|
137
|
+
self.dark_mode = True
|
|
138
|
+
|
|
139
|
+
# Configure ttk style
|
|
140
|
+
self.style = ttk.Style()
|
|
141
|
+
|
|
142
|
+
# Create all widgets
|
|
143
|
+
self.create_widgets()
|
|
144
|
+
|
|
145
|
+
# Apply initial theme
|
|
146
|
+
self.apply_theme()
|
|
147
|
+
|
|
148
|
+
# --------------------------------------------------
|
|
149
|
+
# UI CREATION
|
|
150
|
+
# --------------------------------------------------
|
|
151
|
+
|
|
152
|
+
def create_widgets(self):
|
|
153
|
+
|
|
154
|
+
# Top control frame
|
|
155
|
+
self.top_frame = tk.Frame(self.root)
|
|
156
|
+
self.top_frame.pack(fill="x", padx=10, pady=10)
|
|
157
|
+
|
|
158
|
+
# Theme switch button
|
|
159
|
+
self.theme_button = ttk.Button(
|
|
160
|
+
self.top_frame,
|
|
161
|
+
text="Switch Theme",
|
|
162
|
+
command=self.toggle_theme
|
|
163
|
+
)
|
|
164
|
+
self.theme_button.pack(side="right", padx=(5, 0))
|
|
165
|
+
|
|
166
|
+
# Reset history button
|
|
167
|
+
self.reset_button = ttk.Button(
|
|
168
|
+
self.top_frame,
|
|
169
|
+
text="Reset History",
|
|
170
|
+
command=self.reset_chat_history
|
|
171
|
+
)
|
|
172
|
+
self.reset_button.pack(side="right")
|
|
173
|
+
|
|
174
|
+
# Chat display area
|
|
175
|
+
self.chat_box = scrolledtext.ScrolledText(
|
|
176
|
+
self.root,
|
|
177
|
+
wrap=tk.WORD,
|
|
178
|
+
font=("Consolas", 11),
|
|
179
|
+
state="disabled"
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
self.chat_box.pack(
|
|
183
|
+
fill="both",
|
|
184
|
+
expand=True,
|
|
185
|
+
padx=10,
|
|
186
|
+
pady=(0, 10)
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
# Bottom input frame
|
|
190
|
+
self.bottom_frame = tk.Frame(self.root)
|
|
191
|
+
self.bottom_frame.pack(fill="x", padx=10, pady=10)
|
|
192
|
+
|
|
193
|
+
# User input field
|
|
194
|
+
self.input_box = tk.Entry(
|
|
195
|
+
self.bottom_frame,
|
|
196
|
+
font=("Consolas", 11)
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
self.input_box.pack(
|
|
200
|
+
side="left",
|
|
201
|
+
fill="x",
|
|
202
|
+
expand=True,
|
|
203
|
+
padx=(0, 10)
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
# Send button
|
|
207
|
+
self.send_button = ttk.Button(
|
|
208
|
+
self.bottom_frame,
|
|
209
|
+
text="Send",
|
|
210
|
+
command=self.send_message
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
self.send_button.pack(side="right")
|
|
214
|
+
|
|
215
|
+
# Send message on Enter key
|
|
216
|
+
self.input_box.bind(
|
|
217
|
+
"<Return>",
|
|
218
|
+
lambda event: self.send_message()
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
# --------------------------------------------------
|
|
222
|
+
# THEME SYSTEM
|
|
223
|
+
# --------------------------------------------------
|
|
224
|
+
|
|
225
|
+
def apply_theme(self):
|
|
226
|
+
|
|
227
|
+
if self.dark_mode:
|
|
228
|
+
|
|
229
|
+
bg = "#1e1e1e"
|
|
230
|
+
fg = "#ffffff"
|
|
231
|
+
input_bg = "#2b2b2b"
|
|
232
|
+
|
|
233
|
+
else:
|
|
234
|
+
|
|
235
|
+
bg = "#f0f0f0"
|
|
236
|
+
fg = "#000000"
|
|
237
|
+
input_bg = "#ffffff"
|
|
238
|
+
|
|
239
|
+
# Main window
|
|
240
|
+
self.root.configure(bg=bg)
|
|
241
|
+
|
|
242
|
+
# Frames
|
|
243
|
+
self.top_frame.configure(bg=bg)
|
|
244
|
+
self.bottom_frame.configure(bg=bg)
|
|
245
|
+
|
|
246
|
+
# Chat box
|
|
247
|
+
self.chat_box.configure(
|
|
248
|
+
bg=input_bg,
|
|
249
|
+
fg=fg,
|
|
250
|
+
insertbackground=fg
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
# Input field
|
|
254
|
+
self.input_box.configure(
|
|
255
|
+
bg=input_bg,
|
|
256
|
+
fg=fg,
|
|
257
|
+
insertbackground=fg
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
def toggle_theme(self):
|
|
261
|
+
|
|
262
|
+
self.dark_mode = not self.dark_mode
|
|
263
|
+
self.apply_theme()
|
|
264
|
+
|
|
265
|
+
# --------------------------------------------------
|
|
266
|
+
# CHAT FUNCTIONS
|
|
267
|
+
# --------------------------------------------------
|
|
268
|
+
|
|
269
|
+
def add_message(self, sender, message):
|
|
270
|
+
|
|
271
|
+
self.chat_box.configure(state="normal")
|
|
272
|
+
|
|
273
|
+
self.chat_box.insert(
|
|
274
|
+
tk.END,
|
|
275
|
+
f"{sender}: {message}\n\n"
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
self.chat_box.configure(state="disabled")
|
|
279
|
+
self.chat_box.see(tk.END)
|
|
280
|
+
|
|
281
|
+
def send_message(self):
|
|
282
|
+
|
|
283
|
+
user_message = self.input_box.get().strip()
|
|
284
|
+
|
|
285
|
+
if not user_message:
|
|
286
|
+
return
|
|
287
|
+
|
|
288
|
+
# Show user message
|
|
289
|
+
self.add_message("You", user_message)
|
|
290
|
+
|
|
291
|
+
# Clear input field
|
|
292
|
+
self.input_box.delete(0, tk.END)
|
|
293
|
+
|
|
294
|
+
# Run AI request in separate thread
|
|
295
|
+
threading.Thread(
|
|
296
|
+
target=self.get_ai_response,
|
|
297
|
+
args=(user_message,),
|
|
298
|
+
daemon=True
|
|
299
|
+
).start()
|
|
300
|
+
|
|
301
|
+
def get_ai_response(self, message):
|
|
302
|
+
|
|
303
|
+
try:
|
|
304
|
+
|
|
305
|
+
response = ask(message)
|
|
306
|
+
|
|
307
|
+
self.add_message(
|
|
308
|
+
"AI",
|
|
309
|
+
response
|
|
310
|
+
)
|
|
311
|
+
|
|
312
|
+
except Exception as e:
|
|
313
|
+
|
|
314
|
+
self.add_message(
|
|
315
|
+
"System",
|
|
316
|
+
f"Error: {e}"
|
|
317
|
+
)
|
|
318
|
+
|
|
319
|
+
# --------------------------------------------------
|
|
320
|
+
# HISTORY MANAGEMENT
|
|
321
|
+
# --------------------------------------------------
|
|
322
|
+
|
|
323
|
+
def reset_chat_history(self):
|
|
324
|
+
|
|
325
|
+
# Reset backend history
|
|
326
|
+
reset_history()
|
|
327
|
+
|
|
328
|
+
# Clear chat UI
|
|
329
|
+
self.chat_box.configure(state="normal")
|
|
330
|
+
self.chat_box.delete("1.0", tk.END)
|
|
331
|
+
self.chat_box.configure(state="disabled")
|
|
332
|
+
|
|
333
|
+
# Show system message
|
|
334
|
+
self.add_message(
|
|
335
|
+
"System",
|
|
336
|
+
"Conversation history has been cleared."
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
# --------------------------------------------------
|
|
340
|
+
# APPLICATION START
|
|
341
|
+
# --------------------------------------------------
|
|
342
|
+
|
|
343
|
+
def run(self):
|
|
344
|
+
|
|
345
|
+
self.root.mainloop()
|
|
346
|
+
|
|
347
|
+
if __name__ == '__main__':
|
|
348
|
+
chat()
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: neiroweb
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Python CLI Package made for AI Access
|
|
5
|
+
Home-page: https://github.com/CyberPlugger/aibot
|
|
6
|
+
Author: Andrew Sergeevich
|
|
7
|
+
Author-email: jumpki11@hotmail.com
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Requires-Python: >=3.7
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
Requires-Dist: requests
|
|
23
|
+
Dynamic: author
|
|
24
|
+
Dynamic: author-email
|
|
25
|
+
Dynamic: classifier
|
|
26
|
+
Dynamic: description
|
|
27
|
+
Dynamic: description-content-type
|
|
28
|
+
Dynamic: home-page
|
|
29
|
+
Dynamic: requires-dist
|
|
30
|
+
Dynamic: requires-python
|
|
31
|
+
Dynamic: summary
|
|
32
|
+
|
|
33
|
+
# 🤖 AIBOT
|
|
34
|
+
|
|
35
|
+
AIBOT is a Python AI CLI + GUI tool powered by Pollinations AI.
|
|
36
|
+
|
|
37
|
+
It allows you to interact with AI using:
|
|
38
|
+
- Terminal commands
|
|
39
|
+
- Interactive chat mode
|
|
40
|
+
- Graphical Tkinter chat interface
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## 🚀 Installation
|
|
45
|
+
|
|
46
|
+
Install via pip:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install aibot
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 💻 CLI Usage
|
|
55
|
+
|
|
56
|
+
Show help:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
aibot
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Ask AI:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
aibot ask "Hello!"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Start terminal chat:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
aibot chat
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Start graphical chat:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
aibot graphical_chat
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 🧠 History System
|
|
83
|
+
|
|
84
|
+
Show history:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
aibot history
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Reset history:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
aibot history --reset
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Set history manually:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
aibot history --set "['hello']"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## 🖥 Graphical Chat
|
|
105
|
+
|
|
106
|
+
To start the graphical AI chat interface:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
aibot graphical_chat
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Python usage
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from aibot.interactive import GraphicChat
|
|
116
|
+
|
|
117
|
+
app = GraphicChat()
|
|
118
|
+
app.run()
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## ⚙️ API
|
|
124
|
+
|
|
125
|
+
This project uses:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
https://text.pollinations.ai
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## 📁 Project Structure
|
|
134
|
+
|
|
135
|
+
```text
|
|
136
|
+
aibot/
|
|
137
|
+
├── __init__.py
|
|
138
|
+
├── __main__.py
|
|
139
|
+
├── cli.py
|
|
140
|
+
├── interactive.py
|
|
141
|
+
├── __version__.py
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## 🔧 Requirements
|
|
147
|
+
|
|
148
|
+
- Python 3.8+
|
|
149
|
+
- requests
|
|
150
|
+
- tkinter (built-in)
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 👤 Author
|
|
155
|
+
|
|
156
|
+
Andrey Sergeevich Cherepennikov
|
|
157
|
+
Aliases:
|
|
158
|
+
- vito
|
|
159
|
+
- CyberPlugger
|
|
160
|
+
- jumpkill
|
|
161
|
+
|
|
162
|
+
Age: 11
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## 📌 Run as module
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
python -m aibot
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## 🔮 Future ideas
|
|
175
|
+
|
|
176
|
+
- Streaming responses
|
|
177
|
+
- Plugin system
|
|
178
|
+
- Voice input/output
|
|
179
|
+
- Multi-session memory
|
|
180
|
+
- EXE build via PyInstaller
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
setup.py
|
|
3
|
+
neiroweb/__init__.py
|
|
4
|
+
neiroweb/__main__.py
|
|
5
|
+
neiroweb/__version__.py
|
|
6
|
+
neiroweb/cli.py
|
|
7
|
+
neiroweb/interactive.py
|
|
8
|
+
neiroweb.egg-info/PKG-INFO
|
|
9
|
+
neiroweb.egg-info/SOURCES.txt
|
|
10
|
+
neiroweb.egg-info/dependency_links.txt
|
|
11
|
+
neiroweb.egg-info/requires.txt
|
|
12
|
+
neiroweb.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
requests
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
neiroweb
|
neiroweb-1.0.0/setup.cfg
ADDED
neiroweb-1.0.0/setup.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
# Reading the long description from README.md
|
|
5
|
+
if os.path.exists(r"README.md"):
|
|
6
|
+
with open("README.md", "r", encoding="utf-8") as fh:
|
|
7
|
+
long_description = fh.read()
|
|
8
|
+
else:
|
|
9
|
+
long_description = "Python package made for better PIP access"
|
|
10
|
+
|
|
11
|
+
requirements = open("requirements.txt").read().split('\n')
|
|
12
|
+
|
|
13
|
+
setup(
|
|
14
|
+
name="neiroweb",
|
|
15
|
+
version="1.0.0",
|
|
16
|
+
author="Andrew Sergeevich",
|
|
17
|
+
author_email="jumpki11@hotmail.com",
|
|
18
|
+
description="Python CLI Package made for AI Access",
|
|
19
|
+
long_description=long_description,
|
|
20
|
+
long_description_content_type="text/markdown",
|
|
21
|
+
url="https://github.com/CyberPlugger/aibot",
|
|
22
|
+
packages=find_packages(),
|
|
23
|
+
classifiers=[
|
|
24
|
+
"Development Status :: 4 - Beta",
|
|
25
|
+
"Intended Audience :: Developers",
|
|
26
|
+
"License :: OSI Approved :: MIT License",
|
|
27
|
+
"Operating System :: OS Independent",
|
|
28
|
+
"Programming Language :: Python :: 3",
|
|
29
|
+
"Programming Language :: Python :: 3.7",
|
|
30
|
+
"Programming Language :: Python :: 3.8",
|
|
31
|
+
"Programming Language :: Python :: 3.9",
|
|
32
|
+
"Programming Language :: Python :: 3.10",
|
|
33
|
+
"Programming Language :: Python :: 3.11",
|
|
34
|
+
"Programming Language :: Python :: 3.12",
|
|
35
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
36
|
+
],
|
|
37
|
+
python_requires='>=3.7',
|
|
38
|
+
install_requires=requirements,
|
|
39
|
+
)
|