pygpt-net 2.6.1__py3-none-any.whl → 2.6.6__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 (131) hide show
  1. pygpt_net/CHANGELOG.txt +23 -0
  2. pygpt_net/__init__.py +3 -3
  3. pygpt_net/app.py +20 -1
  4. pygpt_net/config.py +55 -65
  5. pygpt_net/controller/__init__.py +5 -2
  6. pygpt_net/controller/calendar/note.py +101 -126
  7. pygpt_net/controller/chat/chat.py +38 -35
  8. pygpt_net/controller/chat/render.py +154 -214
  9. pygpt_net/controller/chat/response.py +5 -3
  10. pygpt_net/controller/chat/stream.py +92 -27
  11. pygpt_net/controller/config/config.py +39 -42
  12. pygpt_net/controller/config/field/checkbox.py +16 -12
  13. pygpt_net/controller/config/field/checkbox_list.py +36 -31
  14. pygpt_net/controller/config/field/cmd.py +51 -57
  15. pygpt_net/controller/config/field/combo.py +33 -16
  16. pygpt_net/controller/config/field/dictionary.py +48 -55
  17. pygpt_net/controller/config/field/input.py +50 -32
  18. pygpt_net/controller/config/field/slider.py +40 -45
  19. pygpt_net/controller/config/field/textarea.py +20 -6
  20. pygpt_net/controller/config/placeholder.py +110 -231
  21. pygpt_net/controller/ctx/common.py +48 -48
  22. pygpt_net/controller/ctx/ctx.py +91 -132
  23. pygpt_net/controller/lang/mapping.py +57 -95
  24. pygpt_net/controller/lang/plugins.py +64 -55
  25. pygpt_net/controller/lang/settings.py +39 -38
  26. pygpt_net/controller/layout/layout.py +176 -109
  27. pygpt_net/controller/mode/mode.py +88 -85
  28. pygpt_net/controller/model/model.py +73 -73
  29. pygpt_net/controller/plugins/plugins.py +209 -223
  30. pygpt_net/controller/plugins/presets.py +54 -55
  31. pygpt_net/controller/plugins/settings.py +54 -69
  32. pygpt_net/controller/presets/editor.py +33 -88
  33. pygpt_net/controller/presets/experts.py +20 -1
  34. pygpt_net/controller/presets/presets.py +293 -298
  35. pygpt_net/controller/settings/profile.py +16 -4
  36. pygpt_net/controller/theme/theme.py +72 -81
  37. pygpt_net/controller/ui/mode.py +118 -186
  38. pygpt_net/controller/ui/tabs.py +69 -90
  39. pygpt_net/controller/ui/ui.py +47 -56
  40. pygpt_net/controller/ui/vision.py +24 -23
  41. pygpt_net/core/agents/runner.py +15 -7
  42. pygpt_net/core/bridge/bridge.py +5 -5
  43. pygpt_net/core/command/command.py +149 -219
  44. pygpt_net/core/ctx/ctx.py +94 -146
  45. pygpt_net/core/debug/debug.py +48 -58
  46. pygpt_net/core/experts/experts.py +3 -3
  47. pygpt_net/core/models/models.py +74 -112
  48. pygpt_net/core/modes/modes.py +13 -21
  49. pygpt_net/core/plugins/plugins.py +154 -177
  50. pygpt_net/core/presets/presets.py +103 -176
  51. pygpt_net/core/render/web/body.py +217 -215
  52. pygpt_net/core/render/web/renderer.py +330 -474
  53. pygpt_net/core/text/utils.py +28 -44
  54. pygpt_net/core/tokens/tokens.py +104 -203
  55. pygpt_net/data/config/config.json +3 -3
  56. pygpt_net/data/config/models.json +3 -3
  57. pygpt_net/data/locale/locale.de.ini +2 -0
  58. pygpt_net/data/locale/locale.en.ini +2 -0
  59. pygpt_net/data/locale/locale.es.ini +2 -0
  60. pygpt_net/data/locale/locale.fr.ini +2 -0
  61. pygpt_net/data/locale/locale.it.ini +2 -0
  62. pygpt_net/data/locale/locale.pl.ini +3 -1
  63. pygpt_net/data/locale/locale.uk.ini +2 -0
  64. pygpt_net/data/locale/locale.zh.ini +2 -0
  65. pygpt_net/item/ctx.py +141 -139
  66. pygpt_net/plugin/agent/plugin.py +2 -1
  67. pygpt_net/plugin/audio_output/plugin.py +5 -2
  68. pygpt_net/plugin/base/plugin.py +101 -85
  69. pygpt_net/plugin/bitbucket/__init__.py +12 -0
  70. pygpt_net/plugin/bitbucket/config.py +267 -0
  71. pygpt_net/plugin/bitbucket/plugin.py +126 -0
  72. pygpt_net/plugin/bitbucket/worker.py +569 -0
  73. pygpt_net/plugin/cmd_code_interpreter/plugin.py +3 -2
  74. pygpt_net/plugin/cmd_custom/plugin.py +3 -2
  75. pygpt_net/plugin/cmd_files/plugin.py +3 -2
  76. pygpt_net/plugin/cmd_history/plugin.py +3 -2
  77. pygpt_net/plugin/cmd_mouse_control/plugin.py +5 -2
  78. pygpt_net/plugin/cmd_serial/plugin.py +3 -2
  79. pygpt_net/plugin/cmd_system/plugin.py +3 -6
  80. pygpt_net/plugin/cmd_web/plugin.py +3 -2
  81. pygpt_net/plugin/experts/plugin.py +2 -2
  82. pygpt_net/plugin/facebook/__init__.py +12 -0
  83. pygpt_net/plugin/facebook/config.py +359 -0
  84. pygpt_net/plugin/facebook/plugin.py +113 -0
  85. pygpt_net/plugin/facebook/worker.py +698 -0
  86. pygpt_net/plugin/github/__init__.py +12 -0
  87. pygpt_net/plugin/github/config.py +441 -0
  88. pygpt_net/plugin/github/plugin.py +126 -0
  89. pygpt_net/plugin/github/worker.py +674 -0
  90. pygpt_net/plugin/google/__init__.py +12 -0
  91. pygpt_net/plugin/google/config.py +367 -0
  92. pygpt_net/plugin/google/plugin.py +126 -0
  93. pygpt_net/plugin/google/worker.py +826 -0
  94. pygpt_net/plugin/idx_llama_index/plugin.py +3 -2
  95. pygpt_net/plugin/mailer/plugin.py +3 -5
  96. pygpt_net/plugin/openai_vision/plugin.py +3 -2
  97. pygpt_net/plugin/real_time/plugin.py +52 -60
  98. pygpt_net/plugin/slack/__init__.py +12 -0
  99. pygpt_net/plugin/slack/config.py +349 -0
  100. pygpt_net/plugin/slack/plugin.py +115 -0
  101. pygpt_net/plugin/slack/worker.py +639 -0
  102. pygpt_net/plugin/telegram/__init__.py +12 -0
  103. pygpt_net/plugin/telegram/config.py +308 -0
  104. pygpt_net/plugin/telegram/plugin.py +117 -0
  105. pygpt_net/plugin/telegram/worker.py +563 -0
  106. pygpt_net/plugin/twitter/__init__.py +12 -0
  107. pygpt_net/plugin/twitter/config.py +491 -0
  108. pygpt_net/plugin/twitter/plugin.py +125 -0
  109. pygpt_net/plugin/twitter/worker.py +837 -0
  110. pygpt_net/provider/agents/llama_index/legacy/openai_assistant.py +35 -3
  111. pygpt_net/tools/code_interpreter/tool.py +0 -1
  112. pygpt_net/tools/translator/tool.py +1 -1
  113. pygpt_net/ui/base/config_dialog.py +86 -100
  114. pygpt_net/ui/base/context_menu.py +48 -46
  115. pygpt_net/ui/dialog/preset.py +34 -77
  116. pygpt_net/ui/layout/ctx/ctx_list.py +10 -6
  117. pygpt_net/ui/layout/toolbox/presets.py +41 -41
  118. pygpt_net/ui/main.py +49 -31
  119. pygpt_net/ui/tray.py +61 -60
  120. pygpt_net/ui/widget/calendar/select.py +86 -70
  121. pygpt_net/ui/widget/lists/attachment.py +86 -44
  122. pygpt_net/ui/widget/lists/base_list_combo.py +85 -33
  123. pygpt_net/ui/widget/lists/context.py +135 -188
  124. pygpt_net/ui/widget/lists/preset.py +59 -61
  125. pygpt_net/ui/widget/textarea/web.py +161 -48
  126. pygpt_net/utils.py +8 -1
  127. {pygpt_net-2.6.1.dist-info → pygpt_net-2.6.6.dist-info}/METADATA +164 -2
  128. {pygpt_net-2.6.1.dist-info → pygpt_net-2.6.6.dist-info}/RECORD +131 -103
  129. {pygpt_net-2.6.1.dist-info → pygpt_net-2.6.6.dist-info}/LICENSE +0 -0
  130. {pygpt_net-2.6.1.dist-info → pygpt_net-2.6.6.dist-info}/WHEEL +0 -0
  131. {pygpt_net-2.6.1.dist-info → pygpt_net-2.6.6.dist-info}/entry_points.txt +0 -0
@@ -1,4 +1,4 @@
1
- # !/usr/bin/env python3
1
+ #!/usr/bin/env python3
2
2
  # -*- coding: utf-8 -*-
3
3
  # ================================================== #
4
4
  # This file is a part of PYGPT package #
@@ -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.09 19:00:00 #
9
+ # Updated Date: 2025.08.15 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from pygpt_net.core.types import (
@@ -40,204 +40,139 @@ class Mode:
40
40
 
41
41
  mode = self.window.core.config.data['mode']
42
42
 
43
- # presets
44
- if mode != MODE_ASSISTANT:
45
- self.window.ui.nodes['presets.widget'].setVisible(True)
46
- else:
47
- self.window.ui.nodes['presets.widget'].setVisible(False)
48
-
49
- if mode != MODE_COMPUTER:
50
- self.window.ui.nodes['env.widget'].setVisible(False)
51
- else:
52
- self.window.ui.nodes['env.widget'].setVisible(True)
53
-
54
- # presets: labels
55
- if mode == MODE_AGENT:
56
- self.window.ui.nodes['preset.agents.label'].setVisible(True)
57
- self.window.ui.nodes['preset.experts.label'].setVisible(False)
58
- self.window.ui.nodes['preset.presets.label'].setVisible(False)
59
- elif mode == MODE_AGENT_LLAMA:
60
- self.window.ui.nodes['preset.agents.label'].setVisible(True)
61
- self.window.ui.nodes['preset.experts.label'].setVisible(False)
62
- self.window.ui.nodes['preset.presets.label'].setVisible(False)
63
- elif mode == MODE_AGENT_OPENAI:
64
- self.window.ui.nodes['preset.agents.label'].setVisible(True)
65
- self.window.ui.nodes['preset.experts.label'].setVisible(False)
66
- self.window.ui.nodes['preset.presets.label'].setVisible(False)
67
- elif mode == MODE_EXPERT:
68
- self.window.ui.nodes['preset.agents.label'].setVisible(False)
69
- self.window.ui.nodes['preset.experts.label'].setVisible(True)
70
- self.window.ui.nodes['preset.presets.label'].setVisible(False)
71
- else:
72
- self.window.ui.nodes['preset.agents.label'].setVisible(False)
73
- self.window.ui.nodes['preset.experts.label'].setVisible(False)
74
- self.window.ui.nodes['preset.presets.label'].setVisible(True)
75
-
76
- # presets: experts
77
- if mode == MODE_EXPERT:
78
- self.window.ui.nodes['preset.editor.description'].setVisible(True)
79
- self.window.ui.nodes['preset.editor.remote_tools'].setVisible(True)
80
- else:
81
- self.window.ui.nodes['preset.editor.description'].setVisible(False)
82
- self.window.ui.nodes['preset.editor.remote_tools'].setVisible(False)
83
-
84
- if mode == MODE_COMPLETION:
85
- self.window.ui.nodes['preset.editor.user_name'].setVisible(True)
86
- else:
87
- self.window.ui.nodes['preset.editor.user_name'].setVisible(False)
88
-
89
- if mode == MODE_AGENT_OPENAI:
90
- self.window.ui.nodes['preset.editor.agent_provider_openai'].setVisible(True)
91
- else:
92
- self.window.ui.nodes['preset.editor.agent_provider_openai'].setVisible(False)
93
-
94
- # presets: editor
95
- if mode == MODE_AGENT:
96
- self.window.ui.nodes['preset.editor.temperature'].setVisible(True)
97
- self.window.ui.nodes['preset.editor.agent_llama'].setVisible(False)
98
- self.window.ui.nodes['preset.editor.agent_provider'].setVisible(False)
99
- self.window.ui.nodes['preset.editor.functions'].setVisible(False)
100
- self.window.ui.nodes['preset.editor.modes'].setVisible(False)
101
- self.window.ui.nodes['preset.editor.experts'].setVisible(True)
102
- self.window.ui.tabs['preset.editor.extra'].setTabText(0, trans("preset.prompt.agent"))
103
- # self.window.ui.nodes["preset.prompt.label"].setText(trans("preset.prompt.agent"))
104
- self.window.ui.nodes['preset.tool.function.label.all'].setVisible(False)
105
- self.window.ui.nodes['preset.tool.function.label.assistant'].setVisible(False)
106
- self.window.ui.nodes['preset.tool.function.label.agent_llama'].setVisible(False)
107
- elif mode == MODE_AGENT_LLAMA:
108
- self.window.ui.nodes['preset.editor.temperature'].setVisible(False)
109
- self.window.ui.nodes['preset.editor.agent_llama'].setVisible(True)
110
- self.window.ui.nodes['preset.editor.agent_provider'].setVisible(True)
111
- self.window.ui.nodes['preset.editor.functions'].setVisible(False)
112
- self.window.ui.nodes['preset.editor.modes'].setVisible(False)
113
- self.window.ui.nodes['preset.editor.experts'].setVisible(False)
114
- self.window.ui.tabs['preset.editor.extra'].setTabText(0, trans("preset.prompt.agent_llama"))
115
- # self.window.ui.nodes["preset.prompt.label"].setText(trans("preset.prompt.agent_llama"))
116
- self.window.ui.nodes['preset.tool.function.label.all'].setVisible(False)
117
- self.window.ui.nodes['preset.tool.function.label.assistant'].setVisible(False)
118
- self.window.ui.nodes['preset.tool.function.label.agent_llama'].setVisible(False)
119
- elif mode == MODE_AGENT_OPENAI:
120
- self.window.ui.nodes['preset.editor.temperature'].setVisible(False)
121
- self.window.ui.nodes['preset.editor.agent_llama'].setVisible(False)
122
- self.window.ui.nodes['preset.editor.agent_provider'].setVisible(False)
123
- self.window.ui.nodes['preset.editor.functions'].setVisible(False)
124
- self.window.ui.nodes['preset.editor.modes'].setVisible(False)
125
- self.window.ui.nodes['preset.editor.experts'].setVisible(True)
126
- self.window.ui.tabs['preset.editor.extra'].setTabText(0, trans("preset.prompt.agent_llama"))
127
- # self.window.ui.nodes["preset.prompt.label"].setText(trans("preset.prompt.agent_llama"))
128
- self.window.ui.nodes['preset.tool.function.label.all'].setVisible(False)
129
- self.window.ui.nodes['preset.tool.function.label.assistant'].setVisible(False)
130
- self.window.ui.nodes['preset.tool.function.label.agent_llama'].setVisible(False)
131
- else:
132
- self.window.ui.nodes['preset.editor.temperature'].setVisible(True)
133
- self.window.ui.nodes['preset.editor.agent_llama'].setVisible(False)
134
- self.window.ui.nodes['preset.editor.agent_provider'].setVisible(False)
135
- self.window.ui.nodes['preset.editor.functions'].setVisible(False)
136
- self.window.ui.nodes['preset.editor.modes'].setVisible(True)
137
- self.window.ui.nodes['preset.editor.experts'].setVisible(False)
138
- self.window.ui.tabs['preset.editor.extra'].setTabText(0, trans("preset.prompt"))
139
- # self.window.ui.nodes["preset.prompt.label"].setText(trans("preset.prompt"))
140
- self.window.ui.nodes['preset.tool.function.label.assistant'].setVisible(False)
141
- self.window.ui.nodes['preset.tool.function.label.agent_llama'].setVisible(False)
142
-
143
- if mode == MODE_ASSISTANT:
144
- self.window.ui.nodes['preset.tool.function.label.assistant'].setVisible(True)
145
- self.window.ui.nodes['preset.tool.function.label.all'].setVisible(False)
43
+ ui_nodes = self.window.ui.nodes
44
+ ui_tabs = self.window.ui.tabs
45
+ ui_menu = self.window.ui.menu
46
+ ctrl = self.window.controller
47
+ presets_editor = ctrl.presets.editor
48
+
49
+ is_assistant = mode == MODE_ASSISTANT
50
+ is_computer = mode == MODE_COMPUTER
51
+ is_agent = mode == MODE_AGENT
52
+ is_agent_llama = mode == MODE_AGENT_LLAMA
53
+ is_agent_openai = mode == MODE_AGENT_OPENAI
54
+ is_expert = mode == MODE_EXPERT
55
+ is_image = mode == MODE_IMAGE
56
+ is_llama_index = mode == MODE_LLAMA_INDEX
57
+ is_completion = mode == MODE_COMPLETION
58
+
59
+ if not is_assistant:
60
+ ui_nodes['presets.widget'].setVisible(True)
61
+ else:
62
+ ui_nodes['presets.widget'].setVisible(False)
63
+
64
+ if not is_computer:
65
+ ui_nodes['env.widget'].setVisible(False)
66
+ else:
67
+ ui_nodes['env.widget'].setVisible(True)
68
+
69
+ show_agents_label = is_agent or is_agent_llama or is_agent_openai
70
+ if show_agents_label:
71
+ ui_nodes['preset.agents.label'].setVisible(True)
72
+ ui_nodes['preset.experts.label'].setVisible(False)
73
+ ui_nodes['preset.presets.label'].setVisible(False)
74
+ elif is_expert:
75
+ ui_nodes['preset.agents.label'].setVisible(False)
76
+ ui_nodes['preset.experts.label'].setVisible(True)
77
+ ui_nodes['preset.presets.label'].setVisible(False)
78
+ else:
79
+ ui_nodes['preset.agents.label'].setVisible(False)
80
+ ui_nodes['preset.experts.label'].setVisible(False)
81
+ ui_nodes['preset.presets.label'].setVisible(True)
82
+
83
+ if is_expert:
84
+ ui_nodes['preset.editor.description'].setVisible(True)
85
+ presets_editor.toggle_tab("remote_tools", True)
86
+ else:
87
+ presets_editor.toggle_tab("remote_tools", False)
88
+ ui_nodes['preset.editor.description'].setVisible(False)
89
+
90
+ if is_completion:
91
+ ui_nodes['preset.editor.user_name'].setVisible(True)
92
+ else:
93
+ ui_nodes['preset.editor.user_name'].setVisible(False)
94
+
95
+ if is_agent_openai:
96
+ ui_nodes['preset.editor.agent_provider_openai'].setVisible(True)
97
+ else:
98
+ ui_nodes['preset.editor.agent_provider_openai'].setVisible(False)
99
+
100
+ if is_agent:
101
+ presets_editor.toggle_tab("experts", True)
102
+ ui_nodes['preset.editor.temperature'].setVisible(True)
103
+ ui_nodes['preset.editor.idx'].setVisible(False)
104
+ ui_nodes['preset.editor.agent_provider'].setVisible(False)
105
+ ui_nodes['preset.editor.modes'].setVisible(False)
106
+ ui_tabs['preset.editor.extra'].setTabText(0, trans("preset.prompt.agent"))
107
+ elif is_agent_llama:
108
+ presets_editor.toggle_tab("experts", False)
109
+ ui_nodes['preset.editor.temperature'].setVisible(False)
110
+ ui_nodes['preset.editor.idx'].setVisible(True)
111
+ ui_nodes['preset.editor.agent_provider'].setVisible(True)
112
+ ui_nodes['preset.editor.modes'].setVisible(False)
113
+ ui_tabs['preset.editor.extra'].setTabText(0, trans("preset.prompt.agent_llama"))
114
+ elif is_agent_openai:
115
+ presets_editor.toggle_tab("experts", True)
116
+ ui_nodes['preset.editor.temperature'].setVisible(False)
117
+ ui_nodes['preset.editor.idx'].setVisible(True)
118
+ ui_nodes['preset.editor.agent_provider'].setVisible(False)
119
+ ui_nodes['preset.editor.modes'].setVisible(False)
120
+ ui_tabs['preset.editor.extra'].setTabText(0, trans("preset.prompt.agent_llama"))
121
+ else:
122
+ if is_expert:
123
+ ui_nodes['preset.editor.idx'].setVisible(True)
146
124
  else:
147
- self.window.ui.nodes['preset.tool.function.label.assistant'].setVisible(False)
148
- self.window.ui.nodes['preset.tool.function.label.all'].setVisible(False)
125
+ ui_nodes['preset.editor.idx'].setVisible(False)
149
126
 
150
- # presets: clear
151
- """
152
- self.window.ui.nodes['preset.clear'].setVisible(False)
153
- if mode in [MODE_IMAGE, MODE_ASSISTANT]:
154
- self.window.ui.nodes['preset.clear'].setVisible(False)
155
- else:
156
- self.window.ui.nodes['preset.clear'].setVisible(True)
157
- """
127
+ presets_editor.toggle_tab("experts", False)
128
+ ui_nodes['preset.editor.temperature'].setVisible(True)
129
+ ui_nodes['preset.editor.agent_provider'].setVisible(False)
130
+ ui_nodes['preset.editor.modes'].setVisible(True)
131
+ ui_tabs['preset.editor.extra'].setTabText(0, trans("preset.prompt"))
158
132
 
159
- # presets: use
160
- """
161
- if mode == MODE_IMAGE:
162
- self.window.ui.nodes['preset.use'].setVisible(True)
163
- else:
164
- self.window.ui.nodes['preset.use'].setVisible(False)
165
- """
166
-
167
- # img options
168
- if mode == MODE_IMAGE:
169
- self.window.ui.nodes['dalle.options'].setVisible(True)
170
- else:
171
- self.window.ui.nodes['dalle.options'].setVisible(False)
172
-
173
- # agent options
174
- if mode in [MODE_AGENT]:
175
- self.window.ui.nodes['agent.options'].setVisible(True)
133
+ if is_image:
134
+ ui_nodes['dalle.options'].setVisible(True)
176
135
  else:
177
- self.window.ui.nodes['agent.options'].setVisible(False)
136
+ ui_nodes['dalle.options'].setVisible(False)
178
137
 
179
- # agent llama options
180
- if mode in [MODE_AGENT_LLAMA, MODE_AGENT_OPENAI]:
181
- self.window.ui.nodes['agent_llama.options'].setVisible(True)
138
+ if is_agent:
139
+ ui_nodes['agent.options'].setVisible(True)
182
140
  else:
183
- self.window.ui.nodes['agent_llama.options'].setVisible(False)
141
+ ui_nodes['agent.options'].setVisible(False)
184
142
 
185
- """
186
- # agent llama sys prompt
187
- if mode in [MODE_AGENT_LLAMA]:
188
- self.window.ui.nodes['preset.prompt'].setVisible(False)
143
+ if is_agent_llama or is_agent_openai:
144
+ ui_nodes['agent_llama.options'].setVisible(True)
189
145
  else:
190
- self.window.ui.nodes['preset.prompt'].setVisible(True)
191
- """
146
+ ui_nodes['agent_llama.options'].setVisible(False)
192
147
 
193
- # assistants list
194
- if mode == MODE_ASSISTANT:
195
- self.window.ui.nodes['assistants.widget'].setVisible(True)
148
+ if is_assistant:
149
+ ui_nodes['assistants.widget'].setVisible(True)
196
150
  else:
197
- self.window.ui.nodes['assistants.widget'].setVisible(False)
151
+ ui_nodes['assistants.widget'].setVisible(False)
198
152
 
199
- # indexes list
200
- if mode == MODE_LLAMA_INDEX:
201
- # self.window.ui.nodes['indexes.widget'].setVisible(True)
202
- self.window.ui.nodes['idx.options'].setVisible(True)
153
+ if is_llama_index:
154
+ ui_nodes['idx.options'].setVisible(True)
203
155
  else:
204
- # self.window.ui.nodes['indexes.widget'].setVisible(False)
205
- self.window.ui.nodes['idx.options'].setVisible(False)
206
-
207
- # stream mode
208
- if mode in [MODE_IMAGE]:
156
+ ui_nodes['idx.options'].setVisible(False)
209
157
 
210
- self.window.ui.nodes['input.stream'].setVisible(False)
158
+ if is_image:
159
+ ui_nodes['input.stream'].setVisible(False)
211
160
  else:
212
- self.window.ui.nodes['input.stream'].setVisible(True)
161
+ ui_nodes['input.stream'].setVisible(True)
213
162
 
214
- # vision
215
163
  show = self.is_vision(mode)
216
- self.window.ui.menu['menu.video'].menuAction().setVisible(show)
217
- self.window.ui.nodes['icon.video.capture'].setVisible(show)
218
- # self.window.ui.nodes['vision.capture.options'].setVisible(show)
219
- self.window.ui.nodes['attachments.capture_clear'].setVisible(show)
164
+ ui_menu['menu.video'].menuAction().setVisible(show)
165
+ ui_nodes['icon.video.capture'].setVisible(show)
166
+ ui_nodes['attachments.capture_clear'].setVisible(show)
220
167
 
221
- # attachments
222
168
  show = self.are_attachments(mode)
223
- self.window.ui.tabs['input'].setTabVisible(1, show) # attachments
169
+ ui_tabs['input'].setTabVisible(1, show)
224
170
 
225
- # uploaded files
226
- if mode == MODE_ASSISTANT:
227
- self.window.ui.tabs['input'].setTabVisible(2, True)
228
- self.window.ui.tabs['input'].setTabVisible(3, False)
229
- else:
230
- if mode != MODE_IMAGE:
231
- self.window.ui.tabs['input'].setTabVisible(2, False)
232
- self.window.ui.tabs['input'].setTabVisible(3, True)
233
- else:
234
- self.window.ui.tabs['input'].setTabVisible(2, False)
235
- self.window.ui.tabs['input'].setTabVisible(3, False)
171
+ ui_tabs['input'].setTabVisible(2, is_assistant)
172
+ ui_tabs['input'].setTabVisible(3, (not is_assistant) and (not is_image))
236
173
 
237
- # show/hide extra options in preset editor
238
- self.window.controller.presets.editor.toggle_extra_options()
174
+ presets_editor.toggle_extra_options()
239
175
 
240
- # chat footer
241
176
  self.toggle_chat_footer()
242
177
 
243
178
  def toggle_chat_footer(self):
@@ -254,13 +189,13 @@ class Mode:
254
189
  :param mode: current mode
255
190
  :return: True if vision is allowed
256
191
  """
257
- if self.window.controller.ui.vision.has_vision():
192
+ ctrl = self.window.controller
193
+ if ctrl.ui.vision.has_vision():
258
194
  return True
259
195
 
260
- if self.window.controller.painter.is_active():
196
+ if ctrl.painter.is_active():
261
197
  return True
262
198
 
263
- # event: UI: vision
264
199
  value = False
265
200
  event = Event(Event.UI_VISION, {
266
201
  'mode': mode,
@@ -276,8 +211,6 @@ class Mode:
276
211
  :param mode: current mode
277
212
  :return: True if attachments are allowed
278
213
  """
279
- # event: UI: attachments
280
- # value = False
281
214
  event = Event(Event.UI_ATTACHMENTS, {
282
215
  'mode': mode,
283
216
  'value': True,
@@ -291,5 +224,4 @@ class Mode:
291
224
 
292
225
  def hide_chat_footer(self):
293
226
  """Hide chat footer"""
294
- self.window.ui.nodes['chat.footer'].setVisible(False)
295
-
227
+ self.window.ui.nodes['chat.footer'].setVisible(False)