pygpt-net 2.4.38__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 (105) hide show
  1. CHANGELOG.md +19 -0
  2. README.md +25 -2
  3. pygpt_net/CHANGELOG.txt +19 -0
  4. pygpt_net/__init__.py +3 -3
  5. pygpt_net/controller/__init__.py +7 -3
  6. pygpt_net/controller/audio/__init__.py +9 -1
  7. pygpt_net/controller/calendar/__init__.py +3 -1
  8. pygpt_net/controller/chat/input.py +2 -1
  9. pygpt_net/controller/chat/render.py +8 -5
  10. pygpt_net/controller/ctx/__init__.py +33 -25
  11. pygpt_net/controller/ctx/common.py +3 -2
  12. pygpt_net/controller/debug/__init__.py +13 -2
  13. pygpt_net/controller/dialogs/confirm.py +2 -2
  14. pygpt_net/controller/kernel/__init__.py +2 -1
  15. pygpt_net/controller/lang/custom.py +2 -7
  16. pygpt_net/controller/lang/mapping.py +2 -2
  17. pygpt_net/controller/layout.py +2 -2
  18. pygpt_net/controller/notepad.py +14 -10
  19. pygpt_net/controller/theme/nodes.py +2 -5
  20. pygpt_net/controller/tools/__init__.py +37 -1
  21. pygpt_net/controller/ui/__init__.py +1 -5
  22. pygpt_net/controller/ui/tabs.py +295 -60
  23. pygpt_net/core/command.py +3 -1
  24. pygpt_net/core/ctx/__init__.py +16 -2
  25. pygpt_net/core/ctx/container.py +18 -11
  26. pygpt_net/core/ctx/output.py +86 -67
  27. pygpt_net/core/debug/tabs.py +5 -2
  28. pygpt_net/core/filesystem/url.py +7 -3
  29. pygpt_net/core/render/base.py +14 -3
  30. pygpt_net/core/render/markdown/renderer.py +3 -1
  31. pygpt_net/core/render/plain/renderer.py +3 -3
  32. pygpt_net/core/render/web/body.py +10 -4
  33. pygpt_net/core/render/web/renderer.py +213 -41
  34. pygpt_net/core/tabs/__init__.py +268 -98
  35. pygpt_net/core/tabs/tab.py +16 -4
  36. pygpt_net/core/web.py +127 -1
  37. pygpt_net/data/config/config.json +12 -5
  38. pygpt_net/data/config/models.json +3 -3
  39. pygpt_net/data/config/modes.json +3 -3
  40. pygpt_net/data/css/web-blocks.css +18 -0
  41. pygpt_net/data/css/web-blocks.light.css +7 -0
  42. pygpt_net/data/css/web-chatgpt.css +8 -0
  43. pygpt_net/data/css/web-chatgpt_wide.css +8 -0
  44. pygpt_net/data/icons/split_screen.svg +1 -0
  45. pygpt_net/data/locale/locale.de.ini +3 -0
  46. pygpt_net/data/locale/locale.en.ini +6 -1
  47. pygpt_net/data/locale/locale.es.ini +3 -0
  48. pygpt_net/data/locale/locale.fr.ini +3 -0
  49. pygpt_net/data/locale/locale.it.ini +3 -0
  50. pygpt_net/data/locale/locale.pl.ini +4 -1
  51. pygpt_net/data/locale/locale.uk.ini +3 -0
  52. pygpt_net/data/locale/locale.zh.ini +3 -0
  53. pygpt_net/data/locale/plugin.cmd_web.de.ini +2 -0
  54. pygpt_net/data/locale/plugin.cmd_web.en.ini +20 -10
  55. pygpt_net/data/locale/plugin.cmd_web.es.ini +2 -0
  56. pygpt_net/data/locale/plugin.cmd_web.fr.ini +2 -0
  57. pygpt_net/data/locale/plugin.cmd_web.it.ini +2 -0
  58. pygpt_net/data/locale/plugin.cmd_web.pl.ini +2 -0
  59. pygpt_net/data/locale/plugin.cmd_web.uk.ini +2 -0
  60. pygpt_net/data/locale/plugin.cmd_web.zh.ini +2 -0
  61. pygpt_net/icons.qrc +1 -0
  62. pygpt_net/icons_rc.py +165 -136
  63. pygpt_net/item/ctx.py +46 -24
  64. pygpt_net/plugin/audio_input/simple.py +4 -2
  65. pygpt_net/plugin/audio_output/__init__.py +4 -1
  66. pygpt_net/plugin/base/plugin.py +18 -4
  67. pygpt_net/plugin/cmd_code_interpreter/__init__.py +39 -37
  68. pygpt_net/plugin/cmd_code_interpreter/runner.py +25 -12
  69. pygpt_net/plugin/cmd_web/__init__.py +46 -6
  70. pygpt_net/plugin/cmd_web/config.py +74 -48
  71. pygpt_net/plugin/cmd_web/websearch.py +61 -28
  72. pygpt_net/plugin/cmd_web/worker.py +79 -13
  73. pygpt_net/provider/core/config/patch.py +29 -1
  74. pygpt_net/provider/core/ctx/base.py +4 -1
  75. pygpt_net/provider/core/ctx/db_sqlite/__init__.py +10 -1
  76. pygpt_net/provider/core/ctx/db_sqlite/storage.py +22 -1
  77. pygpt_net/tools/__init__.py +9 -1
  78. pygpt_net/tools/base.py +15 -1
  79. pygpt_net/tools/code_interpreter/__init__.py +174 -75
  80. pygpt_net/tools/code_interpreter/ui/dialogs.py +21 -103
  81. pygpt_net/tools/code_interpreter/ui/widgets.py +284 -9
  82. pygpt_net/tools/html_canvas/__init__.py +78 -23
  83. pygpt_net/tools/html_canvas/ui/dialogs.py +46 -62
  84. pygpt_net/tools/html_canvas/ui/widgets.py +96 -3
  85. pygpt_net/ui/base/context_menu.py +2 -2
  86. pygpt_net/ui/layout/chat/input.py +10 -18
  87. pygpt_net/ui/layout/chat/output.py +26 -44
  88. pygpt_net/ui/layout/ctx/ctx_list.py +13 -4
  89. pygpt_net/ui/layout/toolbox/footer.py +18 -2
  90. pygpt_net/ui/main.py +2 -2
  91. pygpt_net/ui/menu/debug.py +11 -1
  92. pygpt_net/ui/widget/filesystem/explorer.py +2 -2
  93. pygpt_net/ui/widget/lists/context.py +26 -5
  94. pygpt_net/ui/widget/tabs/Input.py +2 -2
  95. pygpt_net/ui/widget/tabs/body.py +2 -1
  96. pygpt_net/ui/widget/tabs/layout.py +195 -0
  97. pygpt_net/ui/widget/tabs/output.py +209 -55
  98. pygpt_net/ui/widget/textarea/html.py +11 -1
  99. pygpt_net/ui/widget/textarea/output.py +10 -1
  100. pygpt_net/ui/widget/textarea/web.py +49 -9
  101. {pygpt_net-2.4.38.dist-info → pygpt_net-2.4.40.dist-info}/METADATA +26 -3
  102. {pygpt_net-2.4.38.dist-info → pygpt_net-2.4.40.dist-info}/RECORD +105 -103
  103. {pygpt_net-2.4.38.dist-info → pygpt_net-2.4.40.dist-info}/LICENSE +0 -0
  104. {pygpt_net-2.4.38.dist-info → pygpt_net-2.4.40.dist-info}/WHEEL +0 -0
  105. {pygpt_net-2.4.38.dist-info → pygpt_net-2.4.40.dist-info}/entry_points.txt +0 -0
CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 2.4.40 (2024-12-13)
4
+
5
+ - Enhanced Split Screen mode, now promoted from beta to stable.
6
+ - Python Code Interpreter tool added to the Tabs.
7
+ - HTML/JS Canvas tool added to the Tabs.
8
+ - Added attachment icon to the context list if context has attachments.
9
+ - Improved audio playback.
10
+ - Improved web search.
11
+ - Added a thumbnail image to web search results.
12
+ - Added a new commands to web search: "extract_images" and "extract_links".
13
+ - Added the option "Use raw content (without summarization)" to the web search plugin, which provides a more detailed result to the main model.
14
+ - Extended the default maximum result characters to 50,000 in the web search plugin.
15
+
16
+ ## 2.4.39 (2024-12-09)
17
+
18
+ - 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.
19
+
20
+ - Fixed: Language switch.
21
+
3
22
  ## 2.4.38 (2024-12-08)
4
23
 
5
24
  - Added the ability to select a style for chat display between: Blocks, ChatGPT-like, and ChatGPT-like Wide. New option in the menu: Config -> Theme -> Style...
README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![pygpt](https://snapcraft.io/pygpt/badge.svg)](https://snapcraft.io/pygpt)
4
4
 
5
- Release: **2.4.38** | build: **2024.12.08** | Python: **>=3.10, <3.12**
5
+ Release: **2.4.40** | build: **2024.12.13** | Python: **>=3.10, <3.12**
6
6
 
7
7
  > Official website: https://pygpt.net | Documentation: https://pygpt.readthedocs.io
8
8
  >
@@ -1984,6 +1984,10 @@ Per-page content chunk size (max characters per chunk). *Default:* `20000`
1984
1984
 
1985
1985
  Disables SSL verification when crawling web pages. *Default:* `False`
1986
1986
 
1987
+ - `Use raw content (without summarization)` *raw*
1988
+
1989
+ Return raw content from web search instead of summarized content. Provides more data but consumes more tokens. *Default:* `True`
1990
+
1987
1991
  - `Timeout` *timeout*
1988
1992
 
1989
1993
  Connection timeout (seconds). *Default:* `5`
@@ -1994,7 +1998,7 @@ User agent to use when making requests. *Default:* `Mozilla/5.0`.
1994
1998
 
1995
1999
  - `Max result length` *max_result_length*
1996
2000
 
1997
- Max length of summarized result (characters). *Default:* `1500`
2001
+ Max length of the summarized or raw result (characters). *Default:* `50000`
1998
2002
 
1999
2003
  - `Max summary tokens` *summary_max_tokens*
2000
2004
 
@@ -3873,6 +3877,25 @@ may consume additional tokens that are not displayed in the main window.
3873
3877
 
3874
3878
  ## Recent changes:
3875
3879
 
3880
+ **2.4.40 (2024-12-13)**
3881
+
3882
+ - Enhanced Split Screen mode, now promoted from beta to stable.
3883
+ - Python Code Interpreter tool added to the Tabs.
3884
+ - HTML/JS Canvas tool added to the Tabs.
3885
+ - Added attachment icon to the context list if context has attachments.
3886
+ - Improved audio playback.
3887
+ - Improved web search.
3888
+ - Added a thumbnail image to web search results.
3889
+ - Added a new commands to web search: "extract_images" and "extract_links".
3890
+ - Added the option "Use raw content (without summarization)" to the web search plugin, which provides a more detailed result to the main model.
3891
+ - Extended the default maximum result characters to 50,000 in the web search plugin.
3892
+
3893
+ **2.4.39 (2024-12-09)**
3894
+
3895
+ - 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.
3896
+
3897
+ - Fixed: Language switch.
3898
+
3876
3899
  **2.4.38 (2024-12-08)**
3877
3900
 
3878
3901
  - Added the ability to select a style for chat display between: Blocks, ChatGPT-like, and ChatGPT-like Wide. New option in the menu: Config -> Theme -> Style...
pygpt_net/CHANGELOG.txt CHANGED
@@ -1,3 +1,22 @@
1
+ 2.4.40 (2024-12-13)
2
+
3
+ - Enhanced Split Screen mode, now promoted from beta to stable.
4
+ - Python Code Interpreter tool added to the Tabs.
5
+ - HTML/JS Canvas tool added to the Tabs.
6
+ - Added attachment icon to the context list if context has attachments.
7
+ - Improved audio playback.
8
+ - Improved web search.
9
+ - Added a thumbnail image to web search results.
10
+ - Added a new commands to web search: "extract_images" and "extract_links".
11
+ - Added the option "Use raw content (without summarization)" to the web search plugin, which provides a more detailed result to the main model.
12
+ - Extended the default maximum result characters to 50,000 in the web search plugin.
13
+
14
+ 2.4.39 (2024-12-09)
15
+
16
+ - 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.
17
+
18
+ - Fixed: Language switch.
19
+
1
20
  2.4.38 (2024-12-08)
2
21
 
3
22
  - Added the ability to select a style for chat display between: Blocks, ChatGPT-like, and ChatGPT-like Wide. New option in the menu: Config -> Theme -> Style...
pygpt_net/__init__.py CHANGED
@@ -6,15 +6,15 @@
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.08 01:00:00 #
9
+ # Updated Date: 2024.12.13 21:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  __author__ = "Marcin Szczygliński"
13
13
  __copyright__ = "Copyright 2024, Marcin Szczygliński"
14
14
  __credits__ = ["Marcin Szczygliński"]
15
15
  __license__ = "MIT"
16
- __version__ = "2.4.38"
17
- __build__ = "2024.12.08"
16
+ __version__ = "2.4.40"
17
+ __build__ = "2024.12.13"
18
18
  __maintainer__ = "Marcin Szczygliński"
19
19
  __github__ = "https://github.com/szczyglis-dev/py-gpt"
20
20
  __website__ = "https://pygpt.net"
@@ -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 17:00:00 #
9
+ # Updated Date: 2024.12.09 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from pygpt_net.controller.access import Access
@@ -87,15 +87,16 @@ class Controller:
87
87
  self.chat.init()
88
88
 
89
89
  # setup layout
90
- self.ui.pre_setup()
91
90
  self.layout.setup()
92
91
  self.ui.setup()
92
+ self.ui.tabs.setup()
93
93
 
94
94
  # setup controllers
95
95
  self.lang.setup()
96
96
  self.assistant.setup()
97
97
  self.chat.setup()
98
98
  self.agent.setup()
99
+ self.tools.setup()
99
100
  self.ctx.setup()
100
101
  self.presets.setup()
101
102
  self.idx.setup()
@@ -105,7 +106,8 @@ class Controller:
105
106
  self.attachment.setup()
106
107
  self.camera.setup_ui()
107
108
  self.access.setup()
108
- self.tools.setup()
109
+
110
+
109
111
 
110
112
  def post_setup(self):
111
113
  """Post-setup, after plugins are loaded"""
@@ -116,6 +118,7 @@ class Controller:
116
118
  self.calendar.setup() # after everything is loaded
117
119
  self.painter.setup() # load previous image if exists
118
120
  self.debug.post_setup() # post setup debug after all loaded
121
+ self.ui.tabs.restore_data() # restore opened tabs data
119
122
 
120
123
  # show license terms dialog
121
124
  if not self.window.core.config.get('license.accepted'):
@@ -168,6 +171,7 @@ class Controller:
168
171
  # post-reload
169
172
  self.ui.tabs.reload_after()
170
173
  self.ctx.reload_after()
174
+ self.ui.tabs.restore_data() # restore opened tabs data
171
175
  self.kernel.restart()
172
176
 
173
177
  self.reloading = False # unlock
@@ -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.13 08:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import os
@@ -200,6 +200,14 @@ class Audio:
200
200
  }
201
201
  self.window.dispatch(event, all=True)
202
202
 
203
+ def stop_audio(self):
204
+ """Stop audio playback"""
205
+ ctx = CtxItem()
206
+ event = Event(Event.AUDIO_OUTPUT_STOP)
207
+ event.ctx = ctx
208
+ event.data = {}
209
+ self.window.dispatch(event, all=True)
210
+
203
211
  def play_sound(self, filename: str):
204
212
  """
205
213
  Play sound
@@ -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.05 23:00:00 #
9
+ # Updated Date: 2024.12.09 00:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from pygpt_net.core.tabs.tab import Tab
@@ -48,6 +48,8 @@ class Calendar:
48
48
 
49
49
  :param all: reload all notes
50
50
  """
51
+ if not self.is_loaded():
52
+ return
51
53
  year = self.window.ui.calendar['select'].currentYear
52
54
  month = self.window.ui.calendar['select'].currentMonth
53
55
  self.on_page_changed(year, month, all=all) # load notes for current month
@@ -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.12 04:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from pygpt_net.core.bridge import BridgeContext
@@ -52,6 +52,7 @@ class Input:
52
52
  """
53
53
  self.window.controller.agent.experts.unlock() # unlock experts
54
54
  self.window.controller.agent.llama.reset_eval_step() # reset evaluation steps
55
+ self.window.controller.ui.tabs.switch_to_first_chat() # switch to first active chat tab
55
56
 
56
57
  # get text from input
57
58
  text = self.window.ui.nodes['input'].toPlainText().strip()
@@ -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.12 04:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from PySide6.QtCore import Slot, QTimer
@@ -16,6 +16,7 @@ from pygpt_net.core.render.base import BaseRenderer
16
16
  from pygpt_net.core.render.markdown.renderer import Renderer as MarkdownRenderer
17
17
  from pygpt_net.core.render.plain.renderer import Renderer as PlainTextRenderer
18
18
  from pygpt_net.core.render.web.renderer import Renderer as WebRenderer
19
+ from pygpt_net.core.tabs.tab import Tab
19
20
  from pygpt_net.core.text.utils import output_html2text, output_clean_html
20
21
  from pygpt_net.item.ctx import CtxItem, CtxMeta
21
22
 
@@ -67,6 +68,7 @@ class Render:
67
68
  append = data.get("append", False)
68
69
  footer = data.get("footer", False)
69
70
  initialized = data.get("initialized", False)
71
+ tab = data.get("tab")
70
72
 
71
73
  if name == RenderEvent.BEGIN:
72
74
  self.begin(meta, ctx, stream)
@@ -87,7 +89,7 @@ class Render:
87
89
  self.stream_end(meta, ctx)
88
90
 
89
91
  elif name == RenderEvent.ON_PAGE_LOAD:
90
- self.on_page_loaded(meta)
92
+ self.on_page_loaded(meta, tab)
91
93
  elif name ==RenderEvent.ON_THEME_CHANGE:
92
94
  self.on_theme_change()
93
95
  elif name == RenderEvent.ON_LOAD:
@@ -375,13 +377,14 @@ class Render:
375
377
  self.instance().on_reply_submit(ctx)
376
378
  self.update()
377
379
 
378
- def on_page_loaded(self, meta: CtxMeta):
380
+ def on_page_loaded(self, meta: CtxMeta, tab: Tab = None):
379
381
  """
