pygpt-net 2.6.45__py3-none-any.whl → 2.6.47__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 (77) hide show
  1. pygpt_net/CHANGELOG.txt +12 -0
  2. pygpt_net/__init__.py +3 -3
  3. pygpt_net/controller/__init__.py +1 -3
  4. pygpt_net/controller/audio/audio.py +2 -0
  5. pygpt_net/controller/chat/text.py +2 -1
  6. pygpt_net/controller/debug/debug.py +11 -9
  7. pygpt_net/controller/dialogs/debug.py +40 -29
  8. pygpt_net/controller/notepad/notepad.py +0 -2
  9. pygpt_net/controller/theme/theme.py +5 -5
  10. pygpt_net/controller/ui/tabs.py +40 -2
  11. pygpt_net/core/debug/agent.py +19 -14
  12. pygpt_net/core/debug/assistants.py +22 -24
  13. pygpt_net/core/debug/attachments.py +11 -7
  14. pygpt_net/core/debug/config.py +22 -23
  15. pygpt_net/core/debug/context.py +63 -63
  16. pygpt_net/core/debug/db.py +1 -4
  17. pygpt_net/core/debug/events.py +14 -11
  18. pygpt_net/core/debug/indexes.py +41 -76
  19. pygpt_net/core/debug/kernel.py +11 -8
  20. pygpt_net/core/debug/models.py +20 -15
  21. pygpt_net/core/debug/plugins.py +9 -6
  22. pygpt_net/core/debug/presets.py +16 -11
  23. pygpt_net/core/debug/tabs.py +28 -22
  24. pygpt_net/core/debug/ui.py +25 -22
  25. pygpt_net/core/render/web/renderer.py +5 -2
  26. pygpt_net/core/tabs/tab.py +16 -3
  27. pygpt_net/data/config/config.json +3 -3
  28. pygpt_net/data/config/models.json +3 -3
  29. pygpt_net/data/config/settings.json +15 -17
  30. pygpt_net/data/css/style.dark.css +6 -0
  31. pygpt_net/data/css/web-blocks.css +4 -0
  32. pygpt_net/data/css/web-blocks.light.css +1 -1
  33. pygpt_net/data/css/web-chatgpt.css +4 -0
  34. pygpt_net/data/css/web-chatgpt.light.css +1 -1
  35. pygpt_net/data/css/web-chatgpt_wide.css +4 -0
  36. pygpt_net/data/css/web-chatgpt_wide.light.css +1 -1
  37. pygpt_net/data/js/app.js +1804 -1688
  38. pygpt_net/data/locale/locale.de.ini +1 -1
  39. pygpt_net/data/locale/locale.en.ini +1 -1
  40. pygpt_net/data/locale/locale.es.ini +1 -1
  41. pygpt_net/data/locale/locale.fr.ini +1 -1
  42. pygpt_net/data/locale/locale.it.ini +1 -1
  43. pygpt_net/data/locale/locale.pl.ini +2 -2
  44. pygpt_net/data/locale/locale.uk.ini +1 -1
  45. pygpt_net/data/locale/locale.zh.ini +1 -1
  46. pygpt_net/item/model.py +4 -1
  47. pygpt_net/js_rc.py +14303 -14540
  48. pygpt_net/provider/api/anthropic/__init__.py +3 -1
  49. pygpt_net/provider/api/anthropic/tools.py +1 -1
  50. pygpt_net/provider/api/google/__init__.py +7 -1
  51. pygpt_net/provider/api/x_ai/__init__.py +5 -1
  52. pygpt_net/provider/core/config/patch.py +14 -1
  53. pygpt_net/provider/llms/anthropic.py +37 -5
  54. pygpt_net/provider/llms/azure_openai.py +3 -1
  55. pygpt_net/provider/llms/base.py +13 -1
  56. pygpt_net/provider/llms/deepseek_api.py +13 -3
  57. pygpt_net/provider/llms/google.py +14 -1
  58. pygpt_net/provider/llms/hugging_face_api.py +105 -24
  59. pygpt_net/provider/llms/hugging_face_embedding.py +88 -0
  60. pygpt_net/provider/llms/hugging_face_router.py +28 -16
  61. pygpt_net/provider/llms/local.py +2 -0
  62. pygpt_net/provider/llms/mistral.py +60 -3
  63. pygpt_net/provider/llms/open_router.py +4 -2
  64. pygpt_net/provider/llms/openai.py +4 -1
  65. pygpt_net/provider/llms/perplexity.py +66 -5
  66. pygpt_net/provider/llms/utils.py +39 -0
  67. pygpt_net/provider/llms/voyage.py +50 -0
  68. pygpt_net/provider/llms/x_ai.py +70 -10
  69. pygpt_net/ui/widget/lists/db.py +1 -0
  70. pygpt_net/ui/widget/lists/debug.py +1 -0
  71. pygpt_net/ui/widget/tabs/body.py +23 -4
  72. pygpt_net/ui/widget/textarea/notepad.py +0 -4
  73. {pygpt_net-2.6.45.dist-info → pygpt_net-2.6.47.dist-info}/METADATA +16 -4
  74. {pygpt_net-2.6.45.dist-info → pygpt_net-2.6.47.dist-info}/RECORD +77 -74
  75. {pygpt_net-2.6.45.dist-info → pygpt_net-2.6.47.dist-info}/LICENSE +0 -0
  76. {pygpt_net-2.6.45.dist-info → pygpt_net-2.6.47.dist-info}/WHEEL +0 -0
  77. {pygpt_net-2.6.45.dist-info → pygpt_net-2.6.47.dist-info}/entry_points.txt +0 -0
