pygpt-net 2.4.39__py3-none-any.whl → 2.4.40__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.
- CHANGELOG.md +13 -0
- README.md +19 -2
- pygpt_net/CHANGELOG.txt +13 -0
- pygpt_net/__init__.py +3 -3
- pygpt_net/controller/__init__.py +5 -3
- pygpt_net/controller/audio/__init__.py +9 -1
- pygpt_net/controller/chat/input.py +2 -1
- pygpt_net/controller/chat/render.py +2 -2
- pygpt_net/controller/ctx/__init__.py +2 -2
- pygpt_net/controller/debug/__init__.py +13 -2
- pygpt_net/controller/kernel/__init__.py +2 -1
- pygpt_net/controller/notepad.py +7 -6
- pygpt_net/controller/theme/nodes.py +2 -5
- pygpt_net/controller/tools/__init__.py +37 -1
- pygpt_net/controller/ui/__init__.py +1 -5
- pygpt_net/controller/ui/tabs.py +104 -12
- pygpt_net/core/command.py +3 -1
- pygpt_net/core/ctx/__init__.py +6 -2
- pygpt_net/core/ctx/container.py +5 -5
- pygpt_net/core/debug/tabs.py +3 -1
- pygpt_net/core/render/base.py +2 -2
- pygpt_net/core/render/web/body.py +1 -1
- pygpt_net/core/render/web/renderer.py +208 -38
- pygpt_net/core/tabs/__init__.py +104 -43
- pygpt_net/core/tabs/tab.py +4 -1
- pygpt_net/core/web.py +127 -1
- pygpt_net/data/config/config.json +4 -3
- pygpt_net/data/config/models.json +3 -3
- pygpt_net/data/config/modes.json +3 -3
- pygpt_net/data/css/web-blocks.css +18 -0
- pygpt_net/data/css/web-blocks.light.css +7 -0
- pygpt_net/data/css/web-chatgpt.css +8 -0
- pygpt_net/data/css/web-chatgpt_wide.css +8 -0
- pygpt_net/data/icons/split_screen.svg +1 -0
- pygpt_net/data/locale/locale.de.ini +1 -1
- pygpt_net/data/locale/locale.en.ini +4 -2
- pygpt_net/data/locale/locale.es.ini +1 -1
- pygpt_net/data/locale/locale.fr.ini +1 -1
- pygpt_net/data/locale/locale.it.ini +1 -1
- pygpt_net/data/locale/locale.pl.ini +2 -2
- pygpt_net/data/locale/locale.uk.ini +1 -1
- pygpt_net/data/locale/locale.zh.ini +1 -1
- pygpt_net/data/locale/plugin.cmd_web.de.ini +2 -0
- pygpt_net/data/locale/plugin.cmd_web.en.ini +20 -10
- pygpt_net/data/locale/plugin.cmd_web.es.ini +2 -0
- pygpt_net/data/locale/plugin.cmd_web.fr.ini +2 -0
- pygpt_net/data/locale/plugin.cmd_web.it.ini +2 -0
- pygpt_net/data/locale/plugin.cmd_web.pl.ini +2 -0
- pygpt_net/data/locale/plugin.cmd_web.uk.ini +2 -0
- pygpt_net/data/locale/plugin.cmd_web.zh.ini +2 -0
- pygpt_net/icons.qrc +1 -0
- pygpt_net/icons_rc.py +165 -136
- pygpt_net/item/ctx.py +46 -24
- pygpt_net/plugin/audio_output/__init__.py +4 -1
- pygpt_net/plugin/base/plugin.py +18 -4
- pygpt_net/plugin/cmd_code_interpreter/__init__.py +39 -37
- pygpt_net/plugin/cmd_code_interpreter/runner.py +25 -12
- pygpt_net/plugin/cmd_web/__init__.py +46 -6
- pygpt_net/plugin/cmd_web/config.py +74 -48
- pygpt_net/plugin/cmd_web/websearch.py +61 -28
- pygpt_net/plugin/cmd_web/worker.py +79 -13
- pygpt_net/provider/core/config/patch.py +22 -1
- pygpt_net/tools/__init__.py +9 -1
- pygpt_net/tools/base.py +15 -1
- pygpt_net/tools/code_interpreter/__init__.py +174 -75
- pygpt_net/tools/code_interpreter/ui/dialogs.py +21 -103
- pygpt_net/tools/code_interpreter/ui/widgets.py +284 -9
- pygpt_net/tools/html_canvas/__init__.py +78 -23
- pygpt_net/tools/html_canvas/ui/dialogs.py +46 -62
- pygpt_net/tools/html_canvas/ui/widgets.py +96 -3
- pygpt_net/ui/base/context_menu.py +2 -2
- pygpt_net/ui/layout/ctx/ctx_list.py +13 -4
- pygpt_net/ui/layout/toolbox/footer.py +1 -1
- pygpt_net/ui/main.py +2 -2
- pygpt_net/ui/menu/debug.py +11 -1
- pygpt_net/ui/widget/filesystem/explorer.py +2 -2
- pygpt_net/ui/widget/lists/context.py +26 -5
- pygpt_net/ui/widget/tabs/Input.py +2 -2
- pygpt_net/ui/widget/tabs/body.py +2 -1
- pygpt_net/ui/widget/tabs/output.py +126 -61
- {pygpt_net-2.4.39.dist-info → pygpt_net-2.4.40.dist-info}/METADATA +20 -3
- {pygpt_net-2.4.39.dist-info → pygpt_net-2.4.40.dist-info}/RECORD +85 -84
- {pygpt_net-2.4.39.dist-info → pygpt_net-2.4.40.dist-info}/LICENSE +0 -0
- {pygpt_net-2.4.39.dist-info → pygpt_net-2.4.40.dist-info}/WHEEL +0 -0
- {pygpt_net-2.4.39.dist-info → pygpt_net-2.4.40.dist-info}/entry_points.txt +0 -0
@@ -6,10 +6,11 @@
|
|
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.
|
9
|
+
# Updated Date: 2024.12.13 08:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import re
|
13
|
+
|
13
14
|
from bs4 import BeautifulSoup
|
14
15
|
|
15
16
|
from pygpt_net.core.events import KernelEvent
|
@@ -194,19 +195,22 @@ class WebSearch:
|
|
194
195
|
query: str,
|
195
196
|
page_no: int = 1,
|
196
197
|
summarize_prompt: str = ""
|
197
|
-
) -> (str, int, int, str):
|
198
|
+
) -> (str, int, int, str, str):
|
198
199
|
"""
|
199
200
|
Get result from search query
|
200
201
|
|
201
202
|
:param query: query to search
|
202
203
|
:param page_no: page number
|
203
204
|
:param summarize_prompt: custom prompt
|
204
|
-
:return: result, total_found, current, url
|
205
|
+
:return: result, total_found, current, url, thumb image
|
205
206
|
"""
|
206
207
|
self.log("Using web query: " + query)
|
207
208
|
urls = self.get_urls(query)
|
208
209
|
|
209
210
|
# get options
|
211
|
+
is_summary = True
|
212
|
+
if self.plugin.get_option_value("raw"):
|
213
|
+
is_summary = False
|
210
214
|
max_per_page = int(self.plugin.get_option_value("max_page_content_length"))
|
211
215
|
chunk_size = int(self.plugin.get_option_value("chunk_size"))
|
212
216
|
max_result_size = int(self.plugin.get_option_value("max_result_length"))
|
@@ -216,6 +220,7 @@ class WebSearch:
|
|
216
220
|
i = 1
|
217
221
|
current = 1
|
218
222
|
url = ""
|
223
|
+
img = None
|
219
224
|
for url in urls:
|
220
225
|
if url is None or url == "":
|
221
226
|
continue
|
@@ -236,19 +241,27 @@ class WebSearch:
|
|
236
241
|
if 0 < max_per_page < len(content):
|
237
242
|
content = content[:max_per_page]
|
238
243
|
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
244
|
+
# get summary
|
245
|
+
if is_summary:
|
246
|
+
chunks = self.to_chunks(content, chunk_size) # it returns list of chunks
|
247
|
+
self.debug(
|
248
|
+
"Plugin: cmd_web: URL: {}".format(url)
|
249
|
+
)
|
250
|
+
result = self.get_summary(
|
251
|
+
chunks,
|
252
|
+
str(query),
|
253
|
+
summarize_prompt,
|
254
|
+
)
|
255
|
+
else:
|
256
|
+
# no summary
|
257
|
+
result = str(content)
|
258
|
+
|
248
259
|
# if result then stop
|
249
260
|
if result is not None and result != "":
|
261
|
+
# get thumbnail image
|
262
|
+
if self.plugin.get_option_value("img_thumbnail"):
|
263
|
+
img = self.plugin.window.core.web.get_main_image(url)
|
250
264
|
self.log("Summary generated (chars: {})".format(len(result)))
|
251
|
-
|
252
265
|
# index webpage if auto-index is enabled
|
253
266
|
self.index_url(url)
|
254
267
|
break
|
@@ -262,7 +275,7 @@ class WebSearch:
|
|
262
275
|
"Plugin: cmd_web: summary length: {}".format(len(result))
|
263
276
|
)
|
264
277
|
|
265
|
-
if len(result)
|
278
|
+
if 0 < max_result_size < len(result):
|
266
279
|
result = result[:max_result_size]
|
267
280
|
|
268
281
|
self.debug(
|
@@ -273,25 +286,33 @@ class WebSearch:
|
|
273
286
|
result, \
|
274
287
|
total_found, \
|
275
288
|
current, \
|
276
|
-
url
|
289
|
+
url, \
|
290
|
+
img
|
277
291
|
|
278
|
-
def open_url(self, url: str, summarize_prompt: str = "") -> (str, str):
|
292
|
+
def open_url(self, url: str, summarize_prompt: str = "") -> (str, str, str):
|
279
293
|
"""
|
280
294
|
Get result from specified URL
|
281
295
|
|
282
296
|
:param url: URL to visit
|
283
297
|
:param summarize_prompt: custom prompt
|
284
|
-
:return: result, url
|
298
|
+
:return: result, url, thumb image
|
285
299
|
"""
|
286
300
|
self.log("Using URL: " + url)
|
287
|
-
|
288
301
|
# get options
|
302
|
+
is_summary = True
|
303
|
+
if self.plugin.get_option_value("raw"):
|
304
|
+
is_summary = False
|
289
305
|
max_per_page = int(self.plugin.get_option_value("max_page_content_length"))
|
290
306
|
chunk_size = int(self.plugin.get_option_value("chunk_size"))
|
291
307
|
max_result_size = int(self.plugin.get_option_value("max_result_length"))
|
292
308
|
|
309
|
+
img = None
|
293
310
|
self.log("URL: " + url)
|
294
311
|
content = self.query_url(url)
|
312
|
+
|
313
|
+
if content is None:
|
314
|
+
return None, url, img
|
315
|
+
|
295
316
|
self.log("Content found (chars: {}). Please wait...".format(len(content)))
|
296
317
|
|
297
318
|
# index webpage if auto-index is enabled
|
@@ -300,14 +321,23 @@ class WebSearch:
|
|
300
321
|
|
301
322
|
if 0 < max_per_page < len(content):
|
302
323
|
content = content[:max_per_page]
|
303
|
-
chunks = self.to_chunks(
|
304
|
-
content,
|
305
|
-
chunk_size,
|
306
|
-
) # it returns list of chunks
|
307
324
|
|
308
325
|
self.debug("Plugin: cmd_web: URL: {}".format(url)) # log
|
309
326
|
|
310
|
-
|
327
|
+
# get summary
|
328
|
+
if is_summary:
|
329
|
+
chunks = self.to_chunks(
|
330
|
+
content,
|
331
|
+
chunk_size,
|
332
|
+
) # it returns list of chunks
|
333
|
+
result = self.get_summary(chunks, "", summarize_prompt)
|
334
|
+
else:
|
335
|
+
# no summary
|
336
|
+
result = str(content)
|
337
|
+
|
338
|
+
# get thumbnail image
|
339
|
+
if self.plugin.get_option_value("img_thumbnail"):
|
340
|
+
img = self.plugin.window.core.web.get_main_image(url)
|
311
341
|
|
312
342
|
if result is not None and result != "":
|
313
343
|
self.log("Summary generated (chars: {})".format(len(result)))
|
@@ -318,21 +348,21 @@ class WebSearch:
|
|
318
348
|
"Plugin: cmd_web: summary length: {}".format(len(result))
|
319
349
|
)
|
320
350
|
|
321
|
-
if len(result)
|
351
|
+
if 0 < max_result_size < len(result):
|
322
352
|
result = result[:max_result_size]
|
323
353
|
|
324
354
|
self.debug(
|
325
355
|
"Plugin: cmd_web: result length: {}".format(len(result))
|
326
356
|
)
|
327
357
|
|
328
|
-
return result, url
|
358
|
+
return result, url, img
|
329
359
|
|
330
|
-
def open_url_raw(self, url: str) -> (str, str):
|
360
|
+
def open_url_raw(self, url: str) -> (str, str, str):
|
331
361
|
"""
|
332
362
|
Get raw content from specified URL
|
333
363
|
|
334
364
|
:param url: URL to visit
|
335
|
-
:return: result, url
|
365
|
+
:return: result, url, thumb image
|
336
366
|
"""
|
337
367
|
self.log("Using URL: " + url)
|
338
368
|
|
@@ -343,8 +373,11 @@ class WebSearch:
|
|
343
373
|
result = self.query_url(url)
|
344
374
|
self.log("Content found (chars: {}). Please wait...".format(len(result)))
|
345
375
|
|
376
|
+
img = None
|
346
377
|
# index webpage if auto-index is enabled
|
347
378
|
if result:
|
379
|
+
if self.plugin.get_option_value("img_thumbnail"):
|
380
|
+
img = self.plugin.window.core.web.get_main_image(url)
|
348
381
|
self.index_url(url)
|
349
382
|
|
350
383
|
# strip if too long
|
@@ -355,7 +388,7 @@ class WebSearch:
|
|
355
388
|
"Plugin: cmd_web: result length: {}".format(len(result))
|
356
389
|
)
|
357
390
|
|
358
|
-
return result, url
|
391
|
+
return result, url, img
|
359
392
|
|
360
393
|
def index_url(self, url: str):
|
361
394
|
"""
|
@@ -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.
|
9
|
+
# Updated Date: 2024.12.13 08:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import json
|
13
13
|
|
14
14
|
from PySide6.QtCore import Slot
|
15
|
+
|
15
16
|
from pygpt_net.plugin.base.worker import BaseWorker, BaseSignals
|
16
17
|
|
17
18
|
|
@@ -40,7 +41,7 @@ class Worker(BaseWorker):
|
|
40
41
|
response = None
|
41
42
|
try:
|
42
43
|
if item["cmd"] == "web_search":
|
43
|
-
response = self.
|
44
|
+
response = self.cmd_web_urls(item) # return URLs
|
44
45
|
|
45
46
|
elif item["cmd"] == "web_url_open":
|
46
47
|
response = self.cmd_web_url_open(item)
|
@@ -57,6 +58,12 @@ class Worker(BaseWorker):
|
|
57
58
|
elif item["cmd"] == "web_index_query":
|
58
59
|
response = self.cmd_web_index_query(item)
|
59
60
|
|
61
|
+
elif item["cmd"] == "web_extract_links":
|
62
|
+
response = self.cmd_web_extract_links(item)
|
63
|
+
|
64
|
+
elif item["cmd"] == "web_extract_images":
|
65
|
+
response = self.cmd_web_extract_images(item)
|
66
|
+
|
60
67
|
if response:
|
61
68
|
responses.append(response)
|
62
69
|
|
@@ -91,7 +98,7 @@ class Worker(BaseWorker):
|
|
91
98
|
prompt = self.get_param(item, "summarize_prompt")
|
92
99
|
|
93
100
|
query = self.get_param(item, "query", "")
|
94
|
-
content, total_found, current, url = self.websearch.make_query(
|
101
|
+
content, total_found, current, url, img = self.websearch.make_query(
|
95
102
|
query,
|
96
103
|
page,
|
97
104
|
prompt,
|
@@ -105,8 +112,12 @@ class Worker(BaseWorker):
|
|
105
112
|
'total_found': total_found,
|
106
113
|
}
|
107
114
|
if url:
|
108
|
-
self.ctx.
|
115
|
+
self.ctx.urls_before.append(url)
|
116
|
+
if img:
|
117
|
+
result["thumb_img"] = img
|
118
|
+
self.ctx.images_before.append(img)
|
109
119
|
|
120
|
+
self.ctx.save_reply = True # leave links in context
|
110
121
|
return self.make_response(item, result)
|
111
122
|
|
112
123
|
def cmd_web_url_open(self, item: dict) -> dict:
|
@@ -122,7 +133,7 @@ class Worker(BaseWorker):
|
|
122
133
|
url = self.get_param(item, "url", "")
|
123
134
|
|
124
135
|
self.msg = "Opening Web URL: '{}'".format(url)
|
125
|
-
content, url = self.websearch.open_url(
|
136
|
+
content, url, img = self.websearch.open_url(
|
126
137
|
url,
|
127
138
|
prompt,
|
128
139
|
)
|
@@ -130,9 +141,12 @@ class Worker(BaseWorker):
|
|
130
141
|
'url': url,
|
131
142
|
'content': content,
|
132
143
|
}
|
133
|
-
context = "From: " + url + ":\n--------------------------------\n" + content
|
144
|
+
context = "From: " + url + ":\n--------------------------------\n" + str(content)
|
134
145
|
if url:
|
135
|
-
self.ctx.
|
146
|
+
self.ctx.urls_before.append(url)
|
147
|
+
if img:
|
148
|
+
result["thumb_img"] = img
|
149
|
+
self.ctx.images_before.append(img)
|
136
150
|
|
137
151
|
extra = {
|
138
152
|
"context": context,
|
@@ -148,16 +162,19 @@ class Worker(BaseWorker):
|
|
148
162
|
"""
|
149
163
|
url = self.get_param(item, "url", "")
|
150
164
|
self.msg = "Opening Web URL: '{}'".format(url)
|
151
|
-
content, url = self.websearch.open_url_raw(
|
165
|
+
content, url, img = self.websearch.open_url_raw(
|
152
166
|
url,
|
153
167
|
)
|
154
168
|
result = {
|
155
169
|
'url': url,
|
156
170
|
'content': content,
|
157
171
|
}
|
158
|
-
context = "From: " + url + ":\n--------------------------------\n" + content
|
172
|
+
context = "From: " + url + ":\n--------------------------------\n" + str(content)
|
159
173
|
if url:
|
160
|
-
self.ctx.
|
174
|
+
self.ctx.urls_before.append(url)
|
175
|
+
if img:
|
176
|
+
result["thumb_img"] = img
|
177
|
+
self.ctx.images_before.append(img)
|
161
178
|
|
162
179
|
extra = {
|
163
180
|
"context": context,
|
@@ -201,7 +218,7 @@ class Worker(BaseWorker):
|
|
201
218
|
}
|
202
219
|
if urls:
|
203
220
|
for url in urls:
|
204
|
-
self.ctx.
|
221
|
+
self.ctx.urls_before.append(url)
|
205
222
|
|
206
223
|
return self.make_response(item, result)
|
207
224
|
|
@@ -247,7 +264,7 @@ class Worker(BaseWorker):
|
|
247
264
|
'errors': errors,
|
248
265
|
}
|
249
266
|
if url and (url.startswith("http://") or url.startswith("https://")):
|
250
|
-
self.ctx.
|
267
|
+
self.ctx.urls_before.append(url)
|
251
268
|
|
252
269
|
extra = {
|
253
270
|
"url": url,
|
@@ -327,9 +344,58 @@ class Worker(BaseWorker):
|
|
327
344
|
|
328
345
|
# add URL to context
|
329
346
|
if url and (url.startswith("http://") or url.startswith("https://")):
|
330
|
-
self.ctx.
|
347
|
+
self.ctx.urls_before.append(url)
|
331
348
|
|
332
349
|
extra = {
|
333
350
|
"context": context,
|
334
351
|
}
|
335
352
|
return self.make_response(item, result, extra=extra)
|
353
|
+
|
354
|
+
def cmd_web_extract_links(self, item: dict) -> dict:
|
355
|
+
"""
|
356
|
+
Web extract links command
|
357
|
+
|
358
|
+
:param item: command item
|
359
|
+
:return: response item
|
360
|
+
"""
|
361
|
+
url = ""
|
362
|
+
if self.has_param(item, "url"):
|
363
|
+
url = self.get_param(item, "url")
|
364
|
+
if not url:
|
365
|
+
return self.make_response(item, "No URL provided")
|
366
|
+
links = self.plugin.window.core.web.get_links(url)
|
367
|
+
result = {
|
368
|
+
'links': links,
|
369
|
+
}
|
370
|
+
self.ctx.urls_before.append(url)
|
371
|
+
return self.make_response(item, result)
|
372
|
+
|
373
|
+
def cmd_web_extract_images(self, item: dict) -> dict:
|
374
|
+
"""
|
375
|
+
Web extract images command
|
376
|
+
|
377
|
+
:param item: command item
|
378
|
+
:return: response item
|
379
|
+
"""
|
380
|
+
download = False
|
381
|
+
url = ""
|
382
|
+
if self.has_param(item, "url"):
|
383
|
+
url = self.get_param(item, "url")
|
384
|
+
if self.has_param(item, "download"):
|
385
|
+
download = bool(self.get_param(item, "download"))
|
386
|
+
if not url:
|
387
|
+
return self.make_response(item, "No URL provided")
|
388
|
+
images = self.plugin.window.core.web.get_images(url)
|
389
|
+
result = {
|
390
|
+
'images': images,
|
391
|
+
}
|
392
|
+
if images and download:
|
393
|
+
for img in images:
|
394
|
+
try:
|
395
|
+
path = self.plugin.window.core.web.download_image(img)
|
396
|
+
if path:
|
397
|
+
self.ctx.images_before.append(path)
|
398
|
+
except Exception as e:
|
399
|
+
print(e)
|
400
|
+
self.ctx.urls_before.append(url)
|
401
|
+
return self.make_response(item, result)
|
@@ -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: 2024.12.
|
9
|
+
# Updated Date: 2024.12.13 19:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import copy
|
@@ -1755,6 +1755,27 @@ class Patch:
|
|
1755
1755
|
data["layout.split"] = False
|
1756
1756
|
updated = True
|
1757
1757
|
|
1758
|
+
# < 2.4.40
|
1759
|
+
if old < parse_version("2.4.40"):
|
1760
|
+
print("Migrating config from < 2.4.40...")
|
1761
|
+
if 'cmd_web' in data['plugins'] \
|
1762
|
+
and 'max_result_length' in data['plugins']['cmd_web']:
|
1763
|
+
del data['plugins']['cmd_web']['max_result_length']
|
1764
|
+
if 'cmd_web' in data['plugins'] \
|
1765
|
+
and 'cmd.web_search' in data['plugins']['cmd_web']:
|
1766
|
+
del data['plugins']['cmd_web']['cmd.web_search']
|
1767
|
+
if 'cmd_web' in data['plugins'] \
|
1768
|
+
and 'cmd.web_url_open' in data['plugins']['cmd_web']:
|
1769
|
+
del data['plugins']['cmd_web']['cmd.web_url_open']
|
1770
|
+
if 'cmd_web' in data['plugins'] \
|
1771
|
+
and 'cmd.web_url_raw' in data['plugins']['cmd_web']:
|
1772
|
+
del data['plugins']['cmd_web']['cmd.web_url_raw']
|
1773
|
+
self.window.core.updater.patch_css('web-blocks.css', True) # force update
|
1774
|
+
self.window.core.updater.patch_css('web-blocks.light.css', True) # force update
|
1775
|
+
self.window.core.updater.patch_css('web-chatgpt.css', True) # force update
|
1776
|
+
self.window.core.updater.patch_css('web-chatgpt_wide.css', True) # force update
|
1777
|
+
updated = True
|
1778
|
+
|
1758
1779
|
# update file
|
1759
1780
|
migrated = False
|
1760
1781
|
if updated:
|
pygpt_net/tools/__init__.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: 2024.
|
9
|
+
# Updated Date: 2024.12.09 23:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
from pygpt_net.ui.widget.dialog.base import BaseDialog
|
@@ -42,6 +42,14 @@ class Tools:
|
|
42
42
|
if id in self.tools:
|
43
43
|
return self.tools[id]
|
44
44
|
|
45
|
+
def get_all(self) -> dict:
|
46
|
+
"""
|
47
|
+
Get all tools
|
48
|
+
|
49
|
+
:return: dict with tools
|
50
|
+
"""
|
51
|
+
return self.tools
|
52
|
+
|
45
53
|
def setup(self):
|
46
54
|
"""Setup tools"""
|
47
55
|
self.setup_dialogs()
|
pygpt_net/tools/base.py
CHANGED
@@ -6,11 +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.
|
9
|
+
# Updated Date: 2024.12.12 04:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
from PySide6.QtCore import QObject
|
13
|
+
from PySide6.QtWidgets import QWidget
|
13
14
|
|
15
|
+
from pygpt_net.core.tabs.tab import Tab
|
14
16
|
from pygpt_net.ui.widget.dialog.base import BaseDialog
|
15
17
|
|
16
18
|
class BaseTool(QObject):
|
@@ -25,6 +27,9 @@ class BaseTool(QObject):
|
|
25
27
|
super(BaseTool, self).__init__()
|
26
28
|
self.window = None
|
27
29
|
self.id = ""
|
30
|
+
self.has_tab = False
|
31
|
+
self.tab_title = ""
|
32
|
+
self.tab_icon = ":/icons/build.svg"
|
28
33
|
|
29
34
|
def setup(self):
|
30
35
|
"""Setup tool"""
|
@@ -83,6 +88,15 @@ class BaseTool(QObject):
|
|
83
88
|
"""
|
84
89
|
return None
|
85
90
|
|
91
|
+
def as_tab(self, tab: Tab) -> QWidget or None:
|
92
|
+
"""
|
93
|
+
Spawn and return tab instance
|
94
|
+
|
95
|
+
:param tab: Parent tab instance
|
96
|
+
:return: Tab widget instance
|
97
|
+
"""
|
98
|
+
return None
|
99
|
+
|
86
100
|
def get_lang_mappings(self) -> dict:
|
87
101
|
"""
|
88
102
|
Get language mappings
|