chatbotai-gui 1.0.5.post1__py3-none-any.whl → 2.1.0.post2__py3-none-any.whl
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.
- chatai/chatbotgui.py +59 -24
- {chatbotai_gui-1.0.5.post1.dist-info → chatbotai_gui-2.1.0.post2.dist-info}/METADATA +36 -6
- chatbotai_gui-2.1.0.post2.dist-info/RECORD +7 -0
- {chatbotai_gui-1.0.5.post1.dist-info → chatbotai_gui-2.1.0.post2.dist-info}/WHEEL +1 -1
- chatbotai_gui-1.0.5.post1.dist-info/RECORD +0 -7
- {chatbotai_gui-1.0.5.post1.dist-info → chatbotai_gui-2.1.0.post2.dist-info}/top_level.txt +0 -0
chatai/chatbotgui.py
CHANGED
@@ -5,12 +5,16 @@ import openai
|
|
5
5
|
import google.generativeai as genai
|
6
6
|
import os
|
7
7
|
from meta_ai_api import MetaAI
|
8
|
+
import openai as openai
|
9
|
+
import anthropic # Anthropic API import for Claude
|
10
|
+
from PIL import Image as InternalspilImage,ImageTk as InternalspilImageTk
|
8
11
|
|
9
12
|
class SoftwareInterpreter:
|
10
|
-
def __init__(self, ai_type="meta", api_key=None, font="Arial",openai_maxtoken=250):
|
13
|
+
def __init__(self, ai_type="meta", api_key=None, font="Arial", openai_maxtoken=250):
|
11
14
|
self.ai_type = ai_type
|
12
15
|
self.font = font
|
13
|
-
self.api_key = api_key
|
16
|
+
self.api_key = api_key
|
17
|
+
self.model = None # Set model to None initially
|
14
18
|
self.configure_ai()
|
15
19
|
self.muted = False # Initialize mute status
|
16
20
|
self.openai_maxtoken = openai_maxtoken
|
@@ -20,38 +24,59 @@ class SoftwareInterpreter:
|
|
20
24
|
def configure_ai(self):
|
21
25
|
if self.ai_type == "gemini":
|
22
26
|
genai.configure(api_key=self.api_key)
|
27
|
+
self.model = "gemini-1.5-flash" # Default model for Gemini
|
23
28
|
elif self.ai_type == "meta":
|
24
29
|
self.meta_ai = MetaAI()
|
30
|
+
self.model = "meta-ai-1.0" # Default model for Meta AI
|
25
31
|
elif self.ai_type == "chatgpt":
|
26
32
|
openai.api_key = self.api_key
|
33
|
+
self.model = "gpt-3.5-turbo" # Default model for ChatGPT
|
34
|
+
elif self.ai_type == "claude":
|
35
|
+
self.claude = anthropic.Anthropic(api_key=self.api_key)
|
36
|
+
self.model = "claude-3-7-sonnet-20250219" # Default model for Claude
|
27
37
|
else:
|
28
|
-
raise ValueError("Unsupported AI type. Choose from 'gemini', 'meta', or '
|
38
|
+
raise ValueError("Unsupported AI type. Choose from 'gemini', 'meta', 'chatgpt', or 'claude'.")
|
29
39
|
|
30
40
|
def get_installed_fonts(self):
|
31
41
|
"""Returns a list of all installed fonts on the system."""
|
32
42
|
fonts = list(tkfont.families())
|
33
43
|
return sorted(fonts)
|
44
|
+
def search_font(self, search_term):
|
45
|
+
"""Searches for fonts that contain the search term and returns matching fonts."""
|
46
|
+
matching_fonts = [font for font in self.fonts_list if search_term.lower() in font.lower()]
|
47
|
+
return "\n".join(matching_fonts) if matching_fonts else f"No fonts found matching '{search_term}'."
|
48
|
+
|
34
49
|
|
35
50
|
def get_response(self, prompt):
|
36
51
|
if self.muted:
|
37
52
|
return "The bot is muted. Please unmute to receive responses."
|
38
53
|
|
39
54
|
if self.ai_type == "gemini":
|
40
|
-
model = genai.GenerativeModel(
|
55
|
+
model = genai.GenerativeModel(self.model)
|
41
56
|
response = model.generate_content(prompt)
|
42
57
|
return response.text
|
43
58
|
elif self.ai_type == "meta":
|
44
59
|
response = self.meta_ai.prompt(message=prompt)
|
45
60
|
return response['message']
|
46
61
|
elif self.ai_type == "chatgpt":
|
47
|
-
response = openai.
|
48
|
-
model=
|
49
|
-
|
50
|
-
|
62
|
+
response = openai.Completion.create(
|
63
|
+
model=self.model, # Using self.model here
|
64
|
+
prompt=prompt,
|
65
|
+
max_tokens=self.openai_maxtoken
|
51
66
|
)
|
52
|
-
return response.choices[0].
|
67
|
+
return response.choices[0].text.strip()
|
68
|
+
elif self.ai_type == "claude":
|
69
|
+
message = self.claude.messages.create(
|
70
|
+
model=self.model, # Using self.model here
|
71
|
+
max_tokens=1024,
|
72
|
+
messages=[
|
73
|
+
{"role": "user", "content": prompt}
|
74
|
+
]
|
75
|
+
)
|
76
|
+
return message.content
|
77
|
+
|
53
78
|
def toggle_mute(self):
|
54
|
-
"""Toggles the mute status."""
|
79
|
+
"""Toggles the mute status."""
|
55
80
|
self.muted = not self.muted
|
56
81
|
return "Bot muted." if self.muted else "Bot unmuted."
|
57
82
|
|
@@ -73,38 +98,40 @@ class SoftwareInterpreter:
|
|
73
98
|
|
74
99
|
def switch_bot(self, bot_type):
|
75
100
|
"""Switch between bots."""
|
76
|
-
if bot_type in ["gemini", "meta", "chatgpt"]:
|
101
|
+
if bot_type in ["gemini", "meta", "chatgpt", "claude"]:
|
77
102
|
self.ai_type = bot_type
|
78
103
|
self.configure_ai()
|
79
104
|
return f"Switched to {bot_type} bot."
|
80
105
|
else:
|
81
|
-
return "Invalid bot type. Choose from 'gemini', 'meta', or '
|
106
|
+
return "Invalid bot type. Choose from 'gemini', 'meta', 'chatgpt', or 'claude'."
|
82
107
|
|
83
|
-
def
|
84
|
-
"""
|
85
|
-
|
86
|
-
|
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
|
-
)
|
108
|
+
def set_model(self, model_name):
|
109
|
+
"""Sets the AI model if it exists."""
|
110
|
+
self.model = model_name
|
111
|
+
return f"Model changed to {model_name}."
|
90
112
|
|
91
113
|
def show_help(self):
|
92
114
|
"""Returns general help text."""
|
93
115
|
return (
|
94
116
|
"/mute - Mute or unmute the bot.\n"
|
95
117
|
"/say <message> - Send a custom message without bot processing.\n"
|
96
|
-
"/font <set/list> - Change or
|
118
|
+
"/font <set/list/search> - Change, list, or search fonts.\n"
|
97
119
|
"/apikey <API_KEY> - Set or view the current API key.\n"
|
98
|
-
"/switch <bot_name> - Switch between 'gemini', 'meta', or '
|
120
|
+
"/switch <bot_name> - Switch between 'gemini', 'meta', 'chatgpt', or 'claude' bots.\n"
|
121
|
+
"/model <set> - Set AI model to the specified model.\n"
|
99
122
|
"/help - Show this help message."
|
100
123
|
)
|
101
124
|
|
102
125
|
|
103
126
|
class ChatbotApp:
|
104
|
-
def __init__(self, root=None):
|
127
|
+
def __init__(self, root=None, title="ChatBotAi-GUI",icon=os.path.dirname(__file__) + "/defaulticon.png"):
|
105
128
|
self.root = root or tk.Tk() # If root is provided, use it; otherwise create a new Tk instance.
|
106
|
-
self.
|
107
|
-
|
129
|
+
self.title=title
|
130
|
+
self.root.title(self.title)
|
131
|
+
self.iconfile=icon
|
132
|
+
self.icondata= InternalspilImage.open(self.iconfile)
|
133
|
+
photo = InternalspilImageTk.PhotoImage(self.icondata)
|
134
|
+
self.root.wm_iconphoto(False, photo)
|
108
135
|
# Create the chat area and set it to be non-editable
|
109
136
|
self.chat_area = tk.Text(self.root, state=tk.DISABLED, wrap=tk.WORD, height=20, width=50)
|
110
137
|
self.chat_area.pack(padx=10, pady=10, expand=True, fill=tk.BOTH)
|
@@ -146,6 +173,9 @@ class ChatbotApp:
|
|
146
173
|
self.chat_area.config(font=(self.chatbot.font, 14))
|
147
174
|
elif user_message.startswith("/font list"):
|
148
175
|
bot_response = "\n".join(self.chatbot.fonts_list)
|
176
|
+
elif user_message.startswith("/font search"):
|
177
|
+
search_term = user_message[13:].strip()
|
178
|
+
bot_response = self.chatbot.search_font(search_term)
|
149
179
|
elif user_message.startswith("/font"):
|
150
180
|
bot_response = self.chatbot.show_font_help()
|
151
181
|
elif user_message.startswith("/apikey"):
|
@@ -157,6 +187,11 @@ class ChatbotApp:
|
|
157
187
|
elif user_message.startswith("/switch"):
|
158
188
|
bot_type = user_message[8:].strip()
|
159
189
|
bot_response = self.chatbot.switch_bot(bot_type)
|
190
|
+
elif user_message.startswith("/model set"):
|
191
|
+
model_name = user_message[10:].strip()
|
192
|
+
bot_response = self.chatbot.set_model(model_name)
|
193
|
+
elif user_message.startswith("/model"):
|
194
|
+
bot_response = self.chatbot.show_help()
|
160
195
|
elif user_message.startswith("/help"):
|
161
196
|
bot_response = self.chatbot.show_help()
|
162
197
|
else:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: chatbotai-gui
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 2.1.0.post2
|
4
4
|
Summary: A chatbot GUI that uses OpenAI, MetaAI, and Google Generative AI.
|
5
5
|
Author: ProgMEM-CC
|
6
6
|
License: AGPL-3.0-or-later
|
@@ -8,6 +8,7 @@ Description-Content-Type: text/x-rst
|
|
8
8
|
Requires-Dist: openai
|
9
9
|
Requires-Dist: meta_ai_api
|
10
10
|
Requires-Dist: google-generativeai
|
11
|
+
Requires-Dist: anthropic
|
11
12
|
Provides-Extra: dev
|
12
13
|
Requires-Dist: pytest; extra == "dev"
|
13
14
|
Requires-Dist: pytest-cov; extra == "dev"
|
@@ -19,11 +20,11 @@ Requires-Dist: isort; extra == "dev"
|
|
19
20
|
ChatbotAI-GUI
|
20
21
|
=============
|
21
22
|
|
22
|
-
**ChatbotAI-GUI** is a graphical user interface (GUI) chatbot that integrates multiple AI models, including OpenAI, Meta AI,
|
23
|
+
**ChatbotAI-GUI** is a graphical user interface (GUI) chatbot that integrates multiple AI models, including OpenAI, Meta AI, Google Generative AI, and Anthropic Claude. This package allows users to interact with different AI models seamlessly through a single application.
|
23
24
|
|
24
25
|
✨ Features
|
25
26
|
------------
|
26
|
-
- Supports **OpenAI**, **Meta AI API**,
|
27
|
+
- Supports **OpenAI**, **Meta AI API**, **Google Generative AI**, and **Anthropic Claude**.
|
27
28
|
- Simple and intuitive GUI for easy interaction.
|
28
29
|
- Extensible and customizable for different chatbot implementations.
|
29
30
|
|
@@ -54,21 +55,50 @@ Or in a Python script:
|
|
54
55
|
|
55
56
|
📝 Configuration
|
56
57
|
----------------
|
57
|
-
|
58
|
+
The chatbot uses a software interpreter to process API keys and select the AI model on launch.
|
59
|
+
You can also configure the application's title and icon using the `ChatbotApp` class.
|
60
|
+
|
61
|
+
After launching the GUI, you can use the `/help` command to see available commands.
|
62
|
+
|
63
|
+
Example configuration:
|
58
64
|
|
59
65
|
.. code-block:: python
|
60
66
|
|
61
67
|
from chatai.chatbotgui import ChatbotApp, SoftwareInterpreter
|
62
68
|
|
63
|
-
app = ChatbotApp()
|
69
|
+
app = ChatbotApp(title="ExampleTitle", icon="icon.png")
|
64
70
|
app.chatbot = SoftwareInterpreter(
|
65
71
|
api_key="YOUR_API_KEY_HERE",
|
66
|
-
ai_type="GEMINI", # Choose from "GEMINI", "CHATGPT", "META"
|
72
|
+
ai_type="GEMINI", # Choose from "GEMINI", "CHATGPT", "META", or "Claude"
|
67
73
|
font="Arial",
|
68
74
|
openai_maxtoken=250,
|
69
75
|
)
|
70
76
|
app.run()
|
71
77
|
|
78
|
+
🛠 Commands
|
79
|
+
------------
|
80
|
+
Here are the available commands:
|
81
|
+
|
82
|
+
.. code-block:: text
|
83
|
+
|
84
|
+
/mute - Mute or unmute the bot.
|
85
|
+
/say <message> - Send a custom message without bot processing.
|
86
|
+
/font <set/list/search> - Change, list, or search fonts.
|
87
|
+
/apikey <API_KEY> - Set or view the current API key.
|
88
|
+
/switch <bot_name> - Switch between 'gemini', 'meta', 'chatgpt', or 'claude'.
|
89
|
+
/model <set> - Set the AI model to the specified model.
|
90
|
+
/help - Show this help message.
|
91
|
+
|
92
|
+
⚙️ Advanced Configuration
|
93
|
+
-------------------------
|
94
|
+
For advanced users, replacing the root window is allowed:
|
95
|
+
|
96
|
+
.. code-block:: python
|
97
|
+
|
98
|
+
import tkinter as tk
|
99
|
+
app = ChatbotApp(root=tk.Tk())
|
100
|
+
app.run()
|
101
|
+
|
72
102
|
📜 License
|
73
103
|
-----------
|
74
104
|
This project is licensed under **AGPL-3.0-or-later**. See the `LICENSE` file for more details.
|
@@ -0,0 +1,7 @@
|
|
1
|
+
chatai/__init__.py,sha256=2xKUBq0-tjLn88n92IOS0eNZIgywDxHfZTY9w-Zgxbo,3282
|
2
|
+
chatai/__main__.py,sha256=4tAOzUAJrsa3st202WTvfNPsKh0LVXs8BD-JA1ar_rA,168
|
3
|
+
chatai/chatbotgui.py,sha256=KR6aoBMAboQt-2hyqGlFNEuSV07SFLWbJgZRyfYTPvo,9337
|
4
|
+
chatbotai_gui-2.1.0.post2.dist-info/METADATA,sha256=QBNZh3gOkIxvDxbLXIi5x7Q8uw7FnK-VebweeHM08io,3016
|
5
|
+
chatbotai_gui-2.1.0.post2.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
6
|
+
chatbotai_gui-2.1.0.post2.dist-info/top_level.txt,sha256=HDCQB7_6yio4QMbTcjAN9lFfqE3SGdOjJ-o7wtMtypM,7
|
7
|
+
chatbotai_gui-2.1.0.post2.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
chatai/__init__.py,sha256=2xKUBq0-tjLn88n92IOS0eNZIgywDxHfZTY9w-Zgxbo,3282
|
2
|
-
chatai/__main__.py,sha256=4tAOzUAJrsa3st202WTvfNPsKh0LVXs8BD-JA1ar_rA,168
|
3
|
-
chatai/chatbotgui.py,sha256=sU89yngl4Ejtyuq_r_k0nUrGB1u0gk37ZfKzH5AobLc,7527
|
4
|
-
chatbotai_gui-1.0.5.post1.dist-info/METADATA,sha256=zqX0FiUcaGEh6tsrSL07wUBY1JWk9DaKExJJtnShxIg,1989
|
5
|
-
chatbotai_gui-1.0.5.post1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
6
|
-
chatbotai_gui-1.0.5.post1.dist-info/top_level.txt,sha256=HDCQB7_6yio4QMbTcjAN9lFfqE3SGdOjJ-o7wtMtypM,7
|
7
|
-
chatbotai_gui-1.0.5.post1.dist-info/RECORD,,
|
File without changes
|