pygpt_net/CHANGELOG.txt CHANGED
@@ -1,3 +1,15 @@
1
+ 2.6.47 (2025-09-15)
2
+
3
+ - Improved: Parsing of custom markup tags.
4
+ - Optimized: Switching profiles.
5
+
6
+ 2.6.46 (2025-09-15)
7
+
8
+ - Added: Global proxy settings for all API SDKs.
9
+ - Fixed: xAI client configuration in Chat with Files.
10
+ - Fixed: Top margin in streaming container.
11
+ - Refactored: Debug workers.
12
+
1
13
  2.6.45 (2025-09-13)
2
14
 
3
15
  - Improved: Parsing of custom markup in the stream.
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: 2025.09.13 00:00:00 #
9
+ # Updated Date: 2025.09.15 00:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  __author__ = "Marcin Szczygliński"
13
13
  __copyright__ = "Copyright 2025, Marcin Szczygliński"
14
14
  __credits__ = ["Marcin Szczygliński"]
15
15
  __license__ = "MIT"
16
- __version__ = "2.6.45"
17
- __build__ = "2025-09-13"
16
+ __version__ = "2.6.47"
17
+ __build__ = "2025-09-15"
18
18
  __maintainer__ = "Marcin Szczygliński"
19
19
  __github__ = "https://github.com/szczyglis-dev/py-gpt"
20
20
  __report__ = "https://github.com/szczyglis-dev/py-gpt/issues"
@@ -154,8 +154,6 @@ class Controller:
154
154
 
155
155
  print(trans("status.reloading.profile.begin"))
156
156
 
157
- prev_theme = self.window.core.config.get("theme")
158
-
159
157
  self.window.core.reload() # db, config, patch, etc.
160
158
  self.ui.tabs.reload()
161
159
  self.ctx.reload()
@@ -183,7 +181,7 @@ class Controller:
183
181
  self.ctx.reload_after()
184
182
  self.ui.tabs.restore_data() # restore opened tabs data
185
183
  self.kernel.restart()
186
- self.theme.reload_all(prev_theme=prev_theme) # do not reload theme if no change
184
+ self.theme.reload_all() # do not reload theme if no change
187
185
 
188
186
  self.reloading = False # unlock
189
187
  self.presets.unlock()
@@ -449,6 +449,8 @@ class Audio:
449
449
  if is_enabled:
450
450
  # show/hide extra options
451
451
  tab = self.window.controller.ui.tabs.get_current_tab()
452
+ if not tab:
453
+ return
452
454
  if tab.type == Tab.TAB_NOTEPAD:
453
455
  self.window.controller.audio.ui.on_input_continuous_enable("input")
454
456
  else:
@@ -92,7 +92,8 @@ class Text:
92
92
 
93
93
  # create ctx item
94
94
  meta = core.ctx.get_current_meta()
95
- meta.preset = config.get("preset") # current preset
95
+ if meta:
96
+ meta.preset = config.get("preset") # current preset
96
97
 
97
98
  ctx = CtxItem()
98
99
  ctx.meta = meta # CtxMeta (owner object)
@@ -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: 2025.09.12 20:00:00 #
9
+ # Updated Date: 2025.09.14 20:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from datetime import datetime
@@ -84,18 +84,19 @@ class Debug(QObject):
84
84
  return
85
85
 
86
86
  print("[LOGGER] Changing log level to: " + level)
87
+ debug = self.window.core.debug
87
88
 
88
89
  if level == 'debug':
89
- self.window.core.debug.switch_log_level(DEBUG)
90
+ debug.switch_log_level(DEBUG)
90
91
  print("** DEBUG level enabled")
91
92
  elif level == 'info':
92
- self.window.core.debug.switch_log_level(INFO)
93
+ debug.switch_log_level(INFO)
93
94
  print("** INFO level enabled")
94
95
  elif level == 'warning':
95
- self.window.core.debug.switch_log_level(WARNING)
96
+ debug.switch_log_level(WARNING)
96
97
  print("** WARNING level enabled")
97
98
  else:
98
- self.window.core.debug.switch_log_level(ERROR)
99
+ debug.switch_log_level(ERROR)
99
100
  print("** ERROR level enabled")
100
101
 
101
102
  self.window.ui.dialogs.app_log.update_log_level()
@@ -106,11 +107,12 @@ class Debug(QObject):
106
107
 
107
108
  :param all: update all debug windows
108
109
  """
110
+ dialog = self.window.controller.dialogs.debug
109
111
  if self._ids is None:
110
- self._ids = self.window.controller.dialogs.debug.get_ids()
112
+ self._ids = dialog.get_ids()
111
113
  for id in self._ids:
112
- if self.window.controller.dialogs.debug.is_active(id):
113
- self.window.controller.dialogs.debug.update_worker(id)
114
+ if dialog.is_active(id):
115
+ dialog.update_worker(id)
114
116
 
115
117
  def post_setup(self):
116
118
  """Post setup debug"""
@@ -239,7 +241,7 @@ class Debug(QObject):
239
241
  self.window.core.tabs.toggle_debug(False)
240
242
  else:
241
243
  if id == "db":
242
- self.window.ui.dialogs.database.viewer.update_table_view() # update view on load
244
+ self.window.ui.dialogs.database.viewer.update_table_view(force=True) # update view on load
243
245
  elif id == "tabs":
244
246
  self.window.core.tabs.toggle_debug(True)
245
247
  self.window.controller.dialogs.debug.show(id)
@@ -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.14 00:00:00 #
9
+ # Updated Date: 2025.09.14 20:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from typing import Any
@@ -31,6 +31,7 @@ from pygpt_net.core.debug.ui import UIDebug
31
31
 
32
32
 
33
33
  class Debug:
34
+
34
35
  DBG_KEY, DBG_VALUE = range(2)
35
36
 
36
37
  def __init__(self, window=None):
@@ -42,21 +43,22 @@ class Debug:
42
43
  self.window = window
43
44
 
44
45
  # setup workers
45
- self.workers = {}
46
- self.workers['agent'] = AgentDebug(self.window)
47
- self.workers['assistants'] = AssistantsDebug(self.window)
48
- self.workers['attachments'] = AttachmentsDebug(self.window)
49
- self.workers['config'] = ConfigDebug(self.window)
50
- self.workers['context'] = ContextDebug(self.window)
51
- self.workers['db'] = DatabaseDebug(self.window)
52
- self.workers['events'] = EventsDebug(self.window)
53
- self.workers['indexes'] = IndexesDebug(self.window)
54
- self.workers['kernel'] = KernelDebug(self.window)
55
- self.workers['models'] = ModelsDebug(self.window)
56
- self.workers['plugins'] = PluginsDebug(self.window)
57
- self.workers['presets'] = PresetsDebug(self.window)
58
- self.workers['tabs'] = TabsDebug(self.window)
59
- self.workers['ui'] = UIDebug(self.window)
46
+ self.workers = {
47
+ 'agent': AgentDebug(self.window),
48
+ 'assistants': AssistantsDebug(self.window),
49
+ 'attachments': AttachmentsDebug(self.window),
50
+ 'config': ConfigDebug(self.window),
51
+ 'context': ContextDebug(self.window),
52
+ 'db': DatabaseDebug(self.window),
53
+ 'events': EventsDebug(self.window),
54
+ 'indexes': IndexesDebug(self.window),
55
+ 'kernel': KernelDebug(self.window),
56
+ 'models': ModelsDebug(self.window),
57
+ 'plugins': PluginsDebug(self.window),
58
+ 'presets': PresetsDebug(self.window),
59
+ 'tabs': TabsDebug(self.window),
60
+ 'ui': UIDebug(self.window)
61
+ }
60
62
 
61
63
  # prepare debug ids
62
64
  self.ids = self.workers.keys()
@@ -79,12 +81,16 @@ class Debug:
79
81
 
80
82
  :param id: debug id
81
83
  """
82
- self.window.ui.debug[id].setModel(self.models[id])
83
- self.models[id].dataChanged.connect(self.window.ui.debug[id].on_data_begin)
84
+ model = self.models.get(id, None)
85
+ dialog = self.window.ui.debug[id]
86
+ dialog.setModel(model)
87
+ model.dataChanged.connect(dialog.on_data_begin)
84
88
 
85
- if id not in self.counters or self.counters[id] != self.models[id].rowCount():
86
- self.models[id].removeRows(0, self.models[id].rowCount())
89
+ dialog.setUpdatesEnabled(False)
90
+ if id not in self.counters or self.counters[id] != model.rowCount():
91
+ model.removeRows(0, model.rowCount())
87
92
  self.initialized[id] = False
93
+ dialog.setUpdatesEnabled(True)
88
94
  self.idx[id] = 0
89
95
 
90
96
  def end(self, id: str):
@@ -105,18 +111,23 @@ class Debug:
105
111
  :param k: key
106
112
  :param v: value
107
113
  """
114
+ dialog = self.window.ui.debug[id]
115
+ dialog.setUpdatesEnabled(False)
116
+ model = self.models.get(id, None)
108
117
  if self.initialized[id] is False:
109
- idx = self.models[id].rowCount()
110
- self.models[id].insertRow(idx)
111
- self.models[id].setData(self.models[id].index(idx, self.DBG_KEY), k)
112
- self.models[id].setData(self.models[id].index(idx, self.DBG_VALUE), v)
118
+ idx = model.rowCount()
119
+ model.insertRow(idx)
120
+ model.setData(model.index(idx, self.DBG_KEY), k)
121
+ model.setData(model.index(idx, self.DBG_VALUE), v)
113
122
  else:
114
- for idx in range(0, self.models[id].rowCount()):
115
- if self.models[id].index(idx, self.DBG_KEY).data() == k:
116
- self.models[id].setData(self.models[id].index(idx, self.DBG_VALUE), v)
123
+ for idx in range(0, model.rowCount()):
124
+ if model.index(idx, self.DBG_KEY).data() == k:
125
+ model.setData(model.index(idx, self.DBG_VALUE), v)
117
126
  self.idx[id] += 1
127
+ dialog.setUpdatesEnabled(True)
118
128
  return
119
129
  self.idx[id] += 1
130
+ dialog.setUpdatesEnabled(True)
120
131
 
121
132
  def get_ids(self) -> list:
122
133
  """
@@ -163,7 +174,7 @@ class Debug:
163
174
  if id not in self.active:
164
175
  return
165
176
  self.active[id] = True
166
- self.window.ui.dialogs.open('debug.' + id, width=800, height=600)
177
+ self.window.ui.dialogs.open(f"debug.{id}", width=800, height=600)
167
178
 
168
179
  def hide(self, id: str):
169
180
  """
@@ -174,7 +185,7 @@ class Debug:
174
185
  if id not in self.active:
175
186
  return
176
187
  self.active[id] = False
177
- self.window.ui.dialogs.close('debug.' + id)
188
+ self.window.ui.dialogs.close(f"debug.{id}")
178
189
 
179
190
  def create_model(self, parent) -> QStandardItemModel:
180
191
  """
@@ -105,8 +105,6 @@ class Notepad:
105
105
  :param body: TabBody instance
106
106
  """
107
107
  tab = body.owner
108
- if not tab.owner:
109
- return
110
108
  if tab.type != Tab.TAB_NOTEPAD:
111
109
  return
112
110
  idx = tab.data_id
@@ -34,6 +34,7 @@ class Theme:
34
34
  self.markdown = Markdown(window)
35
35
  self.menu = Menu(window)
36
36
  self.nodes = Nodes(window)
37
+ self.current_theme = None
37
38
 
38
39
  def setup(self):
39
40
  """Setup theme"""
@@ -192,7 +193,8 @@ class Theme:
192
193
 
193
194
  :param force: force theme change (manual trigger)
194
195
  """
195
- self.toggle(self.window.core.config.get('theme'), force=force)
196
+ self.current_theme = self.window.core.config.get('theme')
197
+ self.toggle(self.current_theme, force=force)
196
198
 
197
199
  def update_syntax(self):
198
200
  """Update syntax menu"""
@@ -280,13 +282,11 @@ class Theme:
280
282
  """
281
283
  return self.common.get_style(element)
282
284
 
283
- def reload_all(self, prev_theme: Optional[str] = None):
285
+ def reload_all(self):
284
286
  """
285
287
  Reload all
