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
@@ -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.14 01:00:00 #
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
- content = None
104
- if self.input is not None:
105
- content = self.input
106
- if self.hidden_input:
107
- content += "\n\n" + self.hidden_input
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
- content = None
118
- if self.output is not None:
119
- content = self.output
120
- if self.hidden_output:
121
- content += "\n\n" + self.hidden_output
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
- if self.prev_ctx is not None:
133
- if self.prev_ctx.urls:
134
- self.urls = copy.deepcopy(self.prev_ctx.urls)
135
- if self.prev_ctx.images:
136
- self.images = copy.deepcopy(self.prev_ctx.images)
137
- if self.prev_ctx.images_before:
138
- self.images = copy.deepcopy(self.prev_ctx.images_before)
139
- if self.prev_ctx.files_before:
140
- self.files = copy.deepcopy(self.prev_ctx.files_before)
141
- if self.prev_ctx.attachments_before:
142
- self.attachments = copy.deepcopy(self.prev_ctx.attachments_before)
143
- if self.prev_ctx.urls_before:
144
- self.urls = copy.deepcopy(self.prev_ctx.urls_before)
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 len(self.cmds) > 0 or len(self.tool_calls) > 0
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
- allowed = True
161
- if self.has_commands() or '<tool>{"cmd":' in self.output:
162
- allowed = False
163
- return allowed
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
- self.id = data.get("id", None)
309
- self.meta = data.get("meta", None)
310
- self.meta_id = data.get("meta_id", None)
311
- self.external_id = data.get("external_id", None)
312
- self.stream = data.get("stream", None)
313
- self.cmds = data.get("cmds", [])
314
- self.results = data.get("results", [])
315
- self.urls = data.get("urls", [])
316
- self.urls_before = data.get("urls_before", [])
317
- self.images = data.get("images", [])
318
- self.images_before = data.get("images_before", [])
319
- self.files = data.get("files", [])
320
- self.files_before = data.get("files_before", [])
321
- self.attachments = data.get("attachments", [])
322
- self.attachments_before = data.get("attachments_before", [])
323
- self.reply = data.get("reply", False)
324
- self.input = data.get("input", None)
325
- self.output = data.get("output", None)
326
- self.mode = data.get("mode", None)
327
- self.model = data.get("model", None)
328
- self.thread = data.get("thread", None)
329
- self.msg_id = data.get("msg_id", None)
330
- self.run_id = data.get("run_id", None)
331
- self.audio_id = data.get("audio_id", None)
332
- self.audio_expires_ts = data.get("audio_expires_ts", None)
333
- self.input_name = data.get("input_name", None)
334
- self.output_name = data.get("output_name", None)
335
- self.input_timestamp = data.get("input_timestamp", None)
336
- self.output_timestamp = data.get("output_timestamp", None)
337
- self.hidden_input = data.get("hidden_input", None)
338
- self.hidden_output = data.get("hidden_output", None)
339
- self.input_tokens = data.get("input_tokens", 0)
340
- self.output_tokens = data.get("output_tokens", 0)
341
- self.total_tokens = data.get("total_tokens", 0)
342
- self.extra = data.get("extra", None)
343
- self.extra_ctx = data.get("extra_ctx", False)
344
- self.current = data.get("current", False)
345
- self.internal = data.get("internal", False)
346
- self.is_vision = data.get("is_vision", False)
347
- self.idx = data.get("idx", 0)
348
- self.first = data.get("first", False)
349
- self.agent_call = data.get("agent_call", False)
350
- self.tool_calls = data.get("tool_calls", [])
351
- self.index_meta = data.get("index_meta", {})
352
- self.doc_ids = data.get("doc_ids", [])
353
- self.sub_calls = data.get("sub_calls", 0)
354
- self.sub_call = data.get("sub_call", False)
355
- self.sub_reply = data.get("sub_reply", False)
356
- self.sub_tool_call = data.get("sub_tool_call", False)
357
- self.hidden = data.get("hidden", False)
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 as e:
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("[" + str(self.id) + "]")
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 is not None and len(self.additional_ctx) > 0:
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
- if self.group.additional_ctx:
447
- return self.group.additional_ctx
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
- if item in self.group.additional_ctx:
467
- self.group.additional_ctx.remove(item)
466
+ lst = self.group.additional_ctx
467
+ if item in lst:
468
+ lst.remove(item)
468
469
  else:
469
- if item in self.additional_ctx:
470
- self.additional_ctx.remove(item)
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
- self.id = data.get("id", None)
531
- self.external_id = data.get("external_id", None)
532
- self.uuid = data.get("uuid", None)
533
- self.name = data.get("name", None)
534
- self.date = data.get("date", None)
535
- self.created = data.get("created", None)
536
- self.updated = data.get("updated", None)
537
- self.indexed = data.get("indexed", None)
538
- self.mode = data.get("mode", None)
539
- self.model = data.get("model", None)
540
- self.last_mode = data.get("last_mode", None)
541
- self.last_model = data.get("last_model", None)
542
- self.thread = data.get("thread", None)
543
- self.assistant = data.get("assistant", None)
544
- self.preset = data.get("preset", None)
545
- self.run = data.get("run", None)
546
- self.status = data.get("status", None)
547
- self.extra = data.get("extra", None)
548
- self.initialized = data.get("initialized", False)
549
- self.deleted = data.get("deleted", False)
550
- self.important = data.get("important", False)
551
- self.archived = data.get("archived", False)
552
- self.label = data.get("label", 0)
553
- self.indexes = data.get("indexes", {})
554
- self.additional_ctx = data.get("additional_ctx", [])
555
- self.group_id = data.get("group_id", None)
556
- self.root_id = data.get("root_id", None)
557
- self.parent_id = data.get("parent_id", None)
558
- self.owner_uuid = data.get("owner_uuid", None)
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 as e:
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
- if self.additional_ctx is not None and len(self.additional_ctx) > 0:
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
- self.id = data.get("id", None)
655
- self.uuid = data.get("uuid", None)
656
- self.name = data.get("name", None)
657
- self.items = data.get("items", [])
658
- self.created = data.get("created", None)
659
- self.updated = data.get("updated", None)
660
- self.count = data.get("count", 0)
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 as e:
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()
@@ -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: 2024.12.14 22:00:00 #
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.07 22:00:00 #
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