pygpt-net 2.6.33__py3-none-any.whl → 2.6.34__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 (42) hide show
  1. pygpt_net/CHANGELOG.txt +7 -0
  2. pygpt_net/__init__.py +3 -3
  3. pygpt_net/controller/assistant/batch.py +14 -4
  4. pygpt_net/controller/assistant/files.py +1 -0
  5. pygpt_net/controller/assistant/store.py +195 -1
  6. pygpt_net/controller/camera/camera.py +1 -1
  7. pygpt_net/controller/chat/common.py +50 -46
  8. pygpt_net/controller/config/placeholder.py +95 -75
  9. pygpt_net/controller/dialogs/confirm.py +3 -1
  10. pygpt_net/controller/media/media.py +11 -3
  11. pygpt_net/controller/painter/common.py +231 -13
  12. pygpt_net/core/assistants/files.py +18 -0
  13. pygpt_net/core/camera/camera.py +31 -402
  14. pygpt_net/core/camera/worker.py +430 -0
  15. pygpt_net/core/filesystem/url.py +3 -0
  16. pygpt_net/core/render/web/body.py +65 -9
  17. pygpt_net/core/text/utils.py +3 -0
  18. pygpt_net/data/config/config.json +3 -3
  19. pygpt_net/data/config/models.json +3 -3
  20. pygpt_net/data/config/settings.json +10 -5
  21. pygpt_net/data/locale/locale.de.ini +8 -7
  22. pygpt_net/data/locale/locale.en.ini +9 -6
  23. pygpt_net/data/locale/locale.es.ini +8 -7
  24. pygpt_net/data/locale/locale.fr.ini +8 -7
  25. pygpt_net/data/locale/locale.it.ini +8 -7
  26. pygpt_net/data/locale/locale.pl.ini +8 -7
  27. pygpt_net/data/locale/locale.uk.ini +8 -7
  28. pygpt_net/data/locale/locale.zh.ini +8 -7
  29. pygpt_net/item/assistant.py +13 -1
  30. pygpt_net/provider/api/google/__init__.py +32 -23
  31. pygpt_net/provider/api/openai/store.py +45 -1
  32. pygpt_net/provider/llms/google.py +4 -0
  33. pygpt_net/ui/dialog/assistant_store.py +213 -203
  34. pygpt_net/ui/layout/chat/input.py +3 -3
  35. pygpt_net/ui/widget/draw/painter.py +16 -1
  36. pygpt_net/ui/widget/option/combo.py +5 -1
  37. pygpt_net/ui/widget/textarea/input.py +273 -3
  38. {pygpt_net-2.6.33.dist-info → pygpt_net-2.6.34.dist-info}/METADATA +9 -2
  39. {pygpt_net-2.6.33.dist-info → pygpt_net-2.6.34.dist-info}/RECORD +42 -41
  40. {pygpt_net-2.6.33.dist-info → pygpt_net-2.6.34.dist-info}/LICENSE +0 -0
  41. {pygpt_net-2.6.33.dist-info → pygpt_net-2.6.34.dist-info}/WHEEL +0 -0
  42. {pygpt_net-2.6.33.dist-info → pygpt_net-2.6.34.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.26 19:00:00 #
9
+ # Updated Date: 2025.09.02 16:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from typing import Dict, Any, List
@@ -29,42 +29,48 @@ class Placeholder:
29
29
  """
30
30
  self.window = window
31
31
  self._apply_handlers = {
32
- "presets": lambda p: self.get_presets(p),
33
- "modes": lambda p: self.get_modes(p),
34
- "models": lambda p: self.get_models(p),
35
- "languages": lambda p: self.get_languages(),
36
- "multimodal": lambda p: self.get_multimodal(p),
37
- "langchain_providers": lambda p: self.get_langchain_providers(),
38
- "llama_index_providers": lambda p: self.get_llama_index_providers(),
39
- "llm_providers": lambda p: self.get_llm_providers(),
40
- "embeddings_providers": lambda p: self.get_embeddings_providers(),
41
- "llama_index_loaders": lambda p: self.get_llama_index_loaders(),
42
- "llama_index_loaders_file": lambda p: self.get_llama_index_loaders(type="file"),
43
- "llama_index_loaders_web": lambda p: self.get_llama_index_loaders(type="web"),
44
- "llama_index_chat_modes": lambda p: self.get_llama_index_chat_modes(),
45
- "vector_storage": lambda p: self.get_vector_storage(),
46
- "var_types": lambda p: self.get_var_types(),
32
+ "access_actions": lambda p: self.get_access_actions(),
47
33
  "agent_modes": lambda p: self.get_agent_modes(),
48
34
  "agent_provider": lambda p: self.get_agent_providers(),
49
35
  "agent_provider_llama": lambda p: self.get_agent_providers_llama(),
50
36
  "agent_provider_openai": lambda p: self.get_agent_providers_openai(),
51
- "remote_tools_openai": lambda p: self.get_remote_tools_openai(),
52
- "syntax_styles": lambda p: self.get_syntax_styles(),
53
- "styles": lambda p: self.get_styles(),
37
+ "audio_input_backend": lambda p: self.get_audio_input_backend(),
38
+ "audio_input_devices": lambda p: self.get_audio_input_devices(),
39
+ "audio_output_backend": lambda p: self.get_audio_output_backend(),
40
+ "audio_output_devices": lambda p: self.get_audio_output_devices(),
41
+ "audio_tts_whisper_voices": lambda p: self.get_audio_tts_whisper_voices(),
42
+ "camera_devices": lambda p: self.get_camera_devices(),
43
+ "embeddings_providers": lambda p: self.get_embeddings_providers(),
54
44
  "idx": lambda p: self.get_idx(p),
55
45
  "keys": lambda p: self.get_keys(),
56
46
  "keys_modifiers": lambda p: self.get_modifiers(),
57
- "access_actions": lambda p: self.get_access_actions(),
47
+ "langchain_providers": lambda p: self.get_langchain_providers(),
48
+ "languages": lambda p: self.get_languages(),
49
+ "llama_index_chat_modes": lambda p: self.get_llama_index_chat_modes(),
50
+ "llama_index_loaders": lambda p: self.get_llama_index_loaders(),
51
+ "llama_index_loaders_file": lambda p: self.get_llama_index_loaders(type="file"),
52
+ "llama_index_loaders_web": lambda p: self.get_llama_index_loaders(type="web"),
53
+ "llama_index_providers": lambda p: self.get_llama_index_providers(),
54
+ "llm_providers": lambda p: self.get_llm_providers(),
55
+ "models": lambda p: self.get_models(p),
56
+ "modes": lambda p: self.get_modes(p),
57
+ "multimodal": lambda p: self.get_multimodal(p),
58
+ "presets": lambda p: self.get_presets(p),
59
+ "remote_tools_openai": lambda p: self.get_remote_tools_openai(),
58
60
  "speech_synthesis_actions": lambda p: self.get_speech_synthesis_actions(),
61
+ "styles": lambda p: self.get_styles(),
62
+ "syntax_styles": lambda p: self.get_syntax_styles(),
63
+ "vector_storage": lambda p: self.get_vector_storage(),
64
+ "var_types": lambda p: self.get_var_types(),
59
65
  "voice_control_actions": lambda p: self.get_voice_control_actions(),
60
- "audio_input_devices": lambda p: self.get_audio_input_devices(),
61
- "audio_output_devices": lambda p: self.get_audio_output_devices(),
62
- "audio_input_backend": lambda p: self.get_audio_input_backend(),
63
- "audio_output_backend": lambda p: self.get_audio_output_backend(),
64
- "audio_tts_whisper_voices": lambda p: self.get_audio_tts_whisper_voices(),
65
66
  }
66
67
 
67
68
  def _apply_combo_if_needed(self, item: Any):
69
+ """
70
+ Apply combo keys if needed
71
+
72
+ :param item: item to check
73
+ """
68
74
  if isinstance(item, dict) and item.get("type") == "combo":
69
75
  use = item.get("use")
70
76
  if use is not None:
@@ -74,6 +80,11 @@ class Placeholder:
74
80
  item["keys"] = self.apply_by_id(use, params)
75
81
 
76
82
  def _apply_suboptions(self, mapping: Dict[str, Any]):
83
+ """
84
+ Apply placeholders to suboptions in mapping
85
+
86
+ :param mapping: Suboptions mapping
87
+ """
77
88
  for item in mapping.values():
78
89
  self._apply_combo_if_needed(item)
79
90
 
@@ -102,6 +113,7 @@ class Placeholder:
102
113
 
103
114
  :param id: Placeholder options id
104
115
  :param params: Additional parameters for specific placeholders
116
+ :return: Filled placeholder list
105
117
  """
106
118
  if params is None:
107
119
  params = {}
@@ -112,7 +124,7 @@ class Placeholder:
112
124
  """
113
125
  Get audio TTS whisper voices list
114
126
 
115
- :return: placeholders list
127
+ :return: Filled placeholder list
116
128
  """
117
129
  voices = self.window.core.audio.whisper.get_voices()
118
130
  return [{v: v} for v in voices]
@@ -121,16 +133,24 @@ class Placeholder:
121
133
  """
122
134
  Get audio input devices list
123
135
 
124
- :return: placeholders list
136
+ :return: Filled placeholder list
125
137
  """
126
138
  devices = self.window.core.audio.get_input_devices()
127
139
  return [{str(did): name} for did, name in devices]
128
140
 
141
+ def get_camera_devices(self) -> List[Dict[str, str]]:
142
+ """
143
+ Get camera devices list
144
+
145
+ :return: Filled placeholder list
146
+ """
147
+ return self.window.core.camera.get_devices()
148
+
129
149
  def get_audio_output_devices(self) -> List[Dict[str, str]]:
130
150
  """
131
151
  Get audio output devices list
132
152
 
133
- :return: placeholders list
153
+ :return: Filled placeholder list
134
154
  """
135
155
  devices = self.window.core.audio.get_output_devices()
136
156
  return [{str(did): name} for did, name in devices]
@@ -139,7 +159,7 @@ class Placeholder:
139
159
  """
140
160
  Get audio input backends list
141
161
 
142
- :return: placeholders list
162
+ :return: Filled placeholder list
143
163
  """
144
164
  items = self.window.core.audio.get_input_backends()
145
165
  return [{str(i): name} for i, name in items]
@@ -148,25 +168,25 @@ class Placeholder:
148
168
  """
149
169
  Get audio output backends list
150
170
 
151
- :return: placeholders list
171
+ :return: Filled placeholder list
152
172
  """
153
173
  items = self.window.core.audio.get_output_backends()
154
174
  return [{str(i): name} for i, name in items]
155
175
 
156
176
  def get_langchain_providers(self) -> List[Dict[str, str]]:
157
177
  """
158
- Get Langchain LLM provider placeholders list
178
+ Get Langchain LLM providers list
159
179
 
160
- :return: placeholders list
180
+ :return: Filled placeholder list
161
181
  """
162
182
  choices = self.window.core.llm.get_choices(MODE_LANGCHAIN)
163
183
  return [{k: v} for k, v in choices.items()]
164
184
 
165
185
  def get_llama_index_providers(self) -> List[Dict[str, str]]:
166
186
  """
167
- Get Llama-index LLM provider placeholders list
187
+ Get Llama-index LLM providers list
168
188
 
169
- :return: placeholders list
189
+ :return: Filled placeholder list
170
190
  """
171
191
  choices = self.window.core.llm.get_choices(MODE_LLAMA_INDEX)
172
192
  return [{k: v} for k, v in choices.items()]
@@ -175,49 +195,49 @@ class Placeholder:
175
195
  """
176
196
  Get all LLM provider placeholders list
177
197
 
178
- :return: placeholders list
198
+ :return: Filled placeholder list
179
199
  """
180
200
  choices = self.window.core.llm.get_choices()
181
201
  return [{k: v} for k, v in choices.items()]
182
202
 
183
203
  def get_embeddings_providers(self) -> List[Dict[str, str]]:
184
204
  """
185
- Get embeddings placeholders list
205
+ Get embedding providers list
186
206
 
187
- :return: placeholders list
207
+ :return: Filled placeholder list
188
208
  """
189
209
  choices = self.window.core.llm.get_choices("embeddings")
190
210
  return [{k: v} for k, v in choices.items()]
191
211
 
192
212
  def get_agent_providers(self) -> List[Dict[str, str]]:
193
213
  """
194
- Get all agent provider placeholders list
214
+ Get all agent providers list
195
215
 
196
- :return: placeholders list
216
+ :return: Filled placeholder list
197
217
  """
198
218
  return self.window.core.agents.provider.get_choices()
199
219
 
200
220
  def get_agent_providers_llama(self) -> List[Dict[str, str]]:
201
221
  """
202
- Get Llama-index agent provider placeholders list
222
+ Get Llama-index agent provider list
203
223
 
204
- :return: placeholders list
224
+ :return: Filled placeholder list
205
225
  """
206
226
  return self.window.core.agents.provider.get_choices(AGENT_TYPE_LLAMA)
207
227
 
208
228
  def get_agent_providers_openai(self) -> List[Dict[str, str]]:
209
229
  """
210
- Get OpenAI agent provider placeholders list
230
+ Get OpenAI agent provider list
211
231
 
212
- :return: placeholders list
232
+ :return: Filled placeholder list
213
233
  """
214
234
  return self.window.core.agents.provider.get_choices(AGENT_TYPE_OPENAI)
215
235
 
216
236
  def get_remote_tools_openai(self) -> List[Dict[str, str]]:
217
237
  """
218
- Get OpenAI remote tools placeholders list
238
+ Get OpenAI remote tools list
219
239
 
220
- :return: placeholders list
240
+ :return: Filled placeholder list
221
241
  """
222
242
  return self.window.core.api.openai.remote_tools.get_choices()
223
243
 
@@ -225,7 +245,7 @@ class Placeholder:
225
245
  """
226
246
  Get llama chat modes list
227
247
 
228
- :return: placeholders list
248
+ :return: Filled placeholder list
229
249
  """
230
250
  return [
231
251
  {"best": "best"},
@@ -239,10 +259,10 @@ class Placeholder:
239
259
 
240
260
  def get_llama_index_loaders(self, type: str = "all") -> List[Dict[str, str]]:
241
261
  """
242
- Get data loaders placeholders list
262
+ Get data loaders list
243
263
 
244
264
  :param type: data type
245
- :return: placeholders list
265
+ :return: Filled placeholder list
246
266
  """
247
267
  data = []
248
268
  choices = self.window.controller.idx.common.get_loaders_choices()
@@ -261,28 +281,28 @@ class Placeholder:
261
281
 
262
282
  def get_vector_storage(self) -> List[Dict[str, str]]:
263
283
  """
264
- Get vector storage placeholders list
284
+ Get vector storage list
265
285
 
266
- :return: placeholders list
286
+ :return: Filled placeholder list
267
287
  """
268
288
  ids = self.window.core.idx.storage.get_ids()
269
289
  return [{i: i} for i in ids]
270
290
 
271
291
  def get_var_types(self) -> List[Dict[str, str]]:
272
292
  """
273
- Get langchain placeholders list
293
+ Get var types list
274
294
 
275
- :return: placeholders list
295
+ :return: Filled placeholder list
276
296
  """
277
297
  types = ["str", "int", "float", "bool", "dict", "list", "None"]
278
298
  return [{t: t} for t in types]
279
299
 
280
300
  def get_presets(self, params: dict = None) -> List[Dict[str, str]]:
281
301
  """
282
- Get presets placeholders list
302
+ Get presets list
283
303
 
284
304
  :param params: Additional parameters for specific placeholders
285
- :return: Presets placeholders list
305
+ :return: Filled placeholder list
286
306
  """
287
307
  if params is None:
288
308
  params = {}
@@ -293,10 +313,10 @@ class Placeholder:
293
313
 
294
314
  def get_modes(self, params: dict = None) -> List[Dict[str, str]]:
295
315
  """
296
- Get modes placeholders list
316
+ Get modes list
297
317
 
298
318
  :param params: Additional parameters for specific placeholders
299
- :return: Modes placeholders list
319
+ :return: Filled placeholder list
300
320
  """
301
321
  if params is None:
302
322
  params = {}
@@ -305,10 +325,10 @@ class Placeholder:
305
325
 
306
326
  def get_multimodal(self, params: dict = None) -> List[Dict[str, str]]:
307
327
  """
308
- Get multimodal placeholders list
328
+ Get multimodal options list
309
329
 
310
330
  :param params: Additional parameters for specific placeholders
311
- :return: multimodal placeholders list
331
+ :return: Filled placeholder list
312
332
  """
313
333
  if params is None:
314
334
  params = {}
@@ -317,10 +337,10 @@ class Placeholder:
317
337
 
318
338
  def get_models(self, params: dict = None) -> List[Dict[str, str]]:
319
339
  """
320
- Get models placeholders list (+ provider separators)
340
+ Get models list (+ provider separators)
321
341
 
322
342
  :param params: Additional parameters for specific placeholders
323
- :return: Models placeholders list
343
+ :return: Filled placeholder list
324
344
  """
325
345
  if params is None:
326
346
  params = {}
@@ -354,9 +374,9 @@ class Placeholder:
354
374
 
355
375
  def get_agent_modes(self) -> List[Dict[str, str]]:
356
376
  """
357
- Get agent/expert modes placeholders list
377
+ Get agent/expert modes list
358
378
 
359
- :return: Models placeholders list
379
+ :return: Filled placeholder list
360
380
  """
361
381
  modes = self.window.core.agents.legacy.get_allowed_modes()
362
382
  return [{mid: trans(f"mode.{mid}")} for mid in modes]
@@ -365,16 +385,16 @@ class Placeholder:
365
385
  """
366
386
  Get world languages list
367
387
 
368
- :return: Languages placeholders list
388
+ :return: Filled placeholder list
369
389
  """
370
390
  return self.window.core.text.get_language_choices()
371
391
 
372
392
  def get_idx(self, params: dict = None) -> List[Dict[str, str]]:
373
393
  """
374
- Get indexes placeholders list
394
+ Get indexes (LlamaIndex) list
375
395
 
376
396
  :param params: Additional parameters for specific placeholders
377
- :return: Indexes placeholders list
397
+ :return: Filled placeholder list
378
398
  """
379
399
  if params is None:
380
400
  params = {}
@@ -389,9 +409,9 @@ class Placeholder:
389
409
 
390
410
  def get_syntax_styles(self) -> List[Dict[str, str]]:
391
411
  """
392
- Get highlighter styles list
412
+ Get code syntax highlighter styles list
393
413
 
394
- :return: placeholders list
414
+ :return: Filled placeholder list
395
415
  """
396
416
  styles = self.window.controller.chat.render.web_renderer.body.highlight.get_styles()
397
417
  styles.sort()
@@ -399,9 +419,9 @@ class Placeholder:
399
419
 
400
420
  def get_styles(self) -> List[Dict[str, str]]:
401
421
  """
402
- Get styles list
422
+ Get styles list (blocks, chatgpt, etc.)
403
423
 
404
- :return: placeholders list
424
+ :return: Filled placeholder list
405
425
  """
406
426
  styles = self.window.controller.theme.common.get_styles_list()
407
427
  styles.sort()
@@ -409,9 +429,9 @@ class Placeholder:
409
429
 
410
430
  def get_keys(self) -> List[Dict[str, str]]:
411
431
  """
412
- Get keys
432
+ Get keyboard keys list
413
433
 
414
- :return: keys
434
+ :return: Filled placeholder list
415
435
  """
416
436
  return self.window.core.access.shortcuts.get_keys_choices()
417
437
 
@@ -419,7 +439,7 @@ class Placeholder:
419
439
  """
420
440
  Get modifiers
421
441
 
422
- :return: keys
442
+ :return: Filled placeholder list
423
443
  """
424
444
  return self.window.core.access.shortcuts.get_modifiers_choices()
425
445
 
@@ -432,7 +452,7 @@ class Placeholder:
432
452
  """
433
453
  Get access actions list
434
454
 
435
- :return: app actions list
455
+ :return: Filled placeholder list
436
456
  """
437
457
  choices = self.window.core.access.actions.get_access_choices()
438
458
  return self._translate_sort_choices(choices)
@@ -441,7 +461,7 @@ class Placeholder:
441
461
  """
442
462
  Get speech actions list
443
463
 
444
- :return: app actions list
464
+ :return: Filled placeholder list
445
465
  """
446
466
  choices = self.window.core.access.actions.get_speech_synthesis_choices()
447
467
  return self._translate_sort_choices(choices)
@@ -450,7 +470,7 @@ class Placeholder:
450
470
  """
451
471
  Get voice control actions list
452
472
 
453
- :return: app actions list
473
+ :return: Filled placeholder list
454
474
  """
455
475
  choices = self.window.core.access.actions.get_voice_control_choices()
456
476
  return self._translate_sort_choices(choices)
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2025.08.09 19:00:00 #
9
+ # Updated Date: 2025.09.02 22:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from typing import Any, Optional
@@ -204,6 +204,8 @@ class Confirm:
204
204
  self.window.controller.assistant.batch.clear_store_files(id, True) # by store_id
205
205
  elif type == 'assistant.files.upload':
206
206
  self.window.controller.assistant.batch.upload(True)
207
+ elif type == 'assistant.file.delete':
208
+ self.window.controller.assistant.store.delete_file_by_idx(id, True)
207
209
  elif type == 'assistant.functions.import':
208
210
  self.window.controller.assistant.editor.import_functions(True)
209
211
  elif type == 'assistant.functions.clear':
@@ -80,12 +80,12 @@ class Media:
80
80
  self.window.core.config.save()
81
81
 
82
82
  def disable_raw(self):
83
- """Disable prompt enhancement for images"""
83
+ """Disable prompt enhancement for media"""
84
84
  self.window.core.config.set('img_raw', False)
85
85
  self.window.core.config.save()
86
86
 
87
87
  def toggle_raw(self):
88
- """Save prompt enhancement option for images"""
88
+ """Save prompt enhancement option for media"""
89
89
  state = self.window.ui.config['global']['img_raw'].isChecked()
90
90
  if not state:
91
91
  self.disable_raw()
@@ -112,4 +112,12 @@ class Media:
112
112
  current = self.window.core.config.get("model")
113
113
  model_data = self.window.core.models.get(current)
114
114
  if model_data:
115
- return model_data.is_video_output()
115
+ return model_data.is_video_output()
116
+
117
+ def play_video(self, path: str):
118
+ """
119
+ Play video file
120
+
121
+ :param path: path to video file
122
+ """
123
+ self.window.tools.get("player").play(path)