pygpt-net 2.6.45__py3-none-any.whl → 2.6.46__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 (71) hide show
  1. pygpt_net/CHANGELOG.txt +7 -0
  2. pygpt_net/__init__.py +3 -3
  3. pygpt_net/app.py +0 -5
  4. pygpt_net/controller/debug/debug.py +11 -9
  5. pygpt_net/controller/dialogs/debug.py +40 -29
  6. pygpt_net/core/debug/agent.py +19 -14
  7. pygpt_net/core/debug/assistants.py +22 -24
  8. pygpt_net/core/debug/attachments.py +11 -7
  9. pygpt_net/core/debug/config.py +22 -23
  10. pygpt_net/core/debug/context.py +63 -63
  11. pygpt_net/core/debug/db.py +1 -4
  12. pygpt_net/core/debug/events.py +14 -11
  13. pygpt_net/core/debug/indexes.py +41 -76
  14. pygpt_net/core/debug/kernel.py +11 -8
  15. pygpt_net/core/debug/models.py +20 -15
  16. pygpt_net/core/debug/plugins.py +9 -6
  17. pygpt_net/core/debug/presets.py +16 -11
  18. pygpt_net/core/debug/tabs.py +28 -22
  19. pygpt_net/core/debug/ui.py +25 -22
  20. pygpt_net/core/render/web/renderer.py +3 -2
  21. pygpt_net/core/tabs/tab.py +14 -1
  22. pygpt_net/data/config/config.json +3 -3
  23. pygpt_net/data/config/models.json +3 -3
  24. pygpt_net/data/config/settings.json +15 -17
  25. pygpt_net/data/css/style.dark.css +6 -0
  26. pygpt_net/data/css/web-blocks.css +4 -0
  27. pygpt_net/data/css/web-blocks.light.css +1 -1
  28. pygpt_net/data/css/web-chatgpt.css +4 -0
  29. pygpt_net/data/css/web-chatgpt.light.css +1 -1
  30. pygpt_net/data/css/web-chatgpt_wide.css +4 -0
  31. pygpt_net/data/css/web-chatgpt_wide.light.css +1 -1
  32. pygpt_net/data/js/app.js +720 -636
  33. pygpt_net/data/locale/locale.de.ini +1 -1
  34. pygpt_net/data/locale/locale.en.ini +1 -1
  35. pygpt_net/data/locale/locale.es.ini +1 -1
  36. pygpt_net/data/locale/locale.fr.ini +1 -1
  37. pygpt_net/data/locale/locale.it.ini +1 -1
  38. pygpt_net/data/locale/locale.pl.ini +2 -2
  39. pygpt_net/data/locale/locale.uk.ini +1 -1
  40. pygpt_net/data/locale/locale.zh.ini +1 -1
  41. pygpt_net/item/model.py +4 -1
  42. pygpt_net/js_rc.py +12824 -12612
  43. pygpt_net/provider/api/anthropic/__init__.py +3 -1
  44. pygpt_net/provider/api/anthropic/tools.py +1 -1
  45. pygpt_net/provider/api/google/__init__.py +7 -1
  46. pygpt_net/provider/api/x_ai/__init__.py +5 -1
  47. pygpt_net/provider/core/config/patch.py +14 -1
  48. pygpt_net/provider/llms/anthropic.py +37 -5
  49. pygpt_net/provider/llms/azure_openai.py +3 -1
  50. pygpt_net/provider/llms/base.py +13 -1
  51. pygpt_net/provider/llms/deepseek_api.py +13 -3
  52. pygpt_net/provider/llms/google.py +14 -1
  53. pygpt_net/provider/llms/hugging_face_api.py +105 -24
  54. pygpt_net/provider/llms/hugging_face_embedding.py +88 -0
  55. pygpt_net/provider/llms/hugging_face_router.py +28 -16
  56. pygpt_net/provider/llms/local.py +2 -0
  57. pygpt_net/provider/llms/mistral.py +60 -3
  58. pygpt_net/provider/llms/open_router.py +4 -2
  59. pygpt_net/provider/llms/openai.py +4 -1
  60. pygpt_net/provider/llms/perplexity.py +66 -5
  61. pygpt_net/provider/llms/utils.py +39 -0
  62. pygpt_net/provider/llms/voyage.py +50 -0
  63. pygpt_net/provider/llms/x_ai.py +70 -10
  64. pygpt_net/ui/widget/lists/db.py +1 -0
  65. pygpt_net/ui/widget/lists/debug.py +1 -0
  66. pygpt_net/ui/widget/tabs/body.py +12 -1
  67. {pygpt_net-2.6.45.dist-info → pygpt_net-2.6.46.dist-info}/METADATA +11 -4
  68. {pygpt_net-2.6.45.dist-info → pygpt_net-2.6.46.dist-info}/RECORD +71 -68
  69. {pygpt_net-2.6.45.dist-info → pygpt_net-2.6.46.dist-info}/LICENSE +0 -0
  70. {pygpt_net-2.6.45.dist-info → pygpt_net-2.6.46.dist-info}/WHEEL +0 -0
  71. {pygpt_net-2.6.45.dist-info → pygpt_net-2.6.46.dist-info}/entry_points.txt +0 -0
