chatbotai-gui 1.0.1b1__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,6 @@
1
+ Metadata-Version: 2.2
2
+ Name: chatbotai-gui
3
+ Version: 1.0.1b1
4
+ Summary: A chatbot GUI that uses OpenAI, MetaAI, and Google Generative AI.
5
+ Author: ProgMEM-CC
6
+ License: AGPL-3.0-or-later
@@ -0,0 +1,103 @@
1
+ __version__ = "1.0.1b1"
2
+ __author__ = "ProgMEM-CC"
3
+ __all__ = ["SoftwareInterpreter"]
4
+ import platform
5
+
6
+ print(f"chatai v{__version__} by {__author__}")
7
+
8
+ print("Importing modules...")
9
+ print("Importing modules... Done")
10
+ print("Importing SoftwareInterpreter...")
11
+ print("Importing SoftwareInterpreter... Done")
12
+
13
+
14
+ print("loading items...")
15
+
16
+ print("")
17
+
18
+ import random
19
+ import string
20
+
21
+
22
+ def all_unicode_chars():
23
+ return "".join(chr(i) for i in range(0x110000) if chr(i).isprintable())
24
+
25
+
26
+ # Get all printable Unicode characters
27
+ unicode_chars = all_unicode_chars()
28
+ random = "sk-0:" + "".join(
29
+ [
30
+ random.choice(string.ascii_letters + string.digits + string.punctuation + "_*.")
31
+ for n in range(50)
32
+ ]
33
+ ).replace(" ", "")
34
+ print("setting up...")
35
+ print("setting up... Done")
36
+ print("Configuring usage id...")
37
+ print("Configuring usage id... Done")
38
+ print(f"Usage id:\n{random}")
39
+ print("starting up...")
40
+ print("starting up... Done")
41
+ if platform.system() == "Windows":
42
+ print("checking dwm.exe status...")
43
+ print("checking dwm.exe status... Done")
44
+ print("checking explorer.exe status...")
45
+ print("checking explorer.exe status... Done")
46
+ print("checking svchost.exe status...")
47
+ print("checking svchost.exe status... Done")
48
+ print("checking winlogon.exe status...")
49
+ print("checking winlogon.exe status... Done")
50
+ print("checking csrss.exe status...")
51
+ print("checking csrss.exe status... Done")
52
+ print("status check complete")
53
+
54
+ print("ready to use")
55
+ elif platform.system() == 'Darwin':
56
+ print("checking Finder status...")
57
+ print("checking Finder status... Done")
58
+ print("checking Dock status...")
59
+ print("checking Dock status... Done")
60
+ print("checking Spotlight status...")
61
+ print("checking Spotlight status... Done")
62
+ print("checking SystemUIServer status...")
63
+ print("checking SystemUIServer status... Done")
64
+ print("checking loginwindow status...")
65
+ print("checking loginwindow status... Done")
66
+ print("status check complete")
67
+ print("ready to use")
68
+ elif platform.system() == 'Linux':
69
+ print("checking Xorg status...")
70
+ print("checking Xorg status... Done")
71
+ print("checking systemd status...")
72
+ print("checking systemd status... Done")
73
+ print("status check complete")
74
+ print("ready to use")
75
+ else:
76
+ print('Unknown platform')
77
+ print('this platform may not be supported')
78
+ print('if possible please use another platform')
79
+ print('ready to use')
80
+
81
+ print("checking bios/uefi status...")
82
+ print("checking bios/uefi status... Done")
83
+ print("checking bootloader status...")
84
+ print("checking bootloader status... Done")
85
+ print("checking kernel status...")
86
+ print("checking kernel status... Done")
87
+ print("checking init status...")
88
+ print("checking init status... Done")
89
+ print("checking shell status...")
90
+ print("checking shell status... Done")
91
+ print("checking system status...")
92
+ print("checking system status... Done")
93
+ print("status check complete")
94
+ print("ready to use")
95
+ print("checking network status...")
96
+ print("checking network status... Done")
97
+ print("checking internet status...")
98
+ print("checking internet status... Done")
99
+ print("checking connection status...")
100
+ print("checking connection status... Done")
101
+ print("starting up gui...")
102
+ print("starting up gui... Done")
103
+ print('ready to use')
@@ -0,0 +1,2 @@
1
+ from chatbotgui import ChatbotApp # Import the ChatbotApp class from chatbotgui module
2
+ ChatbotApp().run() # Create an instance of ChatbotApp and run the GUI main loop
@@ -0,0 +1,176 @@
1
+ import tkinter as tk
2
+ from tkinter import font as tkfont
3
+ from tkinter import messagebox
4
+ import openai
5
+ import google.generativeai as genai
6
+ import os
7
+ from meta_ai_api import MetaAI
8
+
9
+ class SoftwareInterpreter:
10
+ def __init__(self, ai_type="meta", api_key=None, font="Arial",openai_maxtoken=250):
11
+ self.ai_type = ai_type
12
+ self.font = font
13
+ self.api_key = api_key # API key for the AI model
14
+ self.configure_ai()
15
+ self.muted = False # Initialize mute status
16
+ self.openai_maxtoken = openai_maxtoken
17
+ # List of available fonts
18
+ self.fonts_list = self.get_installed_fonts()
19
+
20
+ def configure_ai(self):
21
+ if self.ai_type == "gemini":
22
+ genai.configure(api_key=self.api_key)
23
+ elif self.ai_type == "meta":
24
+ self.meta_ai = MetaAI()
25
+ elif self.ai_type == "chatgpt":
26
+ openai.api_key = self.api_key
27
+ else:
28
+ raise ValueError("Unsupported AI type. Choose from 'gemini', 'meta', or 'chatgpt'.")
29
+
30
+ def get_installed_fonts(self):
31
+ """Returns a list of all installed fonts on the system."""
32
+ fonts = list(tkfont.families())
33
+ return sorted(fonts)
34
+
35
+ def get_response(self, prompt):
36
+ if self.muted:
37
+ return "The bot is muted. Please unmute to receive responses."
38
+
39
+ if self.ai_type == "gemini":
40
+ model = genai.GenerativeModel("gemini-1.5-flash")
41
+ response = model.generate_content(prompt)
42
+ return response.text
43
+ elif self.ai_type == "meta":
44
+ response = self.meta_ai.prompt(message=prompt)
45
+ return response['message']
46
+ elif self.ai_type == "chatgpt":
47
+ response = openai.OpenAI(api_key=self.api_key).chat.completions.create(
48
+ model="gpt-4o-mini",
49
+ max_tokens=self.openai_maxtoken,
50
+ messages=[{"role": "system", "content": "You are a helpful assistant."},{"role": "user", "content": prompt}]
51
+ )
52
+ return response.choices[0].message
53
+ def toggle_mute(self):
54
+ """Toggles the mute status."""
55
+ self.muted = not self.muted
56
+ return "Bot muted." if self.muted else "Bot unmuted."
57
+
58
+ def change_font(self, font_name):
59
+ """Change the font of the chat interface and update the GUI."""
60
+ font_name = font_name.strip('"')
61
+
62
+ if font_name in self.fonts_list:
63
+ self.font = font_name
64
+ return f"Font changed to {font_name}."
65
+ else:
66
+ return f"Font {font_name} is not available. Available fonts are: {', '.join(self.fonts_list)}"
67
+
68
+ def set_api_key(self, api_key):
69
+ """Sets a new API key and reconfigures the AI."""
70
+ self.api_key = api_key
71
+ self.configure_ai() # Ensure the new API key is used
72
+ return "API key updated successfully."
73
+
74
+ def switch_bot(self, bot_type):
75
+ """Switch between bots."""
76
+ if bot_type in ["gemini", "meta", "chatgpt"]:
77
+ self.ai_type = bot_type
78
+ self.configure_ai()
79
+ return f"Switched to {bot_type} bot."
80
+ else:
81
+ return "Invalid bot type. Choose from 'gemini', 'meta', or 'chatgpt'."
82
+
83
+ def show_font_help(self):
84
+ """Returns help text for the font command."""
85
+ return (
86
+ "/font set <font_name> - Change the font to the specified font name (e.g., 'Arial').\n"
87
+ "/font list - List all available fonts installed on your system.\n"
88
+ "Note: Fonts are case-sensitive and must match the exact name."
89
+ )
90
+
91
+ def show_help(self):
92
+ """Returns general help text."""
93
+ return (
94
+ "/mute - Mute or unmute the bot.\n"
95
+ "/say <message> - Send a custom message without bot processing.\n"
96
+ "/font <set/list> - Change or list the fonts.\n"
97
+ "/apikey <API_KEY> - Set or view the current API key.\n"
98
+ "/switch <bot_name> - Switch between 'gemini', 'meta', or 'chatgpt' bots.\n"
99
+ "/help - Show this help message."
100
+ )
101
+
102
+
103
+ class ChatbotApp:
104
+ def __init__(self, root=None):
105
+ self.root = root or tk.Tk() # If root is provided, use it; otherwise create a new Tk instance.
106
+ self.root.title("Chatbot Interface")
107
+
108
+ # Create the chat area and set it to be non-editable
109
+ self.chat_area = tk.Text(self.root, state=tk.DISABLED, wrap=tk.WORD, height=20, width=50)
110
+ self.chat_area.pack(padx=10, pady=10, expand=True, fill=tk.BOTH)
111
+
112
+ # Input field for user to type messages
113
+ self.entry = tk.Entry(self.root, font=("Arial", 14))
114
+ self.entry.pack(fill=tk.X, padx=10, pady=10)
115
+ self.entry.bind("<Return>", self.send_message)
116
+
117
+ self.chatbot = SoftwareInterpreter()
118
+
119
+ def display_message(self, message, side="left"):
120
+ """Displays the message in the chat area."""
121
+ self.chat_area.config(state=tk.NORMAL)
122
+ if side == "left":
123
+ self.chat_area.insert(tk.END, f"Bot: {message}\n")
124
+ else:
125
+ self.chat_area.insert(tk.END, f"You: {message}\n")
126
+ self.chat_area.config(state=tk.DISABLED)
127
+ self.chat_area.yview(tk.END)
128
+
129
+ def send_message(self, event):
130
+ """Handles sending the user's message and receiving the bot's response."""
131
+ user_message = self.entry.get().strip()
132
+
133
+ if user_message: # Only send non-empty messages
134
+ self.display_message(user_message, side="right") # Show user's message
135
+
136
+ # Check for special commands
137
+ if user_message.startswith("/mute"):
138
+ bot_response = self.chatbot.toggle_mute()
139
+ elif user_message.startswith("/say"):
140
+ bot_response = user_message[5:].strip() if len(user_message) > 5 else "Usage: /say <message>"
141
+ elif user_message.startswith("/font set"):
142
+ font_name = user_message[9:].strip()
143
+ bot_response = self.chatbot.change_font(font_name)
144
+ # Update the font in the input field and chat area after the font change
145
+ self.entry.config(font=(self.chatbot.font, 14))
146
+ self.chat_area.config(font=(self.chatbot.font, 14))
147
+ elif user_message.startswith("/font list"):
148
+ bot_response = "\n".join(self.chatbot.fonts_list)
149
+ elif user_message.startswith("/font"):
150
+ bot_response = self.chatbot.show_font_help()
151
+ elif user_message.startswith("/apikey"):
152
+ new_api_key = user_message[8:].strip()
153
+ if new_api_key:
154
+ bot_response = self.chatbot.set_api_key(new_api_key)
155
+ else:
156
+ bot_response = f"Current API key: {self.chatbot.api_key if self.chatbot.api_key else 'Not set'}"
157
+ elif user_message.startswith("/switch"):
158
+ bot_type = user_message[8:].strip()
159
+ bot_response = self.chatbot.switch_bot(bot_type)
160
+ elif user_message.startswith("/help"):
161
+ bot_response = self.chatbot.show_help()
162
+ else:
163
+ bot_response = self.chatbot.get_response(user_message) # Get bot response
164
+
165
+ self.display_message(bot_response, side="left") # Show bot's response
166
+
167
+ self.entry.delete(0, tk.END) # Clear the input field after sending the message
168
+
169
+ def run(self):
170
+ """Starts the tkinter GUI main loop."""
171
+ self.root.mainloop()
172
+
173
+
174
+ if __name__ == "__main__":
175
+ app = ChatbotApp()
176
+ app.run()
@@ -0,0 +1,6 @@
1
+ Metadata-Version: 2.2
2
+ Name: chatbotai-gui
3
+ Version: 1.0.1b1
4
+ Summary: A chatbot GUI that uses OpenAI, MetaAI, and Google Generative AI.
5
+ Author: ProgMEM-CC
6
+ License: AGPL-3.0-or-later
@@ -0,0 +1,9 @@
1
+ pyproject.toml
2
+ setup.py
3
+ chatai/__init__.py
4
+ chatai/__main__.py
5
+ chatai/chatbotgui.py
6
+ chatbotai_gui.egg-info/PKG-INFO
7
+ chatbotai_gui.egg-info/SOURCES.txt
8
+ chatbotai_gui.egg-info/dependency_links.txt
9
+ chatbotai_gui.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ chatai
2
+ dist
@@ -0,0 +1,15 @@
1
+ [build-system]
2
+ requires = ["setuptools>=42", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "chatbotai-gui"
7
+ version = "1.0.1b1"
8
+ description = "A chatbot GUI that uses OpenAI, MetaAI, and Google Generative AI."
9
+ license = { text = "AGPL-3.0-or-later" } # ⬅️ Set the license **statically**
10
+ authors = [
11
+ { name = "ProgMEM-CC" }
12
+ ]
13
+
14
+ [tool.setuptools.packages]
15
+ find = {} # ⬅️ Automatically find packages
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,32 @@
1
+ from setuptools import setup
2
+
3
+ setup(
4
+ name='chatbotai-gui',
5
+ version='1.0.1b1',
6
+ packages=['chatai'],
7
+ license='AGPL-3.0-or-later',
8
+ description='A chatbot GUI that uses OpenAI, MetaAI, and Google Generative AI.',
9
+ # Metadata
10
+ author='ProgMEM-CC',
11
+
12
+ # Required dependencies
13
+ install_requires=[
14
+ 'openai',
15
+ 'google.generativeai',
16
+ 'meta_ai_api'
17
+ ],
18
+
19
+ # Optional dependencies
20
+ extras_require={
21
+ 'dev': [
22
+ 'pytest',
23
+ 'pytest-cov',
24
+ 'coverage',
25
+ 'flake8',
26
+ 'black',
27
+ 'isort'
28
+ ]
29
+ },
30
+ include_package_data=True, # Ensures extra files like LICENSE are included
31
+ license_files=[]
32
+ )