pygpt-net 2.6.21__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 (144) hide show
  1. pygpt_net/CHANGELOG.txt +4 -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/assistant/batch.py +2 -3
  7. pygpt_net/controller/assistant/editor.py +2 -2
  8. pygpt_net/controller/assistant/files.py +2 -3
  9. pygpt_net/controller/assistant/store.py +2 -2
  10. pygpt_net/controller/audio/audio.py +2 -2
  11. pygpt_net/controller/ctx/ctx.py +2 -1
  12. pygpt_net/controller/idx/indexer.py +85 -76
  13. pygpt_net/controller/lang/lang.py +52 -34
  14. pygpt_net/controller/model/importer.py +2 -2
  15. pygpt_net/controller/notepad/notepad.py +86 -84
  16. pygpt_net/controller/plugins/settings.py +3 -4
  17. pygpt_net/controller/settings/profile.py +105 -124
  18. pygpt_net/controller/theme/menu.py +154 -57
  19. pygpt_net/controller/theme/nodes.py +51 -44
  20. pygpt_net/controller/theme/theme.py +33 -9
  21. pygpt_net/controller/tools/tools.py +2 -2
  22. pygpt_net/controller/ui/tabs.py +2 -3
  23. pygpt_net/core/ctx/container.py +13 -12
  24. pygpt_net/core/ctx/output.py +7 -4
  25. pygpt_net/core/debug/console/console.py +2 -2
  26. pygpt_net/core/filesystem/actions.py +1 -2
  27. pygpt_net/core/render/plain/helpers.py +2 -5
  28. pygpt_net/core/render/plain/renderer.py +26 -30
  29. pygpt_net/core/render/web/body.py +1 -1
  30. pygpt_net/core/settings/settings.py +43 -13
  31. pygpt_net/core/tabs/tabs.py +20 -13
  32. pygpt_net/data/config/config.json +4 -4
  33. pygpt_net/data/config/models.json +3 -3
  34. pygpt_net/data/locale/locale.de.ini +4 -1
  35. pygpt_net/data/locale/locale.en.ini +4 -1
  36. pygpt_net/data/locale/locale.es.ini +4 -1
  37. pygpt_net/data/locale/locale.fr.ini +4 -1
  38. pygpt_net/data/locale/locale.it.ini +4 -1
  39. pygpt_net/data/locale/locale.pl.ini +5 -4
  40. pygpt_net/data/locale/locale.uk.ini +4 -1
  41. pygpt_net/data/locale/locale.zh.ini +4 -1
  42. pygpt_net/plugin/twitter/plugin.py +2 -2
  43. pygpt_net/tools/audio_transcriber/ui/dialogs.py +44 -54
  44. pygpt_net/tools/code_interpreter/body.py +1 -2
  45. pygpt_net/tools/code_interpreter/tool.py +7 -4
  46. pygpt_net/tools/code_interpreter/ui/html.py +1 -3
  47. pygpt_net/tools/code_interpreter/ui/widgets.py +2 -3
  48. pygpt_net/tools/html_canvas/ui/widgets.py +1 -3
  49. pygpt_net/tools/image_viewer/ui/dialogs.py +40 -37
  50. pygpt_net/tools/indexer/ui/widgets.py +2 -4
  51. pygpt_net/tools/media_player/tool.py +2 -5
  52. pygpt_net/tools/media_player/ui/widgets.py +60 -36
  53. pygpt_net/tools/text_editor/ui/widgets.py +18 -19
  54. pygpt_net/tools/translator/ui/widgets.py +39 -35
  55. pygpt_net/ui/base/context_menu.py +9 -4
  56. pygpt_net/ui/dialog/db.py +1 -3
  57. pygpt_net/ui/dialog/models.py +1 -3
  58. pygpt_net/ui/dialog/models_importer.py +2 -4
  59. pygpt_net/ui/dialogs.py +34 -30
  60. pygpt_net/ui/layout/chat/attachments.py +72 -84
  61. pygpt_net/ui/layout/chat/attachments_ctx.py +40 -44
  62. pygpt_net/ui/layout/chat/attachments_uploaded.py +36 -39
  63. pygpt_net/ui/layout/chat/calendar.py +100 -70
  64. pygpt_net/ui/layout/chat/chat.py +23 -17
  65. pygpt_net/ui/layout/chat/input.py +95 -118
  66. pygpt_net/ui/layout/chat/output.py +100 -162
  67. pygpt_net/ui/layout/chat/painter.py +89 -61
  68. pygpt_net/ui/layout/ctx/ctx_list.py +43 -52
  69. pygpt_net/ui/layout/status.py +23 -14
  70. pygpt_net/ui/layout/toolbox/agent.py +27 -38
  71. pygpt_net/ui/layout/toolbox/agent_llama.py +42 -45
  72. pygpt_net/ui/layout/toolbox/assistants.py +42 -38
  73. pygpt_net/ui/layout/toolbox/computer_env.py +32 -23
  74. pygpt_net/ui/layout/toolbox/footer.py +13 -16
  75. pygpt_net/ui/layout/toolbox/image.py +18 -21
  76. pygpt_net/ui/layout/toolbox/indexes.py +46 -89
  77. pygpt_net/ui/layout/toolbox/mode.py +20 -7
  78. pygpt_net/ui/layout/toolbox/model.py +12 -10
  79. pygpt_net/ui/layout/toolbox/presets.py +68 -52
  80. pygpt_net/ui/layout/toolbox/prompt.py +31 -58
  81. pygpt_net/ui/layout/toolbox/toolbox.py +25 -21
  82. pygpt_net/ui/layout/toolbox/vision.py +20 -22
  83. pygpt_net/ui/main.py +2 -4
  84. pygpt_net/ui/menu/about.py +64 -84
  85. pygpt_net/ui/menu/audio.py +87 -63
  86. pygpt_net/ui/menu/config.py +121 -127
  87. pygpt_net/ui/menu/debug.py +69 -76
  88. pygpt_net/ui/menu/file.py +32 -35
  89. pygpt_net/ui/menu/menu.py +2 -3
  90. pygpt_net/ui/menu/plugins.py +69 -33
  91. pygpt_net/ui/menu/theme.py +45 -46
  92. pygpt_net/ui/menu/tools.py +56 -60
  93. pygpt_net/ui/menu/video.py +20 -25
  94. pygpt_net/ui/tray.py +1 -2
  95. pygpt_net/ui/widget/audio/bar.py +1 -3
  96. pygpt_net/ui/widget/audio/input_button.py +3 -4
  97. pygpt_net/ui/widget/calendar/select.py +1 -2
  98. pygpt_net/ui/widget/dialog/base.py +12 -9
  99. pygpt_net/ui/widget/dialog/editor_file.py +20 -23
  100. pygpt_net/ui/widget/dialog/find.py +25 -24
  101. pygpt_net/ui/widget/dialog/profile.py +57 -53
  102. pygpt_net/ui/widget/draw/painter.py +62 -93
  103. pygpt_net/ui/widget/element/button.py +42 -30
  104. pygpt_net/ui/widget/element/checkbox.py +23 -15
  105. pygpt_net/ui/widget/element/group.py +6 -5
  106. pygpt_net/ui/widget/element/labels.py +1 -2
  107. pygpt_net/ui/widget/filesystem/explorer.py +93 -102
  108. pygpt_net/ui/widget/image/display.py +1 -2
  109. pygpt_net/ui/widget/lists/assistant.py +1 -2
  110. pygpt_net/ui/widget/lists/attachment.py +1 -2
  111. pygpt_net/ui/widget/lists/attachment_ctx.py +1 -2
  112. pygpt_net/ui/widget/lists/context.py +2 -4
  113. pygpt_net/ui/widget/lists/index.py +1 -2
  114. pygpt_net/ui/widget/lists/model.py +1 -2
  115. pygpt_net/ui/widget/lists/model_editor.py +1 -2
  116. pygpt_net/ui/widget/lists/model_importer.py +1 -2
  117. pygpt_net/ui/widget/lists/preset.py +1 -2
  118. pygpt_net/ui/widget/lists/preset_plugins.py +1 -2
  119. pygpt_net/ui/widget/lists/profile.py +1 -2
  120. pygpt_net/ui/widget/lists/uploaded.py +1 -2
  121. pygpt_net/ui/widget/option/checkbox.py +2 -4
  122. pygpt_net/ui/widget/option/checkbox_list.py +1 -4
  123. pygpt_net/ui/widget/option/cmd.py +1 -4
  124. pygpt_net/ui/widget/option/dictionary.py +25 -28
  125. pygpt_net/ui/widget/option/input.py +1 -3
  126. pygpt_net/ui/widget/tabs/Input.py +16 -12
  127. pygpt_net/ui/widget/tabs/body.py +5 -3
  128. pygpt_net/ui/widget/tabs/layout.py +36 -25
  129. pygpt_net/ui/widget/tabs/output.py +96 -74
  130. pygpt_net/ui/widget/textarea/calendar_note.py +1 -2
  131. pygpt_net/ui/widget/textarea/editor.py +41 -73
  132. pygpt_net/ui/widget/textarea/find.py +11 -10
  133. pygpt_net/ui/widget/textarea/html.py +3 -6
  134. pygpt_net/ui/widget/textarea/input.py +63 -64
  135. pygpt_net/ui/widget/textarea/notepad.py +54 -38
  136. pygpt_net/ui/widget/textarea/output.py +65 -54
  137. pygpt_net/ui/widget/textarea/search_input.py +5 -4
  138. pygpt_net/ui/widget/textarea/web.py +2 -4
  139. pygpt_net/ui/widget/vision/camera.py +2 -31
  140. {pygpt_net-2.6.21.dist-info → pygpt_net-2.6.22.dist-info}/METADATA +15 -151
  141. {pygpt_net-2.6.21.dist-info → pygpt_net-2.6.22.dist-info}/RECORD +144 -144
  142. {pygpt_net-2.6.21.dist-info → pygpt_net-2.6.22.dist-info}/LICENSE +0 -0
  143. {pygpt_net-2.6.21.dist-info → pygpt_net-2.6.22.dist-info}/WHEEL +0 -0
  144. {pygpt_net-2.6.21.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.11.17 03:00:00 #
9
+ # Updated Date: 2025.08.24 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from PySide6 import QtCore
@@ -16,7 +16,6 @@ from PySide6.QtWidgets import QVBoxLayout, QHBoxLayout, QPushButton, QWidget
16
16
  from pygpt_net.ui.widget.element.labels import HelpLabel, TitleLabel
17
17
  from pygpt_net.ui.widget.lists.assistant import AssistantList
18
18
  from pygpt_net.utils import trans
19
- import pygpt_net.icons_rc
20
19
 
21
20
  class Assistants:
22
21
  def __init__(self, window=None):
@@ -48,49 +47,50 @@ class Assistants:
48
47
 
49
48
  :return: QVBoxLayout
50
49
  """
50
+ nodes = self.window.ui.nodes
51
+ ctrl = self.window.controller
52
+
51
53
  # new
52
- self.window.ui.nodes['assistants.new'] = QPushButton(QIcon(":/icons/add.svg"), "")
53
- self.window.ui.nodes['assistants.new'].clicked.connect(
54
- lambda: self.window.controller.assistant.editor.edit())
54
+ nodes['assistants.new'] = QPushButton(QIcon(":/icons/add.svg"), "")
55
+ _cb_new = ctrl.assistant.editor.edit
56
+ nodes['assistants.new'].clicked.connect(lambda checked=False, cb=_cb_new: cb())
55
57
 
56
58
  # import
57
- self.window.ui.nodes['assistants.import'] = QPushButton(trans('assistant.import'))
58
- self.window.ui.nodes['assistants.import'].clicked.connect(
59
- lambda: self.window.controller.assistant.batch.import_assistants()
60
- )
59
+ nodes['assistants.import'] = QPushButton(trans('assistant.import'))
60
+ _cb_import = ctrl.assistant.batch.import_assistants
61
+ nodes['assistants.import'].clicked.connect(lambda checked=False, cb=_cb_import: cb())
61
62
 
62
63
  # label
63
- self.window.ui.nodes['assistants.label'] = TitleLabel(trans("toolbox.assistants.label"))
64
+ nodes['assistants.label'] = TitleLabel(trans("toolbox.assistants.label"))
64
65
 
65
66
  # header
66
67
  header = QHBoxLayout()
67
- header.addWidget(self.window.ui.nodes['assistants.label'])
68
+ header.addWidget(nodes['assistants.label'])
68
69
  header.addStretch(1)
69
-
70
- header.addWidget(self.window.ui.nodes['assistants.new'], alignment=Qt.AlignRight)
71
- header.addWidget(self.window.ui.nodes['assistants.import'], alignment=Qt.AlignRight)
70
+ header.addWidget(nodes['assistants.new'], alignment=Qt.AlignRight)
71
+ header.addWidget(nodes['assistants.import'], alignment=Qt.AlignRight)
72
72
  header.setContentsMargins(5, 0, 0, 0)
73
73
  header_widget = QWidget()
74
74
  header_widget.setLayout(header)
75
75
 
76
76
  # list
77
- self.window.ui.nodes[self.id] = AssistantList(self.window, self.id)
78
- self.window.ui.nodes[self.id].selection_locked = self.window.controller.assistant.change_locked
79
- self.window.ui.nodes[self.id].setMinimumWidth(40)
77
+ nodes[self.id] = AssistantList(self.window, self.id)
78
+ nodes[self.id].selection_locked = ctrl.assistant.change_locked
79
+ nodes[self.id].setMinimumWidth(40)
80
80
 
81
- self.window.ui.nodes['tip.toolbox.assistants'] = HelpLabel(trans('tip.toolbox.assistants'), self.window)
82
- self.window.ui.nodes['tip.toolbox.assistants'].setAlignment(Qt.AlignCenter)
81
+ nodes['tip.toolbox.assistants'] = HelpLabel(trans('tip.toolbox.assistants'), self.window)
82
+ nodes['tip.toolbox.assistants'].setAlignment(Qt.AlignCenter)
83
83
 
84
84
  # rows
85
85
  layout = QVBoxLayout()
86
86
  layout.addWidget(header_widget)
87
- layout.addWidget(self.window.ui.nodes[self.id])
88
- layout.addWidget(self.window.ui.nodes['tip.toolbox.assistants'])
87
+ layout.addWidget(nodes[self.id])
88
+ layout.addWidget(nodes['tip.toolbox.assistants'])
89
89
  layout.setContentsMargins(2, 5, 5, 5)
90
90
 
91
91
  # model
92
- self.window.ui.models[self.id] = self.create_model(self.window)
93
- self.window.ui.nodes[self.id].setModel(self.window.ui.models[self.id])
92
+ self.window.ui.models[self.id] = self.create_model(nodes[self.id])
93
+ nodes[self.id].setModel(self.window.ui.models[self.id])
94
94
 
95
95
  return layout
96
96
 
@@ -109,18 +109,22 @@ class Assistants:
109
109
 
110
110
  :param data: Data to update
111
111
  """
112
- # store previous selection
113
- self.window.ui.nodes[self.id].backup_selection()
114
-
115
- self.window.ui.models[self.id].removeRows(0, self.window.ui.models[self.id].rowCount())
116
- i = 0
117
- for n in data:
118
- self.window.ui.models[self.id].insertRow(i)
119
- name = data[n].name
120
- index = self.window.ui.models[self.id].index(i, 0)
121
- self.window.ui.models[self.id].setData(index, "ID: " + data[n].id, QtCore.Qt.ToolTipRole)
122
- self.window.ui.models[self.id].setData(self.window.ui.models[self.id].index(i, 0), name)
123
- i += 1
124
-
125
- # restore previous selection
126
- self.window.ui.nodes[self.id].restore_selection()
112
+ view = self.window.ui.nodes[self.id]
113
+ model = self.window.ui.models[self.id]
114
+
115
+ view.backup_selection()
116
+ view.setUpdatesEnabled(False)
117
+ try:
118
+ with QtCore.QSignalBlocker(model):
119
+ model.setRowCount(0)
120
+ count = len(data)
121
+ if count:
122
+ model.setRowCount(count)
123
+ for i, item in enumerate(data.values()):
124
+ index = model.index(i, 0)
125
+ model.setData(index, "ID: " + item.id, QtCore.Qt.ToolTipRole)
126
+ model.setData(index, item.name)
127
+ finally:
128
+ view.setUpdatesEnabled(True)
129
+
130
+ view.restore_selection()
@@ -6,14 +6,13 @@
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.26 18:00:00 #
9
+ # Updated Date: 2025.08.24 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
- from PySide6.QtWidgets import QVBoxLayout, QHBoxLayout, QWidget, QComboBox
12
+ from PySide6.QtWidgets import QHBoxLayout, QWidget, QComboBox
13
13
 
14
14
  from pygpt_net.ui.widget.element.labels import TitleLabel
15
15
  from pygpt_net.utils import trans
16
- import pygpt_net.icons_rc
17
16
 
18
17
 
19
18
  class ComputerEnv:
@@ -33,36 +32,46 @@ class ComputerEnv:
33
32
  :return: QWidget
34
33
  """
35
34
  layout = self.setup_env()
36
- self.window.ui.nodes['env.widget'] = QWidget()
37
- self.window.ui.nodes['env.widget'].setLayout(layout)
38
- return self.window.ui.nodes['env.widget']
35
+ nodes = self.window.ui.nodes
36
+ widget = QWidget()
37
+ widget.setLayout(layout)
38
+ nodes['env.widget'] = widget
39
+ return widget
39
40
 
40
- def setup_env(self) -> QVBoxLayout:
41
+ def _on_env_index_changed(self, index: int) -> None:
42
+ nodes = self.window.ui.nodes
43
+ cbox = nodes.get(self.id)
44
+ if cbox is None:
45
+ return
46
+ data = cbox.itemData(index)
47
+ self.window.controller.ui.on_computer_env_changed(data)
48
+
49
+ def setup_env(self) -> QHBoxLayout:
41
50
  """
42
51
  Setup list of environments
43
52
 
44
53
  :return: QVBoxLayout
45
54
  """
46
55
 
47
- # label
48
- self.window.ui.nodes['env.label'] = TitleLabel(trans("toolbox.env.label"))
56
+ nodes = self.window.ui.nodes
57
+ label = TitleLabel(trans("toolbox.env.label"))
58
+ nodes['env.label'] = label
49
59
 
50
- # list
51
- self.window.ui.nodes[self.id] = QComboBox()
52
- self.window.ui.nodes[self.id].addItem("Browser", "browser")
53
- self.window.ui.nodes[self.id].addItem("Windows", "windows")
54
- self.window.ui.nodes[self.id].addItem("Linux", "linux")
55
- self.window.ui.nodes[self.id].addItem("Mac", "mac")
56
- self.window.ui.nodes[self.id].setMinimumWidth(40)
60
+ cbox = QComboBox()
61
+ for text, data in (
62
+ ("Browser", "browser"),
63
+ ("Windows", "windows"),
64
+ ("Linux", "linux"),
65
+ ("Mac", "mac"),
66
+ ):
67
+ cbox.addItem(text, data)
68
+ cbox.setMinimumWidth(40)
57
69
 
58
- # on change signal
59
- self.window.ui.nodes[self.id].currentIndexChanged.connect(
60
- lambda index: self.window.controller.ui.on_computer_env_changed(
61
- self.window.ui.nodes[self.id].itemData(index)))
70
+ cbox.currentIndexChanged.connect(self._on_env_index_changed)
71
+ nodes[self.id] = cbox
62
72
 
63
- # rows
64
73
  layout = QHBoxLayout()
65
- layout.addWidget(self.window.ui.nodes['env.label'], 0) # label
66
- layout.addWidget(self.window.ui.nodes[self.id], 1) # combobox
74
+ layout.addWidget(label, 0)
75
+ layout.addWidget(cbox, 1)
67
76
  layout.setContentsMargins(2, 5, 5, 5)
68
77
  return layout
@@ -58,7 +58,7 @@ class Footer:
58
58
 
59
59
  # bottom
60
60
  option = dict(self.window.controller.settings.editor.get_options()["temperature"])
61
- self.window.ui.nodes['temperature.label'] = QLabel(trans("toolbox.temperature.label"))
61
+ self.window.ui.nodes['temperature.label'] = QLabel(trans("toolbox.temperature.label"), self.window)
62
62
  self.window.ui.config['global']['current_temperature'] = \
63
63
  OptionSlider(self.window, 'global', 'current_temperature', option)
64
64
  self.window.ui.add_hook("update.global.current_temperature", self.window.controller.mode.hook_global_temperature)
@@ -68,7 +68,8 @@ class Footer:
68
68
  self.window.ui.nodes['voice.control.btn'].setVisible(False)
69
69
 
70
70
  # per mode options
71
- rows = QVBoxLayout()
71
+ widget = QWidget(self.window)
72
+ rows = QVBoxLayout(widget)
72
73
  # rows.addWidget(self.window.ui.nodes['temperature.label'])
73
74
  # rows.addWidget(self.window.ui.config['global']['current_temperature'])
74
75
  rows.addWidget(self.agent.setup())
@@ -83,21 +84,20 @@ class Footer:
83
84
  self.window.ui.nodes['layout.split'] = ToggleLabel(trans('layout.split'), label_position="left",
84
85
  icon=":/icons/split_screen.svg",
85
86
  parent=self.window)
86
- self.window.ui.nodes['layout.split'].box.stateChanged.connect(
87
- lambda: self.window.controller.ui.tabs.toggle_split_screen(self.window.ui.nodes['layout.split'].box.isChecked())
87
+ self.window.ui.nodes['layout.split'].box.toggled.connect(
88
+ self.window.controller.ui.tabs.toggle_split_screen
88
89
  )
89
- split_layout = QHBoxLayout()
90
+ split_widget = QWidget(widget)
91
+ split_layout = QHBoxLayout(split_widget)
90
92
 
91
- split_layout.addWidget(QLabel(""))
93
+ split_layout.addWidget(QLabel("", split_widget))
92
94
  split_layout.addStretch(1)
93
95
  split_layout.addWidget(self.window.ui.nodes['layout.split'])
94
96
  split_layout.setContentsMargins(5, 0, 15, 0)
95
- split_widget = QWidget()
96
- split_widget.setLayout(split_layout)
97
97
  rows.addWidget(split_widget)
98
98
 
99
99
  # logo
100
- logo_button = self.setup_logo()
100
+ # logo_button = self.setup_logo()
101
101
 
102
102
  # bottom (options and logo)
103
103
  # bottom = QHBoxLayout()
@@ -113,9 +113,6 @@ class Footer:
113
113
  # layout.addLayout(names_layout)
114
114
  # layout.addWidget(bottom_widget)
115
115
 
116
- widget = QWidget()
117
- widget.setLayout(rows)
118
-
119
116
  return widget
120
117
 
121
118
  def setup_name_input(self, id: str, title: str) -> QVBoxLayout:
@@ -127,7 +124,7 @@ class Footer:
127
124
  :return: QVBoxLayout
128
125
  """
129
126
  label_key = 'toolbox.' + id + '.label'
130
- self.window.ui.nodes[label_key] = QLabel(title)
127
+ self.window.ui.nodes[label_key] = QLabel(title, self.window)
131
128
  self.window.ui.nodes[id] = NameInput(self.window, id)
132
129
 
133
130
  layout = QVBoxLayout()
@@ -144,11 +141,11 @@ class Footer:
144
141
  """
145
142
  path = os.path.abspath(os.path.join(self.window.core.config.get_app_path(), 'data', 'logo.png'))
146
143
 
147
- button = QPushButton()
144
+ button = QPushButton(self.window)
148
145
  button.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding)
149
146
  button.setIcon(QIcon(path))
150
147
  button.setIconSize(QSize(100, 28))
151
148
  button.setFlat(True)
152
- button.clicked.connect(lambda: self.window.controller.dialogs.info.goto_website())
149
+ button.clicked.connect(self.window.controller.dialogs.info.goto_website)
153
150
 
154
- return button
151
+ return button
@@ -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.01.19 19:00:00 #
9
+ # Updated Date: 2025.08.24 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from PySide6.QtWidgets import QVBoxLayout, QLabel, QHBoxLayout, QWidget, QCheckBox
@@ -31,7 +31,6 @@ class Image:
31
31
  :return: QWidget
32
32
  :rtype: QWidget
33
33
  """
34
- # img variants
35
34
  option = {
36
35
  "type": "int",
37
36
  "slider": True,
@@ -42,32 +41,30 @@ class Image:
42
41
  "value": 1,
43
42
  "multiplier": 1,
44
43
  }
45
- self.window.ui.nodes['img_variants.label'] = QLabel(trans("toolbox.img_variants.label"))
46
- self.window.ui.config['global']['img_variants'] = \
47
- OptionSlider(self.window, 'global', 'img_variants', option)
48
44
 
49
- # img raw
50
- self.window.ui.config['global']['img_raw'] = QCheckBox(trans("img.raw"))
51
- self.window.ui.config['global']['img_raw'].stateChanged.connect(
52
- lambda:
53
- self.window.controller.chat.common.img_toggle_raw(self.window.ui.config['global']['img_raw'].isChecked()))
45
+ ui = self.window.ui
46
+ conf_global = ui.config['global']
54
47
 
55
- # label
56
- label = QLabel(trans("toolbox.img_variants.label"))
48
+ container = QWidget()
49
+ ui.nodes['dalle.options'] = container
50
+
51
+ label_text = trans("toolbox.img_variants.label")
52
+ ui.nodes['img_variants.label'] = QLabel(label_text, parent=container)
53
+
54
+ conf_global['img_variants'] = OptionSlider(self.window, 'global', 'img_variants', option)
55
+ conf_global['img_raw'] = QCheckBox(trans("img.raw"), parent=container)
56
+ conf_global['img_raw'].toggled.connect(self.window.controller.chat.common.img_toggle_raw)
57
57
 
58
- # options
59
58
  cols = QHBoxLayout()
60
- cols.addWidget(self.window.ui.config['global']['img_raw'])
61
- cols.addWidget(self.window.ui.config['global']['img_variants'])
59
+ cols.addWidget(conf_global['img_raw'])
60
+ cols.addWidget(conf_global['img_variants'])
62
61
 
63
- # rows
64
62
  rows = QVBoxLayout()
65
- rows.addWidget(label)
63
+ rows.addWidget(ui.nodes['img_variants.label'])
66
64
  rows.addLayout(cols)
67
65
  rows.setContentsMargins(2, 5, 5, 5)
68
66
 
69
- self.window.ui.nodes['dalle.options'] = QWidget()
70
- self.window.ui.nodes['dalle.options'].setLayout(rows)
71
- self.window.ui.nodes['dalle.options'].setContentsMargins(2, 0, 0, 0)
67
+ container.setLayout(rows)
68
+ container.setContentsMargins(2, 0, 0, 0)
72
69
 
73
- return self.window.ui.nodes['dalle.options']
70
+ return container
@@ -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.08.27 22:00:00 #
9
+ # Updated Date: 2025.08.24 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from PySide6.QtGui import QStandardItemModel, Qt, QIcon
@@ -17,7 +17,6 @@ from pygpt_net.ui.widget.lists.index import IndexList
17
17
  from pygpt_net.ui.widget.lists.index_combo import IndexCombo
18
18
  from pygpt_net.ui.widget.lists.llama_mode_combo import LlamaModeCombo
19
19
  from pygpt_net.utils import trans
20
- import pygpt_net.icons_rc
21
20
 
22
21
 
23
22
  class Indexes:
@@ -29,6 +28,8 @@ class Indexes:
29
28
  """
30
29
  self.window = window
31
30
  self.id = 'indexes'
31
+ self._settings_icon = QIcon(":/icons/settings.svg")
32
+ self._last_combo_signature = None
32
33
 
33
34
  def setup(self) -> QWidget:
34
35
  """
@@ -37,12 +38,13 @@ class Indexes:
37
38
  :return: QWidget
38
39
  """
39
40
  layout = self.setup_idx()
41
+ nodes = self.window.ui.nodes
40
42
 
41
- self.window.ui.nodes['indexes.widget'] = QWidget()
42
- self.window.ui.nodes['indexes.widget'].setLayout(layout)
43
- self.window.ui.nodes['indexes.widget'].setMinimumHeight(150)
43
+ nodes['indexes.widget'] = QWidget()
44
+ nodes['indexes.widget'].setLayout(layout)
45
+ nodes['indexes.widget'].setMinimumHeight(150)
44
46
 
45
- return self.window.ui.nodes['indexes.widget']
47
+ return nodes['indexes.widget']
46
48
 
47
49
  def setup_idx(self) -> QVBoxLayout:
48
50
  """
@@ -50,40 +52,31 @@ class Indexes:
50
52
 
51
53
  :return: QVBoxLayout
52
54
  """
53
- # new
54
- self.window.ui.nodes['indexes.new'] = QPushButton(QIcon(":/icons/settings.svg"), "")
55
- self.window.ui.nodes['indexes.new'].clicked.connect(
56
- lambda: self.window.controller.settings.open_section('llama-index'))
55
+ nodes = self.window.ui.nodes
56
+ nodes['indexes.new'] = QPushButton(self._settings_icon, "")
57
+ nodes['indexes.new'].clicked.connect(self._open_llama_index_settings)
57
58
 
58
- # label
59
- self.window.ui.nodes['indexes.label'] = TitleLabel(trans("toolbox.indexes.label"))
59
+ nodes['indexes.label'] = TitleLabel(trans("toolbox.indexes.label"))
60
60
 
61
- # header
62
61
  header = QHBoxLayout()
63
- header.addWidget(self.window.ui.nodes['indexes.label'])
62
+ header.addWidget(nodes['indexes.label'])
64
63
  header.addStretch(1)
65
- header.addWidget(self.window.ui.nodes['indexes.new'], alignment=Qt.AlignRight)
64
+ header.addWidget(nodes['indexes.new'], alignment=Qt.AlignRight)
66
65
  header.setContentsMargins(5, 0, 0, 0)
67
- header_widget = QWidget()
68
- header_widget.setLayout(header)
69
66
 
70
- # list
71
- self.window.ui.nodes[self.id] = IndexList(self.window, self.id)
72
- self.window.ui.nodes[self.id].selection_locked = self.window.controller.idx.change_locked
73
- self.window.ui.nodes[self.id].setMinimumWidth(40)
67
+ nodes[self.id] = IndexList(self.window, self.id)
68
+ nodes[self.id].selection_locked = self.window.controller.idx.change_locked
69
+ nodes[self.id].setMinimumWidth(40)
74
70
 
75
- self.window.ui.nodes['tip.toolbox.indexes'] = HelpLabel(trans('tip.toolbox.indexes'), self.window)
71
+ nodes['tip.toolbox.indexes'] = HelpLabel(trans('tip.toolbox.indexes'), self.window)
76
72
 
77
- # rows
78
73
  layout = QVBoxLayout()
79
- layout.addWidget(header_widget)
74
+ layout.addLayout(header)
80
75
  layout.addWidget(self.window.ui.nodes[self.id])
81
76
  layout.setContentsMargins(2, 5, 5, 5)
82
- #layout.addWidget(self.window.ui.nodes['tip.toolbox.indexes'])
83
77
 
84
- # model
85
78
  self.window.ui.models[self.id] = self.create_model(self.window)
86
- self.window.ui.nodes[self.id].setModel(self.window.ui.models[self.id])
79
+ nodes[self.id].setModel(self.window.ui.models[self.id])
87
80
 
88
81
  return layout
89
82
 
@@ -94,100 +87,69 @@ class Indexes:
94
87
  :return: QWidget
95
88
  :rtype: QWidget
96
89
  """
97
- # idx query only
98
- """
99
- self.window.ui.config['global']['llama.idx.raw'] = QCheckBox(trans("idx.query.raw"))
100
- self.window.ui.config['global']['llama.idx.raw'].stateChanged.connect(
101
- lambda: self.window.controller.idx.common.toggle_raw(
102
- self.window.ui.config['global']['llama.idx.raw'].isChecked()
103
- )
104
- )
105
- """
106
-
107
- # label
108
- # label = QLabel(trans("toolbox.llama_index.label"))
109
-
110
- # add options
111
- # cols = QHBoxLayout()
112
- # cols.addWidget(self.window.ui.config['global']['llama.idx.raw'])
113
-
114
- # indexes combo
90
+ nodes = self.window.ui.nodes
115
91
  option = {
116
92
  "name": "current_index",
117
93
  "label": "toolbox.llama_index.current_index",
118
94
  "keys": [],
119
95
  "value": None,
120
96
  }
121
- self.window.ui.nodes['indexes.select'] = IndexCombo(
97
+ nodes['indexes.select'] = IndexCombo(
122
98
  self.window,
123
99
  'global',
124
100
  'current_index',
125
101
  option,
126
102
  )
127
- self.window.ui.nodes['indexes.select'].setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
103
+ nodes['indexes.select'].setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
128
104
 
129
- # mode select combo
130
105
  option = {
131
106
  "name": "llama.idx.mode",
132
107
  "label": "toolbox.llama_index.mode",
133
108
  "keys": self.window.controller.idx.get_modes_keys(),
134
109
  "value": "chat",
135
110
  }
136
- self.window.ui.nodes['llama_index.mode.select'] = LlamaModeCombo(
111
+ nodes['llama_index.mode.select'] = LlamaModeCombo(
137
112
  self.window,
138
113
  'global',
139
114
  'llama.idx.mode',
140
115
  option,
141
116
  )
142
- self.window.ui.nodes['indexes.select'].setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
143
- self.window.ui.nodes['llama_index.mode.select'].setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
144
-
145
- # tip
146
- # self.window.ui.nodes['tip.toolbox.indexes'] = HelpLabel(trans('tip.toolbox.indexes'), self.window)
117
+ nodes['llama_index.mode.select'].setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
147
118
 
148
- # new
149
- self.window.ui.nodes['indexes.new'] = QPushButton(QIcon(":/icons/settings.svg"), "")
150
- self.window.ui.nodes['indexes.new'].clicked.connect(
151
- lambda: self.window.controller.settings.open_section('llama-index'))
119
+ nodes['indexes.new'] = QPushButton(self._settings_icon, "")
120
+ nodes['indexes.new'].clicked.connect(self._open_llama_index_settings)
152
121
 
153
- # labels
154
- self.window.ui.nodes['indexes.label'] = TitleLabel(trans("toolbox.indexes.label"))
155
- self.window.ui.nodes['llama_index.mode.label'] = TitleLabel(trans("toolbox.llama_index.mode.label"))
122
+ nodes['indexes.label'] = TitleLabel(trans("toolbox.indexes.label"))
123
+ nodes['llama_index.mode.label'] = TitleLabel(trans("toolbox.llama_index.mode.label"))
156
124
 
157
- # idx select combo
158
125
  idx_layout = QHBoxLayout()
159
- idx_layout.addWidget(self.window.ui.nodes['indexes.label'])
160
- idx_layout.addWidget(self.window.ui.nodes['indexes.select'])
161
- idx_layout.addWidget(self.window.ui.nodes['indexes.new'], alignment=Qt.AlignRight)
126
+ idx_layout.addWidget(nodes['indexes.label'])
127
+ idx_layout.addWidget(nodes['indexes.select'])
128
+ idx_layout.addWidget(nodes['indexes.new'], alignment=Qt.AlignRight)
162
129
  idx_layout.setContentsMargins(0, 0, 0, 10)
163
130
  idx_widget = QWidget()
164
131
  idx_widget.setLayout(idx_layout)
165
132
  idx_widget.setMinimumHeight(55)
166
133
  idx_widget.setMinimumWidth(275)
167
134
 
168
- # mode select combo
169
135
  mode_layout = QHBoxLayout()
170
- mode_layout.addWidget(self.window.ui.nodes['llama_index.mode.label'])
171
- mode_layout.addWidget(self.window.ui.nodes['llama_index.mode.select'])
136
+ mode_layout.addWidget(nodes['llama_index.mode.label'])
137
+ mode_layout.addWidget(nodes['llama_index.mode.select'])
172
138
  mode_layout.setContentsMargins(0, 0, 0, 10)
173
139
  mode_widget = QWidget()
174
140
  mode_widget.setLayout(mode_layout)
175
141
  mode_widget.setMinimumHeight(55)
176
142
  mode_widget.setMinimumWidth(275)
177
143
 
178
- # rows
179
144
  rows = QVBoxLayout()
180
- # rows.addWidget(label)
181
145
  rows.addWidget(idx_widget)
182
146
  rows.addWidget(mode_widget)
183
- # rows.addLayout(cols) # raw option
184
- # rows.addWidget(self.window.ui.nodes['tip.toolbox.indexes'])
185
147
 
186
- self.window.ui.nodes['idx.options'] = QWidget()
187
- self.window.ui.nodes['idx.options'].setLayout(rows)
188
- self.window.ui.nodes['idx.options'].setContentsMargins(0, 0, 0, 0)
148
+ nodes['idx.options'] = QWidget()
149
+ nodes['idx.options'].setLayout(rows)
150
+ nodes['idx.options'].setContentsMargins(0, 0, 0, 0)
189
151
 
190
- return self.window.ui.nodes['idx.options']
152
+ return nodes['idx.options']
191
153
 
192
154
  def create_model(self, parent) -> QStandardItemModel:
193
155
  """
@@ -204,19 +166,11 @@ class Indexes:
204
166
 
205
167
  :param data: Data to update
206
168
  """
207
- # combo box
208
- combo_keys = []
209
- combo_keys.append({ # add empty
210
- "-": "---"
211
- })
212
- for item in data:
213
- name = item['name']
214
- if name == "":
215
- name = item['id']
216
- combo_keys.append({
217
- item['id']: name
218
- })
219
- self.window.ui.nodes['indexes.select'].set_keys(combo_keys)
169
+ combo_keys = [{"-": "---"}] + [{item['id']: (item['name'] or item['id'])} for item in data]
170
+ signature = tuple((item['id'], (item['name'] or item['id'])) for item in data)
171
+ if self._last_combo_signature != signature:
172
+ self.window.ui.nodes['indexes.select'].set_keys(combo_keys)
173
+ self._last_combo_signature = signature
220
174
  """
221
175
  # store previous selection
222
176
  self.window.ui.nodes[self.id].backup_selection()
@@ -234,3 +188,6 @@ class Indexes:
234
188
  # restore previous selection
235
189
  self.window.ui.nodes[self.id].restore_selection()
236
190
  """
191
+
192
+ def _open_llama_index_settings(self):
193
+ self.window.controller.settings.open_section('llama-index')
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.11.17 03:00:00 #
9
+ # Updated Date: 2025.08.24 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from PySide6.QtWidgets import QVBoxLayout, QWidget
@@ -25,6 +25,8 @@ class Mode:
25
25
  """
26
26
  self.window = window
27
27
  self.id = 'prompt.mode'
28
+ self._label_key = f'{self.id}.label'
29
+ self._label_trans_key = 'toolbox.mode.label'
28
30
 
29
31
  def setup(self) -> QWidget:
30
32
  """
@@ -42,18 +44,29 @@ class Mode:
42
44
 
43
45
  :return: QVBoxLayout
44
46
  """
45
- label_key = self.id + '.label'
46
- self.window.ui.nodes[self.id] = ModeCombo(self.window, self.id)
47
- self.window.ui.nodes[label_key] = TitleLabel(trans("toolbox.mode.label"))
47
+ ui_nodes = self.window.ui.nodes
48
+
49
+ label = ui_nodes.get(self._label_key)
50
+ label_text = trans(self._label_trans_key)
51
+ if label is None:
52
+ label = TitleLabel(label_text)
53
+ ui_nodes[self._label_key] = label
54
+ else:
55
+ label.setText(label_text)
56
+
57
+ combo = ui_nodes.get(self.id)
58
+ if combo is None:
59
+ combo = ModeCombo(self.window, self.id)
60
+ ui_nodes[self.id] = combo
48
61
 
49
62
  header_layout = QVBoxLayout()
50
- header_layout.addWidget(self.window.ui.nodes[label_key])
63
+ header_layout.addWidget(label)
51
64
  header_layout.setContentsMargins(5, 5, 0, 0)
52
65
 
53
66
  layout = QVBoxLayout()
54
67
  layout.addLayout(header_layout)
55
- layout.addWidget(self.window.ui.nodes[self.id])
68
+ layout.addWidget(combo)
56
69
  layout.addStretch()
57
70
  layout.setContentsMargins(2, 5, 5, 5)
58
71
 
59
- return layout
72
+ return layout