pygpt-net 2.4.39__py3-none-any.whl → 2.4.40__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 (85) hide show
  1. CHANGELOG.md +13 -0
  2. README.md +19 -2
  3. pygpt_net/CHANGELOG.txt +13 -0
  4. pygpt_net/__init__.py +3 -3
  5. pygpt_net/controller/__init__.py +5 -3
  6. pygpt_net/controller/audio/__init__.py +9 -1
  7. pygpt_net/controller/chat/input.py +2 -1
  8. pygpt_net/controller/chat/render.py +2 -2
  9. pygpt_net/controller/ctx/__init__.py +2 -2
  10. pygpt_net/controller/debug/__init__.py +13 -2
  11. pygpt_net/controller/kernel/__init__.py +2 -1
  12. pygpt_net/controller/notepad.py +7 -6
  13. pygpt_net/controller/theme/nodes.py +2 -5
  14. pygpt_net/controller/tools/__init__.py +37 -1
  15. pygpt_net/controller/ui/__init__.py +1 -5
  16. pygpt_net/controller/ui/tabs.py +104 -12
  17. pygpt_net/core/command.py +3 -1
  18. pygpt_net/core/ctx/__init__.py +6 -2
  19. pygpt_net/core/ctx/container.py +5 -5
  20. pygpt_net/core/debug/tabs.py +3 -1
  21. pygpt_net/core/render/base.py +2 -2
  22. pygpt_net/core/render/web/body.py +1 -1
  23. pygpt_net/core/render/web/renderer.py +208 -38
  24. pygpt_net/core/tabs/__init__.py +104 -43
  25. pygpt_net/core/tabs/tab.py +4 -1
  26. pygpt_net/core/web.py +127 -1
  27. pygpt_net/data/config/config.json +4 -3
  28. pygpt_net/data/config/models.json +3 -3
  29. pygpt_net/data/config/modes.json +3 -3
  30. pygpt_net/data/css/web-blocks.css +18 -0
  31. pygpt_net/data/css/web-blocks.light.css +7 -0
  32. pygpt_net/data/css/web-chatgpt.css +8 -0
  33. pygpt_net/data/css/web-chatgpt_wide.css +8 -0
  34. pygpt_net/data/icons/split_screen.svg +1 -0
  35. pygpt_net/data/locale/locale.de.ini +1 -1
  36. pygpt_net/data/locale/locale.en.ini +4 -2
  37. pygpt_net/data/locale/locale.es.ini +1 -1
  38. pygpt_net/data/locale/locale.fr.ini +1 -1
  39. pygpt_net/data/locale/locale.it.ini +1 -1
  40. pygpt_net/data/locale/locale.pl.ini +2 -2
  41. pygpt_net/data/locale/locale.uk.ini +1 -1
  42. pygpt_net/data/locale/locale.zh.ini +1 -1
  43. pygpt_net/data/locale/plugin.cmd_web.de.ini +2 -0
  44. pygpt_net/data/locale/plugin.cmd_web.en.ini +20 -10
  45. pygpt_net/data/locale/plugin.cmd_web.es.ini +2 -0
  46. pygpt_net/data/locale/plugin.cmd_web.fr.ini +2 -0
  47. pygpt_net/data/locale/plugin.cmd_web.it.ini +2 -0
  48. pygpt_net/data/locale/plugin.cmd_web.pl.ini +2 -0
  49. pygpt_net/data/locale/plugin.cmd_web.uk.ini +2 -0
  50. pygpt_net/data/locale/plugin.cmd_web.zh.ini +2 -0
  51. pygpt_net/icons.qrc +1 -0
  52. pygpt_net/icons_rc.py +165 -136
  53. pygpt_net/item/ctx.py +46 -24
  54. pygpt_net/plugin/audio_output/__init__.py +4 -1
  55. pygpt_net/plugin/base/plugin.py +18 -4
  56. pygpt_net/plugin/cmd_code_interpreter/__init__.py +39 -37
  57. pygpt_net/plugin/cmd_code_interpreter/runner.py +25 -12
  58. pygpt_net/plugin/cmd_web/__init__.py +46 -6
  59. pygpt_net/plugin/cmd_web/config.py +74 -48
  60. pygpt_net/plugin/cmd_web/websearch.py +61 -28
  61. pygpt_net/plugin/cmd_web/worker.py +79 -13
  62. pygpt_net/provider/core/config/patch.py +22 -1
  63. pygpt_net/tools/__init__.py +9 -1
  64. pygpt_net/tools/base.py +15 -1
  65. pygpt_net/tools/code_interpreter/__init__.py +174 -75
  66. pygpt_net/tools/code_interpreter/ui/dialogs.py +21 -103
  67. pygpt_net/tools/code_interpreter/ui/widgets.py +284 -9
  68. pygpt_net/tools/html_canvas/__init__.py +78 -23
  69. pygpt_net/tools/html_canvas/ui/dialogs.py +46 -62
  70. pygpt_net/tools/html_canvas/ui/widgets.py +96 -3
  71. pygpt_net/ui/base/context_menu.py +2 -2
  72. pygpt_net/ui/layout/ctx/ctx_list.py +13 -4
  73. pygpt_net/ui/layout/toolbox/footer.py +1 -1
  74. pygpt_net/ui/main.py +2 -2
  75. pygpt_net/ui/menu/debug.py +11 -1
  76. pygpt_net/ui/widget/filesystem/explorer.py +2 -2
  77. pygpt_net/ui/widget/lists/context.py +26 -5
  78. pygpt_net/ui/widget/tabs/Input.py +2 -2
  79. pygpt_net/ui/widget/tabs/body.py +2 -1
  80. pygpt_net/ui/widget/tabs/output.py +126 -61
  81. {pygpt_net-2.4.39.dist-info → pygpt_net-2.4.40.dist-info}/METADATA +20 -3
  82. {pygpt_net-2.4.39.dist-info → pygpt_net-2.4.40.dist-info}/RECORD +85 -84
  83. {pygpt_net-2.4.39.dist-info → pygpt_net-2.4.40.dist-info}/LICENSE +0 -0
  84. {pygpt_net-2.4.39.dist-info → pygpt_net-2.4.40.dist-info}/WHEEL +0 -0
  85. {pygpt_net-2.4.39.dist-info → pygpt_net-2.4.40.dist-info}/entry_points.txt +0 -0
@@ -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.09 03:00:00 #
9
+ # Updated Date: 2024.12.12 01:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from PySide6.QtWidgets import QTabWidget, QMenu, QPushButton
@@ -18,6 +18,73 @@ from pygpt_net.utils import trans
18
18
  import pygpt_net.icons_rc
19
19
 
20
20
 
21
+ class AddButton(QPushButton):
22
+ def __init__(self, window=None, column=None, tabs=None):
23
+ super(AddButton, self).__init__(QIcon(":/icons/add.svg"), "", window)
24
+ self.window = window
25
+ self.column = column
26
+ self.tabs = tabs
27
+ self.setFixedSize(30, 25)
28
+ self.setFlat(True)
29
+ self.clicked.connect(
30
+ lambda: self.window.controller.ui.tabs.new_tab(self.column.get_idx())
31
+ )
32
+ self.setObjectName('tab-add')
33
+ self.setProperty('tabAdd', True)
34
+ self.setToolTip(trans('action.tab.add.chat'))
35
+
36
+ def mousePressEvent(self, event):
37
+ """
38
+ Mouse press event
39
+
40
+ :param event: event
41
+ """
42
+ if event.button() == Qt.RightButton:
43
+ idx = 0
44
+ column_idx = self.column.get_idx()
45
+ self.show_menu(idx, column_idx, event.globalPos())
46
+ super(AddButton, self).mousePressEvent(event)
47
+
48
+ def show_menu(self, index: int, column_idx: int, global_pos):
49
+ """
50
+ Show context menu
51
+
52
+ :param index: index
53
+ :param column_idx: column index
54
+ :param global_pos: global position
55
+ """
56
+ context_menu = self.prepare_menu(index, column_idx)
57
+ context_menu.exec(global_pos)
58
+
59
+ def prepare_menu(self, index: int, column_idx: int) -> QMenu:
60
+ """
61
+ Prepare and return context menu
62
+
63
+ :param index: index
64
+ :param column_idx: column index
65
+ :return: menu
66
+ """
67
+ menu = QMenu(self)
68
+
69
+ actions = {}
70
+ actions['add_chat'] = QAction(QIcon(":/icons/add.svg"), trans('action.tab.add.chat'), self)
71
+ actions['add_chat'].triggered.connect(
72
+ lambda: self.tabs.add_tab(index, column_idx, Tab.TAB_CHAT)
73
+ )
74
+ actions['add_notepad'] = QAction(QIcon(":/icons/add.svg"), trans('action.tab.add.notepad'), self)
75
+ actions['add_notepad'].triggered.connect(
76
+ lambda: self.tabs.add_tab(index, column_idx, Tab.TAB_NOTEPAD)
77
+ )
78
+
79
+ # add chat, add notepad
80
+ menu.addAction(actions['add_chat'])
81
+ menu.addAction(actions['add_notepad'])
82
+
83
+ # add tools submenu
84
+ self.window.controller.tools.append_tab_menu(self, menu, index, column_idx)
85
+
86
+ return menu
87
+
21
88
  class OutputTabs(QTabWidget):
22
89
  def __init__(self, window=None, column=None):
23
90
  super(OutputTabs, self).__init__(window)
@@ -31,15 +98,7 @@ class OutputTabs(QTabWidget):
31
98
  def init(self):
32
99
  """Initialize"""
33
100
  # create the [+] button
34
- add_button = QPushButton(QIcon(":/icons/add.svg"), "")
35
- add_button.setFixedSize(30, 25)
36
- add_button.setFlat(True)
37
- add_button.clicked.connect(
38
- lambda: self.window.controller.ui.tabs.new_tab(self.column.get_idx())
39
- )
40
- add_button.setObjectName('tab-add')
41
- add_button.setProperty('tabAdd', True)
42
- add_button.setToolTip(trans('action.tab.add.chat'))
101
+ add_button = AddButton(self.window, self.column, self)
43
102
 
44
103
  # add the button to the top right corner of the tab bar
45
104
  self.setCornerWidget(add_button, corner=Qt.TopRightCorner)
@@ -94,18 +153,22 @@ class OutputTabs(QTabWidget):
94
153
  self.show_chat_menu(idx, column_idx, event.globalPos()) # chat
95
154
  elif tab.type == Tab.TAB_FILES:
96
155
  self.show_files_menu(idx, column_idx, event.globalPos()) # files
156
+ elif tab.type == Tab.TAB_TOOL:
157
+ self.show_tool_menu(idx, column_idx, event.globalPos()) # tool
97
158
  else:
98
159
  self.show_default_menu(idx, column_idx, event.globalPos()) # default
99
160
  super(OutputTabs, self).mousePressEvent(event)
100
161
 
101
- def get_common_actions(self, index: int, column_idx: int):
162
+ def prepare_menu(self, index: int, column_idx: int) -> QMenu:
102
163
  """
103
- Get common actions
164
+ Prepare and return context menu
104
165
 
105
166
  :param index: index
106
167
  :param column_idx: column index
107
- :return: dict
168
+ :return: menu
108
169
  """
170
+ menu = QMenu(self)
171
+
109
172
  actions = {}
110
173
  actions['add_chat'] = QAction(QIcon(":/icons/add.svg"), trans('action.tab.add.chat'), self)
111
174
  actions['add_chat'].triggered.connect(
@@ -127,7 +190,24 @@ class OutputTabs(QTabWidget):
127
190
  actions['move_left'].triggered.connect(
128
191
  lambda: self.window.controller.ui.tabs.move_tab(index, column_idx, 0)
129
192
  )
130
- return actions
193
+
194
+ # add chat, add notepad
195
+ menu.addAction(actions['add_chat'])
196
+ menu.addAction(actions['add_notepad'])
197
+
198
+ # add tools submenu
199
+ self.window.controller.tools.append_tab_menu(self, menu, index, column_idx)
200
+
201
+ # rename tab
202
+ menu.addAction(actions['edit'])
203
+
204
+ # move tab left, move tab right
205
+ if column_idx != 0:
206
+ menu.addAction(actions['move_left'])
207
+ if column_idx != 1:
208
+ menu.addAction(actions['move_right'])
209
+
210
+ return menu
131
211
 
132
212
  def show_notepad_menu(self, index: int, column_idx: int, global_pos):
133
213
  """
@@ -137,8 +217,8 @@ class OutputTabs(QTabWidget):
137
217
  :param column_idx: column index
138
218
  :param global_pos: global position
139
219
  """
140
- context_menu = QMenu()
141
- actions = self.get_common_actions(index, column_idx)
220
+ context_menu = self.prepare_menu(index, column_idx)
221
+ actions = {}
142
222
  actions['close'] = QAction(QIcon(":/icons/close.svg"), trans('action.tab.close'), self)
143
223
  actions['close'].triggered.connect(
144
224
  lambda: self.close_tab(index, column_idx)
@@ -147,20 +227,11 @@ class OutputTabs(QTabWidget):
147
227
  actions['close_all'].triggered.connect(
148
228
  lambda: self.close_all(Tab.TAB_NOTEPAD, column_idx)
149
229
  )
150
- context_menu.addAction(actions['add_chat'])
151
- context_menu.addAction(actions['add_notepad'])
152
- context_menu.addAction(actions['edit'])
153
230
  context_menu.addAction(actions['close'])
154
231
 
155
232
  if self.window.core.tabs.count_by_type(Tab.TAB_NOTEPAD) > 1:
156
233
  context_menu.addAction(actions['close_all'])
157
234
 
158
- # move
159
- if column_idx != 0:
160
- context_menu.addAction(actions['move_left'])
161
- if column_idx != 1:
162
- context_menu.addAction(actions['move_right'])
163
-
164
235
  context_menu.exec(global_pos)
165
236
 
166
237
  def show_chat_menu(self, index: int, column_idx: int, global_pos):
@@ -171,8 +242,8 @@ class OutputTabs(QTabWidget):
171
242
  :param column_idx: column index
172
243
  :param global_pos: global position
173
244
  """
174
- context_menu = QMenu()
175
- actions = self.get_common_actions(index, column_idx)
245
+ context_menu = self.prepare_menu(index, column_idx)
246
+ actions = {}
176
247
  actions['close'] = QAction(QIcon(":/icons/close.svg"), trans('action.tab.close'), self)
177
248
  actions['close'].triggered.connect(
178
249
  lambda: self.close_tab(index, column_idx)
@@ -181,21 +252,12 @@ class OutputTabs(QTabWidget):
181
252
  actions['close_all'].triggered.connect(
182
253
  lambda: self.close_all(Tab.TAB_CHAT, column_idx)
183
254
  )
184
- context_menu.addAction(actions['add_chat'])
185
- context_menu.addAction(actions['add_notepad'])
186
- context_menu.addAction(actions['edit'])
187
255
 
188
256
  # at least one chat tab must be open
189
257
  if self.window.core.tabs.count_by_type(Tab.TAB_CHAT) > 1:
190
258
  context_menu.addAction(actions['close'])
191
259
  context_menu.addAction(actions['close_all'])
192
260
 
193
- # move
194
- if column_idx != 0:
195
- context_menu.addAction(actions['move_left'])
196
- if column_idx != 1:
197
- context_menu.addAction(actions['move_right'])
198
-
199
261
  context_menu.exec(global_pos)
200
262
 
201
263
  def show_files_menu(self, index: int, column_idx: int, global_pos):
@@ -206,23 +268,30 @@ class OutputTabs(QTabWidget):
206
268
  :param column_idx: column index
207
269
  :param global_pos: global position
208
270
  """
209
- context_menu = QMenu()
210
- actions = self.get_common_actions(index, column_idx)
271
+ context_menu = self.prepare_menu(index, column_idx)
272
+ actions = {}
211
273
  actions['refresh'] = QAction(QIcon(":/icons/reload.svg"), trans('action.refresh'), self)
212
274
  actions['refresh'].triggered.connect(
213
275
  lambda: self.window.controller.files.update_explorer()
214
276
  )
215
- context_menu.addAction(actions['add_chat'])
216
- context_menu.addAction(actions['add_notepad'])
217
277
  context_menu.addAction(actions['refresh'])
218
- context_menu.addAction(actions['edit'])
278
+ context_menu.exec(global_pos)
219
279
 
220
- # move
221
- if column_idx != 0:
222
- context_menu.addAction(actions['move_left'])
223
- if column_idx != 1:
224
- context_menu.addAction(actions['move_right'])
280
+ def show_tool_menu(self, index: int, column_idx: int, global_pos):
281
+ """
282
+ Show tool menu
225
283
 
284
+ :param index: index
285
+ :param column_idx: column index
286
+ :param global_pos: global position
287
+ """
288
+ context_menu = self.prepare_menu(index, column_idx)
289
+ actions = {}
290
+ actions['close'] = QAction(QIcon(":/icons/close.svg"), trans('action.tab.close'), self)
291
+ actions['close'].triggered.connect(
292
+ lambda: self.close_tab(index, column_idx)
293
+ )
294
+ context_menu.addAction(actions['close'])
226
295
  context_menu.exec(global_pos)
227
296
 
228
297
  def show_default_menu(self, index: int, column_idx: int, global_pos):
@@ -233,18 +302,7 @@ class OutputTabs(QTabWidget):
233
302
  :param column_idx: column index
234
303
  :param global_pos: global position
235
304
  """
236
- context_menu = QMenu()
237
- actions = self.get_common_actions(index, column_idx)
238
- context_menu.addAction(actions['add_chat'])
239
- context_menu.addAction(actions['add_notepad'])
240
- context_menu.addAction(actions['edit'])
241
-
242
- # move
243
- if column_idx != 0:
244
- context_menu.addAction(actions['move_left'])
245
- if column_idx != 1:
246
- context_menu.addAction(actions['move_right'])
247
-
305
+ context_menu = self.prepare_menu(index, column_idx)
248
306
  context_menu.exec(global_pos)
249
307
 
250
308
  @Slot()
@@ -278,11 +336,18 @@ class OutputTabs(QTabWidget):
278
336
  self.window.controller.ui.tabs.close_all(type, column_idx)
279
337
 
280
338
  @Slot()
281
- def add_tab(self, index: int, column_idx: int, type):
339
+ def add_tab(self, index: int, column_idx: int, type: int, tool_id: str = None):
282
340
  """
283
- Add tab
341
+ Add a new tab
342
+
284
343
  :param index: index
285
344
  :param column_idx: column index
286
345
  :param type: type
346
+ :param tool_id: tool id
287
347
  """
288
- self.window.controller.ui.tabs.append(type, index, column_idx)
348
+ self.window.controller.ui.tabs.append(
349
+ type=type,
350
+ tool_id=tool_id,
351
+ idx=index,
352
+ column_idx=column_idx,
353
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pygpt-net
3
- Version: 2.4.39
3
+ Version: 2.4.40
4
4
  Summary: Desktop AI Assistant powered by models: OpenAI o1, GPT-4o, GPT-4, GPT-4 Vision, GPT-3.5, DALL-E 3, Llama 3, Mistral, Gemini, Claude, Bielik, and other models supported by Langchain, Llama Index, and Ollama. Features include chatbot, text completion, image generation, vision analysis, speech-to-text, internet access, file handling, command execution and more.
5
5
  Home-page: https://pygpt.net
6
6
  License: MIT
@@ -92,7 +92,7 @@ Description-Content-Type: text/markdown
92
92
 
93
93
  [![pygpt](https://snapcraft.io/pygpt/badge.svg)](https://snapcraft.io/pygpt)
94
94
 
95
- Release: **2.4.39** | build: **2024.12.09** | Python: **>=3.10, <3.12**
95
+ Release: **2.4.40** | build: **2024.12.13** | Python: **>=3.10, <3.12**
96
96
 
97
97
  > Official website: https://pygpt.net | Documentation: https://pygpt.readthedocs.io
98
98
  >
@@ -2074,6 +2074,10 @@ Per-page content chunk size (max characters per chunk). *Default:* `20000`
2074
2074
 
2075
2075
  Disables SSL verification when crawling web pages. *Default:* `False`
2076
2076
 
2077
+ - `Use raw content (without summarization)` *raw*
2078
+
2079
+ Return raw content from web search instead of summarized content. Provides more data but consumes more tokens. *Default:* `True`
2080
+
2077
2081
  - `Timeout` *timeout*
2078
2082
 
2079
2083
  Connection timeout (seconds). *Default:* `5`
@@ -2084,7 +2088,7 @@ User agent to use when making requests. *Default:* `Mozilla/5.0`.
2084
2088
 
2085
2089
  - `Max result length` *max_result_length*
2086
2090
 
2087
- Max length of summarized result (characters). *Default:* `1500`
2091
+ Max length of the summarized or raw result (characters). *Default:* `50000`
2088
2092
 
2089
2093
  - `Max summary tokens` *summary_max_tokens*
2090
2094
 
@@ -3963,6 +3967,19 @@ may consume additional tokens that are not displayed in the main window.
3963
3967
 
3964
3968
  ## Recent changes:
3965
3969
 
3970
+ **2.4.40 (2024-12-13)**
3971
+
3972
+ - Enhanced Split Screen mode, now promoted from beta to stable.
3973
+ - Python Code Interpreter tool added to the Tabs.
3974
+ - HTML/JS Canvas tool added to the Tabs.
3975
+ - Added attachment icon to the context list if context has attachments.
3976
+ - Improved audio playback.
3977
+ - Improved web search.
3978
+ - Added a thumbnail image to web search results.
3979
+ - Added a new commands to web search: "extract_images" and "extract_links".
3980
+ - Added the option "Use raw content (without summarization)" to the web search plugin, which provides a more detailed result to the main model.
3981
+ - Extended the default maximum result characters to 50,000 in the web search plugin.
3982
+
3966
3983
  **2.4.39 (2024-12-09)**
3967
3984
 
3968
3985
  - Added "Split Screen" mode (accessible via the switch in the bottom-right corner of the screen), which allows you to work in two windows simultaneously. It is currently experimental (beta). Future updates will include Code Interpreter and Canvas running in tabs.