pygpt-net 2.6.20__py3-none-any.whl → 2.6.22__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 (221) hide show
  1. pygpt_net/CHANGELOG.txt +13 -0
  2. pygpt_net/__init__.py +3 -3
  3. pygpt_net/app.py +3 -1
  4. pygpt_net/controller/__init__.py +4 -8
  5. pygpt_net/controller/access/voice.py +2 -2
  6. pygpt_net/controller/agent/agent.py +130 -2
  7. pygpt_net/controller/agent/experts.py +93 -96
  8. pygpt_net/controller/agent/llama.py +2 -1
  9. pygpt_net/controller/assistant/assistant.py +18 -1
  10. pygpt_net/controller/assistant/batch.py +2 -3
  11. pygpt_net/controller/assistant/editor.py +2 -2
  12. pygpt_net/controller/assistant/files.py +2 -3
  13. pygpt_net/controller/assistant/store.py +2 -2
  14. pygpt_net/controller/attachment/attachment.py +17 -1
  15. pygpt_net/controller/audio/audio.py +2 -2
  16. pygpt_net/controller/camera/camera.py +15 -7
  17. pygpt_net/controller/chat/chat.py +2 -2
  18. pygpt_net/controller/chat/common.py +50 -33
  19. pygpt_net/controller/chat/image.py +67 -77
  20. pygpt_net/controller/chat/input.py +94 -166
  21. pygpt_net/controller/chat/output.py +83 -140
  22. pygpt_net/controller/chat/response.py +83 -102
  23. pygpt_net/controller/chat/text.py +116 -149
  24. pygpt_net/controller/ctx/common.py +2 -1
  25. pygpt_net/controller/ctx/ctx.py +87 -6
  26. pygpt_net/controller/files/files.py +13 -1
  27. pygpt_net/controller/idx/idx.py +26 -2
  28. pygpt_net/controller/idx/indexer.py +85 -76
  29. pygpt_net/controller/kernel/reply.py +53 -66
  30. pygpt_net/controller/kernel/stack.py +16 -16
  31. pygpt_net/controller/lang/lang.py +52 -34
  32. pygpt_net/controller/model/importer.py +3 -2
  33. pygpt_net/controller/model/model.py +62 -3
  34. pygpt_net/controller/notepad/notepad.py +86 -84
  35. pygpt_net/controller/plugins/settings.py +3 -4
  36. pygpt_net/controller/settings/editor.py +4 -4
  37. pygpt_net/controller/settings/profile.py +105 -124
  38. pygpt_net/controller/theme/menu.py +154 -57
  39. pygpt_net/controller/theme/nodes.py +51 -44
  40. pygpt_net/controller/theme/theme.py +33 -9
  41. pygpt_net/controller/tools/tools.py +2 -2
  42. pygpt_net/controller/ui/tabs.py +2 -3
  43. pygpt_net/controller/ui/ui.py +16 -2
  44. pygpt_net/core/agents/observer/evaluation.py +3 -3
  45. pygpt_net/core/agents/provider.py +25 -3
  46. pygpt_net/core/agents/runner.py +4 -1
  47. pygpt_net/core/agents/runners/llama_workflow.py +19 -7
  48. pygpt_net/core/agents/runners/loop.py +3 -1
  49. pygpt_net/core/agents/runners/openai_workflow.py +17 -3
  50. pygpt_net/core/agents/tools.py +4 -1
  51. pygpt_net/core/bridge/context.py +34 -37
  52. pygpt_net/core/ctx/container.py +13 -12
  53. pygpt_net/core/ctx/ctx.py +1 -1
  54. pygpt_net/core/ctx/output.py +7 -4
  55. pygpt_net/core/db/database.py +2 -2
  56. pygpt_net/core/debug/console/console.py +2 -2
  57. pygpt_net/core/debug/debug.py +12 -1
  58. pygpt_net/core/dispatcher/dispatcher.py +24 -1
  59. pygpt_net/core/events/app.py +7 -7
  60. pygpt_net/core/events/control.py +26 -26
  61. pygpt_net/core/events/event.py +6 -3
  62. pygpt_net/core/events/kernel.py +2 -2
  63. pygpt_net/core/events/render.py +13 -13
  64. pygpt_net/core/experts/experts.py +76 -82
  65. pygpt_net/core/experts/worker.py +12 -12
  66. pygpt_net/core/filesystem/actions.py +1 -2
  67. pygpt_net/core/models/models.py +5 -1
  68. pygpt_net/core/models/ollama.py +14 -5
  69. pygpt_net/core/render/plain/helpers.py +2 -5
  70. pygpt_net/core/render/plain/renderer.py +26 -30
  71. pygpt_net/core/render/web/body.py +1 -1
  72. pygpt_net/core/render/web/helpers.py +2 -2
  73. pygpt_net/core/render/web/renderer.py +4 -4
  74. pygpt_net/core/settings/settings.py +43 -13
  75. pygpt_net/core/tabs/tabs.py +20 -13
  76. pygpt_net/core/types/__init__.py +2 -1
  77. pygpt_net/core/types/agent.py +4 -4
  78. pygpt_net/core/types/base.py +19 -0
  79. pygpt_net/core/types/console.py +6 -6
  80. pygpt_net/core/types/mode.py +8 -8
  81. pygpt_net/core/types/multimodal.py +3 -3
  82. pygpt_net/core/types/openai.py +2 -1
  83. pygpt_net/data/config/config.json +5 -5
  84. pygpt_net/data/config/models.json +19 -3
  85. pygpt_net/data/config/settings.json +14 -14
  86. pygpt_net/data/locale/locale.de.ini +4 -1
  87. pygpt_net/data/locale/locale.en.ini +6 -3
  88. pygpt_net/data/locale/locale.es.ini +4 -1
  89. pygpt_net/data/locale/locale.fr.ini +4 -1
  90. pygpt_net/data/locale/locale.it.ini +4 -1
  91. pygpt_net/data/locale/locale.pl.ini +5 -4
  92. pygpt_net/data/locale/locale.uk.ini +4 -1
  93. pygpt_net/data/locale/locale.zh.ini +4 -1
  94. pygpt_net/item/ctx.py +256 -240
  95. pygpt_net/item/model.py +59 -116
  96. pygpt_net/item/preset.py +122 -105
  97. pygpt_net/plugin/twitter/plugin.py +2 -2
  98. pygpt_net/provider/agents/llama_index/workflow/planner.py +3 -3
  99. pygpt_net/provider/agents/openai/agent.py +4 -12
  100. pygpt_net/provider/agents/openai/agent_b2b.py +10 -15
  101. pygpt_net/provider/agents/openai/agent_planner.py +4 -4
  102. pygpt_net/provider/agents/openai/agent_with_experts.py +3 -7
  103. pygpt_net/provider/agents/openai/agent_with_experts_feedback.py +4 -8
  104. pygpt_net/provider/agents/openai/agent_with_feedback.py +4 -8
  105. pygpt_net/provider/agents/openai/bot_researcher.py +2 -18
  106. pygpt_net/provider/agents/openai/bots/__init__.py +0 -0
  107. pygpt_net/provider/agents/openai/bots/research_bot/__init__.py +0 -0
  108. pygpt_net/provider/agents/openai/bots/research_bot/agents/__init__.py +0 -0
  109. pygpt_net/provider/agents/openai/bots/research_bot/agents/planner_agent.py +1 -1
  110. pygpt_net/provider/agents/openai/bots/research_bot/agents/search_agent.py +1 -0
  111. pygpt_net/provider/agents/openai/bots/research_bot/agents/writer_agent.py +1 -1
  112. pygpt_net/provider/agents/openai/bots/research_bot/manager.py +1 -10
  113. pygpt_net/provider/agents/openai/evolve.py +5 -9
  114. pygpt_net/provider/agents/openai/supervisor.py +4 -8
  115. pygpt_net/provider/core/config/patch.py +10 -3
  116. pygpt_net/provider/core/ctx/db_sqlite/utils.py +43 -43
  117. pygpt_net/provider/core/model/patch.py +11 -1
  118. pygpt_net/provider/core/preset/json_file.py +47 -49
  119. pygpt_net/provider/gpt/agents/experts.py +2 -2
  120. pygpt_net/tools/audio_transcriber/ui/dialogs.py +44 -54
  121. pygpt_net/tools/code_interpreter/body.py +1 -2
  122. pygpt_net/tools/code_interpreter/tool.py +7 -4
  123. pygpt_net/tools/code_interpreter/ui/html.py +1 -3
  124. pygpt_net/tools/code_interpreter/ui/widgets.py +2 -3
  125. pygpt_net/tools/html_canvas/ui/widgets.py +1 -3
  126. pygpt_net/tools/image_viewer/ui/dialogs.py +40 -37
  127. pygpt_net/tools/indexer/ui/widgets.py +2 -4
  128. pygpt_net/tools/media_player/tool.py +2 -5
  129. pygpt_net/tools/media_player/ui/widgets.py +60 -36
  130. pygpt_net/tools/text_editor/ui/widgets.py +18 -19
  131. pygpt_net/tools/translator/ui/widgets.py +39 -35
  132. pygpt_net/ui/base/context_menu.py +9 -4
  133. pygpt_net/ui/dialog/db.py +1 -3
  134. pygpt_net/ui/dialog/models.py +1 -3
  135. pygpt_net/ui/dialog/models_importer.py +2 -4
  136. pygpt_net/ui/dialogs.py +34 -30
  137. pygpt_net/ui/layout/chat/attachments.py +72 -84
  138. pygpt_net/ui/layout/chat/attachments_ctx.py +40 -44
  139. pygpt_net/ui/layout/chat/attachments_uploaded.py +36 -39
  140. pygpt_net/ui/layout/chat/calendar.py +100 -70
  141. pygpt_net/ui/layout/chat/chat.py +23 -17
  142. pygpt_net/ui/layout/chat/input.py +95 -118
  143. pygpt_net/ui/layout/chat/output.py +100 -162
  144. pygpt_net/ui/layout/chat/painter.py +89 -61
  145. pygpt_net/ui/layout/ctx/ctx_list.py +43 -52
  146. pygpt_net/ui/layout/status.py +23 -14
  147. pygpt_net/ui/layout/toolbox/agent.py +27 -38
  148. pygpt_net/ui/layout/toolbox/agent_llama.py +42 -45
  149. pygpt_net/ui/layout/toolbox/assistants.py +42 -38
  150. pygpt_net/ui/layout/toolbox/computer_env.py +32 -23
  151. pygpt_net/ui/layout/toolbox/footer.py +13 -16
  152. pygpt_net/ui/layout/toolbox/image.py +18 -21
  153. pygpt_net/ui/layout/toolbox/indexes.py +46 -89
  154. pygpt_net/ui/layout/toolbox/mode.py +20 -7
  155. pygpt_net/ui/layout/toolbox/model.py +12 -10
  156. pygpt_net/ui/layout/toolbox/presets.py +68 -52
  157. pygpt_net/ui/layout/toolbox/prompt.py +31 -58
  158. pygpt_net/ui/layout/toolbox/toolbox.py +25 -21
  159. pygpt_net/ui/layout/toolbox/vision.py +20 -22
  160. pygpt_net/ui/main.py +2 -4
  161. pygpt_net/ui/menu/about.py +64 -84
  162. pygpt_net/ui/menu/audio.py +87 -63
  163. pygpt_net/ui/menu/config.py +121 -127
  164. pygpt_net/ui/menu/debug.py +69 -76
  165. pygpt_net/ui/menu/file.py +32 -35
  166. pygpt_net/ui/menu/menu.py +2 -3
  167. pygpt_net/ui/menu/plugins.py +69 -33
  168. pygpt_net/ui/menu/theme.py +45 -46
  169. pygpt_net/ui/menu/tools.py +56 -60
  170. pygpt_net/ui/menu/video.py +20 -25
  171. pygpt_net/ui/tray.py +1 -2
  172. pygpt_net/ui/widget/audio/bar.py +1 -3
  173. pygpt_net/ui/widget/audio/input_button.py +3 -4
  174. pygpt_net/ui/widget/calendar/select.py +1 -2
  175. pygpt_net/ui/widget/dialog/base.py +12 -9
  176. pygpt_net/ui/widget/dialog/editor_file.py +20 -23
  177. pygpt_net/ui/widget/dialog/find.py +25 -24
  178. pygpt_net/ui/widget/dialog/profile.py +57 -53
  179. pygpt_net/ui/widget/draw/painter.py +62 -93
  180. pygpt_net/ui/widget/element/button.py +42 -30
  181. pygpt_net/ui/widget/element/checkbox.py +23 -15
  182. pygpt_net/ui/widget/element/group.py +6 -5
  183. pygpt_net/ui/widget/element/labels.py +1 -2
  184. pygpt_net/ui/widget/filesystem/explorer.py +93 -102
  185. pygpt_net/ui/widget/image/display.py +1 -2
  186. pygpt_net/ui/widget/lists/assistant.py +1 -2
  187. pygpt_net/ui/widget/lists/attachment.py +1 -2
  188. pygpt_net/ui/widget/lists/attachment_ctx.py +1 -2
  189. pygpt_net/ui/widget/lists/context.py +2 -4
  190. pygpt_net/ui/widget/lists/index.py +1 -2
  191. pygpt_net/ui/widget/lists/model.py +1 -2
  192. pygpt_net/ui/widget/lists/model_editor.py +1 -2
  193. pygpt_net/ui/widget/lists/model_importer.py +1 -2
  194. pygpt_net/ui/widget/lists/preset.py +1 -2
  195. pygpt_net/ui/widget/lists/preset_plugins.py +1 -2
  196. pygpt_net/ui/widget/lists/profile.py +1 -2
  197. pygpt_net/ui/widget/lists/uploaded.py +1 -2
  198. pygpt_net/ui/widget/option/checkbox.py +2 -4
  199. pygpt_net/ui/widget/option/checkbox_list.py +1 -4
  200. pygpt_net/ui/widget/option/cmd.py +1 -4
  201. pygpt_net/ui/widget/option/dictionary.py +25 -28
  202. pygpt_net/ui/widget/option/input.py +1 -3
  203. pygpt_net/ui/widget/tabs/Input.py +16 -12
  204. pygpt_net/ui/widget/tabs/body.py +5 -3
  205. pygpt_net/ui/widget/tabs/layout.py +36 -25
  206. pygpt_net/ui/widget/tabs/output.py +96 -74
  207. pygpt_net/ui/widget/textarea/calendar_note.py +1 -2
  208. pygpt_net/ui/widget/textarea/editor.py +41 -73
  209. pygpt_net/ui/widget/textarea/find.py +11 -10
  210. pygpt_net/ui/widget/textarea/html.py +3 -6
  211. pygpt_net/ui/widget/textarea/input.py +63 -64
  212. pygpt_net/ui/widget/textarea/notepad.py +54 -38
  213. pygpt_net/ui/widget/textarea/output.py +65 -54
  214. pygpt_net/ui/widget/textarea/search_input.py +5 -4
  215. pygpt_net/ui/widget/textarea/web.py +2 -4
  216. pygpt_net/ui/widget/vision/camera.py +2 -31
  217. {pygpt_net-2.6.20.dist-info → pygpt_net-2.6.22.dist-info}/METADATA +25 -154
  218. {pygpt_net-2.6.20.dist-info → pygpt_net-2.6.22.dist-info}/RECORD +218 -217
  219. {pygpt_net-2.6.20.dist-info → pygpt_net-2.6.22.dist-info}/LICENSE +0 -0
  220. {pygpt_net-2.6.20.dist-info → pygpt_net-2.6.22.dist-info}/WHEEL +0 -0
  221. {pygpt_net-2.6.20.dist-info → pygpt_net-2.6.22.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.14 18:00:00 #
9
+ # Updated Date: 2025.08.24 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from PySide6.QtGui import QAction, QIcon
@@ -25,65 +25,89 @@ class Audio:
25
25
 
26
26
  def setup(self):
27
27
  """Setup audio menu"""
28
- self.window.ui.menu['audio.output'] = QAction(
29
- trans("menu.audio.output"),
30
- self.window,
31
- checkable=True,
32
- )
33
- self.window.ui.menu['audio.input'] = QAction(
34
- trans("menu.audio.input"),
35
- self.window,
36
- checkable=True,
37
- )
38
- self.window.ui.menu['audio.control.plugin'] = QAction(
39
- trans("menu.audio.control.plugin"),
40
- self.window,
41
- checkable=True,
42
- )
43
- self.window.ui.menu['audio.control.global'] = QAction(
44
- trans("menu.audio.control.global"),
45
- self.window,
46
- checkable=True,
47
- )
48
- self.window.ui.menu['audio.cache.clear'] = QAction(
49
- QIcon(":/icons/delete.svg"),
50
- trans("menu.audio.cache.clear"),
51
- self.window,
52
- checkable=False,
53
- )
54
-
55
- self.window.ui.menu['audio.stop'] = QAction(
56
- QIcon(":/icons/mute.svg"),
57
- trans("menu.audio.stop"),
58
- self.window,
59
- checkable=False,
60
- )
61
-
62
- self.window.ui.menu['audio.output'].triggered.connect(
63
- lambda: self.window.controller.plugins.toggle('audio_output')
64
- )
65
- self.window.ui.menu['audio.input'].triggered.connect(
66
- lambda: self.window.controller.plugins.toggle('audio_input')
67
- )
68
- self.window.ui.menu['audio.control.plugin'].triggered.connect(
69
- lambda: self.window.controller.plugins.toggle('voice_control')
70
- )
71
- self.window.ui.menu['audio.control.global'].triggered.connect(
72
- lambda: self.window.controller.access.voice.toggle_voice_control()
73
- )
74
- self.window.ui.menu['audio.cache.clear'].triggered.connect(
75
- lambda: self.window.controller.audio.clear_cache()
76
- )
77
- self.window.ui.menu['audio.stop'].triggered.connect(
78
- lambda: self.window.controller.audio.stop_audio()
79
- )
80
-
81
- self.window.ui.menu['menu.audio'] = self.window.menuBar().addMenu(trans("menu.audio"))
82
- self.window.ui.menu['menu.audio'].addAction(self.window.ui.menu['audio.input'])
83
- self.window.ui.menu['menu.audio'].addAction(self.window.ui.menu['audio.output'])
84
- self.window.ui.menu['menu.audio'].addSeparator()
85
- self.window.ui.menu['menu.audio'].addAction(self.window.ui.menu['audio.control.plugin'])
86
- self.window.ui.menu['menu.audio'].addAction(self.window.ui.menu['audio.control.global'])
87
- self.window.ui.menu['menu.audio'].addSeparator()
88
- self.window.ui.menu['menu.audio'].addAction(self.window.ui.menu['audio.cache.clear'])
89
- self.window.ui.menu['menu.audio'].addAction(self.window.ui.menu['audio.stop'])
28
+ w = self.window
29
+ m = w.ui.menu
30
+
31
+ title = trans("menu.audio")
32
+ txt_output = trans("menu.audio.output")
33
+ txt_input = trans("menu.audio.input")
34
+ txt_ctrl_plugin = trans("menu.audio.control.plugin")
35
+ txt_ctrl_global = trans("menu.audio.control.global")
36
+ txt_cache_clear = trans("menu.audio.cache.clear")
37
+ txt_stop = trans("menu.audio.stop")
38
+
39
+ icon_cache = QIcon(":/icons/delete.svg")
40
+ icon_stop = QIcon(":/icons/mute.svg")
41
+
42
+ plugins_toggle = w.controller.plugins.toggle
43
+ voice_toggle = w.controller.access.voice.toggle_voice_control
44
+ audio_clear = w.controller.audio.clear_cache
45
+ audio_stop = w.controller.audio.stop_audio
46
+
47
+ menu = m.get('menu.audio')
48
+ is_new_menu = menu is None
49
+ if is_new_menu:
50
+ menu = w.menuBar().addMenu(title)
51
+ m['menu.audio'] = menu
52
+ else:
53
+ menu.setTitle(title)
54
+
55
+ act_output = m.get('audio.output')
56
+ if act_output is None:
57
+ act_output = QAction(txt_output, w, checkable=True)
58
+ m['audio.output'] = act_output
59
+ act_output.triggered.connect(lambda _=False: plugins_toggle('audio_output'))
60
+ else:
61
+ act_output.setText(txt_output)
62
+
63
+ act_input = m.get('audio.input')
64
+ if act_input is None:
65
+ act_input = QAction(txt_input, w, checkable=True)
66
+ m['audio.input'] = act_input
67
+ act_input.triggered.connect(lambda _=False: plugins_toggle('audio_input'))
68
+ else:
69
+ act_input.setText(txt_input)
70
+
71
+ act_ctrl_plugin = m.get('audio.control.plugin')
72
+ if act_ctrl_plugin is None:
73
+ act_ctrl_plugin = QAction(txt_ctrl_plugin, w, checkable=True)
74
+ m['audio.control.plugin'] = act_ctrl_plugin
75
+ act_ctrl_plugin.triggered.connect(lambda _=False: plugins_toggle('voice_control'))
76
+ else:
77
+ act_ctrl_plugin.setText(txt_ctrl_plugin)
78
+
79
+ act_ctrl_global = m.get('audio.control.global')
80
+ if act_ctrl_global is None:
81
+ act_ctrl_global = QAction(txt_ctrl_global, w, checkable=True)
82
+ m['audio.control.global'] = act_ctrl_global
83
+ act_ctrl_global.triggered.connect(lambda _=False: voice_toggle())
84
+ else:
85
+ act_ctrl_global.setText(txt_ctrl_global)
86
+
87
+ act_cache_clear = m.get('audio.cache.clear')
88
+ if act_cache_clear is None:
89
+ act_cache_clear = QAction(icon_cache, txt_cache_clear, w, checkable=False)
90
+ m['audio.cache.clear'] = act_cache_clear
91
+ act_cache_clear.triggered.connect(lambda _=False: audio_clear())
92
+ else:
93
+ act_cache_clear.setText(txt_cache_clear)
94
+ act_cache_clear.setIcon(icon_cache)
95
+
96
+ act_stop = m.get('audio.stop')
97
+ if act_stop is None:
98
+ act_stop = QAction(icon_stop, txt_stop, w, checkable=False)
99
+ m['audio.stop'] = act_stop
100
+ act_stop.triggered.connect(lambda _=False: audio_stop())
101
+ else:
102
+ act_stop.setText(txt_stop)
103
+ act_stop.setIcon(icon_stop)
104
+
105
+ if is_new_menu:
106
+ menu.addAction(act_input)
107
+ menu.addAction(act_output)
108
+ menu.addSeparator()
109
+ menu.addAction(act_ctrl_plugin)
110
+ menu.addAction(act_ctrl_global)
111
+ menu.addSeparator()
112
+ menu.addAction(act_cache_clear)
113
+ menu.addAction(act_stop)
@@ -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.08.02 20:00:00 #
9
+ # Updated Date: 2025.08.24 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import os
@@ -15,7 +15,6 @@ from PySide6.QtGui import QAction, QIcon
15
15
  from PySide6.QtWidgets import QMenu
16
16
 
17
17
  from pygpt_net.utils import trans
18
- import pygpt_net.icons_rc
19
18
 
20
19
  from .lang import Lang
21
20
  from .theme import Theme
@@ -34,137 +33,132 @@ class Config:
34
33
 
35
34
  def setup(self):
36
35
  """Setup config menu"""
37
- self.window.ui.menu['config.settings'] = QAction(QIcon(":/icons/settings_filled.svg"),
38
- trans("menu.config.settings"), self.window)
39
- self.window.ui.menu['config.settings'].setMenuRole(QAction.MenuRole.NoRole)
40
-
41
- self.window.ui.menu['config.models'] = QMenu(trans("menu.config.models"), self.window)
42
-
43
- self.window.ui.menu['config.access'] = QAction(QIcon(":/icons/accessibility.svg"),
44
- trans("menu.config.access"), self.window)
45
- self.window.ui.menu['config.access'].setMenuRole(QAction.MenuRole.NoRole)
46
-
47
- # models
48
- self.window.ui.menu['config.models.edit'] = QAction(QIcon(":/icons/settings_filled.svg"),
49
- trans("menu.config.models.edit"), self.window)
50
- self.window.ui.menu['config.models.edit'].triggered.connect(
51
- lambda: self.window.controller.model.editor.toggle_editor())
52
- self.window.ui.menu['config.models.import.provider'] = QAction(QIcon(":/icons/reload.svg"),
53
- trans("menu.config.models.import.provider"),
54
- self.window)
55
- self.window.ui.menu['config.models.import.provider'].triggered.connect(
56
- lambda: self.window.controller.model.importer.toggle_editor())
57
-
58
- self.window.ui.menu['config.models'].addAction(self.window.ui.menu['config.models.edit'])
59
- self.window.ui.menu['config.models'].addAction(self.window.ui.menu['config.models.import.provider'])
60
-
61
-
62
- css_dir = os.path.join(self.window.core.config.path, 'css')
63
- css_files = os.listdir(css_dir)
64
- css_files = [f for f in css_files if not f.endswith('.backup')] # remove .backup files
65
- css_files = sorted(css_files) # sort by name
66
-
67
- json_files = []
68
- json_files.append("attachments.json")
69
- json_files.append("assistants.json")
70
- json_files.append("config.json")
71
- json_files.append("models.json")
72
- json_files.append("plugin_presets.json")
73
-
74
- # -------------------------------------------- #
75
-
76
- # create submenu for css files
77
- self.window.ui.menu['config.edit.css'] = QMenu(trans("menu.config.edit.css"), self.window)
36
+ w = self.window
37
+ m = w.ui.menu
38
+ tr = trans
39
+
40
+ icon_settings = QIcon(":/icons/settings_filled.svg")
41
+ icon_access = QIcon(":/icons/accessibility.svg")
42
+ icon_reload = QIcon(":/icons/reload.svg")
43
+ icon_edit = QIcon(":/icons/edit.svg")
44
+ icon_undo = QIcon(":/icons/undo.svg")
45
+ icon_add = QIcon(":/icons/add.svg")
46
+ icon_folder = QIcon(":/icons/folder_filled.svg")
47
+ icon_save = QIcon(":/icons/save.svg")
48
+
49
+ m['config.settings'] = QAction(icon_settings, tr("menu.config.settings"), w)
50
+ m['config.settings'].setMenuRole(QAction.MenuRole.NoRole)
51
+
52
+ m['config.models'] = QMenu(tr("menu.config.models"), w)
53
+
54
+ m['config.access'] = QAction(icon_access, tr("menu.config.access"), w)
55
+ m['config.access'].setMenuRole(QAction.MenuRole.NoRole)
56
+
57
+ m['config.models.edit'] = QAction(icon_settings, tr("menu.config.models.edit"), w)
58
+ m['config.models.edit'].triggered.connect(
59
+ lambda: w.controller.model.editor.toggle_editor()
60
+ )
61
+ m['config.models.import.provider'] = QAction(icon_reload, tr("menu.config.models.import.provider"), w)
62
+ m['config.models.import.provider'].triggered.connect(
63
+ lambda: w.controller.model.importer.toggle_editor()
64
+ )
65
+
66
+ m['config.models'].addAction(m['config.models.edit'])
67
+ m['config.models'].addAction(m['config.models.import.provider'])
68
+
69
+ css_dir = os.path.join(w.core.config.path, 'css')
70
+ css_files = sorted(f for f in os.listdir(css_dir) if not f.endswith('.backup'))
71
+
72
+ json_files = (
73
+ "attachments.json",
74
+ "assistants.json",
75
+ "config.json",
76
+ "models.json",
77
+ "plugin_presets.json",
78
+ )
79
+
80
+ m['config.edit.css'] = QMenu(tr("menu.config.edit.css"), w)
81
+ css_menu = m['config.edit.css']
78
82
 
79
83
  for css_file in css_files:
80
- name = css_file.split("/")[-1]
81
- self.window.ui.menu['config.edit.css.' + name] = QAction(QIcon(":/icons/edit.svg"),
82
- name, self.window)
83
- self.window.ui.menu['config.edit.css.' + name].triggered.connect(
84
- lambda checked=True, file=css_file: self.window.controller.settings.toggle_file_editor(file))
85
- self.window.ui.menu['config.edit.css'].addAction(self.window.ui.menu['config.edit.css.' + name])
86
-
87
- # restore css files
88
- self.window.ui.menu['config.edit.css'].addSeparator()
89
- self.window.ui.menu['config.edit.css.restore'] = QAction(QIcon(":/icons/undo.svg"),
90
- trans('menu.config.edit.css.restore'), self.window)
91
- self.window.ui.menu['config.edit.css.restore'].triggered.connect(
92
- lambda checked=True: self.window.controller.layout.restore_default_css(force=False))
93
- self.window.ui.menu['config.edit.css'].addAction(self.window.ui.menu['config.edit.css.restore'])
94
-
95
- # -------------------------------------------- #
96
-
97
- # create submenu for JSON files
98
- self.window.ui.menu['config.edit.json'] = QMenu(trans("menu.config.edit.json"), self.window)
84
+ name = os.path.basename(css_file)
85
+ key = 'config.edit.css.' + name
86
+ m[key] = QAction(icon_edit, name, w)
87
+ m[key].triggered.connect(
88
+ lambda checked=True, file=css_file: w.controller.settings.toggle_file_editor(file)
89
+ )
90
+ css_menu.addAction(m[key])
91
+
92
+ css_menu.addSeparator()
93
+ m['config.edit.css.restore'] = QAction(icon_undo, tr('menu.config.edit.css.restore'), w)
94
+ m['config.edit.css.restore'].triggered.connect(
95
+ lambda checked=True: w.controller.layout.restore_default_css(force=False)
96
+ )
97
+ css_menu.addAction(m['config.edit.css.restore'])
98
+
99
+ m['config.edit.json'] = QMenu(tr("menu.config.edit.json"), w)
100
+ json_menu = m['config.edit.json']
99
101
 
100
102
  for json_file in json_files:
101
103
  name = json_file
102
- self.window.ui.menu['config.edit.json.' + name] = QAction(QIcon(":/icons/edit.svg"),
103
- name, self.window)
104
- self.window.ui.menu['config.edit.json.' + name].triggered.connect(
105
- lambda checked=True, file=json_file: self.window.controller.settings.toggle_file_editor(file))
106
- self.window.ui.menu['config.edit.json'].addAction(self.window.ui.menu['config.edit.json.' + name])
107
-
108
- # -------------------------------------------- #
109
-
110
- # create submenu for profiles
111
- self.window.ui.menu['config.profiles'] = {}
112
- self.window.ui.menu['config.profile'] = QMenu(trans("menu.config.profile"), self.window)
113
-
114
- # add new
115
- self.window.ui.menu['config.profile.new'] = QAction(
116
- QIcon(":/icons/add.svg"), trans("menu.config.profile.new"), self.window, checkable=False)
117
- self.window.ui.menu['config.profile.new'].triggered.connect(
118
- lambda: self.window.controller.settings.profile.new())
119
- self.window.ui.menu['config.profile.new'].setMenuRole(QAction.MenuRole.NoRole)
120
- self.window.ui.menu['config.profile'].addAction(self.window.ui.menu['config.profile.new'])
121
-
122
- # edit
123
- self.window.ui.menu['config.profile.edit'] = QAction(
124
- QIcon(":/icons/edit.svg"), trans("menu.config.profile.edit"), self.window, checkable=False)
125
- self.window.ui.menu['config.profile.edit'].triggered.connect(
126
- lambda: self.window.controller.settings.profile.toggle_editor())
127
- self.window.ui.menu['config.profile.edit'].setMenuRole(QAction.MenuRole.NoRole)
128
- self.window.ui.menu['config.profile'].addAction(self.window.ui.menu['config.profile.edit'])
129
- self.window.ui.menu['config.profile'].addSeparator()
130
-
131
- # -------------------------------------------- #
132
-
133
- self.window.ui.menu['config.open_dir'] = QAction(QIcon(":/icons/folder_filled.svg"),
134
- trans("menu.config.open_dir"), self.window)
135
- self.window.ui.menu['config.change_dir'] = QAction(QIcon(":/icons/settings_filled.svg"),
136
- trans("menu.config.change_dir"), self.window)
137
- self.window.ui.menu['config.save'] = QAction(QIcon(":/icons/save.svg"),
138
- trans("menu.config.save"), self.window)
139
-
140
- self.window.ui.menu['config.settings'].triggered.connect(
141
- lambda: self.window.controller.settings.toggle_editor('settings'))
142
-
143
- self.window.ui.menu['config.access'].triggered.connect(
144
- lambda: self.window.controller.settings.open_section('access'))
145
-
146
- self.window.ui.menu['config.open_dir'].triggered.connect(
147
- lambda: self.window.controller.settings.open_config_dir())
148
-
149
- self.window.ui.menu['config.change_dir'].triggered.connect(
150
- lambda: self.window.controller.settings.workdir.change())
151
-
152
- self.window.ui.menu['config.save'].triggered.connect(
153
- lambda: self.window.controller.settings.save_all())
104
+ key = 'config.edit.json.' + name
105
+ m[key] = QAction(icon_edit, name, w)
106
+ m[key].triggered.connect(
107
+ lambda checked=True, file=json_file: w.controller.settings.toggle_file_editor(file)
108
+ )
109
+ json_menu.addAction(m[key])
110
+
111
+ m['config.profiles'] = {}
112
+ m['config.profile'] = QMenu(tr("menu.config.profile"), w)
113
+
114
+ m['config.profile.new'] = QAction(icon_add, tr("menu.config.profile.new"), w, checkable=False)
115
+ m['config.profile.new'].triggered.connect(
116
+ lambda: w.controller.settings.profile.new()
117
+ )
118
+ m['config.profile.new'].setMenuRole(QAction.MenuRole.NoRole)
119
+ m['config.profile'].addAction(m['config.profile.new'])
120
+
121
+ m['config.profile.edit'] = QAction(icon_edit, tr("menu.config.profile.edit"), w, checkable=False)
122
+ m['config.profile.edit'].triggered.connect(
123
+ lambda: w.controller.settings.profile.toggle_editor()
124
+ )
125
+ m['config.profile.edit'].setMenuRole(QAction.MenuRole.NoRole)
126
+ m['config.profile'].addAction(m['config.profile.edit'])
127
+ m['config.profile'].addSeparator()
128
+
129
+ m['config.open_dir'] = QAction(icon_folder, tr("menu.config.open_dir"), w)
130
+ m['config.change_dir'] = QAction(icon_settings, tr("menu.config.change_dir"), w)
131
+ m['config.save'] = QAction(icon_save, tr("menu.config.save"), w)
132
+
133
+ m['config.settings'].triggered.connect(
134
+ lambda: w.controller.settings.toggle_editor('settings')
135
+ )
136
+ m['config.access'].triggered.connect(
137
+ lambda: w.controller.settings.open_section('access')
138
+ )
139
+ m['config.open_dir'].triggered.connect(
140
+ lambda: w.controller.settings.open_config_dir()
141
+ )
142
+ m['config.change_dir'].triggered.connect(
143
+ lambda: w.controller.settings.workdir.change()
144
+ )
145
+ m['config.save'].triggered.connect(
146
+ lambda: w.controller.settings.save_all()
147
+ )
154
148
 
155
149
  self.lang.setup()
156
150
  self.theme.setup()
157
151
 
158
- self.window.ui.menu['menu.config'] = self.window.menuBar().addMenu(trans("menu.config"))
159
- self.window.ui.menu['menu.config'].addAction(self.window.ui.menu['config.settings'])
160
- self.window.ui.menu['menu.config'].addMenu(self.window.ui.menu['config.models'])
161
- self.window.ui.menu['menu.config'].addAction(self.window.ui.menu['config.access'])
162
-
163
- self.window.ui.menu['menu.config'].addMenu(self.window.ui.menu['menu.theme'])
164
- self.window.ui.menu['menu.config'].addMenu(self.window.ui.menu['menu.lang'])
165
- self.window.ui.menu['menu.config'].addMenu(self.window.ui.menu['config.edit.css'])
166
- self.window.ui.menu['menu.config'].addMenu(self.window.ui.menu['config.edit.json'])
167
- self.window.ui.menu['menu.config'].addMenu(self.window.ui.menu['config.profile'])
168
- self.window.ui.menu['menu.config'].addAction(self.window.ui.menu['config.open_dir'])
169
- self.window.ui.menu['menu.config'].addAction(self.window.ui.menu['config.change_dir'])
170
- self.window.ui.menu['menu.config'].addAction(self.window.ui.menu['config.save'])
152
+ m['menu.config'] = w.menuBar().addMenu(tr("menu.config"))
153
+ menu = m['menu.config']
154
+ menu.addAction(m['config.settings'])
155
+ menu.addMenu(m['config.models'])
156
+ menu.addAction(m['config.access'])
157
+ menu.addMenu(m['menu.theme'])
158
+ menu.addMenu(m['menu.lang'])
159
+ menu.addMenu(m['config.edit.css'])
160
+ menu.addMenu(m['config.edit.json'])
161
+ menu.addMenu(m['config.profile'])
162
+ menu.addAction(m['config.open_dir'])
163
+ menu.addAction(m['config.change_dir'])
164
+ menu.addAction(m['config.save'])
@@ -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.13 19:00:00 #
9
+ # Updated Date: 2025.08.24 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from PySide6.QtGui import QAction
@@ -25,83 +25,76 @@ class Debug:
25
25
 
26
26
  def setup(self):
27
27
  """Setup debug menu"""
28
- self.window.ui.menu['debug.config'] = QAction(trans("menu.debug.config"), self.window, checkable=True)
29
- self.window.ui.menu['debug.context'] = QAction(trans("menu.debug.context"), self.window, checkable=True)
30
- self.window.ui.menu['debug.presets'] = QAction(trans("menu.debug.presets"), self.window, checkable=True)
31
- self.window.ui.menu['debug.models'] = QAction(trans("menu.debug.models"), self.window, checkable=True)
32
- self.window.ui.menu['debug.plugins'] = QAction(trans("menu.debug.plugins"), self.window, checkable=True)
33
- self.window.ui.menu['debug.attachments'] = QAction(trans("menu.debug.attachments"), self.window, checkable=True)
34
- self.window.ui.menu['debug.assistants'] = QAction(trans("menu.debug.assistants"), self.window, checkable=True)
35
- self.window.ui.menu['debug.agent'] = QAction(trans("menu.debug.agent"), self.window, checkable=True)
36
- self.window.ui.menu['debug.events'] = QAction(trans("menu.debug.events"), self.window, checkable=True)
37
- self.window.ui.menu['debug.indexes'] = QAction(trans("menu.debug.indexes"), self.window, checkable=True)
38
- self.window.ui.menu['debug.ui'] = QAction(trans("menu.debug.ui"), self.window, checkable=True)
39
- self.window.ui.menu['debug.tabs'] = QAction(trans("menu.debug.tabs"), self.window, checkable=True)
40
- self.window.ui.menu['debug.db'] = QAction(trans("menu.debug.db"), self.window, checkable=True)
41
- self.window.ui.menu['debug.logger'] = QAction(trans("menu.debug.logger"), self.window, checkable=True)
42
- self.window.ui.menu['debug.app.log'] = QAction(trans("menu.debug.app.log"), self.window, checkable=True)
43
- self.window.ui.menu['debug.kernel'] = QAction(trans("menu.debug.kernel"), self.window, checkable=True)
44
- self.window.ui.menu['debug.render'] = QAction(trans("menu.debug.render"), self.window, checkable=True)
28
+ win = self.window
29
+ ui = win.ui
30
+ m = ui.menu
31
+ dbg = win.controller.debug
45
32
 
46
- self.window.ui.menu['debug.config'].triggered.connect(
47
- lambda: self.window.controller.debug.toggle('config'))
48
- self.window.ui.menu['debug.context'].triggered.connect(
49
- lambda: self.window.controller.debug.toggle('context'))
50
- self.window.ui.menu['debug.presets'].triggered.connect(
51
- lambda: self.window.controller.debug.toggle('presets'))
52
- self.window.ui.menu['debug.models'].triggered.connect(
53
- lambda: self.window.controller.debug.toggle('models'))
54
- self.window.ui.menu['debug.plugins'].triggered.connect(
55
- lambda: self.window.controller.debug.toggle('plugins'))
56
- self.window.ui.menu['debug.attachments'].triggered.connect(
57
- lambda: self.window.controller.debug.toggle('attachments'))
58
- self.window.ui.menu['debug.assistants'].triggered.connect(
59
- lambda: self.window.controller.debug.toggle('assistants'))
60
- self.window.ui.menu['debug.agent'].triggered.connect(
61
- lambda: self.window.controller.debug.toggle('agent'))
62
- self.window.ui.menu['debug.events'].triggered.connect(
63
- lambda: self.window.controller.debug.toggle('events'))
64
- self.window.ui.menu['debug.indexes'].triggered.connect(
65
- lambda: self.window.controller.debug.toggle('indexes'))
66
- self.window.ui.menu['debug.logger'].triggered.connect(
67
- lambda: self.window.controller.debug.toggle_logger())
68
- self.window.ui.menu['debug.ui'].triggered.connect(
69
- lambda: self.window.controller.debug.toggle('ui'))
70
- self.window.ui.menu['debug.tabs'].triggered.connect(
71
- lambda: self.window.controller.debug.toggle('tabs'))
72
- self.window.ui.menu['debug.app.log'].triggered.connect(
73
- lambda: self.window.controller.debug.toggle_app_log())
74
- self.window.ui.menu['debug.db'].triggered.connect(
75
- lambda: self.window.controller.debug.toggle('db'))
76
- self.window.ui.menu['debug.kernel'].triggered.connect(
77
- lambda: self.window.controller.debug.toggle('kernel'))
78
- self.window.ui.menu['debug.render'].triggered.connect(
79
- lambda: self.window.controller.debug.toggle_render())
33
+ keys = (
34
+ 'config',
35
+ 'context',
36
+ 'presets',
37
+ 'models',
38
+ 'plugins',
39
+ 'attachments',
40
+ 'assistants',
41
+ 'agent',
42
+ 'events',
43
+ 'indexes',
44
+ 'ui',
45
+ 'tabs',
46
+ 'db',
47
+ 'logger',
48
+ 'app.log',
49
+ 'kernel',
50
+ 'render'
51
+ )
52
+ for k in keys:
53
+ m[f'debug.{k}'] = QAction(trans(f"menu.debug.{k}"), win, checkable=True)
80
54
 
81
- self.window.ui.menu['menu.debug'] = self.window.menuBar().addMenu(trans("menu.debug"))
82
- self.window.ui.menu['menu.debug'].addAction(self.window.ui.menu['debug.logger'])
83
- self.window.ui.menu['menu.debug'].addAction(self.window.ui.menu['debug.render'])
84
- self.window.ui.menu['menu.debug'].addAction(self.window.ui.menu['debug.db'])
85
- self.window.ui.menu['menu.debug'].addAction(self.window.ui.menu['debug.app.log'])
86
- self.window.ui.menu['menu.debug'].addSeparator()
87
- self.window.ui.menu['menu.debug'].addAction(self.window.ui.menu['debug.agent'])
88
- self.window.ui.menu['menu.debug'].addAction(self.window.ui.menu['debug.assistants'])
89
- self.window.ui.menu['menu.debug'].addAction(self.window.ui.menu['debug.attachments'])
90
- self.window.ui.menu['menu.debug'].addAction(self.window.ui.menu['debug.config'])
91
- self.window.ui.menu['menu.debug'].addAction(self.window.ui.menu['debug.context'])
92
- self.window.ui.menu['menu.debug'].addAction(self.window.ui.menu['debug.events'])
93
- self.window.ui.menu['menu.debug'].addAction(self.window.ui.menu['debug.indexes'])
94
- self.window.ui.menu['menu.debug'].addAction(self.window.ui.menu['debug.kernel'])
95
- self.window.ui.menu['menu.debug'].addAction(self.window.ui.menu['debug.models'])
96
- self.window.ui.menu['menu.debug'].addAction(self.window.ui.menu['debug.plugins'])
97
- self.window.ui.menu['menu.debug'].addAction(self.window.ui.menu['debug.presets'])
98
- self.window.ui.menu['menu.debug'].addAction(self.window.ui.menu['debug.tabs'])
99
- self.window.ui.menu['menu.debug'].addAction(self.window.ui.menu['debug.ui'])
55
+ for k in ('config',
56
+ 'context',
57
+ 'presets',
58
+ 'models',
59
+ 'plugins',
60
+ 'attachments',
61
+ 'assistants',
62
+ 'agent',
63
+ 'events',
64
+ 'indexes',
65
+ 'ui',
66
+ 'tabs',
67
+ 'db',
68
+ 'kernel'):
69
+ m[f'debug.{k}'].triggered.connect(lambda _=False, kk=k: dbg.toggle(kk))
100
70
 
101
- # restore state
102
- if self.window.core.config.get('debug.render'):
103
- self.window.ui.menu['debug.render'].setChecked(True)
104
- else:
105
- self.window.ui.menu['debug.render'].setChecked(False)
71
+ m['debug.logger'].triggered.connect(dbg.toggle_logger)
72
+ m['debug.app.log'].triggered.connect(dbg.toggle_app_log)
73
+ m['debug.render'].triggered.connect(dbg.toggle_render)
106
74
 
75
+ m['menu.debug'] = win.menuBar().addMenu(trans("menu.debug"))
76
+ menu = m['menu.debug']
77
+ menu.addActions(
78
+ [m['debug.logger'],
79
+ m['debug.render'],
80
+ m['debug.db'],
81
+ m['debug.app.log']]
82
+ )
83
+ menu.addSeparator()
84
+ menu.addActions([
85
+ m['debug.agent'],
86
+ m['debug.assistants'],
87
+ m['debug.attachments'],
88
+ m['debug.config'],
89
+ m['debug.context'],
90
+ m['debug.events'],
91
+ m['debug.indexes'],
92
+ m['debug.kernel'],
93
+ m['debug.models'],
94
+ m['debug.plugins'],
95
+ m['debug.presets'],
96
+ m['debug.tabs'],
97
+ m['debug.ui'],
98
+ ])
107
99
 
100
+ m['debug.render'].setChecked(bool(win.core.config.get('debug.render')))