pygpt-net 2.7.8__py3-none-any.whl → 2.7.10__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 (112) hide show
  1. pygpt_net/CHANGELOG.txt +14 -0
  2. pygpt_net/LICENSE +1 -1
  3. pygpt_net/__init__.py +3 -3
  4. pygpt_net/config.py +15 -1
  5. pygpt_net/controller/chat/common.py +5 -4
  6. pygpt_net/controller/chat/image.py +3 -3
  7. pygpt_net/controller/chat/stream.py +76 -41
  8. pygpt_net/controller/chat/stream_worker.py +3 -3
  9. pygpt_net/controller/ctx/extra.py +3 -1
  10. pygpt_net/controller/dialogs/debug.py +37 -8
  11. pygpt_net/controller/kernel/kernel.py +3 -7
  12. pygpt_net/controller/lang/custom.py +25 -12
  13. pygpt_net/controller/lang/lang.py +45 -3
  14. pygpt_net/controller/lang/mapping.py +15 -2
  15. pygpt_net/controller/notepad/notepad.py +68 -25
  16. pygpt_net/controller/presets/editor.py +5 -1
  17. pygpt_net/controller/presets/presets.py +17 -5
  18. pygpt_net/controller/realtime/realtime.py +13 -1
  19. pygpt_net/controller/theme/theme.py +11 -2
  20. pygpt_net/controller/ui/tabs.py +1 -1
  21. pygpt_net/core/ctx/output.py +38 -12
  22. pygpt_net/core/db/database.py +4 -2
  23. pygpt_net/core/debug/console/console.py +30 -2
  24. pygpt_net/core/debug/context.py +2 -1
  25. pygpt_net/core/debug/ui.py +26 -4
  26. pygpt_net/core/filesystem/filesystem.py +6 -2
  27. pygpt_net/core/notepad/notepad.py +2 -2
  28. pygpt_net/core/tabs/tabs.py +79 -19
  29. pygpt_net/data/config/config.json +4 -3
  30. pygpt_net/data/config/models.json +37 -22
  31. pygpt_net/data/config/settings.json +12 -0
  32. pygpt_net/data/locale/locale.ar.ini +1833 -0
  33. pygpt_net/data/locale/locale.bg.ini +1833 -0
  34. pygpt_net/data/locale/locale.cs.ini +1833 -0
  35. pygpt_net/data/locale/locale.da.ini +1833 -0
  36. pygpt_net/data/locale/locale.de.ini +4 -1
  37. pygpt_net/data/locale/locale.en.ini +70 -67
  38. pygpt_net/data/locale/locale.es.ini +4 -1
  39. pygpt_net/data/locale/locale.fi.ini +1833 -0
  40. pygpt_net/data/locale/locale.fr.ini +4 -1
  41. pygpt_net/data/locale/locale.he.ini +1833 -0
  42. pygpt_net/data/locale/locale.hi.ini +1833 -0
  43. pygpt_net/data/locale/locale.hu.ini +1833 -0
  44. pygpt_net/data/locale/locale.it.ini +4 -1
  45. pygpt_net/data/locale/locale.ja.ini +1833 -0
  46. pygpt_net/data/locale/locale.ko.ini +1833 -0
  47. pygpt_net/data/locale/locale.nl.ini +1833 -0
  48. pygpt_net/data/locale/locale.no.ini +1833 -0
  49. pygpt_net/data/locale/locale.pl.ini +5 -2
  50. pygpt_net/data/locale/locale.pt.ini +1833 -0
  51. pygpt_net/data/locale/locale.ro.ini +1833 -0
  52. pygpt_net/data/locale/locale.ru.ini +1833 -0
  53. pygpt_net/data/locale/locale.sk.ini +1833 -0
  54. pygpt_net/data/locale/locale.sv.ini +1833 -0
  55. pygpt_net/data/locale/locale.tr.ini +1833 -0
  56. pygpt_net/data/locale/locale.uk.ini +4 -1
  57. pygpt_net/data/locale/locale.zh.ini +4 -1
  58. pygpt_net/item/notepad.py +8 -2
  59. pygpt_net/migrations/Version20260121190000.py +25 -0
  60. pygpt_net/migrations/Version20260122140000.py +25 -0
  61. pygpt_net/migrations/__init__.py +5 -1
  62. pygpt_net/preload.py +246 -3
  63. pygpt_net/provider/api/__init__.py +16 -2
  64. pygpt_net/provider/api/anthropic/__init__.py +21 -7
  65. pygpt_net/provider/api/google/__init__.py +21 -7
  66. pygpt_net/provider/api/google/image.py +89 -2
  67. pygpt_net/provider/api/google/realtime/client.py +70 -24
  68. pygpt_net/provider/api/google/realtime/realtime.py +48 -12
  69. pygpt_net/provider/api/google/video.py +2 -2
  70. pygpt_net/provider/api/openai/__init__.py +26 -11
  71. pygpt_net/provider/api/openai/image.py +79 -3
  72. pygpt_net/provider/api/openai/realtime/realtime.py +26 -6
  73. pygpt_net/provider/api/openai/responses.py +11 -31
  74. pygpt_net/provider/api/openai/video.py +2 -2
  75. pygpt_net/provider/api/x_ai/__init__.py +21 -10
  76. pygpt_net/provider/api/x_ai/realtime/client.py +185 -146
  77. pygpt_net/provider/api/x_ai/realtime/realtime.py +30 -15
  78. pygpt_net/provider/api/x_ai/remote_tools.py +83 -0
  79. pygpt_net/provider/api/x_ai/tools.py +51 -0
  80. pygpt_net/provider/core/config/patch.py +12 -1
  81. pygpt_net/provider/core/model/patch.py +36 -1
  82. pygpt_net/provider/core/notepad/db_sqlite/storage.py +53 -10
  83. pygpt_net/tools/agent_builder/ui/dialogs.py +2 -1
  84. pygpt_net/tools/audio_transcriber/ui/dialogs.py +2 -1
  85. pygpt_net/tools/code_interpreter/ui/dialogs.py +2 -1
  86. pygpt_net/tools/html_canvas/ui/dialogs.py +2 -1
  87. pygpt_net/tools/image_viewer/ui/dialogs.py +3 -5
  88. pygpt_net/tools/indexer/ui/dialogs.py +2 -1
  89. pygpt_net/tools/media_player/ui/dialogs.py +2 -1
  90. pygpt_net/tools/translator/ui/dialogs.py +2 -1
  91. pygpt_net/tools/translator/ui/widgets.py +6 -2
  92. pygpt_net/ui/dialog/about.py +2 -2
  93. pygpt_net/ui/dialog/db.py +2 -1
  94. pygpt_net/ui/dialog/debug.py +169 -6
  95. pygpt_net/ui/dialog/logger.py +6 -2
  96. pygpt_net/ui/dialog/models.py +36 -3
  97. pygpt_net/ui/dialog/preset.py +5 -1
  98. pygpt_net/ui/dialog/remote_store.py +2 -1
  99. pygpt_net/ui/main.py +3 -2
  100. pygpt_net/ui/widget/dialog/editor_file.py +2 -1
  101. pygpt_net/ui/widget/lists/debug.py +12 -7
  102. pygpt_net/ui/widget/option/checkbox.py +2 -8
  103. pygpt_net/ui/widget/option/combo.py +10 -2
  104. pygpt_net/ui/widget/textarea/console.py +156 -7
  105. pygpt_net/ui/widget/textarea/highlight.py +66 -0
  106. pygpt_net/ui/widget/textarea/input.py +624 -57
  107. pygpt_net/ui/widget/textarea/notepad.py +294 -27
  108. {pygpt_net-2.7.8.dist-info → pygpt_net-2.7.10.dist-info}/LICENSE +1 -1
  109. {pygpt_net-2.7.8.dist-info → pygpt_net-2.7.10.dist-info}/METADATA +16 -64
  110. {pygpt_net-2.7.8.dist-info → pygpt_net-2.7.10.dist-info}/RECORD +112 -91
  111. {pygpt_net-2.7.8.dist-info → pygpt_net-2.7.10.dist-info}/WHEEL +0 -0
  112. {pygpt_net-2.7.8.dist-info → pygpt_net-2.7.10.dist-info}/entry_points.txt +0 -0