380
382
  On page loaded callback
381
383
 
382
384
  :param meta: context meta
385
+ :param tab: Tab
383
386
  """
384
- self.instance().on_page_loaded(meta) # TODO: send ID with callback
387
+ self.instance().on_page_loaded(meta, tab)
385
388
  self.update()
386
389
 
387
390
  def on_theme_change(self):
@@ -491,7 +494,7 @@ class Render:
491
494
  if plain:
492
495
  self.window.controller.theme.markdown.clear()
493
496
  for pid in self.window.ui.nodes['output_plain']:
494
- if self.window.ui.nodes['output'][pid] is not None:
497
+ if self.window.ui.nodes['output_plain'][pid] is not None:
495
498
  self.window.ui.nodes['output'][pid].setVisible(False)
496
499
  self.window.ui.nodes['output_plain'][pid].setVisible(True)
497
500
  else:
@@ -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.24 00:00:00 #
9
+ # Updated Date: 2024.12.12 04:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from PySide6.QtCore import QModelIndex
@@ -19,7 +19,7 @@ from .summarizer import Summarizer
19
19
  from .extra import Extra
20
20
 
21
21
  from pygpt_net.utils import trans
22
- from pygpt_net.core.tabs import Tab
22
+ from pygpt_net.core.tabs.tab import Tab
23
23
 
24
24
 
25
25
  class Ctx:
@@ -60,20 +60,6 @@ class Ctx:
60
60
  # if no ctx then get first ctx
61
61
  self.window.core.ctx.set_current(self.window.core.ctx.get_first())
62
62
 
63
- # restore previous ctx
64
- # 1) try to load from tabs data - if not exists, load from current
65
- tab = self.window.core.tabs.get_first_by_type(Tab.TAB_CHAT)
66
- loaded = False
67
- if tab is not None:
68
- meta_id = tab.data_id
69
- if meta_id is not None:
70
- self.load(meta_id)
71
- loaded = True
72
-
73
- # 2) load from current if not loaded yet
74
- if not loaded:
75
- self.load(self.window.core.ctx.get_current())
76
-
77
63
  # restore search string if exists
78
64
  if self.window.core.config.has("ctx.search.string"):
79
65
  string = self.window.core.config.get("ctx.search.string")
@@ -144,6 +130,19 @@ class Ctx:
144
130
  # update additional context attachments
145
131
  self.window.controller.chat.attachment.update()
146
132
 
133
+ def select_on_list_only(self, id: int):
134
+ """
135
+ Select ctx by id only on list
136
+
137
+ :param id: context meta id
138
+ """
139
+ self.window.core.ctx.select(id, restore_model=True)
140
+ self.window.core.ctx.set_current(id)
141
+ self.update_list(True)
142
+ self.select_by_current()
143
+ self.reload_config(all=False)
144
+ self.update()
145
+
147
146
  def select_by_idx(self, idx: int):
148
147
  """
149
148
  Select ctx by index
@@ -348,6 +347,21 @@ class Ctx:
348
347
  event = RenderEvent(RenderEvent.ON_LOAD, data)
349
348
  self.window.dispatch(event)
350
349
 
350
+ self.reload_config()
351
+
352
+ # reload ctx list and select current ctx on list, without reloading all
353
+ self.update(reload=False, all=True)
354
+
355
+ # update tab title
356
+ if meta is not None:
357
+ self.window.controller.ui.tabs.update_title_current(meta.name)
358
+
359
+ def reload_config(self, all: bool = True):
360
+ """
361
+ Reload config
362
+
363
+ :param all: reload all
364
+ """
351
365
  # get current settings stored in ctx
352
366
  thread = self.window.core.ctx.get_thread()
353
367
  mode = self.window.core.ctx.get_mode()
@@ -358,8 +372,9 @@ class Ctx:
358
372
  # restore thread from ctx
359
373
  self.window.core.config.set('assistant_thread', thread)
360
374
 
361
- # clear before output and append ctx to output
362
- self.refresh_output()
375
+ if all:
376
+ # clear before output and append ctx to output
377
+ self.refresh_output()
363
378
 
364
379
  # switch mode to ctx mode
365
380
  if mode is not None:
@@ -384,16 +399,9 @@ class Ctx:
384
399
  if model is not None and self.window.core.models.has_model(mode, model):