pygpt_net/CHANGELOG.txt CHANGED
@@ -1,3 +1,10 @@
1
+ 2.6.46 (2025-09-15)
2
+
3
+ - Added: Global proxy settings for all API SDKs.
4
+ - Fixed: xAI client configuration in Chat with Files.
5
+ - Fixed: Top margin in streaming container.
6
+ - Refactored: Debug workers.
7
+
1
8
  2.6.45 (2025-09-13)
2
9
 
3
10
  - 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.46"
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"
pygpt_net/app.py CHANGED
@@ -35,11 +35,6 @@ os.environ["QTWEBENGINE_CHROMIUM_FLAGS"] = (
35
35
  "--js-flags=--expose-gc"
36
36
  )
37
37
  """
38
- # by default, optimize for low-end devices
39
- os.environ.setdefault(
40
- "QTWEBENGINE_CHROMIUM_FLAGS",
41
- "--enable-low-end-device-mode"
42
- )
43
38
 
44
39
  _original_open = builtins.open
45
40
 
@@ -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
  """
@@ -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)
@@ -6,8 +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: 2025.07.19 17:00:00 #
9
+ # Updated Date: 2025.09.14 20:00:00 #
10
10
  # ================================================== #
11
+
11
12
  import json
12
13
 
13
14
 
@@ -23,68 +24,67 @@ class ContextDebug:
23
24
 
24
25
  def update(self):
25
26
  """Update debug window"""
26
- self.window.core.debug.begin(self.id)
27
- if self.window.core.bridge.last_context is not None:
28
- self.window.core.debug.add(self.id, 'bridge (last call)', str(self.window.core.bridge.last_context.to_dict()))
29
- else:
30
- self.window.core.debug.add(self.id, 'bridge (last call)', '---')
31
- if self.window.core.bridge.last_context_quick is not None:
32
- self.window.core.debug.add(self.id, 'bridge (last quick call)', str(self.window.core.bridge.last_context_quick.to_dict()))
33
- else:
34
- self.window.core.debug.add(self.id, 'bridge (last quick call)', '---')
35
- if self.window.controller.kernel.stack.current is not None:
36
- self.window.core.debug.add(self.id, 'reply (queue)', str(self.window.controller.kernel.stack.current.to_dict()))
37
- else:
38
- self.window.core.debug.add(self.id, 'reply (queue)', '---')
39
- self.window.core.debug.add(self.id, 'reply (locked)', str(self.window.controller.kernel.stack.locked))
40
- self.window.core.debug.add(self.id, 'reply (processed)', str(self.window.controller.kernel.stack.processed))
41
- self.window.core.debug.add(self.id, 'current (id)', str(self.window.core.ctx.get_current()))
42
- self.window.core.debug.add(self.id, 'len(meta)', len(self.window.core.ctx.meta))
43
- self.window.core.debug.add(self.id, 'len(items)', len(self.window.core.ctx.get_items()))
44
- self.window.core.debug.add(self.id, 'SYS PROMPT (current)', str(self.window.core.ctx.current_sys_prompt))
45
- self.window.core.debug.add(self.id, 'CMD (current)', str(self.window.core.ctx.current_cmd))
46
- self.window.core.debug.add(self.id, 'CMD schema (current)', str(self.window.core.ctx.current_cmd_schema))
47
- self.window.core.debug.add(self.id, 'FUNCTIONS (current)', str(self.get_functions()))
48
- self.window.core.debug.add(self.id, 'Attachments: last used content',
49
- str(self.window.core.attachments.context.last_used_content))
50
- self.window.core.debug.add(self.id, 'Attachments: last used context',
51
- str(self.window.core.attachments.context.last_used_context))
52
-
53
- current = None
54
- if self.window.core.ctx.get_current() is not None:
55
- if self.window.core.ctx.get_current() in self.window.core.ctx.meta:
56
- current = self.window.core.ctx.meta[self.window.core.ctx.get_current()]
57
- if current is not None:
58
- data = current.to_dict()
59
- self.window.core.debug.add(self.id, '*** (current)', str(data))
60
-
61
- if self.window.core.ctx.get_tmp_meta() is not None:
62
- self.window.core.debug.add(self.id, 'tmp meta', str(self.window.core.ctx.get_tmp_meta().to_dict()))
63
-
64
- self.window.core.debug.add(self.id, 'selected[]', str(self.window.controller.ctx.selected))
65
- self.window.core.debug.add(self.id, 'group_id (active)', str(self.window.controller.ctx.group_id))
66
- self.window.core.debug.add(self.id, 'assistant', str(self.window.core.ctx.get_assistant()))
67
- self.window.core.debug.add(self.id, 'mode', str(self.window.core.ctx.get_mode()))
68
- self.window.core.debug.add(self.id, 'model', str(self.window.core.ctx.get_model()))
69
- self.window.core.debug.add(self.id, 'preset', str(self.window.core.ctx.get_preset()))
70
- self.window.core.debug.add(self.id, 'run', str(self.window.core.ctx.get_run()))
71
- self.window.core.debug.add(self.id, 'status', str(self.window.core.ctx.get_status()))
72
- self.window.core.debug.add(self.id, 'thread', str(self.window.core.ctx.get_thread()))
73
- self.window.core.debug.add(self.id, 'last_mode', str(self.window.core.ctx.get_last_mode()))
74
- self.window.core.debug.add(self.id, 'last_model', str(self.window.core.ctx.get_last_model()))
75
- self.window.core.debug.add(self.id, 'search_string', str(self.window.core.ctx.get_search_string()))
76
- self.window.core.debug.add(self.id, 'filters', str(self.window.core.ctx.filters))
77
- self.window.core.debug.add(self.id, 'filters_labels', str(self.window.core.ctx.filters_labels))
78
- self.window.core.debug.add(self.id, 'allowed_modes', str(self.window.core.ctx.allowed_modes))
79
-
80
- i = 0
81
- self.window.core.debug.add(self.id, 'items[]', '')
82
- for item in self.window.core.ctx.get_items():
83
- data = item.to_dict()
84
- self.window.core.debug.add(self.id, str(item.id), str(data))
85
- i += 1
86
-
87
- self.window.core.debug.end(self.id)
27
+ debug = self.window.core.debug
28
+ bridge = self.window.core.bridge
29
+ controller = self.window.controller
30
+ ctx_core = self.window.core.ctx
31
+ attachments = self.window.core.attachments.context
32
+ kernel_stack = controller.kernel.stack
33
+
34
+ debug.begin(self.id)
35
+
36
+ last_context = bridge.last_context
37
+ last_context_quick = bridge.last_context_quick
38
+ current_stack = kernel_stack.current
39
+
40
+ debug.add(self.id, 'bridge (last call)', str(last_context.to_dict()) if last_context is not None else '---')
41
+ debug.add(self.id, 'bridge (last quick call)',
42
+ str(last_context_quick.to_dict()) if last_context_quick is not None else '---')
43
+ debug.add(self.id, 'reply (queue)', str(current_stack.to_dict()) if current_stack is not None else '---')
44
+
45
+ debug.add(self.id, 'reply (locked)', str(kernel_stack.locked))
46
+ debug.add(self.id, 'reply (processed)', str(kernel_stack.processed))
47
+ debug.add(self.id, 'current (id)', str(ctx_core.get_current()))
48
+ debug.add(self.id, 'len(meta)', len(ctx_core.meta))
49
+ debug.add(self.id, 'len(items)', len(ctx_core.get_items()))
50
+ debug.add(self.id, 'SYS PROMPT (current)', str(ctx_core.current_sys_prompt))
51
+ debug.add(self.id, 'CMD (current)', str(ctx_core.current_cmd))
52
+ debug.add(self.id, 'CMD schema (current)', str(ctx_core.current_cmd_schema))
53
+ debug.add(self.id, 'FUNCTIONS (current)', str(self.get_functions()))
54
+ debug.add(self.id, 'Attachments: last used content', str(attachments.last_used_content))
55
+ debug.add(self.id, 'Attachments: last used context', str(attachments.last_used_context))
56
+
57
+ current_id = ctx_core.get_current()
58
+ current = ctx_core.meta.get(current_id)
59
+
60
+ if current is not None:
61
+ debug.add(self.id, '*** (current)', str(current.to_dict()))
62
+
63
+ tmp_meta = ctx_core.get_tmp_meta()
64
+ if tmp_meta is not None:
65
+ debug.add(self.id, 'tmp meta', str(tmp_meta.to_dict()))
66
+
67
+ debug.add(self.id, 'selected[]', str(controller.ctx.selected))
68
+ debug.add(self.id, 'group_id (active)', str(controller.ctx.group_id))
69
+ debug.add(self.id, 'assistant', str(ctx_core.get_assistant()))
70
+ debug.add(self.id, 'mode', str(ctx_core.get_mode()))
71
+ debug.add(self.id, 'model', str(ctx_core.get_model()))
72
+ debug.add(self.id, 'preset', str(ctx_core.get_preset()))
73
+ debug.add(self.id, 'run', str(ctx_core.get_run()))
74
+ debug.add(self.id, 'status', str(ctx_core.get_status()))
75
+ debug.add(self.id, 'thread', str(ctx_core.get_thread()))
76
+ debug.add(self.id, 'last_mode', str(ctx_core.get_last_mode()))
77
+ debug.add(self.id, 'last_model', str(ctx_core.get_last_model()))
78
+ debug.add(self.id, 'search_string', str(ctx_core.get_search_string()))
79
+ debug.add(self.id, 'filters', str(ctx_core.filters))
80
+ debug.add(self.id, 'filters_labels', str(ctx_core.filters_labels))
81
+ debug.add(self.id, 'allowed_modes', str(ctx_core.allowed_modes))
82
+
83
+ debug.add(self.id, 'items[]', '')
84
+ for i, item in enumerate(ctx_core.get_items()):
85
+ debug.add(self.id, str(item.id), str(item.to_dict()))
86
+
87
+ debug.end(self.id)
88
88
 
89
89
  def get_functions(self) -> list:
90
90
  """
@@ -6,12 +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.03.06 02:00:00 #
9
+ # Updated Date: 2025.09.14 20:00:00 #
10
10
  # ================================================== #
11
11
 
12
- import datetime
13
- import os
14
-
15
12
 
16
13
  class DatabaseDebug:
17
14
  def __init__(self, window=None):