@@ -6,11 +6,10 @@
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.28 09:00:00 #
9
+ # Updated Date: 2026.01.21 13:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import base64
13
- import json
14
13
  import time
15
14
  from typing import Optional, Dict, Any, List, Tuple
16
15
 
@@ -92,9 +91,11 @@ class Responses:
92
91
  user_name = ctx.input_name # from ctx
93
92
  ai_name = ctx.output_name # from ctx
94
93
 
95
- client = self.window.core.api.openai.get_client(mode, model)
94
+ api = self.window.core.api.openai
95
+ client = api.get_client(mode, model)
96
96
 
97
97
  # build chat messages
98
+ self.reset_tokens()
98
99
  messages = self.build(
99
100
  prompt=prompt,
100
101
  system_prompt=system_prompt,
@@ -106,11 +107,12 @@ class Responses:
106
107
  multimodal_ctx=multimodal_ctx,
107
108
  is_expert_call=is_expert_call, # use separated previous response ID for expert calls
108
109
  )
109
-
110
110
  msg_tokens = self.window.core.tokens.from_messages(
111
111
  messages,
112
112
  model.id,
113
113
  )
114
+ self.input_tokens += msg_tokens
115
+
114
116
  # check if max tokens not exceeded
115
117
  if max_tokens > 0 and model.ctx > 0:
116
118
  if msg_tokens + int(max_tokens) > model.ctx:
@@ -121,16 +123,16 @@ class Responses:
121
123
  # extra API kwargs
122
124
  response_kwargs = {}
123
125
 
124
- # tools / functions
125
- tools = self.window.core.api.openai.tools.prepare_responses_api(model, functions)
126
+ # tools prepare
127
+ tools = api.tools.prepare_responses_api(model, functions)
126
128
 