385
400
  self.window.controller.model.set(mode, model)
386
401
 
387
- # reload ctx list and select current ctx on list, without reloading all
388
- self.update(reload=False, all=True)
389
-
390
402
  # update current ctx label in UI
391
403
  self.common.update_label(mode, assistant_id)
392
404
 
393
- # update tab title
394
- if meta is not None:
395
- self.window.controller.ui.tabs.update_title_current(meta.name)
396
-
397
405
  def update_ctx(self):
398
406
  """Update current ctx mode if allowed"""
399
407
  mode = self.window.core.config.get('mode')
@@ -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.23 00:00:00 #
9
+ # Updated Date: 2024.12.09 00:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from PySide6.QtWidgets import QApplication
@@ -91,10 +91,11 @@ class Common:
91
91
 
92
92
  def focus_chat(self):
93
93
  """Focus chat"""
94
+ tabs = self.window.ui.layout.get_active_tabs()
94
95
  if self.window.controller.ui.tabs.get_current_type() != Tab.TAB_CHAT:
95
96
  idx = self.window.core.tabs.get_min_idx_by_type(Tab.TAB_CHAT)
96
97
  if idx is not None:
97
- self.window.ui.tabs['output'].setCurrentIndex(idx)
98
+ tabs.setCurrentIndex(idx)
98
99
 
