pygpt-net 2.6.53__py3-none-any.whl → 2.6.55__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 (38) hide show
  1. pygpt_net/CHANGELOG.txt +11 -0
  2. pygpt_net/__init__.py +3 -3
  3. pygpt_net/app.py +4 -0
  4. pygpt_net/controller/chat/remote_tools.py +2 -2
  5. pygpt_net/controller/ui/mode.py +7 -1
  6. pygpt_net/core/agents/agents.py +0 -0
  7. pygpt_net/core/agents/provider.py +16 -9
  8. pygpt_net/core/ctx/ctx.py +2 -1
  9. pygpt_net/core/models/models.py +25 -1
  10. pygpt_net/data/config/config.json +4 -4
  11. pygpt_net/data/config/models.json +3 -3
  12. pygpt_net/data/js/app.js +19 -0
  13. pygpt_net/data/locale/plugin.osm.en.ini +35 -0
  14. pygpt_net/data/locale/plugin.wolfram.en.ini +24 -0
  15. pygpt_net/js_rc.py +10490 -10432
  16. pygpt_net/plugin/base/worker.py +7 -1
  17. pygpt_net/plugin/osm/__init__.py +12 -0
  18. pygpt_net/plugin/osm/config.py +267 -0
  19. pygpt_net/plugin/osm/plugin.py +87 -0
  20. pygpt_net/plugin/osm/worker.py +719 -0
  21. pygpt_net/plugin/wolfram/__init__.py +12 -0
  22. pygpt_net/plugin/wolfram/config.py +214 -0
  23. pygpt_net/plugin/wolfram/plugin.py +115 -0
  24. pygpt_net/plugin/wolfram/worker.py +551 -0
  25. pygpt_net/provider/api/google/video.py +0 -0
  26. pygpt_net/provider/api/openai/agents/experts.py +1 -1
  27. pygpt_net/provider/api/openai/chat.py +2 -9
  28. pygpt_net/provider/api/x_ai/remote.py +2 -2
  29. pygpt_net/provider/llms/anthropic.py +29 -1
  30. pygpt_net/provider/llms/google.py +30 -1
  31. pygpt_net/provider/llms/open_router.py +3 -1
  32. pygpt_net/provider/llms/x_ai.py +21 -1
  33. pygpt_net/ui/widget/textarea/input.py +9 -2
  34. {pygpt_net-2.6.53.dist-info → pygpt_net-2.6.55.dist-info}/METADATA +37 -2
  35. {pygpt_net-2.6.53.dist-info → pygpt_net-2.6.55.dist-info}/RECORD +36 -26
  36. {pygpt_net-2.6.53.dist-info → pygpt_net-2.6.55.dist-info}/LICENSE +0 -0
  37. {pygpt_net-2.6.53.dist-info → pygpt_net-2.6.55.dist-info}/WHEEL +0 -0
  38. {pygpt_net-2.6.53.dist-info → pygpt_net-2.6.55.dist-info}/entry_points.txt +0 -0
@@ -190,7 +190,13 @@ class BaseWorker(QRunnable):
190
190
  :param item: item with parameters
191
191
  :return: request item
192
192
  """
193
- return {"cmd": item["cmd"]}
193
+ append_params = ("path", "query")
194
+ data = {"cmd": item["cmd"]}
195
+ if "params" in item and isinstance(item["params"], dict):
196
+ for k in append_params:
197
+ if k in item["params"]:
198
+ data[k] = str(item["params"][k])
199
+ return data
194
200
 
195
201
  def make_response(
196
202
  self,
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # ================================================== #
4
+ # This file is a part of PYGPT package #
5
+ # Website: https://pygpt.net #
6
+ # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
+ # MIT License #
8
+ # Created By : Marcin Szczygliński #
9
+ # Updated Date: 2025.06.30 02:00:00 #
10
+ # ================================================== #
11
+
12
+ from .plugin import *
@@ -0,0 +1,267 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # ================================================== #
4
+ # This file is a part of PYGPT package #
5
+ # Website: https://pygpt.net #
6
+ # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
+ # MIT License #
8
+ # Created By : Marcin Szczygliński #
9
+ # Updated Date: 2025.09.18 03:40:00 #
10
+ # ================================================== #
11
+
12
+ from pygpt_net.plugin.base.config import BaseConfig, BasePlugin
13
+
14
+
15
+ class Config(BaseConfig):
16
+ def __init__(self, plugin: BasePlugin = None, *args, **kwargs):
17
+ super(Config, self).__init__(plugin)
18
+ self.plugin = plugin
19
+
20
+ def from_defaults(self, plugin: BasePlugin = None):
21
+ # HTTP / endpoints
22
+ plugin.add_option(
23
+ "http_timeout",
24
+ type="int",
25
+ value=30,
26
+ label="HTTP timeout (s)",
27
+ description="Requests timeout in seconds.",
28
+ )
29
+ plugin.add_option(
30
+ "user_agent",
31
+ type="text",
32
+ value="pygpt/OSM",
33
+ label="User-Agent",
34
+ description="Custom User-Agent for requests. If empty, a default UA will be used.",
35
+ )
36
+ plugin.add_option(
37
+ "contact_email",
38
+ type="text",
39
+ value="",
40
+ label="Contact email (Nominatim)",
41
+ description="Recommended by Nominatim usage policy. Include an email for contact.",
42
+ )
43
+ plugin.add_option(
44
+ "accept_language",
45
+ type="text",
46
+ value="",
47
+ label="Accept-Language",
48
+ description="Preferred language for results, e.g. 'pl,en-US;q=0.8'.",
49
+ )
50
+
51
+ plugin.add_option(
52
+ "nominatim_base",
53
+ type="text",
54
+ value="https://nominatim.openstreetmap.org",
55
+ label="Nominatim base",
56
+ description="Base URL for Nominatim (geocoding).",
57
+ )
58
+ plugin.add_option(
59
+ "osrm_base",
60
+ type="text",
61
+ value="https://router.project-osrm.org",
62
+ label="OSRM base",
63
+ description="Base URL for OSRM routing.",
64
+ )
65
+ plugin.add_option(
66
+ "tile_base",
67
+ type="text",
68
+ value="https://tile.openstreetmap.org",
69
+ label="Tile base",
70
+ description="Base URL for XYZ tiles (z/x/y.png).",
71
+ )
72
+
73
+ # Map defaults (used for URL zoom and bbox zoom estimation)
74
+ plugin.add_option(
75
+ "map_zoom",
76
+ type="int",
77
+ value=14,
78
+ label="Default zoom",
79
+ description="Default zoom if not specified (for OSM site URLs).",
80
+ )
81
+ plugin.add_option(
82
+ "map_width",
83
+ type="int",
84
+ value=800,
85
+ label="Default width",
86
+ description="Used only to estimate zoom for bbox (no image rendering).",
87
+ )
88
+ plugin.add_option(
89
+ "map_height",
90
+ type="int",
91
+ value=600,
92
+ label="Default height",
93
+ description="Used only to estimate zoom for bbox (no image rendering).",
94
+ )
95
+
96
+ # ---------------- Commands ----------------
97
+
98
+ plugin.add_cmd(
99
+ "osm_geocode",
100
+ instruction="OpenStreetMap: Forward geocoding via Nominatim.",
101
+ params=[
102
+ {"name": "query", "type": "str", "required": True, "description": "Address or place to search"},
103
+ {"name": "limit", "type": "int", "required": False, "description": "Max results"},
104
+ {"name": "countrycodes", "type": "str", "required": False, "description": "Comma-separated ISO2 codes (e.g., 'pl,de')"},
105
+ {"name": "viewbox", "type": "str", "required": False, "description": "minlon,minlat,maxlon,maxlat (or list[4])"},
106
+ {"name": "bounded", "type": "bool", "required": False, "description": "Restrict results to viewbox"},
107
+ {"name": "addressdetails", "type": "bool", "required": False, "description": "Include address details"},
108
+ {"name": "polygon_geojson", "type": "bool", "required": False, "description": "Include polygon geometry"},
109
+ {"name": "near", "type": "str", "required": False, "description": "Near point/address; builds a viewbox automatically"},
110
+ {"name": "near_lat", "type": "float", "required": False, "description": "Near latitude (alternative to 'near')"},
111
+ {"name": "near_lon", "type": "float", "required": False, "description": "Near longitude"},
112
+ {"name": "radius_m", "type": "int", "required": False, "description": "Radius for near-based viewbox (m)"},
113
+ {"name": "zoom", "type": "int", "required": False, "description": "Zoom for returned map_url (defaults to 'Default zoom')"},
114
+ {"name": "layers", "type": "str", "required": False, "description": "Optional OSM site 'layers=' value for map_url"},
115
+ ],
116
+ enabled=True,
117
+ description="OSM: geocode (results include map_url)",
118
+ tab="map",
119
+ )
120
+
121
+ plugin.add_cmd(
122
+ "osm_reverse",
123
+ instruction="OpenStreetMap: Reverse geocoding via Nominatim.",
124
+ params=[
125
+ {"name": "lat", "type": "float", "required": False, "description": "Latitude"},
126
+ {"name": "lon", "type": "float", "required": False, "description": "Longitude"},
127
+ {"name": "point", "type": "str", "required": False, "description": "Alternative 'lat,lon'"},
128
+ {"name": "zoom", "type": "int", "required": False, "description": "Detail level (also used for map_url zoom)"},
129
+ {"name": "addressdetails", "type": "bool", "required": False, "description": "Include address details"},
130
+ {"name": "layers", "type": "str", "required": False, "description": "Optional OSM site 'layers=' value for map_url"},
131
+ ],
132
+ enabled=True,
133
+ description="OSM: reverse geocode (response includes map_url)",
134
+ tab="map",
135
+ )
136
+
137
+ plugin.add_cmd(
138
+ "osm_search",
139
+ instruction="OpenStreetMap: General search (Nominatim) with optional near/viewbox filters.",
140
+ params=[
141
+ {"name": "query", "type": "str", "required": True, "description": "Free-text search"},
142
+ {"name": "limit", "type": "int", "required": False, "description": "Max results"},
143
+ {"name": "countrycodes", "type": "str", "required": False, "description": "Comma-separated ISO2 codes"},
144
+ {"name": "near", "type": "str", "required": False, "description": "Near point/address"},
145
+ {"name": "near_lat", "type": "float", "required": False, "description": "Near latitude"},
146
+ {"name": "near_lon", "type": "float", "required": False, "description": "Near longitude"},
147
+ {"name": "radius_m", "type": "int", "required": False, "description": "Radius for near viewbox (m)"},
148
+ {"name": "zoom", "type": "int", "required": False, "description": "Zoom for returned map_url"},
149
+ {"name": "layers", "type": "str", "required": False, "description": "Optional OSM site 'layers=' value for map_url"},
150
+ ],
151
+ enabled=True,
152
+ description="OSM: search (results include map_url)",
153
+ tab="map",
154
+ )
155
+
156
+ plugin.add_cmd(
157
+ "osm_route",
158
+ instruction="OpenStreetMap: Routing via OSRM (driving/walking/cycling). Lightweight by default.",
159
+ params=[
160
+ {"name": "start", "type": "str", "required": False, "description": "Address or 'lat,lon'"},
161
+ {"name": "start_lat", "type": "float", "required": False, "description": "Latitude (alternative)"},
162
+ {"name": "start_lon", "type": "float", "required": False, "description": "Longitude (alternative)"},
163
+ {"name": "end", "type": "str", "required": False, "description": "Address or 'lat,lon'"},
164
+ {"name": "end_lat", "type": "float", "required": False, "description": "Latitude (alternative)"},
165
+ {"name": "end_lon", "type": "float", "required": False, "description": "Longitude (alternative)"},
166
+ {"name": "waypoints", "type": "list", "required": False, "description": "Optional intermediate points"},
167
+
168
+ {"name": "profile", "type": "str", "required": False, "description": "driving|walking|cycling"},
169
+ {"name": "mode", "type": "str", "required": False, "description": "url|summary|full (default: summary)"},
170
+ {"name": "include_geometry", "type": "bool", "required": False, "description": "Include compact geometry (polyline6) in 'full' mode"},
171
+ {"name": "include_steps", "type": "bool", "required": False, "description": "Include step-by-step (only in 'full' mode)"},
172
+ {"name": "alternatives", "type": "int", "required": False, "description": "0|1; if >0 treated as 'true' for OSRM alternatives"},
173
+ {"name": "max_polyline_chars", "type": "int", "required": False, "description": "Limit geometry string length (default 5000)"},
174
+ {"name": "debug_url", "type": "bool", "required": False, "description": "Include OSRM request URL in the response"},
175
+
176
+ {"name": "save_map", "type": "bool", "required": False, "description": "Build an OSM map URL focused on route bbox/center"},
177
+ {"name": "zoom", "type": "int", "required": False, "description": "Zoom for preview URL (when applicable)"},
178
+ {"name": "layers", "type": "str", "required": False, "description": "Optional OSM site 'layers=' for preview"},
179
+ {"name": "width", "type": "int", "required": False, "description": "Used only to estimate zoom for bbox"},
180
+ {"name": "height", "type": "int", "required": False, "description": "Used only to estimate zoom for bbox"},
181
+
182
+ {"name": "markers", "type": "list", "required": False, "description": "Optional list of points; first used as marker in preview"},
183
+ ],
184
+ enabled=True,
185
+ description="OSM: route (returns distance/duration and map_url; geometry optional in 'full')",
186
+ tab="route",
187
+ )
188
+
189
+ plugin.add_cmd(
190
+ "osm_staticmap",
191
+ instruction="OpenStreetMap: Build a map URL on openstreetmap.org (center/zoom or bbox; optional single marker).",
192
+ params=[
193
+ {"name": "center", "type": "str", "required": False, "description": "Address or 'lat,lon'"},
194
+ {"name": "lat", "type": "float", "required": False, "description": "Latitude (alternative)"},
195
+ {"name": "lon", "type": "float", "required": False, "description": "Longitude (alternative)"},
196
+ {"name": "zoom", "type": "int", "required": False, "description": "Zoom level"},
197
+ {"name": "bbox", "type": "list", "required": False, "description": "minlon,minlat,maxlon,maxlat"},
198
+ {"name": "markers", "type": "list", "required": False, "description": "List of candidate points; first valid becomes the marker"},
199
+ {"name": "marker", "type": "bool", "required": False, "description": "If true and no markers given, place marker at center"},
200
+ {"name": "layers", "type": "str", "required": False, "description": "Optional OSM site 'layers=' value"},
201
+ {"name": "width", "type": "int", "required": False, "description": "Used only to estimate zoom for bbox"},
202
+ {"name": "height", "type": "int", "required": False, "description": "Used only to estimate zoom for bbox"},
203
+ ],
204
+ enabled=True,
205
+ description="OSM: build map URL (openstreetmap.org)",
206
+ tab="map",
207
+ )
208
+
209
+ plugin.add_cmd(
210
+ "osm_bbox_map",
211
+ instruction="OpenStreetMap: Shortcut to build a map URL for a given bbox (openstreetmap.org).",
212
+ params=[
213
+ {"name": "bbox", "type": "list", "required": True, "description": "minlon,minlat,maxlon,maxlat"},
214
+ {"name": "markers", "type": "list", "required": False, "description": "Markers (first will be used for OSM site marker)"},
215
+ {"name": "width", "type": "int", "required": False, "description": "Used only to estimate zoom"},
216
+ {"name": "height", "type": "int", "required": False, "description": "Used only to estimate zoom"},
217
+ ],
218
+ enabled=True,
219
+ description="OSM: bbox URL",
220
+ tab="map",
221
+ )
222
+
223
+ plugin.add_cmd(
224
+ "osm_show_url",
225
+ instruction="OpenStreetMap: Return an OSM website URL centered on a point (with marker).",
226
+ params=[
227
+ {"name": "point", "type": "str", "required": False, "description": "'lat,lon' or address"},
228
+ {"name": "lat", "type": "float", "required": False, "description": "Latitude"},
229
+ {"name": "lon", "type": "float", "required": False, "description": "Longitude"},
230
+ {"name": "zoom", "type": "int", "required": False, "description": "Zoom"},
231
+ {"name": "layers", "type": "str", "required": False, "description": "Optional OSM site 'layers=' value"},
232
+ ],
233
+ enabled=True,
234
+ description="OSM: show URL",
235
+ tab="map",
236
+ )
237
+
238
+ plugin.add_cmd(
239
+ "osm_route_url",
240
+ instruction="OpenStreetMap: Return a directions URL on openstreetmap.org.",
241
+ params=[
242
+ {"name": "start", "type": "str", "required": False, "description": "Address or 'lat,lon'"},
243
+ {"name": "end", "type": "str", "required": False, "description": "Address or 'lat,lon'"},
244
+ {"name": "start_lat", "type": "float", "required": False, "description": "Latitude start"},
245
+ {"name": "start_lon", "type": "float", "required": False, "description": "Longitude start"},
246
+ {"name": "end_lat", "type": "float", "required": False, "description": "Latitude end"},
247
+ {"name": "end_lon", "type": "float", "required": False, "description": "Longitude end"},
248
+ {"name": "mode", "type": "str", "required": False, "description": "car|bike|foot"},
249
+ ],
250
+ enabled=True,
251
+ description="OSM: route URL",
252
+ tab="route",
253
+ )
254
+
255
+ plugin.add_cmd(
256
+ "osm_tile",
257
+ instruction="OpenStreetMap: Download a single XYZ tile (z/x/y.png).",
258
+ params=[
259
+ {"name": "z", "type": "int", "required": True, "description": "Zoom"},
260
+ {"name": "x", "type": "int", "required": True, "description": "X index"},
261
+ {"name": "y", "type": "int", "required": True, "description": "Y index"},
262
+ {"name": "out", "type": "str", "required": False, "description": "Output file path"},
263
+ ],
264
+ enabled=True,
265
+ description="OSM: download tile",
266
+ tab="map",
267
+ )
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # ================================================== #
4
+ # This file is a part of PYGPT package #
5
+ # Website: https://pygpt.net #
6
+ # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
+ # MIT License #
8
+ # Created By : Marcin Szczygliński #
9
+ # Updated Date: 2025.09.18 00:37:10 #
10
+ # ================================================== #
11
+
12
+ from pygpt_net.plugin.base.plugin import BasePlugin
13
+ from pygpt_net.core.events import Event
14
+ from pygpt_net.item.ctx import CtxItem
15
+
16
+ from .config import Config
17
+
18
+
19
+ class Plugin(BasePlugin):
20
+ def __init__(self, *args, **kwargs):
21
+ super(Plugin, self).__init__(*args, **kwargs)
22
+ self.id = "osm"
23
+ self.name = "OpenStreetMap"
24
+ self.description = "Search, geocode, plan routes, and generate static maps using OpenStreetMap services (Nominatim, OSRM, staticmap)."
25
+ self.prefix = "API"
26
+ self.order = 90
27
+ self.allowed_cmds = [
28
+ "osm_geocode",
29
+ "osm_reverse",
30
+ "osm_search",
31
+ "osm_route",
32
+ "osm_staticmap",
33
+ "osm_bbox_map",
34
+ "osm_show_url",
35
+ "osm_route_url",
36
+ "osm_tile",
37
+ ]
38
+ self.use_locale = False
39
+ self.worker = None
40
+ self.config = Config(self)
41
+ self.init_options()
42
+
43
+ def init_options(self):
44
+ self.config.from_defaults(self)
45
+
46
+ def handle(self, event: Event, *args, **kwargs):
47
+ name = event.name
48
+ data = event.data
49
+ ctx = event.ctx
50
+
51
+ if name == Event.CMD_SYNTAX:
52
+ self.cmd_syntax(data)
53
+ elif name == Event.CMD_EXECUTE:
54
+ self.cmd(ctx, data['commands'])
55
+
56
+ def cmd_syntax(self, data: dict):
57
+ for option in self.allowed_cmds:
58
+ if self.has_cmd(option):
59
+ data['cmd'].append(self.get_cmd(option))
60
+
61
+ def cmd(self, ctx: CtxItem, cmds: list):
62
+ from .worker import Worker
63
+
64
+ is_cmd = False
65
+ my_commands = []
66
+ for item in cmds:
67
+ if item["cmd"] in self.allowed_cmds:
68
+ my_commands.append(item)
69
+ is_cmd = True
70
+
71
+ if not is_cmd:
72
+ return
73
+
74
+ self.cmd_prepare(ctx, my_commands)
75
+
76
+ try:
77
+ worker = Worker()
78
+ worker.from_defaults(self)
79
+ worker.cmds = my_commands
80
+ worker.ctx = ctx
81
+
82
+ if not self.is_async(ctx):
83
+ worker.run()
84
+ return
85
+ worker.run_async()
86
+ except Exception as e:
87
+ self.error(e)