127
- # extra arguments, o3 only
129
+ # extra arguments, reasoning models only
128
130
  if model.extra and "reasoning_effort" in model.extra:
129
131
  response_kwargs['reasoning'] = {}
130
132
  response_kwargs['reasoning']['effort'] = model.extra["reasoning_effort"]
131
133
 
132
134
  # append remote tools
133
- tools = self.window.core.api.openai.remote_tools.append_to_tools(
135
+ tools = api.remote_tools.append_to_tools(
134
136
  mode=mode,
135
137
  model=model,
136
138
  stream=stream,
@@ -217,11 +219,6 @@ class Responses:
217
219
  # tokens config
218
220
  mode = MODE_CHAT
219
221
  tool_call_native_enabled = self.window.core.config.get('func_call.native', False)
220
- allowed_system = True
221
- if (model.id is not None
222
- and model.id in ["o1-mini", "o1-preview"]):
223
- allowed_system = False
224
-
225
222
  used_tokens = self.window.core.tokens.from_user(
226
223
  prompt,
227
224
  system_prompt,
@@ -232,17 +229,6 @@ class Responses:
232
229
  if max_ctx_tokens > model.ctx > 0:
233
230
  max_ctx_tokens = model.ctx
234
231
 
235
- # input tokens: reset
236
- self.reset_tokens()
237
-
238
- # append system prompt
239
- if allowed_system:
240
- pass
241
- '''
242
- if system_prompt is not None and system_prompt != "":
243
- messages.append({"role": "developer", "content": system_prompt})
244
- '''
245
-
246
232
  # append messages from context (memory)
247
233
  if self.window.core.config.get('use_context'):
248
234
  items = self.window.core.ctx.get_history(
@@ -384,7 +370,7 @@ class Responses:
384
370
  break
385
371
 
386
372
  # --- previous message ID ---
387
- if (item.msg_id and is_last_item
373
+ if (item.msg_id
388
374
  and ((item.cmds is None or len(item.cmds) == 0) or is_tool_output)): # if no cmds before or tool output
389
375
  if is_expert_call:
390
376
  self.prev_internal_response_id = item.msg_id
@@ -414,12 +400,6 @@ class Responses:
414
400
  "content": content,
415
401
  })
416
402
 
417
- # input tokens: update
418
- self.input_tokens += self.window.core.tokens.from_messages(
419
- messages,
420
- model.id,
421
- )
422
-
423
403
  return messages
424
404
 
425
405
  def reset_tokens(self):
@@ -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.12.31 16:00:00 #
9
+ # Updated Date: 2026.01.23 23:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import datetime
@@ -286,7 +286,7 @@ class VideoWorker(QRunnable):
286
286
  # Poll until completed (or failed/canceled)
287
287
  if not isinstance(self.ctx.extra, dict):
288
288
  self.ctx.extra = {}
289
- self.ctx.extra['video_id'] = video_id # store video_id in ctx extra
289
+ self.ctx.extra['video_id'] = self.window.core.filesystem.make_local(video_id) # store video_id in ctx extra
290
290
  self.window.core.ctx.update_item(self.ctx)
291
291
  last_progress = None
292
292
  last_status = None
@@ -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: 2026.01.06 20:00:00 #
9
+ # Updated Date: 2026.01.21 13:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from typing import Optional, Dict, Any
@@ -141,9 +141,6 @@ class ApiXAI:
141
141
  MODE_RESEARCH,
142
142
  MODE_AUDIO
143
143
  ):
144
- if mode == MODE_AUDIO:
145
- raise NotImplementedError("Not available. xAI realtime audio streaming coming soon!")
146
-
147
144
  if mode == MODE_AUDIO and stream:
148
145
  # Realtime API for audio streaming
149
146
  is_realtime = self.realtime.begin(
@@ -206,6 +203,25 @@ class ApiXAI:
206
203
  pass
207
204
  return True
208
205
 
206
+ def redirect_call(
207
+ self,
208
+ context: BridgeContext,
209
+ extra: dict = None
210
+ ) -> str:
211
+ """
212
+ Redirect quick call to standard call and return the output text
213
+
214
+ :param context: BridgeContext
215
+ :param extra: Extra parameters
216
+ :return: Output text
217
+ """
218
+ context.stream = False
219
+ context.mode = MODE_CHAT
220
+ self.locked = True
221
+ self.call(context, extra)
222
+ self.locked = False
223
+ return context.ctx.output
224
+
209
225
  def quick_call(
210
226
  self,
211
227
  context: BridgeContext,
@@ -225,12 +241,7 @@ class ApiXAI:
225
241
  return self.quick_call_old(context, extra) # grok-3 uses old path
226
242
 
227
243
  if context.request:
228
- context.stream = False
229
- context.mode = MODE_CHAT
230
- self.locked = True
231
- self.call(context, extra)
232
- self.locked = False
233
- return context.ctx.output
244
+ return self.redirect_call(context, extra)
234
245
 
235
246
  self.locked = True
236
247
  try: