pygpt-net 2.4.41__py3-none-any.whl → 2.4.44__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 (183) hide show
  1. CHANGELOG.md +19 -0
  2. README.md +151 -71
  3. pygpt_net/CHANGELOG.txt +19 -0
  4. pygpt_net/__init__.py +3 -3
  5. pygpt_net/app.py +3 -1
  6. pygpt_net/controller/attachment.py +31 -3
  7. pygpt_net/controller/audio/__init__.py +2 -2
  8. pygpt_net/controller/camera.py +1 -10
  9. pygpt_net/controller/chat/attachment.py +37 -36
  10. pygpt_net/controller/chat/audio.py +2 -2
  11. pygpt_net/controller/config/placeholder.py +20 -4
  12. pygpt_net/controller/idx/common.py +7 -3
  13. pygpt_net/controller/ui/mode.py +16 -21
  14. pygpt_net/core/attachments/__init__.py +7 -2
  15. pygpt_net/core/attachments/context.py +52 -34
  16. pygpt_net/core/audio/__init__.py +4 -1
  17. pygpt_net/core/audio/whisper.py +37 -0
  18. pygpt_net/core/bridge/worker.py +2 -2
  19. pygpt_net/core/db/__init__.py +2 -1
  20. pygpt_net/core/debug/attachments.py +1 -0
  21. pygpt_net/core/debug/events.py +22 -10
  22. pygpt_net/core/debug/tabs.py +6 -3
  23. pygpt_net/core/history.py +3 -2
  24. pygpt_net/core/idx/__init__.py +23 -6
  25. pygpt_net/core/idx/chat.py +15 -5
  26. pygpt_net/core/idx/indexing.py +47 -14
  27. pygpt_net/core/idx/ui/__init__.py +22 -0
  28. pygpt_net/core/idx/ui/loaders.py +217 -0
  29. pygpt_net/core/installer.py +2 -4
  30. pygpt_net/core/models.py +62 -17
  31. pygpt_net/core/modes.py +11 -13
  32. pygpt_net/core/notepad.py +4 -4
  33. pygpt_net/core/plugins.py +27 -16
  34. pygpt_net/core/presets.py +20 -9
  35. pygpt_net/core/profile.py +11 -3
  36. pygpt_net/core/render/web/parser.py +3 -1
  37. pygpt_net/core/settings.py +5 -5
  38. pygpt_net/core/tabs/tab.py +10 -2
  39. pygpt_net/core/tokens.py +8 -6
  40. pygpt_net/core/web/__init__.py +105 -0
  41. pygpt_net/core/{web.py → web/helpers.py} +93 -67
  42. pygpt_net/data/config/config.json +4 -4
  43. pygpt_net/data/config/models.json +3 -3
  44. pygpt_net/data/config/modes.json +3 -3
  45. pygpt_net/data/config/settings.json +5 -5
  46. pygpt_net/data/locale/locale.de.ini +3 -3
  47. pygpt_net/data/locale/locale.en.ini +12 -9
  48. pygpt_net/data/locale/locale.es.ini +3 -3
  49. pygpt_net/data/locale/locale.fr.ini +3 -3
  50. pygpt_net/data/locale/locale.it.ini +3 -3
  51. pygpt_net/data/locale/locale.pl.ini +3 -3
  52. pygpt_net/data/locale/locale.uk.ini +3 -3
  53. pygpt_net/data/locale/locale.zh.ini +3 -3
  54. pygpt_net/data/locale/plugin.cmd_web.en.ini +2 -0
  55. pygpt_net/data/locale/plugin.mailer.en.ini +21 -0
  56. pygpt_net/item/attachment.py +5 -1
  57. pygpt_net/item/ctx.py +111 -3
  58. pygpt_net/migrations/Version20241215110000.py +25 -0
  59. pygpt_net/migrations/__init__.py +3 -1
  60. pygpt_net/plugin/agent/__init__.py +7 -2
  61. pygpt_net/plugin/audio_output/__init__.py +6 -1
  62. pygpt_net/plugin/base/plugin.py +58 -26
  63. pygpt_net/plugin/base/worker.py +20 -17
  64. pygpt_net/plugin/cmd_files/__init__.py +3 -2
  65. pygpt_net/plugin/cmd_history/config.py +2 -2
  66. pygpt_net/plugin/cmd_web/__init__.py +3 -4
  67. pygpt_net/plugin/cmd_web/config.py +71 -3
  68. pygpt_net/plugin/cmd_web/websearch.py +20 -12
  69. pygpt_net/plugin/cmd_web/worker.py +67 -4
  70. pygpt_net/plugin/idx_llama_index/config.py +3 -3
  71. pygpt_net/plugin/mailer/__init__.py +123 -0
  72. pygpt_net/plugin/mailer/config.py +149 -0
  73. pygpt_net/plugin/mailer/runner.py +285 -0
  74. pygpt_net/plugin/mailer/worker.py +123 -0
  75. pygpt_net/provider/agents/base.py +5 -2
  76. pygpt_net/provider/agents/openai.py +4 -2
  77. pygpt_net/provider/agents/openai_assistant.py +4 -2
  78. pygpt_net/provider/agents/planner.py +4 -2
  79. pygpt_net/provider/agents/react.py +4 -2
  80. pygpt_net/provider/audio_output/openai_tts.py +5 -11
  81. pygpt_net/provider/core/assistant/base.py +5 -3
  82. pygpt_net/provider/core/assistant/json_file.py +8 -5
  83. pygpt_net/provider/core/assistant_file/base.py +4 -3
  84. pygpt_net/provider/core/assistant_file/db_sqlite/__init__.py +4 -3
  85. pygpt_net/provider/core/assistant_file/db_sqlite/storage.py +3 -2
  86. pygpt_net/provider/core/assistant_store/base.py +6 -4
  87. pygpt_net/provider/core/assistant_store/db_sqlite/__init__.py +5 -4
  88. pygpt_net/provider/core/assistant_store/db_sqlite/storage.py +5 -3
  89. pygpt_net/provider/core/attachment/base.py +5 -3
  90. pygpt_net/provider/core/attachment/json_file.py +7 -3
  91. pygpt_net/provider/core/calendar/base.py +5 -3
  92. pygpt_net/provider/core/calendar/db_sqlite/__init__.py +6 -5
  93. pygpt_net/provider/core/calendar/db_sqlite/storage.py +5 -4
  94. pygpt_net/provider/core/config/base.py +8 -6
  95. pygpt_net/provider/core/config/json_file.py +9 -7
  96. pygpt_net/provider/core/config/patch.py +6 -0
  97. pygpt_net/provider/core/ctx/base.py +27 -25
  98. pygpt_net/provider/core/ctx/db_sqlite/__init__.py +51 -35
  99. pygpt_net/provider/core/ctx/db_sqlite/storage.py +92 -38
  100. pygpt_net/provider/core/ctx/db_sqlite/utils.py +37 -11
  101. pygpt_net/provider/core/index/base.py +129 -23
  102. pygpt_net/provider/core/index/db_sqlite/__init__.py +130 -23
  103. pygpt_net/provider/core/index/db_sqlite/storage.py +130 -23
  104. pygpt_net/provider/core/index/db_sqlite/utils.py +4 -2
  105. pygpt_net/provider/core/mode/base.py +5 -3
  106. pygpt_net/provider/core/mode/json_file.py +7 -6
  107. pygpt_net/provider/core/model/base.py +6 -4
  108. pygpt_net/provider/core/model/json_file.py +9 -7
  109. pygpt_net/provider/core/notepad/base.py +5 -3
  110. pygpt_net/provider/core/notepad/db_sqlite/__init__.py +5 -4
  111. pygpt_net/provider/core/notepad/db_sqlite/storage.py +4 -3
  112. pygpt_net/provider/core/plugin_preset/base.py +4 -2
  113. pygpt_net/provider/core/plugin_preset/json_file.py +5 -3
  114. pygpt_net/provider/core/preset/base.py +6 -4
  115. pygpt_net/provider/core/preset/json_file.py +9 -9
  116. pygpt_net/provider/core/prompt/base.py +6 -3
  117. pygpt_net/provider/core/prompt/json_file.py +11 -6
  118. pygpt_net/provider/gpt/assistants.py +15 -6
  119. pygpt_net/provider/gpt/audio.py +5 -5
  120. pygpt_net/provider/gpt/chat.py +7 -5
  121. pygpt_net/provider/gpt/completion.py +8 -4
  122. pygpt_net/provider/gpt/image.py +3 -3
  123. pygpt_net/provider/gpt/store.py +46 -12
  124. pygpt_net/provider/gpt/vision.py +16 -11
  125. pygpt_net/provider/llms/anthropic.py +7 -2
  126. pygpt_net/provider/llms/azure_openai.py +26 -5
  127. pygpt_net/provider/llms/base.py +47 -9
  128. pygpt_net/provider/llms/google.py +7 -2
  129. pygpt_net/provider/llms/hugging_face.py +13 -3
  130. pygpt_net/provider/llms/hugging_face_api.py +18 -4
  131. pygpt_net/provider/llms/local.py +7 -2
  132. pygpt_net/provider/llms/ollama.py +30 -6
  133. pygpt_net/provider/llms/openai.py +32 -6
  134. pygpt_net/provider/loaders/base.py +14 -0
  135. pygpt_net/provider/loaders/hub/yt/base.py +5 -0
  136. pygpt_net/provider/loaders/web_database.py +13 -5
  137. pygpt_net/provider/loaders/web_github_issues.py +5 -1
  138. pygpt_net/provider/loaders/web_google_calendar.py +9 -1
  139. pygpt_net/provider/loaders/web_google_docs.py +6 -1
  140. pygpt_net/provider/loaders/web_google_drive.py +10 -1
  141. pygpt_net/provider/loaders/web_google_gmail.py +2 -1
  142. pygpt_net/provider/loaders/web_google_keep.py +5 -1
  143. pygpt_net/provider/loaders/web_google_sheets.py +5 -1
  144. pygpt_net/provider/loaders/web_microsoft_onedrive.py +15 -1
  145. pygpt_net/provider/loaders/web_page.py +4 -2
  146. pygpt_net/provider/loaders/web_rss.py +2 -1
  147. pygpt_net/provider/loaders/web_sitemap.py +2 -1
  148. pygpt_net/provider/loaders/web_twitter.py +4 -2
  149. pygpt_net/provider/loaders/web_yt.py +17 -2
  150. pygpt_net/provider/vector_stores/__init__.py +45 -14
  151. pygpt_net/provider/vector_stores/base.py +35 -8
  152. pygpt_net/provider/vector_stores/chroma.py +13 -3
  153. pygpt_net/provider/vector_stores/ctx_attachment.py +32 -13
  154. pygpt_net/provider/vector_stores/elasticsearch.py +12 -3
  155. pygpt_net/provider/vector_stores/pinecode.py +12 -3
  156. pygpt_net/provider/vector_stores/redis.py +12 -3
  157. pygpt_net/provider/vector_stores/simple.py +12 -3
  158. pygpt_net/provider/vector_stores/temp.py +16 -4
  159. pygpt_net/provider/web/base.py +10 -3
  160. pygpt_net/provider/web/google_custom_search.py +9 -3
  161. pygpt_net/provider/web/microsoft_bing.py +9 -3
  162. pygpt_net/tools/__init__.py +13 -5
  163. pygpt_net/tools/audio_transcriber/__init__.py +4 -3
  164. pygpt_net/tools/base.py +15 -8
  165. pygpt_net/tools/code_interpreter/__init__.py +4 -3
  166. pygpt_net/tools/html_canvas/__init__.py +4 -3
  167. pygpt_net/tools/image_viewer/__init__.py +10 -4
  168. pygpt_net/tools/indexer/__init__.py +15 -46
  169. pygpt_net/tools/indexer/ui/web.py +20 -78
  170. pygpt_net/tools/media_player/__init__.py +4 -3
  171. pygpt_net/tools/text_editor/__init__.py +36 -10
  172. pygpt_net/ui/layout/chat/output.py +2 -2
  173. pygpt_net/ui/layout/ctx/ctx_list.py +86 -18
  174. pygpt_net/ui/menu/audio.py +12 -1
  175. pygpt_net/ui/widget/dialog/url.py +151 -14
  176. pygpt_net/ui/widget/element/group.py +15 -2
  177. pygpt_net/ui/widget/lists/context.py +23 -9
  178. pygpt_net/utils.py +1 -1
  179. {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.44.dist-info}/METADATA +152 -72
  180. {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.44.dist-info}/RECORD +183 -173
  181. {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.44.dist-info}/LICENSE +0 -0
  182. {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.44.dist-info}/WHEEL +0 -0
  183. {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.44.dist-info}/entry_points.txt +0 -0
pygpt_net/item/ctx.py CHANGED
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.12.13 19:00:00 #
9
+ # Updated Date: 2024.12.16 01:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import copy
@@ -20,7 +20,7 @@ class CtxItem:
20
20
  """
21
21
  Context item
22
22
 
23
- :param mode: Mode (completion, chat, img, vision, langchain, assistant, llama_index, agent)
23
+ :param mode: Mode (completion, chat, img, vision, langchain, assistant, llama_index, agent, expert)
24
24
  """
25
25
  self.id = None
26
26
  self.meta = None # CtxMeta object
@@ -137,6 +137,17 @@ class CtxItem:
137
137
  """
138
138
  return len(self.cmds) > 0 or len(self.tool_calls) > 0
139
139
 
140
+ def audio_read_allowed(self) -> bool:
141
+ """
142
+ Check if audio read allowed
143
+
144
+ :return: True if audio read allowed
145
+ """
146
+ allowed = True
147
+ if self.has_commands() or '~###~{"cmd":' in self.output:
148
+ allowed = False
149
+ return allowed
150
+
140
151
  def add_doc_meta(self, meta: dict):
141
152
  """
142
153
  Add document meta
@@ -351,18 +362,76 @@ class CtxMeta:
351
362
  self.label = 0 # label color
352
363
  self.indexes = {} # indexes data
353
364
  self.additional_ctx = [] # additional context data
365
+ self.group = None # parent group
354
366
  self.group_id = None
355
367
  self.root_id = None
356
368
  self.parent_id = None
357
369
  self.owner_uuid = None
358
370
 
371
+ def has_additional_ctx(self) -> bool:
372
+ """
373
+ Check if additional context data is attached
374
+
375
+ :return: True if additional context data is present
376
+ """
377
+ if self.additional_ctx is not None and len(self.additional_ctx) > 0:
378
+ return True
379
+ if self.group:
380
+ if self.group.additional_ctx is not None and len(self.group.additional_ctx) > 0:
381
+ return True
382
+ return False
383
+
384
+ def get_additional_ctx(self) -> list:
385
+ """
386
+ Get additional context data
387
+
388
+ :return: list
389
+ """
390
+ if self.group:
391
+ if self.group.additional_ctx:
392
+ return self.group.additional_ctx
393
+ if self.additional_ctx:
394
+ return self.additional_ctx
395
+ return []
396
+
397
+ def reset_additional_ctx(self):
398
+ """Delete additional context data"""
399
+ if self.group:
400
+ self.group.additional_ctx = []
401
+ else:
402
+ self.additional_ctx = []
403
+
404
+ def remove_additional_ctx(self, item: dict):
405
+ """
406
+ Remove additional context data item
407
+
408
+ :param item: dict
409
+ """
410
+ if self.group:
411
+ if item in self.group.additional_ctx:
412
+ self.group.additional_ctx.remove(item)
413
+ else:
414
+ if item in self.additional_ctx:
415
+ self.additional_ctx.remove(item)
416
+
417
+ def get_attachment_names(self) -> list:
418
+ """
419
+ Get attachment names
420
+
421
+ :return: list
422
+ """
423
+ if self.group:
424
+ if self.group.additional_ctx:
425
+ return self.group.get_attachment_names()
426
+ return [item['name'] for item in self.additional_ctx]
427
+
359
428
  def to_dict(self) -> dict:
360
429
  """
361
430
  Dump context meta to dict
362
431
 
363
432
  :return: dict
364
433
  """
365
- return {
434
+ data = {
366
435
  "id": self.id,
367
436
  "external_id": self.external_id,
368
437
  "uuid": self.uuid,
@@ -393,6 +462,9 @@ class CtxMeta:
393
462
  "parent_id": self.parent_id,
394
463
  "owner_uuid": self.owner_uuid,
395
464
  }
465
+ if self.group:
466
+ data["__group__"] = self.group.to_dict()
467
+ return data
396
468
 
397
469
  def from_dict(self, data: dict):
398
470
  """
@@ -447,8 +519,43 @@ class CtxGroup:
447
519
  self.items = []
448
520
  self.created = int(time.time())
449
521
  self.updated = int(time.time())
522
+ self.additional_ctx = []
450
523
  self.count = 0
451
524
 
525
+ def has_additional_ctx(self) -> bool:
526
+ """
527
+ Check if additional context data is attached
528
+
529
+ :return: True if additional context data is present
530
+ """
531
+ if self.additional_ctx is not None and len(self.additional_ctx) > 0:
532
+ return True
533
+ return False
534
+
535
+ def get_additional_ctx(self) -> list:
536
+ """
537
+ Get additional context data
538
+
539
+ :return: list
540
+ """
541
+ return self.additional_ctx
542
+
543
+ def get_attachments_count(self) -> int:
544
+ """
545
+ Get attachments count
546
+
547
+ :return: int
548
+ """
549
+ return len(self.additional_ctx)
550
+
551
+ def get_attachment_names(self) -> list:
552
+ """
553
+ Get attachment names
554
+
555
+ :return: list
556
+ """
557
+ return [item['name'] for item in self.additional_ctx]
558
+
452
559
  def to_dict(self) -> dict:
453
560
  """
454
561
  Dump context group to dict
@@ -460,6 +567,7 @@ class CtxGroup:
460
567
  "uuid": self.uuid,
461
568
  "name": self.name,
462
569
  "items": self.items,
570
+ "additional_ctx": self.additional_ctx,
463
571
  "created": self.created,
464
572
  "updated": self.updated,
465
573
  "count": self.count,
@@ -0,0 +1,25 @@
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: 2024.11.23 00:00:00 #
10
+ # ================================================== #
11
+
12
+ from sqlalchemy import text
13
+
14
+ from .base import BaseMigration
15
+
16
+
17
+ class Version20241215110000(BaseMigration):
18
+ def __init__(self, window=None):
19
+ super(Version20241215110000, self).__init__(window)
20
+ self.window = window
21
+
22
+ def up(self, conn):
23
+ conn.execute(text("""
24
+ ALTER TABLE ctx_group ADD COLUMN additional_ctx_json TEXT;
25
+ """))
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.11.26 19:00:00 #
9
+ # Updated Date: 2024.12.15 11:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from .Version20231227152900 import Version20231227152900 # 2.0.59
@@ -22,6 +22,7 @@ from .Version20240426050000 import Version20240426050000 # 2.1.79
22
22
  from .Version20240501030000 import Version20240501030000 # 2.2.7
23
23
  from .Version20241122130000 import Version20241122130000 # 2.4.21
24
24
  from .Version20241126170000 import Version20241126170000 # 2.4.34
25
+ from .Version20241215110000 import Version20241215110000 # 2.4.43
25
26
 
26
27
  class Migrations:
27
28
  def __init__(self):
@@ -48,4 +49,5 @@ class Migrations:
48
49
  Version20240501030000(), # 2.2.7
49
50
  Version20241122130000(), # 2.4.21
50
51
  Version20241126170000(), # 2.4.34
52
+ Version20241215110000(), # 2.4.43
51
53
  ]
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.11.21 20:00:00 #
9
+ # Updated Date: 2024.12.14 22:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from pygpt_net.plugin.base.plugin import BasePlugin
@@ -57,7 +57,12 @@ class Plugin(BasePlugin):
57
57
  data = event.data
58
58
  ctx = event.ctx
59
59
 
60
- always_events = [Event.FORCE_STOP, Event.PLUGIN_SETTINGS_CHANGED, Event.ENABLE, Event.DISABLE]
60
+ always_events = [
61
+ Event.FORCE_STOP,
62
+ Event.PLUGIN_SETTINGS_CHANGED,
63
+ Event.ENABLE,
64
+ Event.DISABLE
65
+ ]
61
66
 
62
67
  if not self.is_allowed() and name != Event.DISABLE:
63
68
  return
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.12.13 08:00:00 #
9
+ # Updated Date: 2024.12.14 18:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from PySide6.QtCore import Slot
@@ -167,6 +167,11 @@ class Plugin(BasePlugin):
167
167
  cache_file = None
168
168
  if event.data is not None and isinstance(event.data, dict) and "cache_file" in event.data:
169
169
  cache_file = event.data["cache_file"]
170
+
171
+ # check for audio read allowed. Prevents reading audio in commands, results, etc.
172
+ if name == Event.CTX_AFTER:
173
+ if not ctx.audio_read_allowed():
174
+ return # abort if audio read is not allowed (commands, results, etc.)
170
175
 
171
176
  try:
172
177
  if text is not None and len(text) > 0:
@@ -6,17 +6,14 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.12.14 00:00:00 #
9
+ # Updated Date: 2024.12.14 22:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import copy
13
- from typing import Optional
13
+ from typing import Optional, Any, Dict, List
14
14
 
15
15
  from PySide6.QtCore import QObject, Slot
16
16
 
17
- from pygpt_net.core.types import (
18
- MODE_AGENT_LLAMA,
19
- )
20
17
  from pygpt_net.core.bridge.context import BridgeContext
21
18
  from pygpt_net.core.events import Event, KernelEvent
22
19
  from pygpt_net.item.ctx import CtxItem
@@ -43,7 +40,7 @@ class BasePlugin(QObject):
43
40
  self.use_locale = False
44
41
  self.order = 0
45
42
 
46
- def setup(self) -> dict:
43
+ def setup(self) -> Dict[str, Any]:
47
44
  """
48
45
  Return available config options
49
46
 
@@ -51,7 +48,12 @@ class BasePlugin(QObject):
51
48
  """
52
49
  return self.options
53
50
 
54
- def add_option(self, name: str, type: str, **kwargs) -> dict:
51
+ def add_option(
52
+ self,
53
+ name: str,
54
+ type: str,
55
+ **kwargs
56
+ ) -> Dict[str, Any]:
55
57
  """
56
58
  Add plugin configuration option
57
59
 
@@ -84,7 +86,11 @@ class BasePlugin(QObject):
84
86
  self.options[name] = option
85
87
  return option
86
88
 
87
- def add_cmd(self, cmd: str, **kwargs) -> dict:
89
+ def add_cmd(
90
+ self,
91
+ cmd: str,
92
+ **kwargs
93
+ ) -> Dict[str, Any]:
88
94
  """
89
95
  Add plugin command
90
96
 
@@ -125,7 +131,10 @@ class BasePlugin(QObject):
125
131
 
126
132
  return self.add_option(name, "cmd", **kwargs)
127
133
 
128
- def has_cmd(self, cmd: str) -> bool:
134
+ def has_cmd(
135
+ self,
136
+ cmd: str
137
+ ) -> bool:
129
138
  """
130
139
  Check if command exists
131
140
 
@@ -138,7 +147,10 @@ class BasePlugin(QObject):
138
147
  return self.options[key]["value"]["enabled"]
139
148
  return False
140
149
 
141
- def cmd_allowed(self, cmd: str) -> bool:
150
+ def cmd_allowed(
151
+ self,
152
+ cmd: str
153
+ ) -> bool:
142
154
  """
143
155
  Check if command allowed
144
156
 
@@ -157,7 +169,10 @@ class BasePlugin(QObject):
157
169
  """
158
170
  return self.window.core.config.get("cmd")
159
171
 
160
- def get_cmd(self, cmd: str) -> dict:
172
+ def get_cmd(
173
+ self,
174
+ cmd: str
175
+ ) -> Dict[str, Any]:
161
176
  """
162
177
  Return command
163
178
 
@@ -170,7 +185,10 @@ class BasePlugin(QObject):
170
185
  data = {"cmd": cmd, **data}
171
186
  return data
172
187
 
173
- def has_option(self, name: str) -> bool:
188
+ def has_option(
189
+ self,
190
+ name: str
191
+ ) -> bool:
174
192
  """
175
193
  Check if option exists
176
194
 
@@ -179,7 +197,10 @@ class BasePlugin(QObject):
179
197
  """
180
198
  return name in self.options
181
199
 
182
- def get_option(self, name: str) -> dict:
200
+ def get_option(
201
+ self,
202
+ name: str
203
+ ) -> Dict[str, Any]:
183
204
  """
184
205
  Return option
185
206
 
@@ -189,7 +210,10 @@ class BasePlugin(QObject):
189
210
  if self.has_option(name):
190
211
  return self.options[name]
191
212
 
192
- def get_option_value(self, name: str) -> any:
213
+ def get_option_value(
214
+ self,
215
+ name: str
216
+ ) -> Any:
193
217
  """
194
218
  Return option value
195
219
 
@@ -207,7 +231,12 @@ class BasePlugin(QObject):
207
231
  """
208
232
  self.window = window
209
233
 
210
- def handle(self, event: Event, *args, **kwargs):
234
+ def handle(
235
+ self,
236
+ event: Event,
237
+ *args,
238
+ **kwargs
239
+ ):
211
240
  """
212
241
  Handle event
213
242
 
@@ -235,7 +264,10 @@ class BasePlugin(QObject):
235
264
  """
236
265
  return
237
266
 
238
- def trans(self, text: Optional[str] = None) -> str:
267
+ def trans(
268
+ self,
269
+ text: Optional[str] = None
270
+ ) -> str:
239
271
  """
240
272
  Translate text using plugin domain
241
273
 
@@ -247,7 +279,7 @@ class BasePlugin(QObject):
247
279
  domain = 'plugin.{}'.format(self.id)
248
280
  return trans(text, False, domain)
249
281
 
250
- def error(self, err: any):
282
+ def error(self, err: Any):
251
283
  """
252
284
  Send error message to logger and alert dialog
253
285
 
@@ -257,7 +289,7 @@ class BasePlugin(QObject):
257
289
  msg = self.window.core.debug.parse_alert(err)
258
290
  self.window.ui.dialogs.alert("{}: {}".format(self.name, msg))
259
291
 
260
- def debug(self, data: any):
292
+ def debug(self, data: Any):
261
293
  """
262
294
  Send debug message to logger window
263
295
 
@@ -337,9 +369,9 @@ class BasePlugin(QObject):
337
369
  @Slot(object, object, dict)
338
370
  def handle_finished(
339
371
  self,
340
- response: dict,
372
+ response: Dict[str, Any],
341
373
  ctx: Optional[CtxItem] = None,
342
- extra_data: Optional[dict] = None
374
+ extra_data: Optional[Dict[str, Any]] = None
343
375
  ):
344
376
  """
345
377
  Handle finished response signal
@@ -367,9 +399,9 @@ class BasePlugin(QObject):
367
399
  @Slot(object, object, dict)
368
400
  def handle_finished_more(
369
401
  self,
370
- responses: list,
402
+ responses: List[Dict[str, Any]],
371
403
  ctx: Optional[CtxItem] = None,
372
- extra_data: Optional[dict] = None
404
+ extra_data: Optional[Dict[str, Any]] = None
373
405
  ):
374
406
  """
375
407
  Handle finished response signal
@@ -397,9 +429,9 @@ class BasePlugin(QObject):
397
429
 
398
430
  def prepare_reply_ctx(
399
431
  self,
400
- response: dict,
432
+ response: Dict[str, Any],
401
433
  ctx: Optional[CtxItem] = None
402
- ) -> dict:
434
+ ) -> Dict[str, Any]:
403
435
  """
404
436
  Prepare reply context
405
437
 
@@ -454,7 +486,7 @@ class BasePlugin(QObject):
454
486
  self.window.update_status(str(data))
455
487
 
456
488
  @Slot(object)
457
- def handle_error(self, err: any):
489
+ def handle_error(self, err: Any):
458
490
  """
459
491
  Handle thread error signal
460
492
 
@@ -463,7 +495,7 @@ class BasePlugin(QObject):
463
495
  self.error(err)
464
496
 
465
497
  @Slot(object)
466
- def handle_debug(self, msg: any):
498
+ def handle_debug(self, msg: Any):
467
499
  """
468
500
  Handle debug message signal
469
501
 
@@ -6,10 +6,10 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.12.14 00:00:00 #
9
+ # Updated Date: 2024.12.14 22:00:00 #
10
10
  # ================================================== #
11
11
 
12
- from typing import Optional, Any
12
+ from typing import Optional, Any, Dict, List
13
13
 
14
14
  from PySide6.QtCore import QObject, QRunnable
15
15
  from typing_extensions import deprecated
@@ -44,7 +44,7 @@ class BaseWorker(QObject, QRunnable):
44
44
  if self.signals is not None and hasattr(self.signals, "destroyed"):
45
45
  self.signals.destroyed.emit()
46
46
 
47
- def error(self, err: any):
47
+ def error(self, err: Any):
48
48
  """
49
49
  Emit error signal
50
50
 
@@ -67,8 +67,8 @@ class BaseWorker(QObject, QRunnable):
67
67
  @deprecated("From 2.1.29: BaseWorker.response() is deprecated, use BaseWorker.reply() instead")
68
68
  def response(
69
69
  self,
70
- response: dict,
71
- extra_data: Optional[dict] = None
70
+ response: Dict[str, Any],
71
+ extra_data: Optional[Dict[str, Any]] = None
72
72
  ):
73
73
  """
74
74
  Emit finished signal (deprecated)
@@ -82,8 +82,8 @@ class BaseWorker(QObject, QRunnable):
82
82
 
83
83
  def reply(
84
84
  self,
85
- response: dict,
86
- extra_data: Optional[dict] = None
85
+ response: Dict[str, Any],
86
+ extra_data: Optional[Dict[str, Any]] = None
87
87
  ):
88
88
  """
89
89
  Emit finished signal (on reply from command output)
@@ -101,8 +101,8 @@ class BaseWorker(QObject, QRunnable):
101
101
 
102
102
  def reply_more(
103
103
  self,
104
- responses: list,
105
- extra_data: Optional[dict] = None
104
+ responses: List[Dict[str, Any]],
105
+ extra_data: Optional[Dict[str, Any]] = None
106
106
  ):
107
107
  """
108
108
  Emit finished_more signal (on reply from command output, multiple responses)
@@ -166,7 +166,10 @@ class BaseWorker(QObject, QRunnable):
166
166
  self.signals.status.connect(parent.handle_status)
167
167
  self.signals.error.connect(parent.handle_error)
168
168
 
169
- def from_request(self, item: dict) -> dict:
169
+ def from_request(
170
+ self,
171
+ item: Dict[str, Any]
172
+ ) -> Dict[str, Any]:
170
173
  """
171
174
  Prepare request item for result
172
175
 
@@ -177,10 +180,10 @@ class BaseWorker(QObject, QRunnable):
177
180
 
178
181
  def make_response(
179
182
  self,
180
- item: dict,
181
- result: any,
182
- extra: Optional[dict] = None
183
- ) -> dict:
183
+ item: Dict[str, Any],
184
+ result: Any,
185
+ extra: Optional[Dict[str, Any]] = None
186
+ ) -> Dict[str, Any]:
184
187
  """
185
188
  Prepare response item
186
189
 
@@ -211,7 +214,7 @@ class BaseWorker(QObject, QRunnable):
211
214
 
212
215
  def has_param(
213
216
  self,
214
- item: dict,
217
+ item: Dict[str, Any],
215
218
  param: str
216
219
  ) -> bool:
217
220
  """
@@ -227,10 +230,10 @@ class BaseWorker(QObject, QRunnable):
227
230
 
228
231
  def get_param(
229
232
  self,
230
- item: dict,
233
+ item: Dict[str, Any],
231
234
  param: str,
232
235
  default: Any = None
233
- ) -> any:
236
+ ) -> Any:
234
237
  """
235
238
  Get parameter value from item
236
239
 
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.11.20 03:00:00 #
9
+ # Updated Date: 2024.12.16 01:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import os
@@ -141,7 +141,8 @@ class Plugin(BasePlugin):
141
141
  """
142
142
  # use_loaders = False
143
143
  if use_loaders:
144
- return str(self.window.core.idx.indexing.read_text_content(path))
144
+ content, docs = str(self.window.core.idx.indexing.read_text_content(path))
145
+ return content
145
146
  else:
146
147
  data = ""
147
148
  if os.path.isfile(path):
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.11.18 19:00:00 #
9
+ # Updated Date: 2024.12.14 19:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from pygpt_net.plugin.base.config import BaseConfig, BasePlugin
@@ -34,7 +34,7 @@ class Config(BaseConfig):
34
34
  plugin.add_option(
35
35
  "model_summarize",
36
36
  type="combo",
37
- value="gpt-3.5-turbo",
37
+ value="gpt-4o-mini",
38
38
  label="Model",
39
39
  description="Model used for summarize, default: gpt-3.5-turbo",
40
40
  tooltip="Summarize model",
@@ -6,14 +6,12 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.12.13 08:00:00 #
9
+ # Updated Date: 2024.12.15 01:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import ssl
13
13
  from urllib.request import Request, urlopen
14
14
 
15
- from requests import HTTPError
16
-
17
15
  from pygpt_net.plugin.base.plugin import BasePlugin
18
16
  from pygpt_net.provider.web.base import BaseProvider
19
17
  from pygpt_net.core.events import Event
@@ -38,6 +36,7 @@ class Plugin(BasePlugin):
38
36
  "web_urls",
39
37
  "web_url_open",
40
38
  "web_url_raw",
39
+ "web_request",
41
40
  "web_index",
42
41
  "web_index_query",
43
42
  "web_extract_links",
@@ -96,7 +95,7 @@ class Plugin(BasePlugin):
96
95
 
97
96
  :return: providers dict
98
97
  """
99
- return self.window.core.web.get_providers("search_engine")
98
+ return self.window.core.web.get_providers(self.window.core.web.PROVIDER_SEARCH_ENGINE)
100
99
 
101
100
  def get_provider_options(self) -> list:
102
101
  """Get provider options"""