pygpt-net 2.6.1__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 +4 -0
- pygpt_net/__init__.py +3 -3
- pygpt_net/app.py +15 -1
- pygpt_net/controller/chat/response.py +5 -3
- pygpt_net/controller/chat/stream.py +40 -2
- pygpt_net/controller/plugins/plugins.py +25 -0
- pygpt_net/controller/presets/editor.py +33 -88
- pygpt_net/controller/presets/experts.py +20 -1
- pygpt_net/controller/presets/presets.py +2 -2
- pygpt_net/controller/ui/mode.py +17 -66
- pygpt_net/core/agents/runner.py +15 -7
- pygpt_net/core/experts/experts.py +3 -3
- pygpt_net/data/config/config.json +3 -3
- pygpt_net/data/config/models.json +3 -3
- pygpt_net/data/locale/locale.de.ini +2 -0
- pygpt_net/data/locale/locale.en.ini +2 -0
- pygpt_net/data/locale/locale.es.ini +2 -0
- pygpt_net/data/locale/locale.fr.ini +2 -0
- pygpt_net/data/locale/locale.it.ini +2 -0
- pygpt_net/data/locale/locale.pl.ini +3 -1
- pygpt_net/data/locale/locale.uk.ini +2 -0
- pygpt_net/data/locale/locale.zh.ini +2 -0
- 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/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/llama_index/legacy/openai_assistant.py +35 -3
- 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-2.6.1.dist-info → pygpt_net-2.6.2.dist-info}/METADATA +145 -2
- {pygpt_net-2.6.1.dist-info → pygpt_net-2.6.2.dist-info}/RECORD +61 -33
- {pygpt_net-2.6.1.dist-info → pygpt_net-2.6.2.dist-info}/LICENSE +0 -0
- {pygpt_net-2.6.1.dist-info → pygpt_net-2.6.2.dist-info}/WHEEL +0 -0
- {pygpt_net-2.6.1.dist-info → pygpt_net-2.6.2.dist-info}/entry_points.txt +0 -0
pygpt_net/CHANGELOG.txt
CHANGED
pygpt_net/__init__.py
CHANGED
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
|
7
7
|
# MIT License #
|
|
8
8
|
# Created By : Marcin Szczygliński #
|
|
9
|
-
# Updated Date: 2025.08.
|
|
9
|
+
# Updated Date: 2025.08.15 00:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
__author__ = "Marcin Szczygliński"
|
|
13
13
|
__copyright__ = "Copyright 2025, Marcin Szczygliński"
|
|
14
14
|
__credits__ = ["Marcin Szczygliński"]
|
|
15
15
|
__license__ = "MIT"
|
|
16
|
-
__version__ = "2.6.
|
|
17
|
-
__build__ = "2025-08-
|
|
16
|
+
__version__ = "2.6.2"
|
|
17
|
+
__build__ = "2025-08-15"
|
|
18
18
|
__maintainer__ = "Marcin Szczygliński"
|
|
19
19
|
__github__ = "https://github.com/szczyglis-dev/py-gpt"
|
|
20
20
|
__report__ = "https://github.com/szczyglis-dev/py-gpt/issues"
|
pygpt_net/app.py
CHANGED
|
@@ -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.15 00:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
import os
|
|
@@ -70,6 +70,13 @@ from pygpt_net.plugin.openai_vision import Plugin as OpenAIVisionPlugin
|
|
|
70
70
|
from pygpt_net.plugin.real_time import Plugin as RealTimePlugin
|
|
71
71
|
from pygpt_net.plugin.agent import Plugin as AgentPlugin
|
|
72
72
|
from pygpt_net.plugin.mailer import Plugin as MailerPlugin
|
|
73
|
+
from pygpt_net.plugin.google import Plugin as GooglePlugin
|
|
74
|
+
from pygpt_net.plugin.twitter import Plugin as TwitterPlugin
|
|
75
|
+
from pygpt_net.plugin.facebook import Plugin as FacebookPlugin
|
|
76
|
+
from pygpt_net.plugin.telegram import Plugin as TelegramPlugin
|
|
77
|
+
from pygpt_net.plugin.slack import Plugin as SlackPlugin
|
|
78
|
+
from pygpt_net.plugin.github import Plugin as GithubPlugin
|
|
79
|
+
from pygpt_net.plugin.bitbucket import Plugin as BitbucketPlugin
|
|
73
80
|
|
|
74
81
|
# agents (Llama-index)
|
|
75
82
|
# from pygpt_net.provider.agents.llama_index.legacy.openai import OpenAIAgent
|
|
@@ -380,6 +387,13 @@ def run(**kwargs):
|
|
|
380
387
|
launcher.add_plugin(IdxLlamaIndexPlugin())
|
|
381
388
|
launcher.add_plugin(MailerPlugin())
|
|
382
389
|
launcher.add_plugin(CrontabPlugin())
|
|
390
|
+
launcher.add_plugin(GooglePlugin())
|
|
391
|
+
launcher.add_plugin(TwitterPlugin())
|
|
392
|
+
launcher.add_plugin(FacebookPlugin())
|
|
393
|
+
launcher.add_plugin(TelegramPlugin())
|
|
394
|
+
launcher.add_plugin(SlackPlugin())
|
|
395
|
+
launcher.add_plugin(GithubPlugin())
|
|
396
|
+
launcher.add_plugin(BitbucketPlugin())
|
|
383
397
|
|
|
384
398
|
# register custom plugins
|
|
385
399
|
plugins = kwargs.get('plugins', None)
|
|
@@ -171,8 +171,9 @@ class Response:
|
|
|
171
171
|
if output and has_unclosed_code_tag(output):
|
|
172
172
|
ctx.output += "\n```"
|
|
173
173
|
ctx.msg_id = None
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
if ctx.id is None:
|
|
175
|
+
self.window.core.ctx.add(ctx) # store context to prevent current output from being lost
|
|
176
|
+
self.window.controller.ctx.prepare_name(ctx) # summarize if not yet
|
|
176
177
|
|
|
177
178
|
# finish render
|
|
178
179
|
self.window.dispatch(AppEvent(AppEvent.CTX_END)) # app event
|
|
@@ -228,7 +229,8 @@ class Response:
|
|
|
228
229
|
}
|
|
229
230
|
event = RenderEvent(RenderEvent.INPUT_APPEND, data)
|
|
230
231
|
self.window.dispatch(event)
|
|
231
|
-
|
|
232
|
+
if ctx.id is None:
|
|
233
|
+
self.window.core.ctx.add(ctx)
|
|
232
234
|
self.window.controller.ctx.update(
|
|
233
235
|
reload=True,
|
|
234
236
|
all=False,
|
|
@@ -77,6 +77,21 @@ class StreamWorker(QRunnable):
|
|
|
77
77
|
if generator is not None:
|
|
78
78
|
for chunk in generator:
|
|
79
79
|
if ctrl.kernel.stopped():
|
|
80
|
+
if hasattr(generator, 'close'):
|
|
81
|
+
try:
|
|
82
|
+
generator.close()
|
|
83
|
+
except Exception:
|
|
84
|
+
pass
|
|
85
|
+
elif hasattr(generator, 'cancel'):
|
|
86
|
+
try:
|
|
87
|
+
generator.cancel()
|
|
88
|
+
except Exception:
|
|
89
|
+
pass
|
|
90
|
+
elif hasattr(generator, 'stop'):
|
|
91
|
+
try:
|
|
92
|
+
generator.stop()
|
|
93
|
+
except Exception:
|
|
94
|
+
pass
|
|
80
95
|
ctx.msg_id = None
|
|
81
96
|
stopped = True
|
|
82
97
|
break
|
|
@@ -239,7 +254,6 @@ class StreamWorker(QRunnable):
|
|
|
239
254
|
elif etype == "response.image_generation_call.partial_image":
|
|
240
255
|
image_base64 = chunk.partial_image_b64
|
|
241
256
|
image_bytes = base64.b64decode(image_base64)
|
|
242
|
-
# prosty i bezpieczny overwrite (jak w oryginale)
|
|
243
257
|
with open(img_path, "wb") as f:
|
|
244
258
|
f.write(image_bytes)
|
|
245
259
|
is_image = True
|
|
@@ -249,7 +263,6 @@ class StreamWorker(QRunnable):
|
|
|
249
263
|
ctx.msg_id = str(chunk.response.id)
|
|
250
264
|
core.ctx.update_item(ctx)
|
|
251
265
|
|
|
252
|
-
# end/error etype – nic nie robimy
|
|
253
266
|
elif etype in {"response.done", "response.failed", "error"}:
|
|
254
267
|
pass
|
|
255
268
|
|
|
@@ -407,6 +420,14 @@ class Stream:
|
|
|
407
420
|
):
|
|
408
421
|
"""
|
|
409
422
|
Asynchronous append of stream worker to the thread.
|
|
423
|
+
|
|
424
|
+
:param ctx: Context item
|
|
425
|
+
:param mode: Mode of operation (e.g., MODE_ASSISTANT)
|
|
426
|
+
:param is_response: Whether this is a response stream
|
|
427
|
+
:param reply: Reply identifier
|
|
428
|
+
:param internal: Whether this is an internal stream
|
|
429
|
+
:param context: Optional BridgeContext for additional context
|
|
430
|
+
:param extra: Additional data to pass to the stream
|
|
410
431
|
"""
|
|
411
432
|
self.ctx = ctx
|
|
412
433
|
self.mode = mode
|
|
@@ -430,6 +451,8 @@ class Stream:
|
|
|
430
451
|
def handleEnd(self, ctx: CtxItem):
|
|
431
452
|
"""
|
|
432
453
|
Slot for handling end of stream
|
|
454
|
+
|
|
455
|
+
:param ctx: Context item
|
|
433
456
|
"""
|
|
434
457
|
self.window.controller.ui.update_tokens()
|
|
435
458
|
|
|
@@ -457,9 +480,19 @@ class Stream:
|
|
|
457
480
|
self.worker = None
|
|
458
481
|
|
|
459
482
|
def handleEvent(self, event):
|
|
483
|
+
"""
|
|
484
|
+
Slot for handling stream events
|
|
485
|
+
|
|
486
|
+
:param event: RenderEvent
|
|
487
|
+
"""
|
|
460
488
|
self.window.dispatch(event)
|
|
461
489
|
|
|
462
490
|
def handleError(self, error):
|
|
491
|
+
"""
|
|
492
|
+
Slot for handling stream errors
|
|
493
|
+
|
|
494
|
+
:param error: Exception or error message
|
|
495
|
+
"""
|
|
463
496
|
self.window.core.debug.log(error)
|
|
464
497
|
if self.is_response:
|
|
465
498
|
if not isinstance(self.extra, dict):
|
|
@@ -475,4 +508,9 @@ class Stream:
|
|
|
475
508
|
)
|
|
476
509
|
|
|
477
510
|
def log(self, data: object):
|
|
511
|
+
"""
|
|
512
|
+
Log data to the debug console
|
|
513
|
+
|
|
514
|
+
:param data: object to log
|
|
515
|
+
"""
|
|
478
516
|
self.window.core.debug.info(data)
|
|
@@ -458,6 +458,31 @@ class Plugins:
|
|
|
458
458
|
self.settings.setup()
|
|
459
459
|
self.update()
|
|
460
460
|
|
|
461
|
+
def save_all(self):
|
|
462
|
+
"""Save plugin settings"""
|
|
463
|
+
for id in self.window.core.plugins.plugins.keys():
|
|
464
|
+
plugin = self.window.core.plugins.plugins[id]
|
|
465
|
+
options = plugin.setup() # get plugin options
|
|
466
|
+
|
|
467
|
+
# add plugin to global config data if not exists
|
|
468
|
+
if id not in self.window.core.config.get('plugins'):
|
|
469
|
+
self.window.core.config.data['plugins'][id] = {}
|
|
470
|
+
|
|
471
|
+
# update config with current values
|
|
472
|
+
for key in options:
|
|
473
|
+
self.window.core.config.data['plugins'][id][key] = self.window.core.plugins.plugins[id].options[key]['value']
|
|
474
|
+
|
|
475
|
+
# remove key from config if plugin option not exists
|
|
476
|
+
for key in list(self.window.core.config.data['plugins'].keys()):
|
|
477
|
+
if key not in self.window.core.plugins.plugins:
|
|
478
|
+
self.window.core.config.data['plugins'].pop(key)
|
|
479
|
+
|
|
480
|
+
# save preset
|
|
481
|
+
self.window.controller.plugins.presets.save_current()
|
|
482
|
+
|
|
483
|
+
# save config
|
|
484
|
+
self.window.core.config.save()
|
|
485
|
+
|
|
461
486
|
def log(self, data: Any):
|
|
462
487
|
"""
|
|
463
488
|
Log data to debug
|
|
@@ -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.14
|
|
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
|
},
|
|
@@ -189,25 +197,6 @@ class Editor:
|
|
|
189
197
|
},
|
|
190
198
|
}
|
|
191
199
|
},
|
|
192
|
-
"assistant_id": {
|
|
193
|
-
"type": "text",
|
|
194
|
-
"label": "preset.assistant_id",
|
|
195
|
-
"description": "preset.assistant_id.desc",
|
|
196
|
-
},
|
|
197
|
-
"tool.function": {
|
|
198
|
-
"type": "dict",
|
|
199
|
-
"label": "preset.tool.function",
|
|
200
|
-
"keys": {
|
|
201
|
-
'name': 'text',
|
|
202
|
-
'params': 'textarea',
|
|
203
|
-
'desc': 'textarea',
|
|
204
|
-
},
|
|
205
|
-
"extra": {
|
|
206
|
-
"urls": {
|
|
207
|
-
"Help": "https://platform.openai.com/docs/guides/function-calling",
|
|
208
|
-
},
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
200
|
}
|
|
212
201
|
self.hidden_by_mode = { # hidden fields by mode
|
|
213
202
|
MODE_CHAT: ["idx"],
|
|
@@ -268,15 +257,6 @@ class Editor:
|
|
|
268
257
|
self.window.ui.add_hook("update.preset.agent_provider", self.hook_update)
|
|
269
258
|
self.window.ui.add_hook("update.preset.agent_provider_openai", self.hook_update)
|
|
270
259
|
|
|
271
|
-
# register functions dictionary
|
|
272
|
-
parent = "preset"
|
|
273
|
-
key = "tool.function"
|
|
274
|
-
self.window.ui.dialogs.register_dictionary(
|
|
275
|
-
key,
|
|
276
|
-
parent,
|
|
277
|
-
self.get_option(key),
|
|
278
|
-
)
|
|
279
|
-
|
|
280
260
|
def toggle_extra_options(self):
|
|
281
261
|
"""
|
|
282
262
|
Toggle extra options in preset editor
|
|
@@ -594,6 +574,7 @@ class Editor:
|
|
|
594
574
|
checkboxLayout.addLayout(opt_layout)
|
|
595
575
|
else:
|
|
596
576
|
layout.addLayout(opt_layout)
|
|
577
|
+
layout.addStretch(1)
|
|
597
578
|
layout.addLayout(checkboxLayout)
|
|
598
579
|
|
|
599
580
|
# as tab
|
|
@@ -777,6 +758,7 @@ class Editor:
|
|
|
777
758
|
# load extra options
|
|
778
759
|
self.load_extra_options(data)
|
|
779
760
|
|
|
761
|
+
# toggle extra options
|
|
780
762
|
self.toggle_extra_options()
|
|
781
763
|
|
|
782
764
|
# update experts list, after ID loaded
|
|
@@ -785,24 +767,6 @@ class Editor:
|
|
|
785
767
|
# setup avatar config
|
|
786
768
|
self.update_avatar_config(data)
|
|
787
769
|
|
|
788
|
-
# restore functions
|
|
789
|
-
if data.has_functions():
|
|
790
|
-
functions = data.get_functions()
|
|
791
|
-
values = []
|
|
792
|
-
for function in functions:
|
|
793
|
-
values.append(
|
|
794
|
-
{
|
|
795
|
-
"name": function['name'],
|
|
796
|
-
"params": function['params'],
|
|
797
|
-
"desc": function['desc'],
|
|
798
|
-
}
|
|
799
|
-
)
|
|
800
|
-
self.window.ui.config[self.id]['tool.function'].items = values
|
|
801
|
-
self.window.ui.config[self.id]['tool.function'].model.updateData(values)
|
|
802
|
-
else:
|
|
803
|
-
self.window.ui.config[self.id]['tool.function'].items = []
|
|
804
|
-
self.window.ui.config[self.id]['tool.function'].model.updateData([])
|
|
805
|
-
|
|
806
770
|
# set focus to name field
|
|
807
771
|
current_model = self.window.core.config.get('model')
|
|
808
772
|
# set current model in combo box as selected
|
|
@@ -954,16 +918,9 @@ class Editor:
|
|
|
954
918
|
# sort by name
|
|
955
919
|
self.window.core.presets.sort_by_name()
|
|
956
920
|
|
|
957
|
-
# switch to editing preset
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
self.window.controller.presets.select_model()
|
|
961
|
-
else:
|
|
962
|
-
# switch to model if current preset
|
|
963
|
-
current_preset = self.window.core.config.get('preset')
|
|
964
|
-
if current_preset is not None and current_preset == id:
|
|
965
|
-
self.window.controller.presets.set(mode, current_preset)
|
|
966
|
-
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()
|
|
967
924
|
|
|
968
925
|
# update presets list
|
|
969
926
|
no_scroll = False
|
|
@@ -1000,36 +957,6 @@ class Editor:
|
|
|
1000
957
|
'function': [], # functions are assigned separately (below)
|
|
1001
958
|
}
|
|
1002
959
|
|
|
1003
|
-
# assign functions tool
|
|
1004
|
-
values = self.window.controller.config.get_value(
|
|
1005
|
-
parent_id=self.id,
|
|
1006
|
-
key='tool.function',
|
|
1007
|
-
option=self.options['tool.function'],
|
|
1008
|
-
)
|
|
1009
|
-
functions = []
|
|
1010
|
-
for function in values:
|
|
1011
|
-
name = function['name']
|
|
1012
|
-
params = function['params']
|
|
1013
|
-
desc = function['desc']
|
|
1014
|
-
if name is None or name == "":
|
|
1015
|
-
continue
|
|
1016
|
-
if params is None or params == "":
|
|
1017
|
-
params = '{"type": "object", "properties": {}}' # default empty JSON params
|
|
1018
|
-
if desc is None:
|
|
1019
|
-
desc = ""
|
|
1020
|
-
functions.append(
|
|
1021
|
-
{
|
|
1022
|
-
"name": name,
|
|
1023
|
-
"params": params,
|
|
1024
|
-
"desc": desc,
|
|
1025
|
-
}
|
|
1026
|
-
)
|
|
1027
|
-
|
|
1028
|
-
if len(functions) > 0:
|
|
1029
|
-
preset.tools['function'] = functions
|
|
1030
|
-
else:
|
|
1031
|
-
preset.tools['function'] = []
|
|
1032
|
-
|
|
1033
960
|
# extra options
|
|
1034
961
|
self.append_extra_options(preset)
|
|
1035
962
|
|
|
@@ -1189,3 +1116,21 @@ class Editor:
|
|
|
1189
1116
|
option=self.options["ai_avatar"],
|
|
1190
1117
|
value="",
|
|
1191
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,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.14
|
|
9
|
+
# Updated Date: 2025.08.14 13:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
import re
|
|
@@ -709,4 +709,4 @@ class Presets:
|
|
|
709
709
|
|
|
710
710
|
def clear_selected(self):
|
|
711
711
|
"""Clear selected list"""
|
|
712
|
-
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:
|