99
100
  def restore_display_filter(self):
100
101
  """Restore display filter"""
@@ -15,6 +15,8 @@ from logging import ERROR, WARNING, INFO, DEBUG
15
15
  from PySide6.QtCore import Slot, QObject
16
16
  from PySide6.QtGui import QTextCursor
17
17
 
18
+ from pygpt_net.core.events import RenderEvent
19
+
18
20
 
19
21
  class Debug(QObject):
20
22
  def __init__(self, window=None):
@@ -53,8 +55,17 @@ class Debug(QObject):
53
55
 
54
56
  def toggle_menu(self):
55
57
  """Toggle debug menu"""
56
- stage = self.window.core.config.get('debug')
57
- self.window.ui.menu['menu.debug'].menuAction().setVisible(stage)
58
+ state = self.window.core.config.get('debug')
59
+ self.window.ui.menu['menu.debug'].menuAction().setVisible(state)
60
+
61
+ def toggle_render(self):
62
+ """Toggle render debug"""
63
+ value = self.window.ui.menu['debug.render'].isChecked()
64
+ self.window.core.config.set('debug.render', value)
65
+ self.window.core.config.save()
66
+ event = RenderEvent(RenderEvent.ON_THEME_CHANGE)
67
+ self.window.dispatch(event)
68
+ self.window.controller.ctx.refresh()
58
69
 
59
70
  def set_log_level(self, level: str = 'error'):
60
71
  """
@@ -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 02:00:00 #
9
+ # Updated Date: 2024.12.09 03:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  class Confirm:
@@ -154,7 +154,7 @@ class Confirm:
154
154
 
155
155
  # tab close all
156
156
  elif type == 'tab.close_all':
157
- self.window.controller.ui.tabs.close_all(id, True) # by type
157
+ self.window.controller.ui.tabs.close_all(id, 0, True) # by type
158
158
 
159
159
  # editor
160
160
  elif type == 'editor.changed.clear':
@@ -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.13 08:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import time
@@ -251,6 +251,7 @@ class Kernel(QObject):
251
251
  """
252
252
  self.halt = True
253
253
  self.window.controller.chat.common.stop(exit=exit) # it stops legacy agent also
254
+ self.window.controller.audio.stop_audio()
254
255
  if not exit:
255
256
  self.window.dispatch(KernelEvent(KernelEvent.STOP))
256
257
  self.set_state(KernelEvent(KernelEvent.STATE_IDLE, {"msg": trans("status.stopped")}))
@@ -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,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.07 21:00:00 #
9
+ # Updated Date: 2024.12.09 03:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from pygpt_net.utils import trans
@@ -332,6 +332,7 @@ class Mapping:
332
332
  menu_title['theme.light'] = 'menu.theme.light'
333
333
  menu_title['theme.syntax'] = 'menu.theme.syntax'
334
334
  menu_title['theme.density'] = 'menu.theme.density'
335
+ menu_title['theme.style'] = 'menu.theme.style'
335
336
  menu_title['menu.plugins'] = 'menu.plugins'
336
337
  menu_title['menu.plugins.presets'] = 'menu.plugins.presets'
337
338
  menu_title['menu.about'] = 'menu.info'
@@ -357,7 +358,6 @@ class Mapping:
357
358
  menu_text['config.profile.new'] = 'menu.config.profile.new'
358
359
  menu_text['config.save'] = 'menu.config.save'
