pygpt-net 2.7.5__py3-none-any.whl → 2.7.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 (51) hide show
  1. pygpt_net/CHANGELOG.txt +8 -0
  2. pygpt_net/__init__.py +2 -2
  3. pygpt_net/controller/chat/handler/worker.py +9 -31
  4. pygpt_net/controller/chat/handler/xai_stream.py +621 -52
  5. pygpt_net/controller/debug/fixtures.py +3 -2
  6. pygpt_net/controller/files/files.py +65 -4
  7. pygpt_net/core/filesystem/url.py +4 -1
  8. pygpt_net/core/render/web/body.py +3 -2
  9. pygpt_net/core/types/chunk.py +27 -0
  10. pygpt_net/data/config/config.json +2 -2
  11. pygpt_net/data/config/models.json +2 -2
  12. pygpt_net/data/config/settings.json +1 -1
  13. pygpt_net/data/js/app/template.js +1 -1
  14. pygpt_net/data/js/app.min.js +2 -2
  15. pygpt_net/data/locale/locale.de.ini +3 -0
  16. pygpt_net/data/locale/locale.en.ini +3 -0
  17. pygpt_net/data/locale/locale.es.ini +3 -0
  18. pygpt_net/data/locale/locale.fr.ini +3 -0
  19. pygpt_net/data/locale/locale.it.ini +3 -0
  20. pygpt_net/data/locale/locale.pl.ini +3 -0
  21. pygpt_net/data/locale/locale.uk.ini +3 -0
  22. pygpt_net/data/locale/locale.zh.ini +3 -0
  23. pygpt_net/data/locale/plugin.cmd_mouse_control.en.ini +2 -2
  24. pygpt_net/item/ctx.py +3 -5
  25. pygpt_net/js_rc.py +2449 -2447
  26. pygpt_net/plugin/cmd_mouse_control/config.py +8 -7
  27. pygpt_net/plugin/cmd_mouse_control/plugin.py +3 -4
  28. pygpt_net/provider/api/anthropic/__init__.py +10 -8
  29. pygpt_net/provider/api/google/__init__.py +6 -5
  30. pygpt_net/provider/api/google/chat.py +1 -2
  31. pygpt_net/provider/api/openai/__init__.py +7 -3
  32. pygpt_net/provider/api/openai/responses.py +0 -0
  33. pygpt_net/provider/api/x_ai/__init__.py +10 -9
  34. pygpt_net/provider/api/x_ai/chat.py +272 -102
  35. pygpt_net/tools/image_viewer/ui/dialogs.py +298 -12
  36. pygpt_net/tools/text_editor/ui/widgets.py +5 -1
  37. pygpt_net/ui/base/context_menu.py +44 -1
  38. pygpt_net/ui/layout/toolbox/indexes.py +22 -19
  39. pygpt_net/ui/layout/toolbox/model.py +28 -5
  40. pygpt_net/ui/widget/image/display.py +25 -8
  41. pygpt_net/ui/widget/tabs/output.py +9 -1
  42. pygpt_net/ui/widget/textarea/editor.py +14 -1
  43. pygpt_net/ui/widget/textarea/input.py +20 -7
  44. pygpt_net/ui/widget/textarea/notepad.py +24 -1
  45. pygpt_net/ui/widget/textarea/output.py +23 -1
  46. pygpt_net/ui/widget/textarea/web.py +16 -1
  47. {pygpt_net-2.7.5.dist-info → pygpt_net-2.7.6.dist-info}/METADATA +10 -2
  48. {pygpt_net-2.7.5.dist-info → pygpt_net-2.7.6.dist-info}/RECORD +50 -49
  49. {pygpt_net-2.7.5.dist-info → pygpt_net-2.7.6.dist-info}/LICENSE +0 -0
  50. {pygpt_net-2.7.5.dist-info → pygpt_net-2.7.6.dist-info}/WHEEL +0 -0
  51. {pygpt_net-2.7.5.dist-info → pygpt_net-2.7.6.dist-info}/entry_points.txt +0 -0
@@ -136,7 +136,7 @@ class Config(BaseConfig):
136
136
  "sandbox_path",
137
137
  type="text",
138
138
  value="",
139
- label="Sandbox: Playwright browsers path",
139
+ label="Browsers directory",
140
140
  description="Path to Playwright browsers installation - leave empty to use default",
141
141
  tab="Sandbox (Playwright)"
142
142
  )
@@ -144,7 +144,7 @@ class Config(BaseConfig):
144
144
  "sandbox_engine",
145
145
  type="text",
146
146
  value="chromium",
147
- label="Sandbox: Playwright engine (chromium|firefox|webkit)",
147
+ label="Engine",
148
148
  description="Playwright browser engine to use (chromium, firefox, webkit) - must be installed",
149
149
  tab="Sandbox (Playwright)"
150
150
  )
@@ -152,7 +152,7 @@ class Config(BaseConfig):
152
152
  "sandbox_headless",
153
153
  type="bool",
154
154
  value=False,
155
- label="Sandbox: headless mode",
155
+ label="Headless mode",
156
156
  description="Run Playwright browser in headless mode (default: False)",
157
157
  tab="Sandbox (Playwright)"
158
158
  )
@@ -160,14 +160,15 @@ class Config(BaseConfig):
160
160
  "sandbox_args",
161
161
  type="textarea",
162
162
  value="--disable-extensions,\n--disable-file-system",
163
- label="Sandbox: Playwright browsers args",
163
+ label="Browser args",
164
164
  description="Additional Playwright browser arguments (comma-separated)",
165
+ tab="Sandbox (Playwright)"
165
166
  )
166
167
  plugin.add_option(
167
168
  "sandbox_home",
168
169
  type="text",
169
170
  value="https://duckduckgo.com",
170
- label="Sandbox: home URL",
171
+ label="Home URL",
171
172
  description="Playwright browser home URL",
172
173
  tab="Sandbox (Playwright)"
173
174
  )
@@ -175,7 +176,7 @@ class Config(BaseConfig):
175
176
  "sandbox_viewport_w",
176
177
  type="int",
177
178
  value=1440,
178
- label="Sandbox: viewport width",
179
+ label="Viewport width",
179
180
  description="Playwright viewport width in pixels",
180
181
  tab="Sandbox (Playwright)"
181
182
  )
@@ -183,7 +184,7 @@ class Config(BaseConfig):
183
184
  "sandbox_viewport_h",
184
185
  type="int",
185
186
  value=900,
186
- label="Sandbox: viewport height",
187
+ label="Viewport height",
187
188
  description="Playwright viewport height in pixels",
188
189
  tab="Sandbox (Playwright)"
189
190
  )
@@ -223,7 +223,6 @@ class Plugin(BasePlugin):
223
223
  and response["result"]["no_screenshot"]):
224
224
  with_screenshot = False
225
225
  if ctx is not None:
226
- print("APPEND RESPONSE", response)
227
226
  self.prepare_reply_ctx(response, ctx)
228
227
  ctx.reply = True
229
228
  self.handle_delayed(ctx, with_screenshot)
@@ -356,14 +355,14 @@ class Plugin(BasePlugin):
356
355
  f"1) Please install Playwright browser(s) on host machine: \n\n"
357
356
  f"pip install playwright && playwright install {engine}\n\n"
358
357
  f"2) Set path to browsers directory in `Mouse And Keyboard` plugin settings option: "
359
- f"`Sandbox: Playwright browsers path`.")
358
+ f"`Sandbox (Playwright): Browsers directory`.")
360
359
  else:
361
360
  if os.environ.get("APPIMAGE") and not cfg_path: # set path is required for AppImage version
362
- err_msg = (f"Playwright browsers path is not set - "
361
+ err_msg = (f"Playwright browsers path is not set:\n\n "
363
362
  f"1) Please install Playwright browser(s) on host machine: \n\n"
364
363
  f"pip install playwright && playwright install {engine}\n\n"
365
364
  f"2) Set path to browsers directory in `Mouse And Keyboard` plugin settings option: "
366
- f"`Sandbox: Playwright browsers path`.")
365
+ f"`Sandbox (Playwright): Browsers directory`.")
367
366
 
368
367
  if err_msg is not None:
369
368
  self.error(err_msg)
@@ -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.09.15 01:00:00 #
9
+ # Updated Date: 2026.01.03 17:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from typing import Optional, Dict, Any
@@ -21,6 +21,7 @@ from pygpt_net.core.types import (
21
21
  MODE_RESEARCH,
22
22
  )
23
23
  from pygpt_net.core.bridge.context import BridgeContext
24
+ from pygpt_net.core.types.chunk import ChunkType
24
25
  from pygpt_net.item.model import ModelItem
25
26
 
26
27
  from .chat import Chat
@@ -94,15 +95,16 @@ class ApiAnthropic:
94
95
  stream = context.stream
95
96
  ctx = context.ctx
96
97
  ai_name = ctx.output_name if ctx else "assistant"
97
-
98
- # Anthropic: no Responses API; stream events are custom to Anthropic
99
- if ctx:
100
- ctx.use_responses_api = False
101
-
102
98
  used_tokens = 0
103
99
  response = None
104
-
105
- if mode in (MODE_COMPLETION, MODE_CHAT, MODE_AUDIO, MODE_RESEARCH):
100
+ ctx.chunk_type = ChunkType.ANTHROPIC
101
+
102
+ if mode in (
103
+ MODE_COMPLETION,
104
+ MODE_CHAT,
105
+ MODE_AUDIO,
106
+ MODE_RESEARCH
107
+ ):
106
108
  # MODE_AUDIO fallback: treat as normal chat (no native audio API)
107
109
  response = self.chat.send(context=context, extra=extra)
108
110
  used_tokens = self.chat.get_used_tokens()
@@ -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.02 19:00:00 #
9
+ # Updated Date: 2026.01.03 17:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import os
@@ -25,6 +25,7 @@ from pygpt_net.core.types import (
25
25
  MODE_COMPUTER,
26
26
  )
27
27
  from pygpt_net.core.bridge.context import BridgeContext
28
+ from pygpt_net.core.types.chunk import ChunkType
28
29
  from pygpt_net.item.model import ModelItem
29
30
 
30
31
  from .chat import Chat
@@ -124,10 +125,7 @@ class ApiGoogle:
124
125
  stream = context.stream
125
126
  ctx = context.ctx
126
127
  ai_name = ctx.output_name if ctx else "assistant"
127
-
128
- # No Responses API in google-genai
129
- if ctx:
130
- ctx.use_responses_api = False
128
+ ctx.chunk_type = ChunkType.GOOGLE
131
129
 
132
130
  used_tokens = 0
133
131
  response = None
@@ -151,6 +149,9 @@ class ApiGoogle:
151
149
  if is_realtime:
152
150
  return True
153
151
 
152
+ if mode == MODE_RESEARCH:
153
+ ctx.chunk_type = ChunkType.GOOGLE_INTERACTIONS_API # use interactions API for research
154
+
154
155
  response = self.chat.send(context=context, extra=extra)
155
156
  used_tokens = self.chat.get_used_tokens()
156
157
  if ctx:
@@ -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.03 02:10:00 #
9
+ # Updated Date: 2026.01.03 17:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import os
@@ -180,7 +180,6 @@ class Chat:
180
180
  params = dict(model=model.id, contents=inputs, config=cfg)
181
181
 
182
182
  if mode == MODE_RESEARCH:
183
- ctx.use_google_interactions_api = True
184
183
 
185
184
  # Deep Research does not support audio inputs; if an audio snippet is present, transcribe it to text first.
186
185
  if has_audio_input:
@@ -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.28 00:00:00 #
9
+ # Updated Date: 2026.01.03 17:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from openai import OpenAI
@@ -22,6 +22,7 @@ from pygpt_net.core.types import (
22
22
  MODE_COMPUTER,
23
23
  )
24
24
  from pygpt_net.core.bridge.context import BridgeContext
25
+ from pygpt_net.core.types.chunk import ChunkType
25
26
  from pygpt_net.item.model import ModelItem
26
27
 
27
28
  from .audio import Audio
@@ -116,10 +117,12 @@ class ApiOpenAI:
116
117
  ctx = context.ctx
117
118
  ai_name = ctx.output_name
118
119
  thread_id = ctx.thread # from ctx
120
+ ctx.chunk_type = ChunkType.API_CHAT # default: ChatCompletion API
119
121
 
120
122
  # --- Responses API ----
121
123
  use_responses_api = self.responses.is_enabled(model, mode, parent_mode, is_expert_call, preset)
122
- ctx.use_responses_api = use_responses_api # set in context
124
+ if use_responses_api:
125
+ ctx.chunk_type = ChunkType.API_CHAT_RESPONSES # Responses API
123
126
 
124
127
  fixtures = self.window.controller.debug.fixtures
125
128
 
@@ -137,13 +140,14 @@ class ApiOpenAI:
137
140
 
138
141
  # completion
139
142
  if mode == MODE_COMPLETION:
143
+ ctx.chunk_type = ChunkType.API_COMPLETION
140
144
  response = self.completion.send(
141
145
  context=context,
142
146
  extra=extra,
143
147
  )
144
148
  used_tokens = self.completion.get_used_tokens()
145
149
 
146
- # chat, audio (OpenAI) | research (Perplexity)
150
+ # chat, audio (OpenAI) | research (deep research, Perplexity)
147
151
  elif mode in [
148
152
  MODE_CHAT,
149
153
  MODE_AUDIO,
File without changes
@@ -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.09.15 01:00:00 #
9
+ # Updated Date: 2026.01.03 17:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from typing import Optional, Dict, Any
@@ -23,6 +23,7 @@ from pygpt_net.core.types import (
23
23
  MODE_RESEARCH,
24
24
  )
25
25
  from pygpt_net.core.bridge.context import BridgeContext
26
+ from pygpt_net.core.types.chunk import ChunkType
26
27
  from pygpt_net.item.model import ModelItem
27
28
 
28
29
  import xai_sdk
@@ -109,19 +110,19 @@ class ApiXAI:
109
110
  :return: True on success, False on error
110
111
  """
111
112
  mode = context.mode
112
- model = context.model
113
113
  stream = context.stream
114
114
  ctx = context.ctx
115
115
  ai_name = (ctx.output_name if ctx else "assistant")
116
-
117
- # No Responses API in xAI SDK
118
- if ctx:
119
- ctx.use_responses_api = False
120
-
121
116
  used_tokens = 0
122
117
  response = None
123
-
124
- if mode in (MODE_COMPLETION, MODE_CHAT, MODE_AUDIO, MODE_RESEARCH):
118
+ ctx.chunk_type = ChunkType.XAI_SDK
119
+
120
+ if mode in (
121
+ MODE_COMPLETION,
122
+ MODE_CHAT,
123
+ MODE_AUDIO,
124
+ MODE_RESEARCH
125
+ ):
125
126
  # There is no public realtime audio in SDK; treat MODE_AUDIO as chat (TTS not supported).
126
127
  response = self.chat.send(context=context, extra=extra)
127
128
  used_tokens = self.chat.get_used_tokens()