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.
- pygpt_net/CHANGELOG.txt +23 -0
- pygpt_net/__init__.py +3 -3
- pygpt_net/app.py +20 -1
- pygpt_net/config.py +55 -65
- pygpt_net/controller/__init__.py +5 -2
- pygpt_net/controller/calendar/note.py +101 -126
- pygpt_net/controller/chat/chat.py +38 -35
- pygpt_net/controller/chat/render.py +154 -214
- pygpt_net/controller/chat/response.py +5 -3
- pygpt_net/controller/chat/stream.py +92 -27
- pygpt_net/controller/config/config.py +39 -42
- pygpt_net/controller/config/field/checkbox.py +16 -12
- pygpt_net/controller/config/field/checkbox_list.py +36 -31
- pygpt_net/controller/config/field/cmd.py +51 -57
- pygpt_net/controller/config/field/combo.py +33 -16
- pygpt_net/controller/config/field/dictionary.py +48 -55
- pygpt_net/controller/config/field/input.py +50 -32
- pygpt_net/controller/config/field/slider.py +40 -45
- pygpt_net/controller/config/field/textarea.py +20 -6
- pygpt_net/controller/config/placeholder.py +110 -231
- pygpt_net/controller/ctx/common.py +48 -48
- pygpt_net/controller/ctx/ctx.py +91 -132
- pygpt_net/controller/lang/mapping.py +57 -95
- pygpt_net/controller/lang/plugins.py +64 -55
- pygpt_net/controller/lang/settings.py +39 -38
- pygpt_net/controller/layout/layout.py +176 -109
- pygpt_net/controller/mode/mode.py +88 -85
- pygpt_net/controller/model/model.py +73 -73
- pygpt_net/controller/plugins/plugins.py +209 -223
- pygpt_net/controller/plugins/presets.py +54 -55
- pygpt_net/controller/plugins/settings.py +54 -69
- pygpt_net/controller/presets/editor.py +33 -88
- pygpt_net/controller/presets/experts.py +20 -1
- pygpt_net/controller/presets/presets.py +293 -298
- pygpt_net/controller/settings/profile.py +16 -4
- pygpt_net/controller/theme/theme.py +72 -81
- pygpt_net/controller/ui/mode.py +118 -186
- pygpt_net/controller/ui/tabs.py +69 -90
- pygpt_net/controller/ui/ui.py +47 -56
- pygpt_net/controller/ui/vision.py +24 -23
- pygpt_net/core/agents/runner.py +15 -7
- pygpt_net/core/bridge/bridge.py +5 -5
- pygpt_net/core/command/command.py +149 -219
- pygpt_net/core/ctx/ctx.py +94 -146
- pygpt_net/core/debug/debug.py +48 -58
- pygpt_net/core/experts/experts.py +3 -3
- pygpt_net/core/models/models.py +74 -112
- pygpt_net/core/modes/modes.py +13 -21
- pygpt_net/core/plugins/plugins.py +154 -177
- pygpt_net/core/presets/presets.py +103 -176
- pygpt_net/core/render/web/body.py +217 -215
- pygpt_net/core/render/web/renderer.py +330 -474
- pygpt_net/core/text/utils.py +28 -44
- pygpt_net/core/tokens/tokens.py +104 -203
- 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/item/ctx.py +141 -139
- pygpt_net/plugin/agent/plugin.py +2 -1
- pygpt_net/plugin/audio_output/plugin.py +5 -2
- pygpt_net/plugin/base/plugin.py +101 -85
- pygpt_net/plugin/bitbucket/__init__.py +12 -0
- pygpt_net/plugin/bitbucket/config.py +267 -0
- pygpt_net/plugin/bitbucket/plugin.py +126 -0
- pygpt_net/plugin/bitbucket/worker.py +569 -0
- pygpt_net/plugin/cmd_code_interpreter/plugin.py +3 -2
- pygpt_net/plugin/cmd_custom/plugin.py +3 -2
- pygpt_net/plugin/cmd_files/plugin.py +3 -2
- pygpt_net/plugin/cmd_history/plugin.py +3 -2
- pygpt_net/plugin/cmd_mouse_control/plugin.py +5 -2
- pygpt_net/plugin/cmd_serial/plugin.py +3 -2
- pygpt_net/plugin/cmd_system/plugin.py +3 -6
- pygpt_net/plugin/cmd_web/plugin.py +3 -2
- pygpt_net/plugin/experts/plugin.py +2 -2
- pygpt_net/plugin/facebook/__init__.py +12 -0
- pygpt_net/plugin/facebook/config.py +359 -0
- pygpt_net/plugin/facebook/plugin.py +113 -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 +126 -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/idx_llama_index/plugin.py +3 -2
- pygpt_net/plugin/mailer/plugin.py +3 -5
- pygpt_net/plugin/openai_vision/plugin.py +3 -2
- pygpt_net/plugin/real_time/plugin.py +52 -60
- pygpt_net/plugin/slack/__init__.py +12 -0
- pygpt_net/plugin/slack/config.py +349 -0
- pygpt_net/plugin/slack/plugin.py +115 -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 +117 -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 +125 -0
- pygpt_net/plugin/twitter/worker.py +837 -0
- pygpt_net/provider/agents/llama_index/legacy/openai_assistant.py +35 -3
- pygpt_net/tools/code_interpreter/tool.py +0 -1
- pygpt_net/tools/translator/tool.py +1 -1
- pygpt_net/ui/base/config_dialog.py +86 -100
- pygpt_net/ui/base/context_menu.py +48 -46
- pygpt_net/ui/dialog/preset.py +34 -77
- pygpt_net/ui/layout/ctx/ctx_list.py +10 -6
- pygpt_net/ui/layout/toolbox/presets.py +41 -41
- pygpt_net/ui/main.py +49 -31
- pygpt_net/ui/tray.py +61 -60
- pygpt_net/ui/widget/calendar/select.py +86 -70
- pygpt_net/ui/widget/lists/attachment.py +86 -44
- pygpt_net/ui/widget/lists/base_list_combo.py +85 -33
- pygpt_net/ui/widget/lists/context.py +135 -188
- pygpt_net/ui/widget/lists/preset.py +59 -61
- pygpt_net/ui/widget/textarea/web.py +161 -48
- pygpt_net/utils.py +8 -1
- {pygpt_net-2.6.1.dist-info → pygpt_net-2.6.6.dist-info}/METADATA +164 -2
- {pygpt_net-2.6.1.dist-info → pygpt_net-2.6.6.dist-info}/RECORD +131 -103
- {pygpt_net-2.6.1.dist-info → pygpt_net-2.6.6.dist-info}/LICENSE +0 -0
- {pygpt_net-2.6.1.dist-info → pygpt_net-2.6.6.dist-info}/WHEEL +0 -0
- {pygpt_net-2.6.1.dist-info → pygpt_net-2.6.6.dist-info}/entry_points.txt +0 -0
|
@@ -967,8 +967,10 @@ preset.prompt.rename = Renombrar
|
|
|
967
967
|
preset.prompt.save_custom = Guardar como Mi plantilla
|
|
968
968
|
preset.prompt.use = Pegar...
|
|
969
969
|
preset.research = Investigación
|
|
970
|
+
preset.tab.experts = Expertos
|
|
970
971
|
preset.tab.general = General
|
|
971
972
|
preset.tab.personalize = Personalizar
|
|
973
|
+
preset.tab.remote_tools = Herramientas remotas
|
|
972
974
|
preset.temperature = Temperatura
|
|
973
975
|
preset.tool.function = Funciones
|
|
974
976
|
preset.tool.function.tip.agent_llama = Consejo: Las funciones de los plugins se habilitan automáticamente.
|
|
@@ -966,8 +966,10 @@ preset.prompt.rename = Renommer
|
|
|
966
966
|
preset.prompt.save_custom = Enregistrer comme Mon modèle
|
|
967
967
|
preset.prompt.use = Coller...
|
|
968
968
|
preset.research = Recherche
|
|
969
|
+
preset.tab.experts = Experts
|
|
969
970
|
preset.tab.general = Général
|
|
970
971
|
preset.tab.personalize = Personnaliser
|
|
972
|
+
preset.tab.remote_tools = Outils à distance
|
|
971
973
|
preset.temperature = Température
|
|
972
974
|
preset.tool.function = Fonctionnalités
|
|
973
975
|
preset.tool.function.tip.agent_llama = Astuce : Les fonctions des plugins sont activées automatiquement.
|
|
@@ -966,8 +966,10 @@ preset.prompt.rename = Rinomina
|
|
|
966
966
|
preset.prompt.save_custom = Salva come Mio modello
|
|
967
967
|
preset.prompt.use = Incolla...
|
|
968
968
|
preset.research = Ricerca
|
|
969
|
+
preset.tab.experts = Esperti
|
|
969
970
|
preset.tab.general = Generale
|
|
970
971
|
preset.tab.personalize = Personalizzare
|
|
972
|
+
preset.tab.remote_tools = Strumenti remoti
|
|
971
973
|
preset.temperature = Temperatura
|
|
972
974
|
preset.tool.function = Funzioni
|
|
973
975
|
preset.tool.function.tip.agent_llama = Suggerimento: Le funzioni dai plugin sono abilitate automaticamente.
|
|
@@ -818,7 +818,7 @@ model.ctx = Tokeny kontekstu
|
|
|
818
818
|
model.ctx.desc = Maksymalna liczba tokenów wejściowych modelu
|
|
819
819
|
model.default = Domyślnie w trybie
|
|
820
820
|
model.extra = Dodatkowe parametry (JSON)
|
|
821
|
-
model.extra.desc = Obiekt JSON zawierający dodatkowe parametry dla modelu (takie jak wysiłek intelektualny itp.).
|
|
821
|
+
model.extra.desc = Obiekt JSON zawierający dodatkowe parametry dla modelu (takie jak wysiłek intelektualny itp.).
|
|
822
822
|
model.id = ID modelu
|
|
823
823
|
model.input = Wejście
|
|
824
824
|
mode.llama_index = Czat z plikami
|
|
@@ -969,8 +969,10 @@ preset.prompt.rename = Zmień nazwę
|
|
|
969
969
|
preset.prompt.save_custom = Zapisz jako Mój szablon
|
|
970
970
|
preset.prompt.use = Wklej...
|
|
971
971
|
preset.research = Badania
|
|
972
|
+
preset.tab.experts = Eksperci
|
|
972
973
|
preset.tab.general = Ogólne
|
|
973
974
|
preset.tab.personalize = Personalizuj
|
|
975
|
+
preset.tab.remote_tools = Narzędzia zdalne
|
|
974
976
|
preset.temperature = Temperatura
|
|
975
977
|
preset.tool.function = Funkcje
|
|
976
978
|
preset.tool.function.tip.agent_llama = Tip: Funkcje z wtyczek są automatycznie włączane.
|
|
@@ -966,8 +966,10 @@ preset.prompt.rename = Перейменувати
|
|
|
966
966
|
preset.prompt.save_custom = Зберегти як Моя шаблона
|
|
967
967
|
preset.prompt.use = Вставити...
|
|
968
968
|
preset.research = Дослідження
|
|
969
|
+
preset.tab.experts = Експерти
|
|
969
970
|
preset.tab.general = Загальні
|
|
970
971
|
preset.tab.personalize = Персоналізувати
|
|
972
|
+
preset.tab.remote_tools = Віддалені інструменти
|
|
971
973
|
preset.temperature = Температура
|
|
972
974
|
preset.tool.function = Функції
|
|
973
975
|
preset.tool.function.tip.agent_llama = Порада: Функції з плагінів увімкнені автоматично.
|
|
@@ -966,8 +966,10 @@ preset.prompt.rename = 重命名
|
|
|
966
966
|
preset.prompt.save_custom = 保存为我的模板
|
|
967
967
|
preset.prompt.use = 粘贴...
|
|
968
968
|
preset.research = 研究
|
|
969
|
+
preset.tab.experts = 专家
|
|
969
970
|
preset.tab.general = 常规
|
|
970
971
|
preset.tab.personalize = 个性化
|
|
972
|
+
preset.tab.remote_tools = 远程工具
|
|
971
973
|
preset.temperature = 溫度
|
|
972
974
|
preset.tool.function = 函數
|
|
973
975
|
preset.tool.function.tip.agent_llama = 提示:插件中的功能 会自动启用。
|
pygpt_net/item/ctx.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 23:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
import copy
|
|
@@ -100,12 +100,11 @@ class CtxItem:
|
|
|
100
100
|
|
|
101
101
|
:return: input text
|
|
102
102
|
"""
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return content
|
|
103
|
+
if self.input is None:
|
|
104
|
+
return None
|
|
105
|
+
if self.hidden_input:
|
|
106
|
+
return self.input + "\n\n" + self.hidden_input
|
|
107
|
+
return self.input
|
|
109
108
|
|
|
110
109
|
@property
|
|
111
110
|
def final_output(self) -> str:
|
|
@@ -114,12 +113,11 @@ class CtxItem:
|
|
|
114
113
|
|
|
115
114
|
:return: output text
|
|
116
115
|
"""
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
return content
|
|
116
|
+
if self.output is None:
|
|
117
|
+
return None
|
|
118
|
+
if self.hidden_output:
|
|
119
|
+
return self.output + "\n\n" + self.hidden_output
|
|
120
|
+
return self.output
|
|
123
121
|
|
|
124
122
|
def clear_reply(self):
|
|
125
123
|
"""Clear current reply output"""
|
|
@@ -129,19 +127,22 @@ class CtxItem:
|
|
|
129
127
|
|
|
130
128
|
def from_previous(self):
|
|
131
129
|
"""Copy data from previous context reply to current context"""
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
if
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
if
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
130
|
+
p = self.prev_ctx
|
|
131
|
+
if not p:
|
|
132
|
+
return
|
|
133
|
+
dp = copy.deepcopy
|
|
134
|
+
if p.urls or p.urls_before:
|
|
135
|
+
src = p.urls_before if p.urls_before else p.urls
|
|
136
|
+
if src:
|
|
137
|
+
self.urls = dp(src)
|
|
138
|
+
if p.images or p.images_before:
|
|
139
|
+
src = p.images_before if p.images_before else p.images
|
|
140
|
+
if src:
|
|
141
|
+
self.images = dp(src)
|
|
142
|
+
if p.files_before:
|
|
143
|
+
self.files = dp(p.files_before)
|
|
144
|
+
if p.attachments_before:
|
|
145
|
+
self.attachments = dp(p.attachments_before)
|
|
145
146
|
|
|
146
147
|
def has_commands(self) -> bool:
|
|
147
148
|
"""
|
|
@@ -149,7 +150,7 @@ class CtxItem:
|
|
|
149
150
|
|
|
150
151
|
:return: True if commands are present
|
|
151
152
|
"""
|
|
152
|
-
return
|
|
153
|
+
return bool(self.cmds or self.tool_calls)
|
|
153
154
|
|
|
154
155
|
def audio_read_allowed(self) -> bool:
|
|
155
156
|
"""
|
|
@@ -157,10 +158,12 @@ class CtxItem:
|
|
|
157
158
|
|
|
158
159
|
:return: True if audio read allowed
|
|
159
160
|
"""
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
161
|
+
if self.has_commands():
|
|
162
|
+
return False
|
|
163
|
+
out = self.output
|
|
164
|
+
if isinstance(out, str) and '<tool>{"cmd":' in out:
|
|
165
|
+
return False
|
|
166
|
+
return True
|
|
164
167
|
|
|
165
168
|
def add_doc_meta(self, meta: dict):
|
|
166
169
|
"""
|
|
@@ -305,56 +308,57 @@ class CtxItem:
|
|
|
305
308
|
|
|
306
309
|
:param data: dict
|
|
307
310
|
"""
|
|
308
|
-
|
|
309
|
-
self.
|
|
310
|
-
self.
|
|
311
|
-
self.
|
|
312
|
-
self.
|
|
313
|
-
self.
|
|
314
|
-
self.
|
|
315
|
-
self.
|
|
316
|
-
self.
|
|
317
|
-
self.
|
|
318
|
-
self.
|
|
319
|
-
self.
|
|
320
|
-
self.
|
|
321
|
-
self.
|
|
322
|
-
self.
|
|
323
|
-
self.
|
|
324
|
-
self.
|
|
325
|
-
self.
|
|
326
|
-
self.
|
|
327
|
-
self.
|
|
328
|
-
self.
|
|
329
|
-
self.
|
|
330
|
-
self.
|
|
331
|
-
self.
|
|
332
|
-
self.
|
|
333
|
-
self.
|
|
334
|
-
self.
|
|
335
|
-
self.
|
|
336
|
-
self.
|
|
337
|
-
self.
|
|
338
|
-
self.
|
|
339
|
-
self.
|
|
340
|
-
self.
|
|
341
|
-
self.
|
|
342
|
-
self.
|
|
343
|
-
self.
|
|
344
|
-
self.
|
|
345
|
-
self.
|
|
346
|
-
self.
|
|
347
|
-
self.
|
|
348
|
-
self.
|
|
349
|
-
self.
|
|
350
|
-
self.
|
|
351
|
-
self.
|
|
352
|
-
self.
|
|
353
|
-
self.
|
|
354
|
-
self.
|
|
355
|
-
self.
|
|
356
|
-
self.
|
|
357
|
-
self.
|
|
311
|
+
g = data.get
|
|
312
|
+
self.id = g("id", None)
|
|
313
|
+
self.meta = g("meta", None)
|
|
314
|
+
self.meta_id = g("meta_id", None)
|
|
315
|
+
self.external_id = g("external_id", None)
|
|
316
|
+
self.stream = g("stream", None)
|
|
317
|
+
self.cmds = g("cmds", [])
|
|
318
|
+
self.results = g("results", [])
|
|
319
|
+
self.urls = g("urls", [])
|
|
320
|
+
self.urls_before = g("urls_before", [])
|
|
321
|
+
self.images = g("images", [])
|
|
322
|
+
self.images_before = g("images_before", [])
|
|
323
|
+
self.files = g("files", [])
|
|
324
|
+
self.files_before = g("files_before", [])
|
|
325
|
+
self.attachments = g("attachments", [])
|
|
326
|
+
self.attachments_before = g("attachments_before", [])
|
|
327
|
+
self.reply = g("reply", False)
|
|
328
|
+
self.input = g("input", None)
|
|
329
|
+
self.output = g("output", None)
|
|
330
|
+
self.mode = g("mode", None)
|
|
331
|
+
self.model = g("model", None)
|
|
332
|
+
self.thread = g("thread", None)
|
|
333
|
+
self.msg_id = g("msg_id", None)
|
|
334
|
+
self.run_id = g("run_id", None)
|
|
335
|
+
self.audio_id = g("audio_id", None)
|
|
336
|
+
self.audio_expires_ts = g("audio_expires_ts", None)
|
|
337
|
+
self.input_name = g("input_name", None)
|
|
338
|
+
self.output_name = g("output_name", None)
|
|
339
|
+
self.input_timestamp = g("input_timestamp", None)
|
|
340
|
+
self.output_timestamp = g("output_timestamp", None)
|
|
341
|
+
self.hidden_input = g("hidden_input", None)
|
|
342
|
+
self.hidden_output = g("hidden_output", None)
|
|
343
|
+
self.input_tokens = g("input_tokens", 0)
|
|
344
|
+
self.output_tokens = g("output_tokens", 0)
|
|
345
|
+
self.total_tokens = g("total_tokens", 0)
|
|
346
|
+
self.extra = g("extra", None)
|
|
347
|
+
self.extra_ctx = g("extra_ctx", False)
|
|
348
|
+
self.current = g("current", False)
|
|
349
|
+
self.internal = g("internal", False)
|
|
350
|
+
self.is_vision = g("is_vision", False)
|
|
351
|
+
self.idx = g("idx", 0)
|
|
352
|
+
self.first = g("first", False)
|
|
353
|
+
self.agent_call = g("agent_call", False)
|
|
354
|
+
self.tool_calls = g("tool_calls", [])
|
|
355
|
+
self.index_meta = g("index_meta", {})
|
|
356
|
+
self.doc_ids = g("doc_ids", [])
|
|
357
|
+
self.sub_calls = g("sub_calls", 0)
|
|
358
|
+
self.sub_call = g("sub_call", False)
|
|
359
|
+
self.sub_reply = g("sub_reply", False)
|
|
360
|
+
self.sub_tool_call = g("sub_tool_call", False)
|
|
361
|
+
self.hidden = g("hidden", False)
|
|
358
362
|
|
|
359
363
|
|
|
360
364
|
def dump(self, dump: bool = True) -> str:
|
|
@@ -366,14 +370,14 @@ class CtxItem:
|
|
|
366
370
|
"""
|
|
367
371
|
try:
|
|
368
372
|
return json.dumps(self.to_dict(dump), ensure_ascii=False, indent=2)
|
|
369
|
-
except Exception
|
|
373
|
+
except Exception:
|
|
370
374
|
pass
|
|
371
375
|
return ""
|
|
372
376
|
|
|
373
377
|
def print(self):
|
|
374
378
|
"""Print context item"""
|
|
375
379
|
print("\n----------------------------")
|
|
376
|
-
print("[
|
|
380
|
+
print(f"[{self.id}]")
|
|
377
381
|
print("Input:", self.input)
|
|
378
382
|
print("Output:", self.output)
|
|
379
383
|
print("Extra:", self.extra)
|
|
@@ -429,11 +433,10 @@ class CtxMeta:
|
|
|
429
433
|
|
|
430
434
|
:return: True if additional context data is present
|
|
431
435
|
"""
|
|
432
|
-
if self.additional_ctx
|
|
436
|
+
if self.additional_ctx:
|
|
437
|
+
return True
|
|
438
|
+
if self.group and self.group.additional_ctx:
|
|
433
439
|
return True
|
|
434
|
-
if self.group:
|
|
435
|
-
if self.group.additional_ctx is not None and len(self.group.additional_ctx) > 0:
|
|
436
|
-
return True
|
|
437
440
|
return False
|
|
438
441
|
|
|
439
442
|
def get_additional_ctx(self) -> list:
|
|
@@ -442,12 +445,9 @@ class CtxMeta:
|
|
|
442
445
|
|
|
443
446
|
:return: list
|
|
444
447
|
"""
|
|
445
|
-
if self.group:
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
if self.additional_ctx:
|
|
449
|
-
return self.additional_ctx
|
|
450
|
-
return []
|
|
448
|
+
if self.group and self.group.additional_ctx:
|
|
449
|
+
return self.group.additional_ctx
|
|
450
|
+
return self.additional_ctx or []
|
|
451
451
|
|
|
452
452
|
def reset_additional_ctx(self):
|
|
453
453
|
"""Delete additional context data"""
|
|
@@ -463,11 +463,13 @@ class CtxMeta:
|
|
|
463
463
|
:param item: dict
|
|
464
464
|
"""
|
|
465
465
|
if self.group:
|
|
466
|
-
|
|
467
|
-
|
|
466
|
+
lst = self.group.additional_ctx
|
|
467
|
+
if item in lst:
|
|
468
|
+
lst.remove(item)
|
|
468
469
|
else:
|
|
469
|
-
|
|
470
|
-
|
|
470
|
+
lst = self.additional_ctx
|
|
471
|
+
if item in lst:
|
|
472
|
+
lst.remove(item)
|
|
471
473
|
|
|
472
474
|
def get_attachment_names(self) -> list:
|
|
473
475
|
"""
|
|
@@ -527,35 +529,36 @@ class CtxMeta:
|
|
|
527
529
|
|
|
528
530
|
:param data: dict
|
|
529
531
|
"""
|
|
530
|
-
|
|
531
|
-
self.
|
|
532
|
-
self.
|
|
533
|
-
self.
|
|
534
|
-
self.
|
|
535
|
-
self.
|
|
536
|
-
self.
|
|
537
|
-
self.
|
|
538
|
-
self.
|
|
539
|
-
self.
|
|
540
|
-
self.
|
|
541
|
-
self.
|
|
542
|
-
self.
|
|
543
|
-
self.
|
|
544
|
-
self.
|
|
545
|
-
self.
|
|
546
|
-
self.
|
|
547
|
-
self.
|
|
548
|
-
self.
|
|
549
|
-
self.
|
|
550
|
-
self.
|
|
551
|
-
self.
|
|
552
|
-
self.
|
|
553
|
-
self.
|
|
554
|
-
self.
|
|
555
|
-
self.
|
|
556
|
-
self.
|
|
557
|
-
self.
|
|
558
|
-
self.
|
|
532
|
+
g = data.get
|
|
533
|
+
self.id = g("id", None)
|
|
534
|
+
self.external_id = g("external_id", None)
|
|
535
|
+
self.uuid = g("uuid", None)
|
|
536
|
+
self.name = g("name", None)
|
|
537
|
+
self.date = g("date", None)
|
|
538
|
+
self.created = g("created", None)
|
|
539
|
+
self.updated = g("updated", None)
|
|
540
|
+
self.indexed = g("indexed", None)
|
|
541
|
+
self.mode = g("mode", None)
|
|
542
|
+
self.model = g("model", None)
|
|
543
|
+
self.last_mode = g("last_mode", None)
|
|
544
|
+
self.last_model = g("last_model", None)
|
|
545
|
+
self.thread = g("thread", None)
|
|
546
|
+
self.assistant = g("assistant", None)
|
|
547
|
+
self.preset = g("preset", None)
|
|
548
|
+
self.run = g("run", None)
|
|
549
|
+
self.status = g("status", None)
|
|
550
|
+
self.extra = g("extra", None)
|
|
551
|
+
self.initialized = g("initialized", False)
|
|
552
|
+
self.deleted = g("deleted", False)
|
|
553
|
+
self.important = g("important", False)
|
|
554
|
+
self.archived = g("archived", False)
|
|
555
|
+
self.label = g("label", 0)
|
|
556
|
+
self.indexes = g("indexes", {})
|
|
557
|
+
self.additional_ctx = g("additional_ctx", [])
|
|
558
|
+
self.group_id = g("group_id", None)
|
|
559
|
+
self.root_id = g("root_id", None)
|
|
560
|
+
self.parent_id = g("parent_id", None)
|
|
561
|
+
self.owner_uuid = g("owner_uuid", None)
|
|
559
562
|
|
|
560
563
|
def get_pid(self):
|
|
561
564
|
return 0
|
|
@@ -568,7 +571,7 @@ class CtxMeta:
|
|
|
568
571
|
"""
|
|
569
572
|
try:
|
|
570
573
|
return json.dumps(self.to_dict(), ensure_ascii=False, indent=2)
|
|
571
|
-
except Exception
|
|
574
|
+
except Exception:
|
|
572
575
|
pass
|
|
573
576
|
return ""
|
|
574
577
|
|
|
@@ -600,9 +603,7 @@ class CtxGroup:
|
|
|
600
603
|
|
|
601
604
|
:return: True if additional context data is present
|
|
602
605
|
"""
|
|
603
|
-
|
|
604
|
-
return True
|
|
605
|
-
return False
|
|
606
|
+
return bool(self.additional_ctx)
|
|
606
607
|
|
|
607
608
|
def get_additional_ctx(self) -> list:
|
|
608
609
|
"""
|
|
@@ -651,13 +652,14 @@ class CtxGroup:
|
|
|
651
652
|
|
|
652
653
|
:param data: dict
|
|
653
654
|
"""
|
|
654
|
-
|
|
655
|
-
self.
|
|
656
|
-
self.
|
|
657
|
-
self.
|
|
658
|
-
self.
|
|
659
|
-
self.
|
|
660
|
-
self.
|
|
655
|
+
g = data.get
|
|
656
|
+
self.id = g("id", None)
|
|
657
|
+
self.uuid = g("uuid", None)
|
|
658
|
+
self.name = g("name", None)
|
|
659
|
+
self.items = g("items", [])
|
|
660
|
+
self.created = g("created", None)
|
|
661
|
+
self.updated = g("updated", None)
|
|
662
|
+
self.count = g("count", 0)
|
|
661
663
|
|
|
662
664
|
def dump(self) -> str:
|
|
663
665
|
"""
|
|
@@ -667,10 +669,10 @@ class CtxGroup:
|
|
|
667
669
|
"""
|
|
668
670
|
try:
|
|
669
671
|
return json.dumps(self.to_dict(), ensure_ascii=False, indent=2)
|
|
670
|
-
except Exception
|
|
672
|
+
except Exception:
|
|
671
673
|
pass
|
|
672
674
|
return ""
|
|
673
675
|
|
|
674
676
|
def __str__(self):
|
|
675
677
|
"""To string"""
|
|
676
|
-
return self.dump()
|
|
678
|
+
return self.dump()
|
pygpt_net/plugin/agent/plugin.py
CHANGED
|
@@ -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:
|
|
9
|
+
# Updated Date: 2025.08.15 23:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
from pygpt_net.plugin.base.plugin import BasePlugin
|
|
13
13
|
from pygpt_net.core.events import Event
|
|
14
14
|
from pygpt_net.item.ctx import CtxItem
|
|
15
|
+
|
|
15
16
|
from .config import Config
|
|
16
17
|
|
|
17
18
|
|
|
@@ -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 23:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
from typing import Any
|
|
@@ -20,7 +20,6 @@ from pygpt_net.core.events import Event
|
|
|
20
20
|
from pygpt_net.item.ctx import CtxItem
|
|
21
21
|
|
|
22
22
|
from .config import Config
|
|
23
|
-
from .worker import Worker
|
|
24
23
|
|
|
25
24
|
|
|
26
25
|
class Plugin(BasePlugin):
|
|
@@ -159,6 +158,8 @@ class Plugin(BasePlugin):
|
|
|
159
158
|
:param ctx: CtxItem
|
|
160
159
|
:param event: Event
|
|
161
160
|
"""
|
|
161
|
+
from .worker import Worker
|
|
162
|
+
|
|
162
163
|
# check if provider is configured
|
|
163
164
|
if not self.get_provider().is_configured():
|
|
164
165
|
msg = self.get_provider().get_config_message()
|
|
@@ -233,6 +234,8 @@ class Plugin(BasePlugin):
|
|
|
233
234
|
:param ctx: CtxItem
|
|
234
235
|
:param event: Event
|
|
235
236
|
"""
|
|
237
|
+
from .worker import Worker
|
|
238
|
+
|
|
236
239
|
try:
|
|
237
240
|
self.stop_audio()
|
|
238
241
|
|