359
360
  menu_text['theme.tooltips'] = 'menu.theme.tooltips'
360
- menu_text['theme.style'] = 'menu.theme.style'
361
361
  menu_text['theme.settings'] = 'menu.theme.settings'
362
362
  menu_text['plugins.presets.new'] = 'menu.plugins.presets.new'
363
363
  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.17 17:00:00 #
9
+ # Updated Date: 2024.12.12 01:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from PySide6.QtGui import QTextCursor
@@ -38,13 +38,14 @@ class Notepad:
38
38
  """
39
39
  if idx is None:
40
40
  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
41
+ data_id = idx
42
+ self.window.ui.notepad[data_id] = NotepadWidget(self.window)
43
+ self.window.ui.notepad[data_id].id = idx
44
+ self.window.ui.notepad[data_id].textarea.id = idx
44
45
  title = trans('output.tab.notepad')
45
46
  title += " " + str(idx)
46
- children = self.window.core.tabs.from_widget(self.window.ui.notepad[idx])
47
- return children, idx
47
+ children = self.window.core.tabs.from_widget(self.window.ui.notepad[data_id])
48
+ return children, idx, data_id
48
49
 
49
50
  def load(self):
50
51
  """Load all notepads contents"""
@@ -183,10 +184,11 @@ class Notepad:
183
184
  return
184
185
 
185
186
  # switch to first notepad tab if current tab is not notepad
187
+ tabs = self.window.ui.layout.get_active_tabs()
186
188
  if self.window.controller.ui.tabs.get_current_type() != Tab.TAB_NOTEPAD:
187
189
  idx = self.window.core.tabs.get_min_idx_by_type(Tab.TAB_NOTEPAD)
188
190
  if idx is not None:
189
- self.window.ui.tabs['output'].setCurrentIndex(idx)
191
+ tabs.setCurrentIndex(idx)
190
192
 
191
193
  self.window.activateWindow() # focus
192
194
 
@@ -209,11 +211,12 @@ class Notepad:
209
211
  """
210
212
  if idx is None:
211
213
  idx = self.get_first_notepad_tab_idx()
214
+ tabs = self.window.ui.layout.get_active_tabs()
212
215
  tab = self.window.core.tabs.get_tab_by_index(idx)
213
216
  if tab is not None:
214
- self.window.ui.tabs['output'].setCurrentIndex(idx)
217
+ tabs.setCurrentIndex(idx)
215
218
  else:
216
- self.window.ui.tabs['output'].setCurrentIndex(self.get_first_notepad_tab_idx())
219
+ tabs.setCurrentIndex(self.get_first_notepad_tab_idx())
217
220
 
218
221
  def get_first_notepad_tab_idx(self) -> int:
219
222
  """
@@ -257,11 +260,12 @@ class Notepad:
257
260
  return True
258
261
  return False
259
262
 
260
- def on_open(self, tab_idx: int):
263
+ def on_open(self, tab_idx: int, column_idx: int = 0):
261
264
  """
262
265
  On open notepad tab
263
266
 
264
267
  :param tab_idx: current tab idx
268
+ :param column_idx: column idx
265
269
  """
266
270
  tab = self.window.controller.ui.tabs.get_current_tab()
267
271
  if tab is None:
@@ -6,9 +6,9 @@
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.12 01:00:00 #
10
10
  # ================================================== #
11
- #
11
+
12
12
  from pygpt_net.core.events import RenderEvent
13
13
 
14
14
 
@@ -93,9 +93,6 @@ class Nodes:
93
93
  continue
94
94
  self.apply(key, type)
95
95
 
96
- # self.window.interpreter.update_stylesheet(self.window.controller.theme.style('font.chat.output'))
97
- # self.window.ui.nodes['interpreter.input'].update_stylesheet(self.window.controller.theme.style('font.chat.input'))
98
-
99
96
  # apply to notepads
100
97
  num_notepads = self.window.controller.notepad.get_num_notepads()
101
98
  if num_notepads > 0: