pygpt-net 2.4.37__py3-none-any.whl → 2.4.41__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 (255) hide show
  1. CHANGELOG.md +29 -0
  2. README.md +44 -115
  3. pygpt_net/CHANGELOG.txt +29 -0
  4. pygpt_net/__init__.py +3 -3
  5. pygpt_net/controller/__init__.py +7 -3
  6. pygpt_net/controller/access/control.py +1 -1
  7. pygpt_net/controller/access/voice.py +11 -5
  8. pygpt_net/controller/agent/experts.py +11 -6
  9. pygpt_net/controller/agent/legacy.py +8 -6
  10. pygpt_net/controller/agent/llama.py +4 -2
  11. pygpt_net/controller/assistant/__init__.py +9 -4
  12. pygpt_net/controller/assistant/batch.py +38 -21
  13. pygpt_net/controller/assistant/editor.py +7 -6
  14. pygpt_net/controller/assistant/files.py +23 -7
  15. pygpt_net/controller/assistant/store.py +20 -7
  16. pygpt_net/controller/assistant/threads.py +34 -8
  17. pygpt_net/controller/attachment.py +29 -10
  18. pygpt_net/controller/audio/__init__.py +25 -4
  19. pygpt_net/controller/calendar/__init__.py +23 -4
  20. pygpt_net/controller/calendar/note.py +57 -11
  21. pygpt_net/controller/camera.py +3 -2
  22. pygpt_net/controller/chat/__init__.py +5 -3
  23. pygpt_net/controller/chat/attachment.py +34 -7
  24. pygpt_net/controller/chat/command.py +4 -2
  25. pygpt_net/controller/chat/common.py +11 -4
  26. pygpt_net/controller/chat/files.py +10 -3
  27. pygpt_net/controller/chat/image.py +17 -5
  28. pygpt_net/controller/chat/input.py +10 -7
  29. pygpt_net/controller/chat/output.py +21 -6
  30. pygpt_net/controller/chat/render.py +100 -21
  31. pygpt_net/controller/chat/response.py +34 -7
  32. pygpt_net/controller/chat/stream.py +4 -2
  33. pygpt_net/controller/chat/text.py +6 -4
  34. pygpt_net/controller/command.py +11 -3
  35. pygpt_net/controller/config/__init__.py +34 -6
  36. pygpt_net/controller/config/field/checkbox.py +7 -4
  37. pygpt_net/controller/config/field/cmd.py +7 -5
  38. pygpt_net/controller/config/field/combo.py +14 -6
  39. pygpt_net/controller/config/field/dictionary.py +14 -11
  40. pygpt_net/controller/config/field/input.py +9 -6
  41. pygpt_net/controller/config/field/slider.py +11 -8
  42. pygpt_net/controller/config/field/textarea.py +8 -5
  43. pygpt_net/controller/config/placeholder.py +52 -21
  44. pygpt_net/controller/ctx/__init__.py +138 -49
  45. pygpt_net/controller/ctx/common.py +15 -4
  46. pygpt_net/controller/ctx/extra.py +11 -3
  47. pygpt_net/controller/ctx/summarizer.py +24 -5
  48. pygpt_net/controller/debug/__init__.py +27 -6
  49. pygpt_net/controller/dialogs/confirm.py +34 -7
  50. pygpt_net/controller/dialogs/debug.py +4 -2
  51. pygpt_net/controller/dialogs/info.py +7 -2
  52. pygpt_net/controller/files.py +48 -10
  53. pygpt_net/controller/finder.py +11 -5
  54. pygpt_net/controller/idx/__init__.py +10 -3
  55. pygpt_net/controller/idx/common.py +4 -2
  56. pygpt_net/controller/idx/indexer.py +25 -17
  57. pygpt_net/controller/idx/settings.py +9 -3
  58. pygpt_net/controller/kernel/__init__.py +34 -8
  59. pygpt_net/controller/kernel/reply.py +12 -3
  60. pygpt_net/controller/kernel/stack.py +5 -3
  61. pygpt_net/controller/lang/custom.py +2 -7
  62. pygpt_net/controller/lang/mapping.py +5 -3
  63. pygpt_net/controller/layout.py +2 -2
  64. pygpt_net/controller/mode.py +16 -4
  65. pygpt_net/controller/model/__init__.py +14 -3
  66. pygpt_net/controller/model/editor.py +8 -3
  67. pygpt_net/controller/notepad.py +26 -12
  68. pygpt_net/controller/painter/capture.py +23 -4
  69. pygpt_net/controller/painter/common.py +9 -7
  70. pygpt_net/controller/plugins/__init__.py +19 -5
  71. pygpt_net/controller/plugins/presets.py +15 -6
  72. pygpt_net/controller/plugins/settings.py +9 -3
  73. pygpt_net/controller/presets/__init__.py +55 -16
  74. pygpt_net/controller/presets/editor.py +26 -10
  75. pygpt_net/controller/settings/__init__.py +3 -2
  76. pygpt_net/controller/settings/editor.py +29 -7
  77. pygpt_net/controller/settings/profile.py +22 -5
  78. pygpt_net/controller/theme/__init__.py +54 -12
  79. pygpt_net/controller/theme/common.py +24 -2
  80. pygpt_net/controller/theme/markdown.py +32 -16
  81. pygpt_net/controller/theme/menu.py +26 -5
  82. pygpt_net/controller/theme/nodes.py +2 -5
  83. pygpt_net/controller/tools/__init__.py +40 -2
  84. pygpt_net/controller/ui/__init__.py +4 -6
  85. pygpt_net/controller/ui/tabs.py +363 -65
  86. pygpt_net/core/access/actions.py +6 -4
  87. pygpt_net/core/access/shortcuts.py +4 -3
  88. pygpt_net/core/access/voice.py +6 -5
  89. pygpt_net/core/agents/legacy.py +4 -2
  90. pygpt_net/core/agents/memory.py +7 -2
  91. pygpt_net/core/agents/observer/evaluation.py +15 -7
  92. pygpt_net/core/agents/provider.py +9 -4
  93. pygpt_net/core/agents/runner.py +61 -15
  94. pygpt_net/core/agents/tools.py +23 -5
  95. pygpt_net/core/assistants/__init__.py +6 -4
  96. pygpt_net/core/assistants/files.py +35 -12
  97. pygpt_net/core/assistants/store.py +20 -10
  98. pygpt_net/core/attachments/__init__.py +54 -15
  99. pygpt_net/core/attachments/context.py +92 -29
  100. pygpt_net/core/audio/__init__.py +71 -3
  101. pygpt_net/core/audio/context.py +7 -2
  102. pygpt_net/core/bridge/__init__.py +22 -6
  103. pygpt_net/core/bridge/context.py +5 -3
  104. pygpt_net/core/calendar/__init__.py +57 -11
  105. pygpt_net/core/chain/__init__.py +8 -2
  106. pygpt_net/core/chain/chat.py +10 -8
  107. pygpt_net/core/chain/completion.py +10 -7
  108. pygpt_net/core/command.py +62 -17
  109. pygpt_net/core/ctx/__init__.py +260 -58
  110. pygpt_net/core/ctx/bag.py +25 -4
  111. pygpt_net/core/ctx/container.py +28 -17
  112. pygpt_net/core/ctx/idx.py +45 -8
  113. pygpt_net/core/ctx/output.py +95 -74
  114. pygpt_net/core/ctx/reply.py +5 -2
  115. pygpt_net/core/db/__init__.py +8 -7
  116. pygpt_net/core/db/viewer.py +17 -11
  117. pygpt_net/core/debug/__init__.py +10 -9
  118. pygpt_net/core/debug/tabs.py +5 -2
  119. pygpt_net/core/docker/__init__.py +11 -5
  120. pygpt_net/core/docker/builder.py +11 -3
  121. pygpt_net/core/events/app.py +5 -3
  122. pygpt_net/core/events/base.py +11 -5
  123. pygpt_net/core/events/control.py +5 -3
  124. pygpt_net/core/events/event.py +17 -7
  125. pygpt_net/core/events/kernel.py +5 -3
  126. pygpt_net/core/events/render.py +5 -3
  127. pygpt_net/core/experts/__init__.py +5 -4
  128. pygpt_net/core/filesystem/__init__.py +52 -34
  129. pygpt_net/core/filesystem/actions.py +8 -5
  130. pygpt_net/core/filesystem/editor.py +13 -3
  131. pygpt_net/core/filesystem/types.py +12 -7
  132. pygpt_net/core/filesystem/url.py +7 -3
  133. pygpt_net/core/idx/__init__.py +34 -25
  134. pygpt_net/core/idx/chat.py +40 -16
  135. pygpt_net/core/idx/context.py +6 -2
  136. pygpt_net/core/idx/indexing.py +84 -35
  137. pygpt_net/core/idx/llm.py +11 -3
  138. pygpt_net/core/idx/metadata.py +13 -3
  139. pygpt_net/core/idx/types/ctx.py +32 -6
  140. pygpt_net/core/idx/types/external.py +41 -7
  141. pygpt_net/core/idx/types/files.py +31 -6
  142. pygpt_net/core/image.py +15 -4
  143. pygpt_net/core/llm/__init__.py +13 -3
  144. pygpt_net/core/locale.py +34 -8
  145. pygpt_net/core/models.py +4 -3
  146. pygpt_net/core/notepad.py +9 -4
  147. pygpt_net/core/plugins.py +7 -6
  148. pygpt_net/core/presets.py +19 -10
  149. pygpt_net/core/profile.py +12 -6
  150. pygpt_net/core/prompt/__init__.py +10 -3
  151. pygpt_net/core/prompt/custom.py +7 -6
  152. pygpt_net/core/prompt/template.py +9 -3
  153. pygpt_net/core/render/base.py +117 -22
  154. pygpt_net/core/render/markdown/body.py +27 -7
  155. pygpt_net/core/render/markdown/renderer.py +119 -22
  156. pygpt_net/core/render/plain/body.py +22 -5
  157. pygpt_net/core/render/plain/renderer.py +97 -21
  158. pygpt_net/core/render/web/body.py +75 -25
  159. pygpt_net/core/render/web/renderer.py +313 -63
  160. pygpt_net/core/settings.py +9 -4
  161. pygpt_net/core/tabs/__init__.py +290 -103
  162. pygpt_net/core/tabs/tab.py +17 -4
  163. pygpt_net/core/tokens.py +44 -11
  164. pygpt_net/core/updater/__init__.py +20 -7
  165. pygpt_net/core/vision/analyzer.py +29 -6
  166. pygpt_net/core/web.py +130 -2
  167. pygpt_net/data/config/config.json +15 -4
  168. pygpt_net/data/config/models.json +3 -3
  169. pygpt_net/data/config/modes.json +3 -3
  170. pygpt_net/data/config/settings.json +55 -10
  171. pygpt_net/data/config/settings_section.json +3 -0
  172. pygpt_net/data/css/style.light.css +1 -0
  173. pygpt_net/data/css/{web.css → web-blocks.css} +162 -133
  174. pygpt_net/data/css/{web.light.css → web-blocks.light.css} +7 -0
  175. pygpt_net/data/css/web-chatgpt.css +350 -0
  176. pygpt_net/data/css/web-chatgpt.dark.css +64 -0
  177. pygpt_net/data/css/web-chatgpt.light.css +75 -0
  178. pygpt_net/data/css/web-chatgpt_wide.css +350 -0
  179. pygpt_net/data/css/web-chatgpt_wide.dark.css +64 -0
  180. pygpt_net/data/css/web-chatgpt_wide.light.css +75 -0
  181. pygpt_net/data/icons/split_screen.svg +1 -0
  182. pygpt_net/data/locale/locale.de.ini +12 -0
  183. pygpt_net/data/locale/locale.en.ini +17 -2
  184. pygpt_net/data/locale/locale.es.ini +12 -0
  185. pygpt_net/data/locale/locale.fr.ini +12 -0
  186. pygpt_net/data/locale/locale.it.ini +12 -0
  187. pygpt_net/data/locale/locale.pl.ini +12 -0
  188. pygpt_net/data/locale/locale.uk.ini +12 -0
  189. pygpt_net/data/locale/locale.zh.ini +12 -0
  190. pygpt_net/data/locale/plugin.cmd_web.de.ini +2 -0
  191. pygpt_net/data/locale/plugin.cmd_web.en.ini +20 -10
  192. pygpt_net/data/locale/plugin.cmd_web.es.ini +2 -0
  193. pygpt_net/data/locale/plugin.cmd_web.fr.ini +2 -0
  194. pygpt_net/data/locale/plugin.cmd_web.it.ini +2 -0
  195. pygpt_net/data/locale/plugin.cmd_web.pl.ini +2 -0
  196. pygpt_net/data/locale/plugin.cmd_web.uk.ini +2 -0
  197. pygpt_net/data/locale/plugin.cmd_web.zh.ini +2 -0
  198. pygpt_net/icons.qrc +1 -0
  199. pygpt_net/icons_rc.py +165 -136
  200. pygpt_net/item/ctx.py +46 -24
  201. pygpt_net/plugin/audio_input/simple.py +21 -5
  202. pygpt_net/plugin/audio_output/__init__.py +4 -1
  203. pygpt_net/plugin/base/config.py +4 -2
  204. pygpt_net/plugin/base/plugin.py +26 -6
  205. pygpt_net/plugin/base/worker.py +37 -9
  206. pygpt_net/plugin/cmd_code_interpreter/__init__.py +39 -37
  207. pygpt_net/plugin/cmd_code_interpreter/runner.py +25 -12
  208. pygpt_net/plugin/cmd_web/__init__.py +46 -6
  209. pygpt_net/plugin/cmd_web/config.py +74 -48
  210. pygpt_net/plugin/cmd_web/websearch.py +61 -28
  211. pygpt_net/plugin/cmd_web/worker.py +79 -13
  212. pygpt_net/provider/core/config/patch.py +43 -1
  213. pygpt_net/provider/core/ctx/base.py +4 -1
  214. pygpt_net/provider/core/ctx/db_sqlite/__init__.py +10 -1
  215. pygpt_net/provider/core/ctx/db_sqlite/storage.py +22 -1
  216. pygpt_net/provider/gpt/assistants.py +10 -9
  217. pygpt_net/provider/gpt/audio.py +3 -2
  218. pygpt_net/provider/gpt/chat.py +8 -7
  219. pygpt_net/provider/gpt/completion.py +6 -4
  220. pygpt_net/provider/gpt/image.py +9 -2
  221. pygpt_net/provider/gpt/store.py +14 -13
  222. pygpt_net/provider/gpt/vision.py +6 -5
  223. pygpt_net/tools/__init__.py +9 -1
  224. pygpt_net/tools/base.py +15 -1
  225. pygpt_net/tools/code_interpreter/__init__.py +174 -75
  226. pygpt_net/tools/code_interpreter/ui/dialogs.py +21 -103
  227. pygpt_net/tools/code_interpreter/ui/widgets.py +284 -9
  228. pygpt_net/tools/html_canvas/__init__.py +78 -23
  229. pygpt_net/tools/html_canvas/ui/dialogs.py +46 -62
  230. pygpt_net/tools/html_canvas/ui/widgets.py +96 -3
  231. pygpt_net/ui/base/context_menu.py +2 -2
  232. pygpt_net/ui/layout/chat/input.py +10 -18
  233. pygpt_net/ui/layout/chat/output.py +26 -44
  234. pygpt_net/ui/layout/ctx/ctx_list.py +13 -4
  235. pygpt_net/ui/layout/toolbox/footer.py +18 -2
  236. pygpt_net/ui/main.py +2 -2
  237. pygpt_net/ui/menu/config.py +7 -11
  238. pygpt_net/ui/menu/debug.py +11 -1
  239. pygpt_net/ui/menu/theme.py +9 -2
  240. pygpt_net/ui/widget/filesystem/explorer.py +2 -2
  241. pygpt_net/ui/widget/lists/context.py +27 -5
  242. pygpt_net/ui/widget/tabs/Input.py +2 -2
  243. pygpt_net/ui/widget/tabs/body.py +2 -1
  244. pygpt_net/ui/widget/tabs/layout.py +195 -0
  245. pygpt_net/ui/widget/tabs/output.py +218 -55
  246. pygpt_net/ui/widget/textarea/html.py +11 -1
  247. pygpt_net/ui/widget/textarea/output.py +10 -1
  248. pygpt_net/ui/widget/textarea/search_input.py +4 -1
  249. pygpt_net/ui/widget/textarea/web.py +49 -9
  250. {pygpt_net-2.4.37.dist-info → pygpt_net-2.4.41.dist-info}/METADATA +45 -116
  251. {pygpt_net-2.4.37.dist-info → pygpt_net-2.4.41.dist-info}/RECORD +255 -247
  252. /pygpt_net/data/css/{web.dark.css → web-blocks.dark.css} +0 -0
  253. {pygpt_net-2.4.37.dist-info → pygpt_net-2.4.41.dist-info}/LICENSE +0 -0
  254. {pygpt_net-2.4.37.dist-info → pygpt_net-2.4.41.dist-info}/WHEEL +0 -0
  255. {pygpt_net-2.4.37.dist-info → pygpt_net-2.4.41.dist-info}/entry_points.txt +0 -0
@@ -6,9 +6,11 @@
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 21:00:00 #
9
+ # Updated Date: 2024.12.14 08:00:00 #
10
10
  # ================================================== #
11
11
 
12
+ from typing import Any
13
+
12
14
  from PySide6.QtWidgets import QApplication
13
15
 
14
16
  from pygpt_net.core.events import KernelEvent
@@ -118,7 +120,7 @@ class Stack:
118
120
  self.execute(self.current)
119
121
  self.processed = True
120
122
 
121
- def waiting(self):
123
+ def waiting(self) -> bool:
122
124
  """
123
125
  Check if reply stack is waiting
124
126
 
@@ -126,7 +128,7 @@ class Stack:
126
128
  """
127
129
  return self.has() and not self.is_locked()
128
130
 
129
- def log(self, data: any):
131
+ def log(self, data: Any):
130
132
  """
131
133
  Log data to debug
132
134
 
@@ -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.09 00:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from PySide6.QtCore import Qt
@@ -37,12 +37,7 @@ class Custom:
37
37
 
38
38
  def apply(self):
39
39
  """Apply custom mappings"""
40
- # output: tabs
41
- # self.window.ui.tabs['output'].setTabText(0, trans('output.tab.chat'))
42
- # self.window.ui.tabs['output'].setTabText(1, trans('output.tab.files'))
43
- # self.window.ui.tabs['output'].setTabText(2, trans('output.tab.calendar'))
44
- # self.window.ui.tabs['output'].setTabText(3, trans('output.tab.painter'))
45
-
40
+
46
41
  # tool: indexer
47
42
  self.window.ui.tabs['tool.indexer'].setTabText(0, trans('tool.indexer.tab.files'))
48
43
  self.window.ui.tabs['tool.indexer'].setTabText(1, trans('tool.indexer.tab.web'))
@@ -6,9 +6,11 @@
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.23 00:00:00 #
9
+ # Updated Date: 2024.12.14 08:00:00 #
10
10
  # ================================================== #
11
11
 
12
+ from typing import Dict
13
+
12
14
  from pygpt_net.utils import trans
13
15
 
14
16
 
@@ -69,7 +71,7 @@ class Mapping:
69
71
  if k in self.window.ui.menu:
70
72
  self.window.ui.menu[k].setText(trans("output.tab." + self.window.controller.tools.get_tab_tools()[k][0]))
71
73
 
72
- def get_mapping(self) -> dict:
74
+ def get_mapping(self) -> Dict[str, Dict[str, str]]:
73
75
  """
74
76
  Get nodes => locale keys mapping
75
77
 
@@ -332,6 +334,7 @@ class Mapping:
332
334
  menu_title['theme.light'] = 'menu.theme.light'
333
335
  menu_title['theme.syntax'] = 'menu.theme.syntax'
334
336
  menu_title['theme.density'] = 'menu.theme.density'
337
+ menu_title['theme.style'] = 'menu.theme.style'
335
338
  menu_title['menu.plugins'] = 'menu.plugins'
336
339
  menu_title['menu.plugins.presets'] = 'menu.plugins.presets'
337
340
  menu_title['menu.about'] = 'menu.info'
@@ -357,7 +360,6 @@ class Mapping:
357
360
  menu_text['config.profile.new'] = 'menu.config.profile.new'
358
361
  menu_text['config.save'] = 'menu.config.save'
359
362
  menu_text['theme.tooltips'] = 'menu.theme.tooltips'
360
- menu_text['theme.blocks'] = 'menu.theme.blocks'
361
363
  menu_text['theme.settings'] = 'menu.theme.settings'
362
364
  menu_text['plugins.presets.new'] = 'menu.plugins.presets.new'
363
365
  menu_text['plugins.presets.edit'] = 'menu.plugins.presets.edit'
@@ -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.17 03:00:00 #
9
+ # Updated Date: 2024.12.09 03:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import os
@@ -26,7 +26,7 @@ class Layout:
26
26
  """
27
27
  self.window = window
28
28
  # self.splitters = ["main", "main.output", "toolbox", "toolbox.mode", "toolbox.presets"]
29
- self.splitters = ["main", "main.output", "toolbox", "toolbox.mode", "calendar", "interpreter", "interpreter.columns"]
29
+ self.splitters = ["main", "main.output", "toolbox", "toolbox.mode", "calendar", "interpreter", "interpreter.columns", "columns"]
30
30
  self.text_nodes = ["input"]
31
31
 
32
32
  def setup(self):
@@ -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.14 08:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from pygpt_net.core.events import Event, AppEvent
@@ -87,7 +87,7 @@ class Mode:
87
87
  self.window.controller.ctx.common.update_label_by_current()
88
88
  self.locked = False
89
89
 
90
- def select_on_list(self, mode):
90
+ def select_on_list(self, mode: str):
91
91
  """
92
92
  Select mode on the list
93
93
 
@@ -142,7 +142,14 @@ class Mode:
142
142
  hooks=False) # disable hooks to prevent circular update
143
143
  '''
144
144
 
145
- def hook_global_temperature(self, key, value, caller, *args, **kwargs):
145
+ def hook_global_temperature(
146
+ self,
147
+ key: str,
148
+ value,
149
+ caller,
150
+ *args,
151
+ **kwargs
152
+ ):
146
153
  """
147
154
  Hook: on update current temperature global field
148
155
  """
@@ -158,7 +165,12 @@ class Mode:
158
165
  preset.temperature = temperature
159
166
  self.window.core.presets.save(preset_id)
160
167
 
161
- def switch_inline(self, mode: str, ctx: CtxItem, prompt: str) -> str:
168
+ def switch_inline(
169
+ self,
170
+ mode: str,
171
+ ctx: CtxItem,
172
+ prompt: str
173
+ ) -> str:
162
174
  """
163
175
  Switch inline mode
164
176
 
@@ -6,9 +6,11 @@
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 21:00:00 #
9
+ # Updated Date: 2024.12.14 00:00:00 #
10
10
  # ================================================== #
11
11
 
12
+ from typing import Optional
13
+
12
14
  from pygpt_net.core.events import Event, AppEvent
13
15
  from pygpt_net.item.model import ModelItem
14
16
 
@@ -94,7 +96,12 @@ class Model:
94
96
  })
95
97
  self.window.dispatch(event)
96
98
 
97
- def select_on_list(self, model):
99
+ def select_on_list(self, model: str):
100
+ """
101
+ Select model on list
102
+
103
+ :param model: model ID
104
+ """
98
105
  self.window.ui.nodes["prompt.model"].set_value(model)
99
106
 
100
107
  def select_current(self):
@@ -122,7 +129,11 @@ class Model:
122
129
  # or set default model
123
130
  self.window.core.config.set('model', self.window.core.models.get_default(mode))
124
131
 
125
- def switch_inline(self, mode: str, model: ModelItem = None) -> ModelItem:
132
+ def switch_inline(
133
+ self,
134
+ mode: str,
135
+ model: Optional[ModelItem] = None
136
+ ) -> ModelItem:
126
137
  """
127
138
  Switch inline model instance (force change model if needed)
128
139
 
@@ -6,10 +6,11 @@
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 21:00:00 #
9
+ # Updated Date: 2024.12.14 08:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import copy
13
+ from typing import Optional
13
14
 
14
15
  from pygpt_net.utils import trans
15
16
 
@@ -261,7 +262,11 @@ class Editor:
261
262
  self.set_by_tab(idx)
262
263
  self.init()
263
264
 
264
- def delete_by_idx(self, idx: int, force: bool = False):
265
+ def delete_by_idx(
266
+ self,
267
+ idx: int,
268
+ force: bool = False
269
+ ):
265
270
  """
266
271
  Delete model by idx
267
272
 
@@ -387,7 +392,7 @@ class Editor:
387
392
  i += 1
388
393
  return model_idx
389
394
 
390
- def get_model_by_tab_idx(self, idx: int) -> str or None:
395
+ def get_model_by_tab_idx(self, idx: int) -> Optional[str]:
391
396
  """
392
397
  Get model key by list index
393
398
 
@@ -6,9 +6,11 @@
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.17 17:00:00 #
9
+ # Updated Date: 2024.12.14 08:00:00 #
10
10
  # ================================================== #
11
11
 
12
+ from typing import Optional, Tuple
13
+
12
14
  from PySide6.QtGui import QTextCursor
13
15
 
14
16
  from pygpt_net.core.tabs.tab import Tab
@@ -16,6 +18,7 @@ from pygpt_net.item.notepad import NotepadItem
16
18
  from pygpt_net.ui.widget.tabs.body import TabBody
17
19
  from pygpt_net.ui.widget.textarea.notepad import NotepadWidget
18
20
  from pygpt_net.utils import trans
21
+
19
22
  import pygpt_net.icons_rc
20
23
 
21
24
 
@@ -29,7 +32,10 @@ class Notepad:
29
32
  self.window = window
30
33
  self.opened_once = False
31
34
 
32
- def create(self, idx: int = None) -> (TabBody, int):
35
+ def create(
36
+ self,
37
+ idx: Optional[int] = None
38
+ ) -> Tuple[TabBody, int, int]:
33
39
  """
34
40
  Create notepad widget
35
41
 
@@ -38,13 +44,14 @@ class Notepad:
38
44
  """
39
45
  if idx is None:
40
46
  idx = self.window.core.tabs.count_by_type(Tab.TAB_NOTEPAD) + 1
41
- self.window.ui.notepad[idx] = NotepadWidget(self.window)
42
- self.window.ui.notepad[idx].id = idx
43
- self.window.ui.notepad[idx].textarea.id = idx
47
+ data_id = idx
48
+ self.window.ui.notepad[data_id] = NotepadWidget(self.window)
49
+ self.window.ui.notepad[data_id].id = idx
50
+ self.window.ui.notepad[data_id].textarea.id = idx
44
51
  title = trans('output.tab.notepad')
45
52
  title += " " + str(idx)
46
- children = self.window.core.tabs.from_widget(self.window.ui.notepad[idx])
47
- return children, idx
53
+ children = self.window.core.tabs.from_widget(self.window.ui.notepad[data_id])
54
+ return children, idx, data_id
48
55
 
49
56
  def load(self):
50
57
  """Load all notepads contents"""
@@ -183,10 +190,11 @@ class Notepad:
183
190
  return
184
191
 
185
192
  # switch to first notepad tab if current tab is not notepad
193
+ tabs = self.window.ui.layout.get_active_tabs()
186
194
  if self.window.controller.ui.tabs.get_current_type() != Tab.TAB_NOTEPAD:
187
195
  idx = self.window.core.tabs.get_min_idx_by_type(Tab.TAB_NOTEPAD)
188
196
  if idx is not None:
189
- self.window.ui.tabs['output'].setCurrentIndex(idx)
197
+ tabs.setCurrentIndex(idx)
190
198
 
191
199
  self.window.activateWindow() # focus
192
200
 
@@ -201,7 +209,7 @@ class Notepad:
201
209
  self.load()
202
210
  self.window.core.notepad.locked = False
203
211
 
204
- def switch_to_tab(self, idx: int = None):
212
+ def switch_to_tab(self, idx: Optional[int] = None):
205
213
  """
206
214
  Switch to notepad tab
207
215
 
@@ -209,11 +217,12 @@ class Notepad:
209
217
  """
210
218
  if idx is None:
211
219
  idx = self.get_first_notepad_tab_idx()
220
+ tabs = self.window.ui.layout.get_active_tabs()
212
221
  tab = self.window.core.tabs.get_tab_by_index(idx)
213
222
  if tab is not None:
214
- self.window.ui.tabs['output'].setCurrentIndex(idx)
223
+ tabs.setCurrentIndex(idx)
215
224
  else:
216
- self.window.ui.tabs['output'].setCurrentIndex(self.get_first_notepad_tab_idx())
225
+ tabs.setCurrentIndex(self.get_first_notepad_tab_idx())
217
226
 
218
227
  def get_first_notepad_tab_idx(self) -> int:
219
228
  """
@@ -257,11 +266,16 @@ class Notepad:
257
266
  return True
258
267
  return False
259
268
 
260
- def on_open(self, tab_idx: int):
269
+ def on_open(
270
+ self,
271
+ tab_idx: int,
272
+ column_idx: int = 0
273
+ ):
261
274
  """
262
275
  On open notepad tab
263
276
 
264
277
  :param tab_idx: current tab idx
278
+ :param column_idx: column idx
265
279
  """
266
280
  tab = self.window.controller.ui.tabs.get_current_tab()
267
281
  if tab is None:
@@ -6,12 +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.11.24 00:00:00 #
9
+ # Updated Date: 2024.12.14 08:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import datetime
13
13
  import math
14
14
  import os
15
+ from typing import Optional, Union
16
+
15
17
  import mss
16
18
  import mss.tools
17
19
  from PIL import Image, ImageDraw
@@ -45,7 +47,13 @@ class Capture:
45
47
  image = QImage(frame.data, width, height, bytes, QImage.Format_RGB888)
46
48
  self.window.ui.painter.set_image(image)
47
49
 
48
- def capture_screen_with_custom_cursor(self, save_path) -> str:
50
+ def capture_screen_with_custom_cursor(self, save_path: str) -> str:
51
+ """
52
+ Capture screen with custom cursor
53
+
54
+ :param save_path: Save path
55
+ :return: Save path
56
+ """
49
57
  cursor_path = os.path.join(self.window.core.config.get_app_path(), "data", "icons", "cursor.png")
50
58
 
51
59
  with mss.mss() as sct:
@@ -72,12 +80,17 @@ class Capture:
72
80
  img.save(save_path)
73
81
  return save_path
74
82
 
75
- def screenshot(self, attach_cursor: bool = False, silent: bool = False) -> str:
83
+ def screenshot(
84
+ self,
85
+ attach_cursor: bool = False,
86
+ silent: bool = False
87
+ ) -> Optional[Union[str, bool]]:
76
88
  """
77
89
  Make screenshot and append to attachments
78
90
 
79
91
  :param attach_cursor: True to with custom cursor
80
92
  :param silent: Silent mode
93
+ :return: Path to screenshot or False if failed
81
94
  """
82
95
  if not silent:
83
96
  # switch to vision mode if needed
@@ -152,7 +165,13 @@ class Capture:
152
165
  print("Image capture exception", e)
153
166
  self.window.core.debug.log(e)
154
167
 
155
- def attach(self, name: str, path: str, type: str = 'drawing', silent: bool = False):
168
+ def attach(
169
+ self,
170
+ name: str,
171
+ path: str,
172
+ type: str = 'drawing',
173
+ silent: bool = False
174
+ ):
156
175
  """
157
176
  Attach image to attachments
158
177
 
@@ -6,9 +6,11 @@
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.02.17 15:00:00 #
9
+ # Updated Date: 2024.12.14 08:00:00 #
10
10
  # ================================================== #
11
11
 
12
+ from typing import Tuple, Optional, Dict, List
13
+
12
14
  from PySide6.QtCore import Qt, QSize
13
15
  from PySide6.QtGui import QColor
14
16
 
@@ -22,7 +24,7 @@ class Common:
22
24
  """
23
25
  self.window = window
24
26
 
25
- def convert_to_size(self, canvas_size: str) -> tuple:
27
+ def convert_to_size(self, canvas_size: str) -> Tuple[int, int]:
26
28
  """
27
29
  Convert string to size
28
30
 
@@ -64,7 +66,7 @@ class Common:
64
66
  self.window.core.config.set('painter.brush.mode', "erase")
65
67
  self.window.core.config.save()
66
68
 
67
- def change_canvas_size(self, selected=None):
69
+ def change_canvas_size(self, selected: Optional[str] = None):
68
70
  """
69
71
  Change the canvas size
70
72
 
@@ -79,7 +81,7 @@ class Common:
79
81
  self.window.core.config.set('painter.canvas.size', selected)
80
82
  self.window.core.config.save()
81
83
 
82
- def change_brush_size(self, size):
84
+ def change_brush_size(self, size: int):
83
85
  """
84
86
  Change the brush size
85
87
 
@@ -143,7 +145,7 @@ class Common:
143
145
  self.window.ui.nodes['painter.select.brush.size'].findText(str(size))
144
146
  )
145
147
 
146
- def get_colors(self) -> dict:
148
+ def get_colors(self) -> Dict[str, QColor]:
147
149
  """
148
150
  Get colors dict
149
151
 
@@ -161,7 +163,7 @@ class Common:
161
163
  "Violet": QColor('violet')
162
164
  }
163
165
 
164
- def get_sizes(self) -> list:
166
+ def get_sizes(self) -> List[str]:
165
167
  """
166
168
  Get brush sizes
167
169
 
@@ -169,7 +171,7 @@ class Common:
169
171
  """
170
172
  return ['1', '2', '3', '5', '8', '12', '15', '20', '25', '30', '50', '100', '200']
171
173
 
172
- def get_canvas_sizes(self) -> list:
174
+ def get_canvas_sizes(self) -> List[str]:
173
175
  """
174
176
  Get canvas sizes
175
177
 
@@ -6,9 +6,11 @@
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 08:00:00 #
10
10
  # ================================================== #
11
11
 
12
+ from typing import List, Dict, Any
13
+
12
14
  from PySide6.QtGui import QAction
13
15
 
14
16
  from pygpt_net.core.types import (
@@ -368,7 +370,11 @@ class Plugins:
368
370
  self.window.ui.nodes['chat.plugins'].setText(count_str)
369
371
  self.window.ui.nodes['chat.plugins'].setToolTip(tooltip)
370
372
 
371
- def apply_cmds_all(self, ctx: CtxItem, cmds: list):
373
+ def apply_cmds_all(
374
+ self,
375
+ ctx: CtxItem,
376
+ cmds: List[Dict[str, Any]]
377
+ ):
372
378
  """
373
379
  Apply all commands (inline or not)
374
380
 
@@ -381,7 +387,11 @@ class Plugins:
381
387
  else:
382
388
  return self.apply_cmds_inline(ctx, cmds)
383
389
 
384
- def apply_cmds(self, ctx: CtxItem, cmds: list):
390
+ def apply_cmds(
391
+ self,
392
+ ctx: CtxItem,
393
+ cmds: List[Dict[str, Any]]
394
+ ):
385
395
  """
386
396
  Apply commands
387
397
 
@@ -418,7 +428,11 @@ class Plugins:
418
428
 
419
429
  return ctx.results
420
430
 
421
- def apply_cmds_inline(self, ctx: CtxItem, cmds: list):
431
+ def apply_cmds_inline(
432
+ self,
433
+ ctx: CtxItem,
434
+ cmds: List[Dict[str, Any]]
435
+ ):
422
436
  """
423
437
  Apply inline commands
424
438
 
@@ -462,7 +476,7 @@ class Plugins:
462
476
  self.settings.setup()
463
477
  self.update()
464
478
 
465
- def log(self, data: any):
479
+ def log(self, data: Any):
466
480
  """
467
481
  Log data to debug
468
482
 
@@ -6,10 +6,11 @@
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 21:00:00 #
9
+ # Updated Date: 2024.12.14 08:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import copy
13
+ from typing import Dict
13
14
  from uuid import uuid4
14
15
 
15
16
  from PySide6.QtGui import QAction
@@ -156,7 +157,7 @@ class Presets:
156
157
  self.update_list()
157
158
  self.update_menu()
158
159
 
159
- def store(self, presets: dict):
160
+ def store(self, presets: Dict[str, Dict]):
160
161
  """
161
162
  Store presets
162
163
 
@@ -185,7 +186,11 @@ class Presets:
185
186
  self.toggle(id)
186
187
  self.update_menu()
187
188
 
188
- def delete_by_idx(self, idx: int, force:bool = False):
189
+ def delete_by_idx(
190
+ self,
191
+ idx: int,
192
+ force: bool = False
193
+ ):
189
194
  """
190
195
  Delete preset by index
191
196
 
@@ -241,7 +246,11 @@ class Presets:
241
246
  self.toggle(id)
242
247
  self.window.update_status("Preset cleared: " + presets[id]['name'])
243
248
 
244
- def reset_by_idx(self, idx: int, force: bool = False):
249
+ def reset_by_idx(
250
+ self,
251
+ idx: int,
252
+ force: bool = False
253
+ ):
245
254
  """
246
255
  Reset preset by index
247
256
 
@@ -258,7 +267,7 @@ class Presets:
258
267
  id = self.get_id_by_idx(idx)
259
268
  self.reset(id)
260
269
 
261
- def get_preset(self, id: str) -> dict:
270
+ def get_preset(self, id: str) -> Dict:
262
271
  """
263
272
  Get preset by id
264
273
 
@@ -269,7 +278,7 @@ class Presets:
269
278
  if id in presets:
270
279
  return presets[id]
271
280
 
272
- def get_presets(self) -> dict:
281
+ def get_presets(self) -> Dict[str, Dict]:
273
282
  """
274
283
  Get presets dict
275
284
 
@@ -6,9 +6,11 @@
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 21:00:00 #
9
+ # Updated Date: 2024.12.14 00:00:00 #
10
10
  # ================================================== #
11
11
 
12
+ from typing import Any
13
+
12
14
  from pygpt_net.core.events import Event
13
15
  from pygpt_net.utils import trans
14
16
 
@@ -49,7 +51,11 @@ class Settings:
49
51
  self.config_initialized = True
50
52
  if not self.config_dialog:
51
53
  self.init()
52
- self.window.ui.dialogs.open('plugin_settings', width=self.width, height=self.height)
54
+ self.window.ui.dialogs.open(
55
+ 'plugin_settings',
56
+ width=self.width,
57
+ height=self.height
58
+ )
53
59
  self.config_dialog = True
54
60
 
55
61
  def open_plugin(self, id: str):
@@ -161,7 +167,7 @@ class Settings:
161
167
  self.init()
162
168
  self.window.ui.dialogs.alert(trans('dialog.plugin.settings.defaults.app.result'))
163
169
 
164
- def get_option(self, id: str, key: str) -> any:
170
+ def get_option(self, id: str, key: str) -> Any:
165
171
  """
166
172
  Get plugin option
167
173