286
-
287
- :param prev_theme: previous theme name
288
288
  """
289
- if not prev_theme or prev_theme != self.window.core.config.get('theme'):
289
+ if self.current_theme != self.window.core.config.get('theme'):
290
290
  self.setup()
291
291
  self.update_style()
292
292
  self.update_syntax()
@@ -8,10 +8,11 @@
8
8
  # Created By : Marcin Szczygliński #
9
9
  # Updated Date: 2025.08.24 23:00:00 #
10
10
  # ================================================== #
11
-
11
+ import gc
12
12
  from typing import Any, Optional, Tuple
13
13
 
14
- from PySide6.QtCore import QTimer
14
+ from PySide6.QtCore import QTimer, QUrl
15
+ from PySide6.QtWebEngineCore import QWebEnginePage
15
16
 
16
17
  from pygpt_net.core.events import AppEvent, RenderEvent
17
18
  from pygpt_net.core.tabs.tab import Tab
@@ -133,10 +134,47 @@ class Tabs:
133
134
 
134
135
  def reload(self):
135
136
  """Reload tabs"""
137
+ self.unload_current()
136
138
  self.window.core.tabs.reload()
137
139
  self.window.dispatch(RenderEvent(RenderEvent.PREPARE))
138
140
  self.debug()
139
141
 
142
+ def unload_current(self):
143
+ """Unload current tabs from memory"""
144
+ tabs = self.window.core.tabs.pids
145
+ for pid in tabs:
146
+ tab = self.window.core.tabs.get_tab_by_pid(pid)
147
+ if tab is not None:
148
+ try:
149
+ if tab.type == Tab.TAB_CHAT:
150
+ node = self.window.ui.nodes['output'].get(tab.pid)
151
+ if node:
152
+ node.hide()
153
+ p = node.page()
154
+ p.triggerAction(QWebEnginePage.Stop)
155
+ p.setUrl(QUrl("about:blank"))
156
+ p.history().clear()
157
+ p.setLifecycleState(QWebEnginePage.LifecycleState.Discarded)
158
+ tab.delete_ref(node)
159
+ layout = tab.child.layout()
160
+ layout.removeWidget(node)
161
+ self.window.ui.nodes['output'].pop(pid, None)
162
+ node.on_delete()
163
+ node_plain = self.window.ui.nodes['output_plain'].get(tab.pid)
164
+ if node_plain:
165
+ tab.delete_ref(node_plain)
166
+ layout = tab.child.layout()
167
+ layout.removeWidget(node_plain)
168
+ self.window.ui.nodes['output_plain'].pop(pid, None)
169
+ node_plain.on_delete()
170
+ tab.cleanup()
171
+ except Exception as e:
172
+ print(f"Error unloading tab {pid}: {e}")
173
+ try:
174
+ gc.collect()
175
+ except Exception:
176
+ pass
177
+
140
178
  def reload_after(self):
141
179
  """Reload tabs after"""
142
180
  w = self.window
@@ -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: 2025.09.14 20:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  class AgentDebug:
@@ -21,17 +21,22 @@ class AgentDebug:
21
21
 
22
22
  def update(self):
23
23
  """Update debug window"""
24
- self.window.core.debug.begin(self.id)
25
- self.window.core.debug.add(self.id, '[Llama-index]', '')
26
- self.window.core.debug.add(self.id, 'agents', str(self.window.core.agents.provider.get_ids()))
27
- self.window.core.debug.add(self.id, 'eval_step', str(self.window.controller.agent.llama.eval_step))
28
- self.window.core.debug.add(self.id, '[LEGACY]', '')
29
- self.window.core.debug.add(self.id, 'iteration', str(self.window.controller.agent.legacy.iteration))
30
- self.window.core.debug.add(self.id, 'limit', str(self.window.core.config.get("agent.iterations")))
31
- self.window.core.debug.add(self.id, 'prev_output', str(self.window.controller.agent.legacy.prev_output))
32
- self.window.core.debug.add(self.id, 'is_user', str(self.window.controller.agent.legacy.is_user))
33
- self.window.core.debug.add(self.id, 'stop', str(self.window.controller.agent.legacy.stop))
34
- self.window.core.debug.add(self.id, 'finished', str(self.window.controller.agent.legacy.finished))
35
- self.window.core.debug.add(self.id, 'allowed_cmds', str(self.window.controller.agent.legacy.allowed_cmds))
24
+ debug = self.window.core.debug
25
+ agents_provider = self.window.core.agents.provider
26
+ agent_controller = self.window.controller.agent
27
+ agent_legacy = agent_controller.legacy
28
+ agent_config = self.window.core.config
36
29
 
37
- self.window.core.debug.end(self.id)
30
+ debug.begin(self.id)
31
+ debug.add(self.id, '[Llama-index]', '')
32
+ debug.add(self.id, 'agents', str(agents_provider.get_ids()))
33
+ debug.add(self.id, 'eval_step', str(agent_controller.llama.eval_step))
34
+ debug.add(self.id, '[LEGACY]', '')
35
+ debug.add(self.id, 'iteration', str(agent_legacy.iteration))
36
+ debug.add(self.id, 'limit', str(agent_config.get("agent.iterations")))
37
+ debug.add(self.id, 'prev_output', str(agent_legacy.prev_output))
38
+ debug.add(self.id, 'is_user', str(agent_legacy.is_user))
39
+ debug.add(self.id, 'stop', str(agent_legacy.stop))
40
+ debug.add(self.id, 'finished', str(agent_legacy.finished))
41
+ debug.add(self.id, 'allowed_cmds', str(agent_legacy.allowed_cmds))
42
+ debug.end(self.id)
@@ -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.05.05 12:00:00 #
9
+ # Updated Date: 2025.09.14 20:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  class AssistantsDebug:
@@ -21,24 +21,24 @@ class AssistantsDebug:
21
21
 
22
22
  def update(self):
23
23
  """Update debug window."""
24
- self.window.core.debug.begin(self.id)
25
-
26
- self.window.core.debug.add(self.id, '(thread) started', str(self.window.controller.assistant.threads.started))
27
- self.window.core.debug.add(self.id, '(thread) stop', str(self.window.controller.assistant.threads.stop))
28
- self.window.core.debug.add(self.id, '(thread) run_id', str(self.window.controller.assistant.threads.run_id))
29
- self.window.core.debug.add(self.id, '(thread) tool_calls', str(self.window.controller.assistant.threads.tool_calls))
30
-
31
- self.window.core.debug.add(
32
- self.id, 'Options',
33
- str(self.window.controller.assistant.editor.get_options())
34
- )
35
-
36
- self.window.core.debug.add(self.id, '----', '')
24
+ debug = self.window.core.debug
25
+ assistant_threads = self.window.controller.assistant.threads
26
+ assistant_editor = self.window.controller.assistant.editor
27
+ assistants_core = self.window.core.assistants
28
+ assistants_store = assistants_core.store
29
+
30
+ debug.begin(self.id)
31
+ debug.add(self.id, '(thread) started', str(assistant_threads.started))
32
+ debug.add(self.id, '(thread) stop', str(assistant_threads.stop))
33
+ debug.add(self.id, '(thread) run_id', str(assistant_threads.run_id))
34
+ debug.add(self.id, '(thread) tool_calls', str(assistant_threads.tool_calls))
35
+ debug.add(self.id, 'Options', str(assistant_editor.get_options()))
36
+ debug.add(self.id, '----', '')
37
37
 
38
38
  # assistants
39
- assistants = self.window.core.assistants.get_all()
39
+ assistants = assistants_core.get_all()
40
40
  for key in list(assistants):
41
- prefix = "[{}] ".format(key)
41
+ prefix = f"[{key}] "
42
42
  assistant = assistants[key]
43
43
  data = {
44
44
  'id': assistant.id,
@@ -51,15 +51,13 @@ class AssistantsDebug:
51
51
  'files': assistant.files,
52
52
  'tools[function]': assistant.tools['function']
53
53
  }
54
- self.window.core.debug.add(self.id, str(assistant.name), str(data))
54
+ debug.add(self.id, str(assistant.name), str(data))
55
55
 
56
- self.window.core.debug.add(self.id, '----', '')
56
+ debug.add(self.id, '----', '')
57
57
 
58
58
  store_items = {}
59
- for id in self.window.core.assistants.store.items:
60
- store_items[id] = self.window.core.assistants.store.items[id].to_dict()
61
-
62
- self.window.core.debug.add(self.id, 'Store (items)', str(store_items))
63
- #self.window.core.debug.add(self.id, 'Store (items)', str(self.window.core.assistants.store.items))
59
+ for id in assistants_store.items:
60
+ store_items[id] = assistants_store.items[id].to_dict()
64
61
 
65
- self.window.core.debug.end(self.id)
62
+ debug.add(self.id, 'Store (items)', str(store_items))
63
+ debug.end(self.id)
@@ -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: 2025.09.14 20:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  class AttachmentsDebug:
@@ -21,11 +21,15 @@ class AttachmentsDebug:
21
21
 
22
22
  def update(self):
23
23
  """Update debug window."""
24
- self.window.core.debug.begin(self.id)
24
+ debug = self.window.core.debug
25
+ modes = self.window.core.modes
26
+ attachments_core = self.window.core.attachments
25
27
 
26
- for mode in self.window.core.modes.all:
27
- self.window.core.debug.add(self.id, '[' + mode + ']', '')
28
- attachments = self.window.core.attachments.get_all(mode)
28
+ debug.begin(self.id)
29
+
30
+ for mode in modes.all:
31
+ debug.add(self.id, f'[{mode}]', '')
32
+ attachments = attachments_core.get_all(mode)
29
33
  for key in list(attachments):
30
34
  attachment = attachments[key]
31
35
  data = {
@@ -40,6 +44,6 @@ class AttachmentsDebug:
40
44
  'consumed': attachment.consumed,
41
45
  'extra': attachment.extra,
42
46
  }
43
- self.window.core.debug.add(self.id, attachment.name, str(data))
47
+ debug.add(self.id, attachment.name, str(data))
44
48
 
45
- self.window.core.debug.end(self.id)
49
+ debug.end(self.id)
@@ -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.04.09 23:00:00 #
9
+ # Updated Date: 2025.09.14 20:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import os
@@ -26,29 +26,28 @@ class ConfigDebug:
26
26
 
27
27
  def update(self):
28
28
  """Update debug window."""
29
- self.window.core.debug.begin(self.id)
30
-
29
+ debug = self.window.core.debug
30
+ config = self.window.core.config
31
+ profile = config.profile
32
+ settings_editor = self.window.controller.settings.editor
31
33
  app_fonts = QFontDatabase.families()
32
- path = os.path.join(self.window.core.config.path, '', 'config.json')
33
- self.window.core.debug.add(self.id, 'Config File', str(path))
34
- self.window.core.debug.add(self.id, 'Current workdir', str(self.window.core.config.get_user_path()))
35
- self.window.core.debug.add(self.id, 'Base workdir', str(self.window.core.config.get_base_workdir()))
36
- self.window.core.debug.add(self.id, 'Workdir config', str(os.path.join(self.window.core.config.get_base_workdir(), "path.cfg")))
37
- self.window.core.debug.add(self.id, 'App dir', str(self.window.core.config.get_app_path()))
38
- self.window.core.debug.add(self.id, 'Profile [current]', str(self.window.core.config.profile.get_current()))
39
- self.window.core.debug.add(self.id, 'Profile [all]', str(self.window.core.config.profile.get_all()))
40
- self.window.core.debug.add(self.id, 'Registered fonts', str(app_fonts))
41
- self.window.core.debug.add(
42
- self.id, 'Sections',
43
- str(self.window.controller.settings.editor.get_sections())
44
- )
45
- self.window.core.debug.add(
46
- self.id, 'Options',
47
- str(self.window.controller.settings.editor.get_options())
48
- )
34
+
35
+ debug.begin(self.id)
36
+
37
+ path = os.path.join(config.path, '', 'config.json')
38
+ debug.add(self.id, 'Config File', str(path))
39
+ debug.add(self.id, 'Current workdir', str(config.get_user_path()))
40
+ debug.add(self.id, 'Base workdir', str(config.get_base_workdir()))
41
+ debug.add(self.id, 'Workdir config', str(os.path.join(config.get_base_workdir(), "path.cfg")))
42
+ debug.add(self.id, 'App dir', str(config.get_app_path()))
43
+ debug.add(self.id, 'Profile [current]', str(profile.get_current()))
44
+ debug.add(self.id, 'Profile [all]', str(profile.get_all()))
45
+ debug.add(self.id, 'Registered fonts', str(app_fonts))
46
+ debug.add(self.id, 'Sections', str(settings_editor.get_sections()))
47
+ debug.add(self.id, 'Options', str(settings_editor.get_options()))
49
48
 
50
49
  # config data
51
- for key in self.window.core.config.all():
52
- self.window.core.debug.add(self.id, key, str(self.window.core.config.get(key)))
50
+ for key in config.all():
51
+ debug.add(self.id, key, str(config.get(key)))
53
52
 
54
- self.window.core.debug.end(self.id)
53
+ debug.end(self.id)