pygpt-net 2.6.1__py3-none-any.whl → 2.6.2__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.
Files changed (61) hide show
  1. pygpt_net/CHANGELOG.txt +4 -0
  2. pygpt_net/__init__.py +3 -3
  3. pygpt_net/app.py +15 -1
  4. pygpt_net/controller/chat/response.py +5 -3
  5. pygpt_net/controller/chat/stream.py +40 -2
  6. pygpt_net/controller/plugins/plugins.py +25 -0
  7. pygpt_net/controller/presets/editor.py +33 -88
  8. pygpt_net/controller/presets/experts.py +20 -1
  9. pygpt_net/controller/presets/presets.py +2 -2
  10. pygpt_net/controller/ui/mode.py +17 -66
  11. pygpt_net/core/agents/runner.py +15 -7
  12. pygpt_net/core/experts/experts.py +3 -3
  13. pygpt_net/data/config/config.json +3 -3
  14. pygpt_net/data/config/models.json +3 -3
  15. pygpt_net/data/locale/locale.de.ini +2 -0
  16. pygpt_net/data/locale/locale.en.ini +2 -0
  17. pygpt_net/data/locale/locale.es.ini +2 -0
  18. pygpt_net/data/locale/locale.fr.ini +2 -0
  19. pygpt_net/data/locale/locale.it.ini +2 -0
  20. pygpt_net/data/locale/locale.pl.ini +3 -1
  21. pygpt_net/data/locale/locale.uk.ini +2 -0
  22. pygpt_net/data/locale/locale.zh.ini +2 -0
  23. pygpt_net/plugin/base/plugin.py +35 -3
  24. pygpt_net/plugin/bitbucket/__init__.py +12 -0
  25. pygpt_net/plugin/bitbucket/config.py +267 -0
  26. pygpt_net/plugin/bitbucket/plugin.py +125 -0
  27. pygpt_net/plugin/bitbucket/worker.py +569 -0
  28. pygpt_net/plugin/facebook/__init__.py +12 -0
  29. pygpt_net/plugin/facebook/config.py +359 -0
  30. pygpt_net/plugin/facebook/plugin.py +114 -0
  31. pygpt_net/plugin/facebook/worker.py +698 -0
  32. pygpt_net/plugin/github/__init__.py +12 -0
  33. pygpt_net/plugin/github/config.py +441 -0
  34. pygpt_net/plugin/github/plugin.py +124 -0
  35. pygpt_net/plugin/github/worker.py +674 -0
  36. pygpt_net/plugin/google/__init__.py +12 -0
  37. pygpt_net/plugin/google/config.py +367 -0
  38. pygpt_net/plugin/google/plugin.py +126 -0
  39. pygpt_net/plugin/google/worker.py +826 -0
  40. pygpt_net/plugin/slack/__init__.py +12 -0
  41. pygpt_net/plugin/slack/config.py +349 -0
  42. pygpt_net/plugin/slack/plugin.py +116 -0
  43. pygpt_net/plugin/slack/worker.py +639 -0
  44. pygpt_net/plugin/telegram/__init__.py +12 -0
  45. pygpt_net/plugin/telegram/config.py +308 -0
  46. pygpt_net/plugin/telegram/plugin.py +118 -0
  47. pygpt_net/plugin/telegram/worker.py +563 -0
  48. pygpt_net/plugin/twitter/__init__.py +12 -0
  49. pygpt_net/plugin/twitter/config.py +491 -0
  50. pygpt_net/plugin/twitter/plugin.py +126 -0
  51. pygpt_net/plugin/twitter/worker.py +837 -0
  52. pygpt_net/provider/agents/llama_index/legacy/openai_assistant.py +35 -3
  53. pygpt_net/ui/base/config_dialog.py +4 -0
  54. pygpt_net/ui/dialog/preset.py +34 -77
  55. pygpt_net/ui/layout/toolbox/presets.py +2 -2
  56. pygpt_net/ui/main.py +3 -1
  57. {pygpt_net-2.6.1.dist-info → pygpt_net-2.6.2.dist-info}/METADATA +145 -2
  58. {pygpt_net-2.6.1.dist-info → pygpt_net-2.6.2.dist-info}/RECORD +61 -33
  59. {pygpt_net-2.6.1.dist-info → pygpt_net-2.6.2.dist-info}/LICENSE +0 -0
  60. {pygpt_net-2.6.1.dist-info → pygpt_net-2.6.2.dist-info}/WHEEL +0 -0
  61. {pygpt_net-2.6.1.dist-info → pygpt_net-2.6.2.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # ================================================== #
4
+ # This file is a part of PYGPT package #
5
+ # Website: https://pygpt.net #
6
+ # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
+ # MIT License #
8
+ # Created By : Marcin Szczygliński #
9
+ # Updated Date: 2025.06.30 02:00:00 #
10
+ # ================================================== #
11
+
12
+ from .plugin import *
@@ -0,0 +1,367 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # ================================================== #
4
+ # This file is a part of PYGPT package #
5
+ # Website: https://pygpt.net #
6
+ # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
+ # MIT License #
8
+ # Created By : Marcin Szczygliński #
9
+ # Updated Date: 2025.07.14 00:00:00 #
10
+ # ================================================== #
11
+
12
+ from pygpt_net.core.types import MODEL_DEFAULT_MINI
13
+ from pygpt_net.plugin.base.config import BaseConfig, BasePlugin
14
+
15
+
16
+ class Config(BaseConfig):
17
+ def __init__(self, plugin: BasePlugin = None, *args, **kwargs):
18
+ super(Config, self).__init__(plugin)
19
+ self.plugin = plugin
20
+
21
+
22
+ def from_defaults(self, plugin: BasePlugin = None):
23
+ plugin.add_option(
24
+ "credentials",
25
+ type="textarea",
26
+ value="",
27
+ label="Google credentials.json (content)",
28
+ description="Paste JSON content of your OAuth client or Service Account.",
29
+ secret=True,
30
+ )
31
+ plugin.add_option(
32
+ "oauth_token",
33
+ type="textarea",
34
+ value="",
35
+ label="OAuth token store (auto)",
36
+ description="Automatically stored/updated refresh token.",
37
+ secret=True,
38
+ )
39
+ plugin.add_option(
40
+ "oauth_local_server",
41
+ type="bool",
42
+ value=True,
43
+ label="Use local server for OAuth",
44
+ description="Run local server for installed app OAuth flow.",
45
+ )
46
+ plugin.add_option(
47
+ "oauth_local_port",
48
+ type="int",
49
+ value=0,
50
+ label="OAuth local port (0=random)",
51
+ description="Port for InstalledAppFlow.run_local_server.",
52
+ )
53
+ plugin.add_option(
54
+ "oauth_scopes",
55
+ type="text",
56
+ value="https://www.googleapis.com/auth/gmail.readonly https://www.googleapis.com/auth/gmail.send https://www.googleapis.com/auth/gmail.modify https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/drive https://www.googleapis.com/auth/contacts https://www.googleapis.com/auth/youtube.readonly",
57
+ label="Scopes",
58
+ description="Space-separated OAuth scopes. To use native Keep, add: https://www.googleapis.com/auth/keep and https://www.googleapis.com/auth/keep.readonly.",
59
+ )
60
+ plugin.add_option(
61
+ "impersonate_user",
62
+ type="text",
63
+ value="",
64
+ label="Impersonate user (Workspace DWD)",
65
+ description="Optional subject for service account domain‑wide delegation.",
66
+ )
67
+ plugin.add_option(
68
+ "youtube_api_key",
69
+ type="text",
70
+ value="",
71
+ label="YouTube API Key (optional)",
72
+ description="If provided, used for public video info without OAuth.",
73
+ secret=True,
74
+ )
75
+ plugin.add_option(
76
+ "allow_unofficial_youtube_transcript",
77
+ type="bool",
78
+ value=False,
79
+ label="Allow unofficial YouTube transcript",
80
+ description="Use youtube-transcript-api fallback when official captions are not available.",
81
+ )
82
+ plugin.add_option(
83
+ "keep_mode",
84
+ type="combo",
85
+ value="auto",
86
+ label="Keep mode",
87
+ description="official | unofficial | auto",
88
+ keys=["auto", "official", "unofficial"],
89
+ )
90
+ plugin.add_option(
91
+ "allow_unofficial_keep",
92
+ type="bool",
93
+ value=True,
94
+ label="Allow unofficial Keep",
95
+ description="Enable gkeepapi fallback (needs keep_username and keep_master_token).",
96
+ )
97
+ plugin.add_option(
98
+ "keep_username",
99
+ type="text",
100
+ value="",
101
+ label="Keep username (unofficial)",
102
+ description="Email for gkeepapi.",
103
+ )
104
+ plugin.add_option(
105
+ "keep_master_token",
106
+ type="text",
107
+ value="",
108
+ label="Keep master token (unofficial)",
109
+ description="Master token for gkeepapi (handle securely).",
110
+ secret=True,
111
+ )
112
+
113
+
114
+ # Gmail
115
+ plugin.add_cmd(
116
+ "gmail_list_recent",
117
+ instruction="List n newest Gmail messages",
118
+ params=[
119
+ {"name": "n", "type": "int", "required": False, "description": "How many, default 10"},
120
+ {"name": "q", "type": "str", "required": False, "description": "Gmail search query"},
121
+ {"name": "labelIds", "type": "list", "required": False, "description": "Label IDs"},
122
+ ],
123
+ enabled=True,
124
+ description="Gmail: newest mails",
125
+ tab="gmail",
126
+ )
127
+ plugin.add_cmd(
128
+ "gmail_list_all",
129
+ instruction="List all Gmail messages (paginated)",
130
+ params=[
131
+ {"name": "q", "type": "str", "required": False, "description": "Gmail search query"},
132
+ {"name": "labelIds", "type": "list", "required": False, "description": "Label IDs"},
133
+ {"name": "limit", "type": "int", "required": False, "description": "Safety limit"},
134
+ ],
135
+ enabled=True,
136
+ description="Gmail: list all",
137
+ tab="gmail",
138
+ )
139
+ plugin.add_cmd(
140
+ "gmail_search",
141
+ instruction="Search Gmail",
142
+ params=[
143
+ {"name": "q", "type": "str", "required": True, "description": "Query"},
144
+ {"name": "max", "type": "int", "required": False, "description": "Max results, default 50"},
145
+ ],
146
+ enabled=True,
147
+ description="Gmail: search",
148
+ tab="gmail",
149
+ )
150
+ plugin.add_cmd(
151
+ "gmail_get_by_id",
152
+ instruction="Get Gmail message by ID",
153
+ params=[{"name": "id", "type": "str", "required": True, "description": "Message ID"}],
154
+ enabled=True,
155
+ description="Gmail: get by id",
156
+ tab="gmail",
157
+ )
158
+ plugin.add_cmd(
159
+ "gmail_send",
160
+ instruction="Send Gmail message",
161
+ params=[
162
+ {"name": "to", "type": "str", "required": True, "description": "Recipient"},
163
+ {"name": "subject", "type": "str", "required": False, "description": "Subject"},
164
+ {"name": "body", "type": "str", "required": False, "description": "Body"},
165
+ {"name": "html", "type": "bool", "required": False, "description": "HTML body?"},
166
+ {"name": "cc", "type": "str", "required": False, "description": "CC"},
167
+ {"name": "bcc", "type": "str", "required": False, "description": "BCC"},
168
+ {"name": "attachments", "type": "list", "required": False, "description": "Local file paths"},
169
+ ],
170
+ enabled=True,
171
+ description="Gmail: send",
172
+ tab="gmail",
173
+ )
174
+
175
+
176
+ # Calendar
177
+ plugin.add_cmd(
178
+ "calendar_events_recent",
179
+ instruction="Upcoming events (from now)",
180
+ params=[{"name": "limit", "type": "int", "required": False, "description": "Default 10"}],
181
+ enabled=True,
182
+ description="Calendar: upcoming",
183
+ tab="calendar",
184
+ )
185
+ plugin.add_cmd(
186
+ "calendar_events_today",
187
+ instruction="Events for today (UTC day bounds)",
188
+ params=[],
189
+ enabled=True,
190
+ description="Calendar: today",
191
+ tab="calendar",
192
+ )
193
+ plugin.add_cmd(
194
+ "calendar_events_tomorrow",
195
+ instruction="Events for tomorrow (UTC day bounds)",
196
+ params=[],
197
+ enabled=True,
198
+ description="Calendar: tomorrow",
199
+ tab="calendar",
200
+ )
201
+ plugin.add_cmd(
202
+ "calendar_events_all",
203
+ instruction="All events in range",
204
+ params=[
205
+ {"name": "timeMin", "type": "str", "required": False, "description": "RFC3339"},
206
+ {"name": "timeMax", "type": "str", "required": False, "description": "RFC3339"},
207
+ ],
208
+ enabled=True,
209
+ description="Calendar: all in range",
210
+ tab="calendar",
211
+ )
212
+ plugin.add_cmd(
213
+ "calendar_events_by_date",
214
+ instruction="Events for date or date range",
215
+ params=[
216
+ {"name": "date", "type": "str", "required": True, "description": "YYYY-MM-DD or start|end RFC3339"},
217
+ ],
218
+ enabled=True,
219
+ description="Calendar: by date",
220
+ tab="calendar",
221
+ )
222
+ plugin.add_cmd(
223
+ "calendar_add_event",
224
+ instruction="Add calendar event",
225
+ params=[
226
+ {"name": "summary", "type": "str", "required": True, "description": "Title"},
227
+ {"name": "start", "type": "str", "required": True, "description": "YYYY-MM-DDTHH:MM or RFC3339"},
228
+ {"name": "end", "type": "str", "required": True, "description": "YYYY-MM-DDTHH:MM or RFC3339"},
229
+ {"name": "timezone", "type": "str", "required": False, "description": "Default UTC"},
230
+ {"name": "description", "type": "str", "required": False, "description": "Description"},
231
+ {"name": "location", "type": "str", "required": False, "description": "Location"},
232
+ {"name": "attendees", "type": "list", "required": False, "description": "Emails"},
233
+ ],
234
+ enabled=True,
235
+ description="Calendar: add event",
236
+ tab="calendar",
237
+ )
238
+ plugin.add_cmd(
239
+ "calendar_delete_event",
240
+ instruction="Delete event by ID",
241
+ params=[{"name": "event_id", "type": "str", "required": True, "description": "Event ID"}],
242
+ enabled=True,
243
+ description="Calendar: delete",
244
+ tab="calendar",
245
+ )
246
+
247
+
248
+ # Keep
249
+ plugin.add_cmd(
250
+ "keep_list_notes",
251
+ instruction="List notes (Keep)",
252
+ params=[{"name": "limit", "type": "int", "required": False, "description": "Default 50"}],
253
+ enabled=True,
254
+ description="Keep: list notes",
255
+ tab="keep",
256
+ )
257
+ plugin.add_cmd(
258
+ "keep_add_note",
259
+ instruction="Add note (Keep)",
260
+ params=[
261
+ {"name": "title", "type": "str", "required": False, "description": "Title"},
262
+ {"name": "text", "type": "str", "required": False, "description": "Content"},
263
+ ],
264
+ enabled=True,
265
+ description="Keep: add note",
266
+ tab="keep",
267
+ )
268
+
269
+
270
+ # Drive
271
+ plugin.add_cmd(
272
+ "drive_list_files",
273
+ instruction="List Drive files",
274
+ params=[
275
+ {"name": "q", "type": "str", "required": False, "description": "Drive query"},
276
+ {"name": "page_size", "type": "int", "required": False, "description": "Default 100"},
277
+ {"name": "fields", "type": "str", "required": False, "description": "Fields mask"},
278
+ ],
279
+ enabled=True,
280
+ description="Drive: list files",
281
+ tab="drive",
282
+ )
283
+ plugin.add_cmd(
284
+ "drive_find_by_path",
285
+ instruction="Find Drive file by path",
286
+ params=[{"name": "path", "type": "str", "required": True, "description": "/Folder/Sub/file.ext"}],
287
+ enabled=True,
288
+ description="Drive: find by path",
289
+ tab="drive",
290
+ )
291
+ plugin.add_cmd(
292
+ "drive_download_file",
293
+ instruction="Download Drive file",
294
+ params=[
295
+ {"name": "file_id", "type": "str", "required": False, "description": "File ID"},
296
+ {"name": "path", "type": "str", "required": False, "description": "Drive path (alternative)"},
297
+ {"name": "out", "type": "str", "required": False, "description": "Local output path"},
298
+ {"name": "export_mime", "type": "str", "required": False, "description": "Export mime for Docs"},
299
+ ],
300
+ enabled=True,
301
+ description="Drive: download",
302
+ tab="drive",
303
+ )
304
+ plugin.add_cmd(
305
+ "drive_upload_file",
306
+ instruction="Upload local file to Drive",
307
+ params=[
308
+ {"name": "local", "type": "str", "required": True, "description": "Local file path"},
309
+ {"name": "remote_parent_path", "type": "str", "required": False, "description": "Drive folder path"},
310
+ {"name": "name", "type": "str", "required": False, "description": "Remote name"},
311
+ {"name": "mime", "type": "str", "required": False, "description": "Mime type"},
312
+ ],
313
+ enabled=True,
314
+ description="Drive: upload",
315
+ tab="drive",
316
+ )
317
+
318
+
319
+ # YouTube
320
+ plugin.add_cmd(
321
+ "youtube_video_info",
322
+ instruction="Get YouTube video info",
323
+ params=[{"name": "video", "type": "str", "required": True, "description": "Video ID or URL"}],
324
+ enabled=True,
325
+ description="YouTube: video info",
326
+ tab="youtube",
327
+ )
328
+ plugin.add_cmd(
329
+ "youtube_transcript",
330
+ instruction="Get YouTube transcript",
331
+ params=[
332
+ {"name": "video", "type": "str", "required": True, "description": "Video ID or URL"},
333
+ {"name": "languages", "type": "list", "required": False, "description": "Preferred languages"},
334
+ {"name": "official_only", "type": "bool", "required": False, "description": "Force official API"},
335
+ {"name": "format", "type": "str", "required": False, "description": "srt|vtt|ttml"},
336
+ ],
337
+ enabled=True,
338
+ description="YouTube: transcript (official or optional unofficial)",
339
+ tab="youtube",
340
+ )
341
+
342
+
343
+ # Contacts
344
+ plugin.add_cmd(
345
+ "contacts_list",
346
+ instruction="List contacts",
347
+ params=[
348
+ {"name": "page_size", "type": "int", "required": False, "description": "Default 200"},
349
+ {"name": "person_fields", "type": "str", "required": False, "description": "Fields mask"},
350
+ ],
351
+ enabled=True,
352
+ description="Contacts: list",
353
+ tab="contacts",
354
+ )
355
+ plugin.add_cmd(
356
+ "contacts_add",
357
+ instruction="Add new contact",
358
+ params=[
359
+ {"name": "givenName", "type": "str", "required": False, "description": "Given name"},
360
+ {"name": "familyName", "type": "str", "required": False, "description": "Family name"},
361
+ {"name": "emails", "type": "list", "required": False, "description": "Email list"},
362
+ {"name": "phones", "type": "list", "required": False, "description": "Phone list"},
363
+ ],
364
+ enabled=True,
365
+ description="Contacts: add",
366
+ tab="contacts",
367
+ )
@@ -0,0 +1,126 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # ================================================== #
4
+ # This file is a part of PYGPT package #
5
+ # Website: https://pygpt.net #
6
+ # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
+ # MIT License #
8
+ # Created By : Marcin Szczygliński #
9
+ # Updated Date: 2025.07.14 00:00:00 #
10
+ # ================================================== #
11
+
12
+ import os
13
+
14
+ from pygpt_net.plugin.base.plugin import BasePlugin
15
+ from pygpt_net.core.events import Event
16
+ from pygpt_net.item.ctx import CtxItem
17
+
18
+ from .config import Config
19
+ from .worker import Worker
20
+
21
+
22
+ class Plugin(BasePlugin):
23
+ def __init__(self, *args, **kwargs):
24
+ super(Plugin, self).__init__(*args, **kwargs)
25
+ self.id = "google"
26
+ self.name = "Google"
27
+ self.description = "Access Gmail, Drive, Calendar, Contacts, YouTube, Keep for managing emails, files, events, notes, video info, and contacts."
28
+ self.prefix = "API"
29
+ self.order = 100
30
+ self.allowed_cmds = [
31
+ "gmail_list_recent",
32
+ "gmail_list_all",
33
+ "gmail_search",
34
+ "gmail_get_by_id",
35
+ "gmail_send",
36
+ "calendar_events_recent",
37
+ "calendar_events_today",
38
+ "calendar_events_tomorrow",
39
+ "calendar_events_all",
40
+ "calendar_events_by_date",
41
+ "calendar_add_event",
42
+ "calendar_delete_event",
43
+ "keep_list_notes",
44
+ "keep_add_note",
45
+ "drive_list_files",
46
+ "drive_find_by_path",
47
+ "drive_download_file",
48
+ "drive_upload_file",
49
+ "youtube_video_info",
50
+ "youtube_transcript",
51
+ "contacts_list",
52
+ "contacts_add",
53
+ ]
54
+ self.use_locale = False
55
+ self.worker = None
56
+ self.config = Config(self)
57
+ self.init_options()
58
+
59
+ def init_options(self):
60
+ """Initialize options"""
61
+ self.config.from_defaults(self)
62
+
63
+ def handle(self, event: Event, *args, **kwargs):
64
+ """
65
+ Handle dispatched event
66
+
67
+ :param event: event object
68
+ :param args: event args
69
+ :param kwargs: event kwargs
70
+ """
71
+ name = event.name
72
+ data = event.data
73
+ ctx = event.ctx
74
+
75
+ if name == Event.CMD_SYNTAX:
76
+ self.cmd_syntax(data)
77
+
78
+ elif name == Event.CMD_EXECUTE:
79
+ self.cmd(
80
+ ctx,
81
+ data['commands'],
82
+ )
83
+
84
+ def cmd_syntax(self, data: dict):
85
+ """
86
+ Event: CMD_SYNTAX
87
+
88
+ :param data: event data dict
89
+ """
90
+ for option in self.allowed_cmds:
91
+ if self.has_cmd(option):
92
+ data['cmd'].append(self.get_cmd(option)) # append command
93
+
94
+ def cmd(self, ctx: CtxItem, cmds: list):
95
+ """
96
+ Event: CMD_EXECUTE
97
+
98
+ :param ctx: CtxItem
99
+ :param cmds: commands dict
100
+ """
101
+ is_cmd = False
102
+ my_commands = []
103
+ for item in cmds:
104
+ if item["cmd"] in self.allowed_cmds:
105
+ my_commands.append(item)
106
+ is_cmd = True
107
+
108
+ if not is_cmd:
109
+ return
110
+
111
+ # set state: busy
112
+ self.cmd_prepare(ctx, my_commands)
113
+
114
+ try:
115
+ worker = Worker()
116
+ worker.from_defaults(self)
117
+ worker.cmds = my_commands
118
+ worker.ctx = ctx
119
+
120
+ if not self.is_async(ctx):
121
+ worker.run()
122
+ return
123
+ worker.run_async()
124
+
125
+ except Exception as e:
126
+ self.error(e)