pygpt-net 2.6.0.post2__py3-none-any.whl → 2.6.2__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.
- pygpt_net/CHANGELOG.txt +8 -0
- pygpt_net/__init__.py +3 -3
- pygpt_net/app.py +27 -9
- pygpt_net/controller/chat/response.py +10 -4
- pygpt_net/controller/chat/stream.py +40 -2
- pygpt_net/controller/model/editor.py +45 -4
- pygpt_net/controller/plugins/plugins.py +25 -0
- pygpt_net/controller/presets/editor.py +100 -100
- pygpt_net/controller/presets/experts.py +20 -1
- pygpt_net/controller/presets/presets.py +5 -4
- pygpt_net/controller/ui/mode.py +17 -66
- pygpt_net/core/agents/provider.py +2 -1
- pygpt_net/core/agents/runner.py +123 -9
- pygpt_net/core/agents/runners/helpers.py +3 -2
- pygpt_net/core/agents/runners/llama_workflow.py +176 -22
- pygpt_net/core/agents/runners/loop.py +22 -13
- pygpt_net/core/experts/experts.py +19 -25
- pygpt_net/core/idx/chat.py +24 -34
- pygpt_net/core/idx/response.py +5 -2
- pygpt_net/core/locale/locale.py +73 -45
- pygpt_net/core/render/web/body.py +152 -207
- pygpt_net/core/render/web/renderer.py +4 -2
- pygpt_net/data/config/config.json +3 -3
- pygpt_net/data/config/models.json +3 -3
- pygpt_net/data/locale/locale.de.ini +12 -8
- pygpt_net/data/locale/locale.en.ini +12 -8
- pygpt_net/data/locale/locale.es.ini +12 -8
- pygpt_net/data/locale/locale.fr.ini +12 -8
- pygpt_net/data/locale/locale.it.ini +12 -8
- pygpt_net/data/locale/locale.pl.ini +12 -8
- pygpt_net/data/locale/locale.uk.ini +12 -8
- pygpt_net/data/locale/locale.zh.ini +12 -8
- pygpt_net/item/ctx.py +2 -1
- pygpt_net/plugin/base/plugin.py +35 -3
- pygpt_net/plugin/bitbucket/__init__.py +12 -0
- pygpt_net/plugin/bitbucket/config.py +267 -0
- pygpt_net/plugin/bitbucket/plugin.py +125 -0
- pygpt_net/plugin/bitbucket/worker.py +569 -0
- pygpt_net/plugin/cmd_files/worker.py +19 -16
- pygpt_net/plugin/facebook/__init__.py +12 -0
- pygpt_net/plugin/facebook/config.py +359 -0
- pygpt_net/plugin/facebook/plugin.py +114 -0
- pygpt_net/plugin/facebook/worker.py +698 -0
- pygpt_net/plugin/github/__init__.py +12 -0
- pygpt_net/plugin/github/config.py +441 -0
- pygpt_net/plugin/github/plugin.py +124 -0
- pygpt_net/plugin/github/worker.py +674 -0
- pygpt_net/plugin/google/__init__.py +12 -0
- pygpt_net/plugin/google/config.py +367 -0
- pygpt_net/plugin/google/plugin.py +126 -0
- pygpt_net/plugin/google/worker.py +826 -0
- pygpt_net/plugin/slack/__init__.py +12 -0
- pygpt_net/plugin/slack/config.py +349 -0
- pygpt_net/plugin/slack/plugin.py +116 -0
- pygpt_net/plugin/slack/worker.py +639 -0
- pygpt_net/plugin/telegram/__init__.py +12 -0
- pygpt_net/plugin/telegram/config.py +308 -0
- pygpt_net/plugin/telegram/plugin.py +118 -0
- pygpt_net/plugin/telegram/worker.py +563 -0
- pygpt_net/plugin/twitter/__init__.py +12 -0
- pygpt_net/plugin/twitter/config.py +491 -0
- pygpt_net/plugin/twitter/plugin.py +126 -0
- pygpt_net/plugin/twitter/worker.py +837 -0
- pygpt_net/provider/agents/base.py +4 -1
- pygpt_net/provider/agents/llama_index/codeact_workflow.py +95 -0
- pygpt_net/provider/agents/llama_index/legacy/__init__.py +0 -0
- pygpt_net/provider/agents/llama_index/{openai.py → legacy/openai.py} +2 -2
- pygpt_net/provider/agents/llama_index/{openai_assistant.py → legacy/openai_assistant.py} +37 -5
- pygpt_net/provider/agents/llama_index/{planner.py → legacy/planner.py} +3 -3
- pygpt_net/provider/agents/llama_index/{react.py → legacy/react.py} +3 -3
- pygpt_net/provider/agents/llama_index/openai_workflow.py +52 -0
- pygpt_net/provider/agents/llama_index/planner_workflow.py +115 -0
- pygpt_net/provider/agents/llama_index/react_workflow.py +6 -4
- pygpt_net/provider/agents/llama_index/workflow/__init__.py +0 -0
- pygpt_net/provider/agents/llama_index/{codeact_agent_custom.py → workflow/codeact.py} +124 -8
- pygpt_net/provider/agents/llama_index/workflow/events.py +24 -0
- pygpt_net/provider/agents/llama_index/workflow/openai.py +634 -0
- pygpt_net/provider/agents/llama_index/workflow/planner.py +601 -0
- pygpt_net/provider/agents/openai/agent.py +1 -0
- pygpt_net/provider/agents/openai/agent_b2b.py +2 -0
- pygpt_net/provider/agents/openai/agent_planner.py +1 -0
- pygpt_net/provider/agents/openai/agent_with_experts.py +1 -0
- pygpt_net/provider/agents/openai/agent_with_experts_feedback.py +1 -0
- pygpt_net/provider/agents/openai/agent_with_feedback.py +1 -0
- pygpt_net/provider/agents/openai/evolve.py +1 -0
- pygpt_net/provider/core/preset/patch.py +11 -17
- pygpt_net/ui/base/config_dialog.py +4 -0
- pygpt_net/ui/dialog/preset.py +34 -77
- pygpt_net/ui/layout/toolbox/presets.py +2 -2
- pygpt_net/ui/main.py +3 -1
- pygpt_net/ui/widget/lists/experts.py +3 -2
- {pygpt_net-2.6.0.post2.dist-info → pygpt_net-2.6.2.dist-info}/METADATA +155 -4
- {pygpt_net-2.6.0.post2.dist-info → pygpt_net-2.6.2.dist-info}/RECORD +96 -62
- pygpt_net/data/config/presets/agent_react_workflow.json +0 -34
- pygpt_net/provider/agents/llama_index/code_act.py +0 -58
- {pygpt_net-2.6.0.post2.dist-info → pygpt_net-2.6.2.dist-info}/LICENSE +0 -0
- {pygpt_net-2.6.0.post2.dist-info → pygpt_net-2.6.2.dist-info}/WHEEL +0 -0
- {pygpt_net-2.6.0.post2.dist-info → pygpt_net-2.6.2.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: 2025.08.
|
|
9
|
+
# Updated Date: 2025.08.14 13:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
import datetime
|
|
@@ -38,6 +38,14 @@ from pygpt_net.utils import trans
|
|
|
38
38
|
from .experts import Experts
|
|
39
39
|
|
|
40
40
|
class Editor:
|
|
41
|
+
|
|
42
|
+
TAB_IDX = {
|
|
43
|
+
"general": 0,
|
|
44
|
+
"personalize": 1,
|
|
45
|
+
"experts": 2,
|
|
46
|
+
"remote_tools": 3,
|
|
47
|
+
}
|
|
48
|
+
|
|
41
49
|
def __init__(self, window=None):
|
|
42
50
|
"""
|
|
43
51
|
Presets editor controller
|
|
@@ -77,7 +85,7 @@ class Editor:
|
|
|
77
85
|
"label": "preset.user_name",
|
|
78
86
|
},
|
|
79
87
|
"description": {
|
|
80
|
-
"type": "
|
|
88
|
+
"type": "text",
|
|
81
89
|
"label": "preset.description",
|
|
82
90
|
"placeholder": "preset.description.desc",
|
|
83
91
|
},
|
|
@@ -172,31 +180,22 @@ class Editor:
|
|
|
172
180
|
"label": "preset.agent_provider",
|
|
173
181
|
"description": "preset.agent_provider.desc",
|
|
174
182
|
"use": "agent_provider_llama",
|
|
183
|
+
"extra": {
|
|
184
|
+
"urls": {
|
|
185
|
+
"Help": "https://pygpt.readthedocs.io/en/latest/modes.html#agent-llamaindex"
|
|
186
|
+
},
|
|
187
|
+
}
|
|
175
188
|
},
|
|
176
189
|
"agent_provider_openai": {
|
|
177
190
|
"type": "combo",
|
|
178
191
|
"label": "preset.agent_provider",
|
|
179
192
|
"description": "preset.agent_provider.desc",
|
|
180
193
|
"use": "agent_provider_openai",
|
|
181
|
-
},
|
|
182
|
-
"assistant_id": {
|
|
183
|
-
"type": "text",
|
|
184
|
-
"label": "preset.assistant_id",
|
|
185
|
-
"description": "preset.assistant_id.desc",
|
|
186
|
-
},
|
|
187
|
-
"tool.function": {
|
|
188
|
-
"type": "dict",
|
|
189
|
-
"label": "preset.tool.function",
|
|
190
|
-
"keys": {
|
|
191
|
-
'name': 'text',
|
|
192
|
-
'params': 'textarea',
|
|
193
|
-
'desc': 'textarea',
|
|
194
|
-
},
|
|
195
194
|
"extra": {
|
|
196
195
|
"urls": {
|
|
197
|
-
"Help": "https://
|
|
196
|
+
"Help": "https://pygpt.readthedocs.io/en/latest/modes.html#agent-openai"
|
|
198
197
|
},
|
|
199
|
-
}
|
|
198
|
+
}
|
|
200
199
|
},
|
|
201
200
|
}
|
|
202
201
|
self.hidden_by_mode = { # hidden fields by mode
|
|
@@ -255,17 +254,9 @@ class Editor:
|
|
|
255
254
|
|
|
256
255
|
# add hooks for config update in real-time
|
|
257
256
|
self.window.ui.add_hook("update.preset.prompt", self.hook_update)
|
|
257
|
+
self.window.ui.add_hook("update.preset.agent_provider", self.hook_update)
|
|
258
258
|
self.window.ui.add_hook("update.preset.agent_provider_openai", self.hook_update)
|
|
259
259
|
|
|
260
|
-
# register functions dictionary
|
|
261
|
-
parent = "preset"
|
|
262
|
-
key = "tool.function"
|
|
263
|
-
self.window.ui.dialogs.register_dictionary(
|
|
264
|
-
key,
|
|
265
|
-
parent,
|
|
266
|
-
self.get_option(key),
|
|
267
|
-
)
|
|
268
|
-
|
|
269
260
|
def toggle_extra_options(self):
|
|
270
261
|
"""
|
|
271
262
|
Toggle extra options in preset editor
|
|
@@ -275,7 +266,7 @@ class Editor:
|
|
|
275
266
|
if not self.tab_options_idx:
|
|
276
267
|
return
|
|
277
268
|
mode = self.window.core.config.get('mode')
|
|
278
|
-
if mode
|
|
269
|
+
if mode not in [MODE_AGENT_OPENAI, MODE_AGENT_LLAMA]:
|
|
279
270
|
# show base prompt
|
|
280
271
|
self.window.ui.tabs['preset.editor.extra'].setTabVisible(0, True)
|
|
281
272
|
# hide all tabs
|
|
@@ -303,12 +294,21 @@ class Editor:
|
|
|
303
294
|
# show base prompt
|
|
304
295
|
self.window.ui.tabs['preset.editor.extra'].setTabVisible(0, True)
|
|
305
296
|
return
|
|
297
|
+
|
|
306
298
|
mode = self.window.core.config.get('mode')
|
|
307
|
-
|
|
299
|
+
key_agent = ""
|
|
300
|
+
|
|
301
|
+
if mode in [MODE_AGENT_OPENAI, MODE_AGENT_LLAMA]:
|
|
302
|
+
# get current provider
|
|
303
|
+
if mode == MODE_AGENT_LLAMA:
|
|
304
|
+
key_agent = "agent_provider"
|
|
305
|
+
elif mode == MODE_AGENT_OPENAI:
|
|
306
|
+
key_agent = "agent_provider_openai"
|
|
307
|
+
|
|
308
308
|
current_provider = self.window.controller.config.get_value(
|
|
309
309
|
parent_id=self.id,
|
|
310
|
-
key=
|
|
311
|
-
option=self.options[
|
|
310
|
+
key=key_agent,
|
|
311
|
+
option=self.options[key_agent],
|
|
312
312
|
)
|
|
313
313
|
if current_provider is None or current_provider == "":
|
|
314
314
|
# show base prompt
|
|
@@ -344,22 +344,38 @@ class Editor:
|
|
|
344
344
|
|
|
345
345
|
:param preset: preset item
|
|
346
346
|
"""
|
|
347
|
-
|
|
347
|
+
mode = self.window.core.config.get('mode')
|
|
348
|
+
id = None
|
|
349
|
+
if mode == MODE_AGENT_OPENAI:
|
|
350
|
+
if preset.agent_provider_openai is None or preset.agent_provider_openai == "":
|
|
351
|
+
return
|
|
352
|
+
id = preset.agent_provider_openai
|
|
353
|
+
elif mode == MODE_AGENT_LLAMA:
|
|
354
|
+
if preset.agent_provider is None or preset.agent_provider == "":
|
|
355
|
+
return
|
|
356
|
+
id = preset.agent_provider
|
|
357
|
+
else:
|
|
348
358
|
return
|
|
349
359
|
|
|
350
360
|
# update options in UI
|
|
351
|
-
id = preset.agent_provider_openai
|
|
352
361
|
agent = self.window.core.agents.provider.get(id)
|
|
353
362
|
if not agent:
|
|
354
363
|
return
|
|
355
364
|
if not preset.extra or id not in preset.extra:
|
|
356
365
|
return
|
|
366
|
+
|
|
357
367
|
data_dict = preset.extra[id]
|
|
358
368
|
option_tabs = agent.get_options()
|
|
359
369
|
for option_tab_id in data_dict:
|
|
360
|
-
|
|
370
|
+
parent_key = ""
|
|
371
|
+
if mode == MODE_AGENT_OPENAI:
|
|
372
|
+
parent_key = preset.agent_provider_openai
|
|
373
|
+
elif mode == MODE_AGENT_LLAMA:
|
|
374
|
+
parent_key = preset.agent_provider
|
|
375
|
+
option_key = "agent." + parent_key + "." + option_tab_id
|
|
361
376
|
if option_key not in self.window.ui.config:
|
|
362
377
|
continue
|
|
378
|
+
|
|
363
379
|
extra_options = option_tabs.get(option_tab_id, {}).get('options', {})
|
|
364
380
|
for key in extra_options:
|
|
365
381
|
value = data_dict[option_tab_id].get(key, None)
|
|
@@ -390,7 +406,7 @@ class Editor:
|
|
|
390
406
|
if not self.tab_options_idx:
|
|
391
407
|
return
|
|
392
408
|
mode = self.window.core.config.get('mode')
|
|
393
|
-
if mode
|
|
409
|
+
if mode not in [MODE_AGENT_OPENAI, MODE_AGENT_LLAMA]:
|
|
394
410
|
return
|
|
395
411
|
|
|
396
412
|
# load defaults for all tabs
|
|
@@ -427,13 +443,18 @@ class Editor:
|
|
|
427
443
|
return
|
|
428
444
|
|
|
429
445
|
mode = self.window.core.config.get('mode')
|
|
430
|
-
if mode
|
|
446
|
+
if mode not in [MODE_AGENT_OPENAI, MODE_AGENT_LLAMA]:
|
|
431
447
|
return
|
|
432
448
|
|
|
433
449
|
preset = self.window.core.presets.get_by_uuid(self.current)
|
|
434
450
|
if not preset:
|
|
435
451
|
return
|
|
436
|
-
|
|
452
|
+
|
|
453
|
+
current_provider_id = None
|
|
454
|
+
if mode == MODE_AGENT_OPENAI:
|
|
455
|
+
current_provider_id = preset.agent_provider_openai if preset else None
|
|
456
|
+
elif mode == MODE_AGENT_LLAMA:
|
|
457
|
+
current_provider_id = preset.agent_provider if preset else None
|
|
437
458
|
|
|
438
459
|
# load defaults for all tabs
|
|
439
460
|
for id in self.tab_options_idx:
|
|
@@ -475,10 +496,18 @@ class Editor:
|
|
|
475
496
|
:param id: preset id
|
|
476
497
|
:param preset: preset item
|
|
477
498
|
"""
|
|
499
|
+
mode = self.window.core.config.get('mode')
|
|
478
500
|
exclude_ids = [
|
|
479
501
|
"__prompt__",
|
|
480
502
|
]
|
|
481
|
-
id =
|
|
503
|
+
id = None
|
|
504
|
+
if mode == MODE_AGENT_OPENAI:
|
|
505
|
+
id = preset.agent_provider_openai
|
|
506
|
+
elif mode == MODE_AGENT_LLAMA:
|
|
507
|
+
id = preset.agent_provider
|
|
508
|
+
else:
|
|
509
|
+
return
|
|
510
|
+
|
|
482
511
|
options = {}
|
|
483
512
|
agent = self.window.core.agents.provider.get(id)
|
|
484
513
|
if not agent:
|
|
@@ -545,6 +574,7 @@ class Editor:
|
|
|
545
574
|
checkboxLayout.addLayout(opt_layout)
|
|
546
575
|
else:
|
|
547
576
|
layout.addLayout(opt_layout)
|
|
577
|
+
layout.addStretch(1)
|
|
548
578
|
layout.addLayout(checkboxLayout)
|
|
549
579
|
|
|
550
580
|
# as tab
|
|
@@ -568,14 +598,20 @@ class Editor:
|
|
|
568
598
|
:return: None
|
|
569
599
|
"""
|
|
570
600
|
mode = self.window.core.config.get('mode')
|
|
571
|
-
if mode
|
|
601
|
+
if mode not in [MODE_AGENT_OPENAI, MODE_AGENT_LLAMA]:
|
|
572
602
|
return
|
|
573
603
|
|
|
604
|
+
parent_key = ""
|
|
605
|
+
if mode == MODE_AGENT_OPENAI:
|
|
606
|
+
parent_key = "agent_provider_openai"
|
|
607
|
+
elif mode == MODE_AGENT_LLAMA:
|
|
608
|
+
parent_key = "agent_provider"
|
|
609
|
+
|
|
574
610
|
# get current provider
|
|
575
611
|
current_provider = self.window.controller.config.get_value(
|
|
576
612
|
parent_id=self.id,
|
|
577
|
-
key=
|
|
578
|
-
option=self.options[
|
|
613
|
+
key=parent_key,
|
|
614
|
+
option=self.options[parent_key],
|
|
579
615
|
)
|
|
580
616
|
if current_provider is None or current_provider == "":
|
|
581
617
|
return
|
|
@@ -624,7 +660,7 @@ class Editor:
|
|
|
624
660
|
self.window.controller.presets.from_global() # update current preset
|
|
625
661
|
|
|
626
662
|
# show/hide extra options
|
|
627
|
-
elif key
|
|
663
|
+
elif key in ["agent_provider_openai", "agent_provider"]:
|
|
628
664
|
self.toggle_extra_options_by_provider()
|
|
629
665
|
self.append_default_prompt()
|
|
630
666
|
self.load_extra_defaults_current()
|
|
@@ -722,6 +758,7 @@ class Editor:
|
|
|
722
758
|
# load extra options
|
|
723
759
|
self.load_extra_options(data)
|
|
724
760
|
|
|
761
|
+
# toggle extra options
|
|
725
762
|
self.toggle_extra_options()
|
|
726
763
|
|
|
727
764
|
# update experts list, after ID loaded
|
|
@@ -730,24 +767,6 @@ class Editor:
|
|
|
730
767
|
# setup avatar config
|
|
731
768
|
self.update_avatar_config(data)
|
|
732
769
|
|
|
733
|
-
# restore functions
|
|
734
|
-
if data.has_functions():
|
|
735
|
-
functions = data.get_functions()
|
|
736
|
-
values = []
|
|
737
|
-
for function in functions:
|
|
738
|
-
values.append(
|
|
739
|
-
{
|
|
740
|
-
"name": function['name'],
|
|
741
|
-
"params": function['params'],
|
|
742
|
-
"desc": function['desc'],
|
|
743
|
-
}
|
|
744
|
-
)
|
|
745
|
-
self.window.ui.config[self.id]['tool.function'].items = values
|
|
746
|
-
self.window.ui.config[self.id]['tool.function'].model.updateData(values)
|
|
747
|
-
else:
|
|
748
|
-
self.window.ui.config[self.id]['tool.function'].items = []
|
|
749
|
-
self.window.ui.config[self.id]['tool.function'].model.updateData([])
|
|
750
|
-
|
|
751
770
|
# set focus to name field
|
|
752
771
|
current_model = self.window.core.config.get('model')
|
|
753
772
|
# set current model in combo box as selected
|
|
@@ -899,16 +918,9 @@ class Editor:
|
|
|
899
918
|
# sort by name
|
|
900
919
|
self.window.core.presets.sort_by_name()
|
|
901
920
|
|
|
902
|
-
# switch to editing preset
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
self.window.controller.presets.select_model()
|
|
906
|
-
else:
|
|
907
|
-
# switch to model if current preset
|
|
908
|
-
current_preset = self.window.core.config.get('preset')
|
|
909
|
-
if current_preset is not None and current_preset == id:
|
|
910
|
-
self.window.controller.presets.set(mode, current_preset)
|
|
911
|
-
self.window.controller.presets.select_model()
|
|
921
|
+
# switch to editing preset on save
|
|
922
|
+
self.window.controller.presets.set(mode, id)
|
|
923
|
+
self.window.controller.presets.select_model()
|
|
912
924
|
|
|
913
925
|
# update presets list
|
|
914
926
|
no_scroll = False
|
|
@@ -945,36 +957,6 @@ class Editor:
|
|
|
945
957
|
'function': [], # functions are assigned separately (below)
|
|
946
958
|
}
|
|
947
959
|
|
|
948
|
-
# assign functions tool
|
|
949
|
-
values = self.window.controller.config.get_value(
|
|
950
|
-
parent_id=self.id,
|
|
951
|
-
key='tool.function',
|
|
952
|
-
option=self.options['tool.function'],
|
|
953
|
-
)
|
|
954
|
-
functions = []
|
|
955
|
-
for function in values:
|
|
956
|
-
name = function['name']
|
|
957
|
-
params = function['params']
|
|
958
|
-
desc = function['desc']
|
|
959
|
-
if name is None or name == "":
|
|
960
|
-
continue
|
|
961
|
-
if params is None or params == "":
|
|
962
|
-
params = '{"type": "object", "properties": {}}' # default empty JSON params
|
|
963
|
-
if desc is None:
|
|
964
|
-
desc = ""
|
|
965
|
-
functions.append(
|
|
966
|
-
{
|
|
967
|
-
"name": name,
|
|
968
|
-
"params": params,
|
|
969
|
-
"desc": desc,
|
|
970
|
-
}
|
|
971
|
-
)
|
|
972
|
-
|
|
973
|
-
if len(functions) > 0:
|
|
974
|
-
preset.tools['function'] = functions
|
|
975
|
-
else:
|
|
976
|
-
preset.tools['function'] = []
|
|
977
|
-
|
|
978
960
|
# extra options
|
|
979
961
|
self.append_extra_options(preset)
|
|
980
962
|
|
|
@@ -1134,3 +1116,21 @@ class Editor:
|
|
|
1134
1116
|
option=self.options["ai_avatar"],
|
|
1135
1117
|
value="",
|
|
1136
1118
|
)
|
|
1119
|
+
|
|
1120
|
+
def toggle_tab(self, name: str, show: bool = True):
|
|
1121
|
+
"""
|
|
1122
|
+
Show experts tab
|
|
1123
|
+
|
|
1124
|
+
:param name: name of the tab
|
|
1125
|
+
:param show: Show or hide experts tab
|
|
1126
|
+
"""
|
|
1127
|
+
tabs = self.window.ui.tabs['preset.editor.tabs']
|
|
1128
|
+
idx = self.TAB_IDX[name]
|
|
1129
|
+
if tabs is not None:
|
|
1130
|
+
if show:
|
|
1131
|
+
tabs.setTabEnabled(idx, True)
|
|
1132
|
+
tabs.setTabVisible(idx, True)
|
|
1133
|
+
self.experts.update_tab()
|
|
1134
|
+
else:
|
|
1135
|
+
tabs.setTabEnabled(idx, False)
|
|
1136
|
+
tabs.setTabVisible(idx, False)
|
|
@@ -6,12 +6,14 @@
|
|
|
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.
|
|
9
|
+
# Updated Date: 2025.08.14 13:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
from pygpt_net.core.types import (
|
|
13
13
|
MODE_EXPERT,
|
|
14
14
|
)
|
|
15
|
+
from pygpt_net.utils import trans
|
|
16
|
+
|
|
15
17
|
|
|
16
18
|
class Experts:
|
|
17
19
|
def __init__(self, window=None):
|
|
@@ -74,6 +76,8 @@ class Experts:
|
|
|
74
76
|
# clear selected list if no agent is selected
|
|
75
77
|
self.window.ui.nodes['preset.editor.experts'].update_selected({})
|
|
76
78
|
|
|
79
|
+
self.update_tab()
|
|
80
|
+
|
|
77
81
|
def change_available(self):
|
|
78
82
|
"""Change selected expert"""
|
|
79
83
|
pass
|
|
@@ -157,3 +161,18 @@ class Experts:
|
|
|
157
161
|
self.window.core.presets.remove_expert(agent_uuid, expert_uuid)
|
|
158
162
|
self.update_list()
|
|
159
163
|
|
|
164
|
+
def update_tab(self):
|
|
165
|
+
"""Update experts tab label with number of experts"""
|
|
166
|
+
num = 0
|
|
167
|
+
agent_uuid = self.get_current_agent_id()
|
|
168
|
+
if agent_uuid:
|
|
169
|
+
agent = self.window.core.presets.get_by_uuid(agent_uuid)
|
|
170
|
+
if agent:
|
|
171
|
+
num = len(agent.experts)
|
|
172
|
+
tabs = self.window.ui.tabs['preset.editor.tabs']
|
|
173
|
+
idx = self.window.controller.presets.editor.TAB_IDX["experts"]
|
|
174
|
+
if num == 0:
|
|
175
|
+
tabs.setTabText(idx, trans("preset.tab.experts"))
|
|
176
|
+
else:
|
|
177
|
+
tabs.setTabText(idx, trans("preset.tab.experts") + f" ({num})")
|
|
178
|
+
|
|
@@ -6,12 +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.08.
|
|
9
|
+
# Updated Date: 2025.08.14 13:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
import re
|
|
13
13
|
from typing import Optional, List, Dict
|
|
14
14
|
|
|
15
|
+
from PySide6.QtCore import QTimer
|
|
15
16
|
from PySide6.QtGui import QTextCursor
|
|
16
17
|
from PySide6.QtWidgets import QTextEdit
|
|
17
18
|
|
|
@@ -529,7 +530,7 @@ class Presets:
|
|
|
529
530
|
if preset_id is not None and preset_id != "":
|
|
530
531
|
if preset_id in self.window.core.presets.items:
|
|
531
532
|
self.window.core.presets.enable(preset_id)
|
|
532
|
-
self.refresh
|
|
533
|
+
QTimer.singleShot(100, self.refresh) # delay refresh
|
|
533
534
|
|
|
534
535
|
def disable(self, idx: Optional[int] = None):
|
|
535
536
|
"""
|
|
@@ -543,7 +544,7 @@ class Presets:
|
|
|
543
544
|
if preset_id is not None and preset_id != "":
|
|
544
545
|
if preset_id in self.window.core.presets.items:
|
|
545
546
|
self.window.core.presets.disable(preset_id)
|
|
546
|
-
self.refresh
|
|
547
|
+
QTimer.singleShot(100, self.refresh) # delay refresh
|
|
547
548
|
|
|
548
549
|
def clear(self, force: bool = False):
|
|
549
550
|
"""
|
|
@@ -708,4 +709,4 @@ class Presets:
|
|
|
708
709
|
|
|
709
710
|
def clear_selected(self):
|
|
710
711
|
"""Clear selected list"""
|
|
711
|
-
self.selected = []
|
|
712
|
+
self.selected = []
|
pygpt_net/controller/ui/mode.py
CHANGED
|
@@ -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.
|
|
9
|
+
# Updated Date: 2025.08.14 13:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
from pygpt_net.core.types import (
|
|
@@ -76,10 +76,10 @@ class Mode:
|
|
|
76
76
|
# presets: experts
|
|
77
77
|
if mode == MODE_EXPERT:
|
|
78
78
|
self.window.ui.nodes['preset.editor.description'].setVisible(True)
|
|
79
|
-
self.window.
|
|
79
|
+
self.window.controller.presets.editor.toggle_tab("remote_tools", True)
|
|
80
80
|
else:
|
|
81
|
+
self.window.controller.presets.editor.toggle_tab("remote_tools", False)
|
|
81
82
|
self.window.ui.nodes['preset.editor.description'].setVisible(False)
|
|
82
|
-
self.window.ui.nodes['preset.editor.remote_tools'].setVisible(False)
|
|
83
83
|
|
|
84
84
|
if mode == MODE_COMPLETION:
|
|
85
85
|
self.window.ui.nodes['preset.editor.user_name'].setVisible(True)
|
|
@@ -93,76 +93,38 @@ class Mode:
|
|
|
93
93
|
|
|
94
94
|
# presets: editor
|
|
95
95
|
if mode == MODE_AGENT:
|
|
96
|
+
self.window.controller.presets.editor.toggle_tab("experts", True)
|
|
96
97
|
self.window.ui.nodes['preset.editor.temperature'].setVisible(True)
|
|
97
|
-
self.window.ui.nodes['preset.editor.
|
|
98
|
+
self.window.ui.nodes['preset.editor.idx'].setVisible(False)
|
|
98
99
|
self.window.ui.nodes['preset.editor.agent_provider'].setVisible(False)
|
|
99
|
-
self.window.ui.nodes['preset.editor.functions'].setVisible(False)
|
|
100
100
|
self.window.ui.nodes['preset.editor.modes'].setVisible(False)
|
|
101
|
-
self.window.ui.nodes['preset.editor.experts'].setVisible(True)
|
|
102
101
|
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
102
|
elif mode == MODE_AGENT_LLAMA:
|
|
103
|
+
self.window.controller.presets.editor.toggle_tab("experts", False)
|
|
108
104
|
self.window.ui.nodes['preset.editor.temperature'].setVisible(False)
|
|
109
|
-
self.window.ui.nodes['preset.editor.
|
|
105
|
+
self.window.ui.nodes['preset.editor.idx'].setVisible(True)
|
|
110
106
|
self.window.ui.nodes['preset.editor.agent_provider'].setVisible(True)
|
|
111
|
-
self.window.ui.nodes['preset.editor.functions'].setVisible(False)
|
|
112
107
|
self.window.ui.nodes['preset.editor.modes'].setVisible(False)
|
|
113
|
-
self.window.ui.nodes['preset.editor.experts'].setVisible(False)
|
|
114
108
|
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
109
|
elif mode == MODE_AGENT_OPENAI:
|
|
110
|
+
self.window.controller.presets.editor.toggle_tab("experts", True)
|
|
120
111
|
self.window.ui.nodes['preset.editor.temperature'].setVisible(False)
|
|
121
|
-
self.window.ui.nodes['preset.editor.
|
|
112
|
+
self.window.ui.nodes['preset.editor.idx'].setVisible(True)
|
|
122
113
|
self.window.ui.nodes['preset.editor.agent_provider'].setVisible(False)
|
|
123
|
-
self.window.ui.nodes['preset.editor.functions'].setVisible(False)
|
|
124
114
|
self.window.ui.nodes['preset.editor.modes'].setVisible(False)
|
|
125
|
-
self.window.ui.nodes['preset.editor.experts'].setVisible(True)
|
|
126
115
|
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
116
|
else:
|
|
117
|
+
if mode == MODE_EXPERT:
|
|
118
|
+
self.window.ui.nodes['preset.editor.idx'].setVisible(True)
|
|
119
|
+
else:
|
|
120
|
+
self.window.ui.nodes['preset.editor.idx'].setVisible(False)
|
|
121
|
+
|
|
122
|
+
self.window.controller.presets.editor.toggle_tab("experts", False)
|
|
132
123
|
self.window.ui.nodes['preset.editor.temperature'].setVisible(True)
|
|
133
|
-
self.window.ui.nodes['preset.editor.
|
|
124
|
+
self.window.ui.nodes['preset.editor.idx'].setVisible(True)
|
|
134
125
|
self.window.ui.nodes['preset.editor.agent_provider'].setVisible(False)
|
|
135
|
-
self.window.ui.nodes['preset.editor.functions'].setVisible(False)
|
|
136
126
|
self.window.ui.nodes['preset.editor.modes'].setVisible(True)
|
|
137
|
-
self.window.ui.nodes['preset.editor.experts'].setVisible(False)
|
|
138
127
|
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)
|
|
146
|
-
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)
|
|
149
|
-
|
|
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
|
-
"""
|
|
158
|
-
|
|
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
128
|
|
|
167
129
|
# img options
|
|
168
130
|
if mode == MODE_IMAGE:
|
|
@@ -182,14 +144,6 @@ class Mode:
|
|
|
182
144
|
else:
|
|
183
145
|
self.window.ui.nodes['agent_llama.options'].setVisible(False)
|
|
184
146
|
|
|
185
|
-
"""
|
|
186
|
-
# agent llama sys prompt
|
|
187
|
-
if mode in [MODE_AGENT_LLAMA]:
|
|
188
|
-
self.window.ui.nodes['preset.prompt'].setVisible(False)
|
|
189
|
-
else:
|
|
190
|
-
self.window.ui.nodes['preset.prompt'].setVisible(True)
|
|
191
|
-
"""
|
|
192
|
-
|
|
193
147
|
# assistants list
|
|
194
148
|
if mode == MODE_ASSISTANT:
|
|
195
149
|
self.window.ui.nodes['assistants.widget'].setVisible(True)
|
|
@@ -198,10 +152,8 @@ class Mode:
|
|
|
198
152
|
|
|
199
153
|
# indexes list
|
|
200
154
|
if mode == MODE_LLAMA_INDEX:
|
|
201
|
-
# self.window.ui.nodes['indexes.widget'].setVisible(True)
|
|
202
155
|
self.window.ui.nodes['idx.options'].setVisible(True)
|
|
203
156
|
else:
|
|
204
|
-
# self.window.ui.nodes['indexes.widget'].setVisible(False)
|
|
205
157
|
self.window.ui.nodes['idx.options'].setVisible(False)
|
|
206
158
|
|
|
207
159
|
# stream mode
|
|
@@ -215,12 +167,11 @@ class Mode:
|
|
|
215
167
|
show = self.is_vision(mode)
|
|
216
168
|
self.window.ui.menu['menu.video'].menuAction().setVisible(show)
|
|
217
169
|
self.window.ui.nodes['icon.video.capture'].setVisible(show)
|
|
218
|
-
# self.window.ui.nodes['vision.capture.options'].setVisible(show)
|
|
219
170
|
self.window.ui.nodes['attachments.capture_clear'].setVisible(show)
|
|
220
171
|
|
|
221
172
|
# attachments
|
|
222
173
|
show = self.are_attachments(mode)
|
|
223
|
-
self.window.ui.tabs['input'].setTabVisible(1, show)
|
|
174
|
+
self.window.ui.tabs['input'].setTabVisible(1, show)
|
|
224
175
|
|
|
225
176
|
# uploaded files
|
|
226
177
|
if mode == MODE_ASSISTANT:
|