pygpt-net 2.4.41__py3-none-any.whl → 2.4.44__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 +19 -0
- README.md +151 -71
- pygpt_net/CHANGELOG.txt +19 -0
- pygpt_net/__init__.py +3 -3
- pygpt_net/app.py +3 -1
- pygpt_net/controller/attachment.py +31 -3
- pygpt_net/controller/audio/__init__.py +2 -2
- pygpt_net/controller/camera.py +1 -10
- pygpt_net/controller/chat/attachment.py +37 -36
- pygpt_net/controller/chat/audio.py +2 -2
- pygpt_net/controller/config/placeholder.py +20 -4
- pygpt_net/controller/idx/common.py +7 -3
- pygpt_net/controller/ui/mode.py +16 -21
- pygpt_net/core/attachments/__init__.py +7 -2
- pygpt_net/core/attachments/context.py +52 -34
- pygpt_net/core/audio/__init__.py +4 -1
- pygpt_net/core/audio/whisper.py +37 -0
- pygpt_net/core/bridge/worker.py +2 -2
- pygpt_net/core/db/__init__.py +2 -1
- pygpt_net/core/debug/attachments.py +1 -0
- pygpt_net/core/debug/events.py +22 -10
- pygpt_net/core/debug/tabs.py +6 -3
- pygpt_net/core/history.py +3 -2
- pygpt_net/core/idx/__init__.py +23 -6
- pygpt_net/core/idx/chat.py +15 -5
- pygpt_net/core/idx/indexing.py +47 -14
- pygpt_net/core/idx/ui/__init__.py +22 -0
- pygpt_net/core/idx/ui/loaders.py +217 -0
- pygpt_net/core/installer.py +2 -4
- pygpt_net/core/models.py +62 -17
- pygpt_net/core/modes.py +11 -13
- pygpt_net/core/notepad.py +4 -4
- pygpt_net/core/plugins.py +27 -16
- pygpt_net/core/presets.py +20 -9
- pygpt_net/core/profile.py +11 -3
- pygpt_net/core/render/web/parser.py +3 -1
- pygpt_net/core/settings.py +5 -5
- pygpt_net/core/tabs/tab.py +10 -2
- pygpt_net/core/tokens.py +8 -6
- pygpt_net/core/web/__init__.py +105 -0
- pygpt_net/core/{web.py → web/helpers.py} +93 -67
- pygpt_net/data/config/config.json +4 -4
- pygpt_net/data/config/models.json +3 -3
- pygpt_net/data/config/modes.json +3 -3
- pygpt_net/data/config/settings.json +5 -5
- pygpt_net/data/locale/locale.de.ini +3 -3
- pygpt_net/data/locale/locale.en.ini +12 -9
- pygpt_net/data/locale/locale.es.ini +3 -3
- pygpt_net/data/locale/locale.fr.ini +3 -3
- pygpt_net/data/locale/locale.it.ini +3 -3
- pygpt_net/data/locale/locale.pl.ini +3 -3
- pygpt_net/data/locale/locale.uk.ini +3 -3
- pygpt_net/data/locale/locale.zh.ini +3 -3
- pygpt_net/data/locale/plugin.cmd_web.en.ini +2 -0
- pygpt_net/data/locale/plugin.mailer.en.ini +21 -0
- pygpt_net/item/attachment.py +5 -1
- pygpt_net/item/ctx.py +111 -3
- pygpt_net/migrations/Version20241215110000.py +25 -0
- pygpt_net/migrations/__init__.py +3 -1
- pygpt_net/plugin/agent/__init__.py +7 -2
- pygpt_net/plugin/audio_output/__init__.py +6 -1
- pygpt_net/plugin/base/plugin.py +58 -26
- pygpt_net/plugin/base/worker.py +20 -17
- pygpt_net/plugin/cmd_files/__init__.py +3 -2
- pygpt_net/plugin/cmd_history/config.py +2 -2
- pygpt_net/plugin/cmd_web/__init__.py +3 -4
- pygpt_net/plugin/cmd_web/config.py +71 -3
- pygpt_net/plugin/cmd_web/websearch.py +20 -12
- pygpt_net/plugin/cmd_web/worker.py +67 -4
- pygpt_net/plugin/idx_llama_index/config.py +3 -3
- pygpt_net/plugin/mailer/__init__.py +123 -0
- pygpt_net/plugin/mailer/config.py +149 -0
- pygpt_net/plugin/mailer/runner.py +285 -0
- pygpt_net/plugin/mailer/worker.py +123 -0
- pygpt_net/provider/agents/base.py +5 -2
- pygpt_net/provider/agents/openai.py +4 -2
- pygpt_net/provider/agents/openai_assistant.py +4 -2
- pygpt_net/provider/agents/planner.py +4 -2
- pygpt_net/provider/agents/react.py +4 -2
- pygpt_net/provider/audio_output/openai_tts.py +5 -11
- pygpt_net/provider/core/assistant/base.py +5 -3
- pygpt_net/provider/core/assistant/json_file.py +8 -5
- pygpt_net/provider/core/assistant_file/base.py +4 -3
- pygpt_net/provider/core/assistant_file/db_sqlite/__init__.py +4 -3
- pygpt_net/provider/core/assistant_file/db_sqlite/storage.py +3 -2
- pygpt_net/provider/core/assistant_store/base.py +6 -4
- pygpt_net/provider/core/assistant_store/db_sqlite/__init__.py +5 -4
- pygpt_net/provider/core/assistant_store/db_sqlite/storage.py +5 -3
- pygpt_net/provider/core/attachment/base.py +5 -3
- pygpt_net/provider/core/attachment/json_file.py +7 -3
- pygpt_net/provider/core/calendar/base.py +5 -3
- pygpt_net/provider/core/calendar/db_sqlite/__init__.py +6 -5
- pygpt_net/provider/core/calendar/db_sqlite/storage.py +5 -4
- pygpt_net/provider/core/config/base.py +8 -6
- pygpt_net/provider/core/config/json_file.py +9 -7
- pygpt_net/provider/core/config/patch.py +6 -0
- pygpt_net/provider/core/ctx/base.py +27 -25
- pygpt_net/provider/core/ctx/db_sqlite/__init__.py +51 -35
- pygpt_net/provider/core/ctx/db_sqlite/storage.py +92 -38
- pygpt_net/provider/core/ctx/db_sqlite/utils.py +37 -11
- pygpt_net/provider/core/index/base.py +129 -23
- pygpt_net/provider/core/index/db_sqlite/__init__.py +130 -23
- pygpt_net/provider/core/index/db_sqlite/storage.py +130 -23
- pygpt_net/provider/core/index/db_sqlite/utils.py +4 -2
- pygpt_net/provider/core/mode/base.py +5 -3
- pygpt_net/provider/core/mode/json_file.py +7 -6
- pygpt_net/provider/core/model/base.py +6 -4
- pygpt_net/provider/core/model/json_file.py +9 -7
- pygpt_net/provider/core/notepad/base.py +5 -3
- pygpt_net/provider/core/notepad/db_sqlite/__init__.py +5 -4
- pygpt_net/provider/core/notepad/db_sqlite/storage.py +4 -3
- pygpt_net/provider/core/plugin_preset/base.py +4 -2
- pygpt_net/provider/core/plugin_preset/json_file.py +5 -3
- pygpt_net/provider/core/preset/base.py +6 -4
- pygpt_net/provider/core/preset/json_file.py +9 -9
- pygpt_net/provider/core/prompt/base.py +6 -3
- pygpt_net/provider/core/prompt/json_file.py +11 -6
- pygpt_net/provider/gpt/assistants.py +15 -6
- pygpt_net/provider/gpt/audio.py +5 -5
- pygpt_net/provider/gpt/chat.py +7 -5
- pygpt_net/provider/gpt/completion.py +8 -4
- pygpt_net/provider/gpt/image.py +3 -3
- pygpt_net/provider/gpt/store.py +46 -12
- pygpt_net/provider/gpt/vision.py +16 -11
- pygpt_net/provider/llms/anthropic.py +7 -2
- pygpt_net/provider/llms/azure_openai.py +26 -5
- pygpt_net/provider/llms/base.py +47 -9
- pygpt_net/provider/llms/google.py +7 -2
- pygpt_net/provider/llms/hugging_face.py +13 -3
- pygpt_net/provider/llms/hugging_face_api.py +18 -4
- pygpt_net/provider/llms/local.py +7 -2
- pygpt_net/provider/llms/ollama.py +30 -6
- pygpt_net/provider/llms/openai.py +32 -6
- pygpt_net/provider/loaders/base.py +14 -0
- pygpt_net/provider/loaders/hub/yt/base.py +5 -0
- pygpt_net/provider/loaders/web_database.py +13 -5
- pygpt_net/provider/loaders/web_github_issues.py +5 -1
- pygpt_net/provider/loaders/web_google_calendar.py +9 -1
- pygpt_net/provider/loaders/web_google_docs.py +6 -1
- pygpt_net/provider/loaders/web_google_drive.py +10 -1
- pygpt_net/provider/loaders/web_google_gmail.py +2 -1
- pygpt_net/provider/loaders/web_google_keep.py +5 -1
- pygpt_net/provider/loaders/web_google_sheets.py +5 -1
- pygpt_net/provider/loaders/web_microsoft_onedrive.py +15 -1
- pygpt_net/provider/loaders/web_page.py +4 -2
- pygpt_net/provider/loaders/web_rss.py +2 -1
- pygpt_net/provider/loaders/web_sitemap.py +2 -1
- pygpt_net/provider/loaders/web_twitter.py +4 -2
- pygpt_net/provider/loaders/web_yt.py +17 -2
- pygpt_net/provider/vector_stores/__init__.py +45 -14
- pygpt_net/provider/vector_stores/base.py +35 -8
- pygpt_net/provider/vector_stores/chroma.py +13 -3
- pygpt_net/provider/vector_stores/ctx_attachment.py +32 -13
- pygpt_net/provider/vector_stores/elasticsearch.py +12 -3
- pygpt_net/provider/vector_stores/pinecode.py +12 -3
- pygpt_net/provider/vector_stores/redis.py +12 -3
- pygpt_net/provider/vector_stores/simple.py +12 -3
- pygpt_net/provider/vector_stores/temp.py +16 -4
- pygpt_net/provider/web/base.py +10 -3
- pygpt_net/provider/web/google_custom_search.py +9 -3
- pygpt_net/provider/web/microsoft_bing.py +9 -3
- pygpt_net/tools/__init__.py +13 -5
- pygpt_net/tools/audio_transcriber/__init__.py +4 -3
- pygpt_net/tools/base.py +15 -8
- pygpt_net/tools/code_interpreter/__init__.py +4 -3
- pygpt_net/tools/html_canvas/__init__.py +4 -3
- pygpt_net/tools/image_viewer/__init__.py +10 -4
- pygpt_net/tools/indexer/__init__.py +15 -46
- pygpt_net/tools/indexer/ui/web.py +20 -78
- pygpt_net/tools/media_player/__init__.py +4 -3
- pygpt_net/tools/text_editor/__init__.py +36 -10
- pygpt_net/ui/layout/chat/output.py +2 -2
- pygpt_net/ui/layout/ctx/ctx_list.py +86 -18
- pygpt_net/ui/menu/audio.py +12 -1
- pygpt_net/ui/widget/dialog/url.py +151 -14
- pygpt_net/ui/widget/element/group.py +15 -2
- pygpt_net/ui/widget/lists/context.py +23 -9
- pygpt_net/utils.py +1 -1
- {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.44.dist-info}/METADATA +152 -72
- {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.44.dist-info}/RECORD +183 -173
- {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.44.dist-info}/LICENSE +0 -0
- {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.44.dist-info}/WHEEL +0 -0
- {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.44.dist-info}/entry_points.txt +0 -0
@@ -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.14 22:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import hashlib
|
13
13
|
import os
|
14
14
|
import shutil
|
15
|
+
from typing import Dict, Optional
|
15
16
|
|
16
17
|
from PySide6 import QtGui, QtCore
|
17
18
|
from PySide6.QtGui import QAction, QIcon
|
@@ -19,6 +20,7 @@ from PySide6.QtWidgets import QFileDialog
|
|
19
20
|
|
20
21
|
from pygpt_net.tools.base import BaseTool
|
21
22
|
from pygpt_net.tools.image_viewer.ui.dialogs import DialogSpawner
|
23
|
+
from pygpt_net.ui.widget.dialog.base import BaseDialog
|
22
24
|
from pygpt_net.utils import trans
|
23
25
|
|
24
26
|
|
@@ -255,7 +257,7 @@ class ImageViewer(BaseTool):
|
|
255
257
|
except Exception as e:
|
256
258
|
self.window.core.debug.log(e)
|
257
259
|
|
258
|
-
def setup_menu(self) ->
|
260
|
+
def setup_menu(self) -> Dict[str, QAction]:
|
259
261
|
"""
|
260
262
|
Setup main menu
|
261
263
|
|
@@ -273,7 +275,11 @@ class ImageViewer(BaseTool):
|
|
273
275
|
)
|
274
276
|
return actions
|
275
277
|
|
276
|
-
def get_instance(
|
278
|
+
def get_instance(
|
279
|
+
self,
|
280
|
+
type_id: str,
|
281
|
+
dialog_id: Optional[str] = None
|
282
|
+
) -> Optional[BaseDialog]:
|
277
283
|
"""
|
278
284
|
Spawn and return dialog instance
|
279
285
|
|
@@ -284,7 +290,7 @@ class ImageViewer(BaseTool):
|
|
284
290
|
if type_id == "image_viewer":
|
285
291
|
return self.spawner.setup(dialog_id)
|
286
292
|
|
287
|
-
def get_lang_mappings(self) ->
|
293
|
+
def get_lang_mappings(self) -> Dict[str, Dict]:
|
288
294
|
"""
|
289
295
|
Get language mappings
|
290
296
|
|
@@ -6,11 +6,12 @@
|
|
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.16 01:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import datetime
|
13
13
|
import json
|
14
|
+
from typing import Dict, Any, List
|
14
15
|
|
15
16
|
from PySide6.QtCore import Slot
|
16
17
|
from PySide6.QtGui import QAction, QIcon, QTextCursor
|
@@ -200,7 +201,7 @@ class IndexerTool(BaseTool):
|
|
200
201
|
last_str = datetime.datetime.fromtimestamp(last_ts).strftime('%Y-%m-%d %H:%M:%S')
|
201
202
|
self.window.ui.nodes['tool.indexer.ctx.last_auto'].setText(last_str)
|
202
203
|
|
203
|
-
def update_tab_files(self):
|
204
|
+
def update_tab_files(self) -> List[str]:
|
204
205
|
"""
|
205
206
|
Update files tab
|
206
207
|
|
@@ -310,48 +311,16 @@ class IndexerTool(BaseTool):
|
|
310
311
|
|
311
312
|
:param force: force indexing
|
312
313
|
"""
|
313
|
-
input_params =
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
314
|
+
result, loader, input_params, input_config = self.window.core.idx.ui.loaders.handle_options(
|
315
|
+
self.window.ui.nodes["tool.indexer.web.loader"],
|
316
|
+
"tool.indexer.web.loader.option",
|
317
|
+
"tool.indexer.web.loader.config",
|
318
|
+
)
|
319
|
+
if not result:
|
318
320
|
self.window.ui.dialogs.alert(trans("tool.indexer.alert.no_loader"))
|
319
321
|
return
|
320
|
-
loaders = self.window.core.idx.indexing.get_external_instructions()
|
321
|
-
if loader in loaders:
|
322
|
-
params = loaders[loader]
|
323
|
-
for k in params["args"]:
|
324
|
-
key_path = "tool.indexer.web.loader.option." + loader + "." + k
|
325
|
-
if key_path in self.window.ui.nodes:
|
326
|
-
input_params[k] = self.window.ui.nodes[key_path].text()
|
327
322
|
|
328
|
-
|
329
|
-
if loader in loaders:
|
330
|
-
params = loaders[loader]
|
331
|
-
for k in params:
|
332
|
-
key_path = "tool.indexer.web.loader.config." + loader + "." + k
|
333
|
-
type = params[k]["type"]
|
334
|
-
if key_path in self.window.ui.nodes:
|
335
|
-
tmp_value = self.window.ui.nodes[key_path].text()
|
336
|
-
try:
|
337
|
-
if tmp_value:
|
338
|
-
if type == "int":
|
339
|
-
tmp_value = int(tmp_value)
|
340
|
-
elif type == "float":
|
341
|
-
tmp_value = float(tmp_value)
|
342
|
-
elif type == "bool":
|
343
|
-
if tmp_value.lower() in ["true", "1"]:
|
344
|
-
tmp_value = True
|
345
|
-
else:
|
346
|
-
tmp_value = False
|
347
|
-
elif type == "list":
|
348
|
-
tmp_value = tmp_value.split(",")
|
349
|
-
elif type == "dict":
|
350
|
-
tmp_value = json.loads(tmp_value)
|
351
|
-
input_config[k] = tmp_value
|
352
|
-
except Exception as e:
|
353
|
-
self.window.core.debug.log(e)
|
354
|
-
self.window.ui.dialogs.alert(e)
|
323
|
+
is_replace = self.window.ui.nodes["tool.indexer.web.options.replace"].isChecked()
|
355
324
|
if not force:
|
356
325
|
self.window.ui.dialogs.confirm(
|
357
326
|
type="idx.tool.index",
|
@@ -420,7 +389,7 @@ class IndexerTool(BaseTool):
|
|
420
389
|
self.refresh()
|
421
390
|
|
422
391
|
@Slot(object)
|
423
|
-
def handle_log(self, data:
|
392
|
+
def handle_log(self, data: Any):
|
424
393
|
"""
|
425
394
|
Handle log message
|
426
395
|
|
@@ -428,7 +397,7 @@ class IndexerTool(BaseTool):
|
|
428
397
|
"""
|
429
398
|
self.log(data)
|
430
399
|
|
431
|
-
def log(self, data:
|
400
|
+
def log(self, data: Any):
|
432
401
|
"""
|
433
402
|
Log message to console or logger window
|
434
403
|
|
@@ -451,7 +420,7 @@ class IndexerTool(BaseTool):
|
|
451
420
|
"""Clear log"""
|
452
421
|
self.window.ui.nodes["tool.indexer.status"].clear()
|
453
422
|
|
454
|
-
def get_tables(self) ->
|
423
|
+
def get_tables(self) -> Dict[str, Dict]:
|
455
424
|
"""
|
456
425
|
Get tables configuration
|
457
426
|
|
@@ -513,7 +482,7 @@ class IndexerTool(BaseTool):
|
|
513
482
|
}
|
514
483
|
return tables
|
515
484
|
|
516
|
-
def setup_menu(self) ->
|
485
|
+
def setup_menu(self) -> Dict[str, QAction]:
|
517
486
|
"""
|
518
487
|
Setup main menu (Tools)
|
519
488
|
|
@@ -536,7 +505,7 @@ class IndexerTool(BaseTool):
|
|
536
505
|
self.dialog = DialogBuilder(self.window)
|
537
506
|
self.dialog.setup()
|
538
507
|
|
539
|
-
def get_lang_mappings(self) ->
|
508
|
+
def get_lang_mappings(self) -> Dict[str, Dict]:
|
540
509
|
"""
|
541
510
|
Get language mappings
|
542
511
|
|
@@ -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.16 01:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import json
|
@@ -15,6 +15,7 @@ from PySide6.QtCore import Qt
|
|
15
15
|
from PySide6.QtWidgets import QLabel, QVBoxLayout, QWidget, QCheckBox, QHBoxLayout, QScrollArea, \
|
16
16
|
QSizePolicy
|
17
17
|
|
18
|
+
from pygpt_net.ui.widget.element.group import QVLine, QHLine
|
18
19
|
from pygpt_net.ui.widget.element.labels import HelpLabel, UrlLabel
|
19
20
|
from pygpt_net.ui.widget.option.combo import OptionCombo
|
20
21
|
from pygpt_net.ui.widget.option.input import OptionInput
|
@@ -33,15 +34,17 @@ class WebTab:
|
|
33
34
|
self.params_widget = None
|
34
35
|
|
35
36
|
def setup(self):
|
36
|
-
"""
|
37
|
-
Setup tab widget
|
38
|
-
"""
|
37
|
+
"""Setup tab widget"""
|
39
38
|
# get loaders list
|
40
39
|
loaders = self.window.controller.config.placeholder.apply_by_id("llama_index_loaders_web")
|
41
40
|
loaders_list = []
|
42
41
|
for loader in loaders:
|
43
|
-
|
44
|
-
|
42
|
+
k = list(loader.keys())[0]
|
43
|
+
key = k.replace("web_", "")
|
44
|
+
value = loader[k]
|
45
|
+
loaders_list.append({
|
46
|
+
key: value,
|
47
|
+
})
|
45
48
|
|
46
49
|
self.window.ui.nodes["tool.indexer.web.loader"] = OptionCombo(
|
47
50
|
self.window,
|
@@ -55,14 +58,14 @@ class WebTab:
|
|
55
58
|
)
|
56
59
|
|
57
60
|
self.window.ui.nodes["tool.indexer.web.loader"].layout.setContentsMargins(0, 0, 0, 0)
|
58
|
-
self.window.ui.nodes["tool.indexer.web.loader.label"] =
|
61
|
+
self.window.ui.nodes["tool.indexer.web.loader.label"] = HelpLabel(trans("tool.indexer.tab.web.loader"))
|
59
62
|
self.window.ui.add_hook("update.tool.indexer.web.loader", self.hook_loader_change)
|
60
63
|
|
61
64
|
self.window.ui.nodes["tool.indexer.web.options.label"] = HelpLabel(trans("tool.indexer.tab.web.source"))
|
62
65
|
self.window.ui.nodes["tool.indexer.web.config.label"] = HelpLabel(trans("tool.indexer.tab.web.cfg"))
|
63
66
|
self.window.ui.nodes["tool.indexer.web.config.help"] = UrlLabel(
|
64
67
|
trans("tool.indexer.tab.web.help"),
|
65
|
-
"https://pygpt.readthedocs.io/en/latest/
|
68
|
+
"https://pygpt.readthedocs.io/en/latest/configuration.html#data-loaders")
|
66
69
|
|
67
70
|
# --------------------------------------------------
|
68
71
|
|
@@ -78,7 +81,7 @@ class WebTab:
|
|
78
81
|
|
79
82
|
# params
|
80
83
|
params_layout.addWidget(self.window.ui.nodes["tool.indexer.web.options.label"])
|
81
|
-
inputs, groups = self.setup_loader_options()
|
84
|
+
inputs, groups = self.window.core.idx.ui.loaders.setup_loader_options()
|
82
85
|
for loader in inputs:
|
83
86
|
for k in inputs[loader]:
|
84
87
|
self.window.ui.nodes["tool.indexer.web.loader.option." + loader + "." + k] = inputs[loader][k]
|
@@ -87,9 +90,13 @@ class WebTab:
|
|
87
90
|
params_layout.addWidget(self.window.ui.nodes["tool.indexer.web.loader.option_group"][loader])
|
88
91
|
self.window.ui.nodes["tool.indexer.web.loader.option_group"][loader].hide() # hide on start
|
89
92
|
|
93
|
+
# separator
|
94
|
+
params_layout.addWidget(QHLine())
|
95
|
+
|
90
96
|
# config
|
91
97
|
params_layout.addWidget(self.window.ui.nodes["tool.indexer.web.config.label"])
|
92
|
-
|
98
|
+
self.window.ui.nodes["tool.indexer.web.config.label"].setAlignment(Qt.AlignCenter)
|
99
|
+
inputs, groups = self.window.core.idx.ui.loaders.setup_loader_config()
|
93
100
|
for loader in inputs:
|
94
101
|
for k in inputs[loader]:
|
95
102
|
self.window.ui.nodes["tool.indexer.web.loader.config." + loader + "." + k] = inputs[loader][k]
|
@@ -99,6 +106,7 @@ class WebTab:
|
|
99
106
|
self.window.ui.nodes["tool.indexer.web.loader.config_group"][loader].hide() # hide on start
|
100
107
|
params_layout.addWidget(self.window.ui.nodes["tool.indexer.web.config.help"], alignment=Qt.AlignCenter)
|
101
108
|
|
109
|
+
# stretch
|
102
110
|
params_layout.addStretch(1)
|
103
111
|
|
104
112
|
self.params_widget = QWidget()
|
@@ -117,9 +125,10 @@ class WebTab:
|
|
117
125
|
|
118
126
|
self.window.ui.nodes["tool.indexer.provider"] = HelpLabel(self.window.core.config.get("llama.idx.storage"))
|
119
127
|
|
120
|
-
loader_layout =
|
128
|
+
loader_layout = QVBoxLayout()
|
121
129
|
loader_layout.addWidget(self.window.ui.nodes["tool.indexer.web.loader.label"])
|
122
130
|
loader_layout.addWidget(self.window.ui.nodes["tool.indexer.web.loader"])
|
131
|
+
loader_layout.setContentsMargins(0, 10, 0, 0)
|
123
132
|
|
124
133
|
options_layout = QVBoxLayout()
|
125
134
|
options_layout.addWidget(self.window.ui.nodes["tool.indexer.web.options.replace"])
|
@@ -177,70 +186,3 @@ class WebTab:
|
|
177
186
|
|
178
187
|
self.params_widget.adjustSize()
|
179
188
|
self.params_scroll.update()
|
180
|
-
|
181
|
-
def setup_loader_options(self):
|
182
|
-
"""
|
183
|
-
Setup loader options
|
184
|
-
"""
|
185
|
-
inputs = {}
|
186
|
-
groups = {}
|
187
|
-
loaders = self.window.core.idx.indexing.get_external_instructions()
|
188
|
-
for loader in loaders:
|
189
|
-
params = loaders[loader]
|
190
|
-
inputs[loader] = {}
|
191
|
-
group = QVBoxLayout()
|
192
|
-
for k in params["args"]:
|
193
|
-
widget = OptionInput(self.window, "tool.indexer", f"web.loader.{loader}.option.{k}", {
|
194
|
-
"label": k,
|
195
|
-
"value": "",
|
196
|
-
})
|
197
|
-
widget.setPlaceholderText(params["args"][k]["type"])
|
198
|
-
inputs[loader][k] = widget
|
199
|
-
row = QHBoxLayout() # cols
|
200
|
-
row.addWidget(QLabel(k))
|
201
|
-
row.addWidget(widget)
|
202
|
-
group.addLayout(row)
|
203
|
-
group_widget = QWidget()
|
204
|
-
group_widget.setLayout(group)
|
205
|
-
groups[loader] = group_widget
|
206
|
-
|
207
|
-
return inputs, groups
|
208
|
-
|
209
|
-
def setup_loader_config(self):
|
210
|
-
"""
|
211
|
-
Setup loader config
|
212
|
-
"""
|
213
|
-
inputs = {}
|
214
|
-
groups = {}
|
215
|
-
loaders = self.window.core.idx.indexing.get_external_config()
|
216
|
-
for loader in loaders:
|
217
|
-
params = loaders[loader]
|
218
|
-
inputs[loader] = {}
|
219
|
-
group = QVBoxLayout()
|
220
|
-
for k in params:
|
221
|
-
widget = OptionInput(self.window, "tool.indexer", f"web.loader.{loader}.config.{k}", {
|
222
|
-
"label": k,
|
223
|
-
"value": params[k]["value"],
|
224
|
-
})
|
225
|
-
try:
|
226
|
-
if params[k]["value"] is not None:
|
227
|
-
if params[k]["type"] == "list" and isinstance(params[k]["value"], list):
|
228
|
-
widget.setText(", ".join(params[k]["value"]))
|
229
|
-
elif params[k]["type"] == "dict" and isinstance(params[k]["value"], dict):
|
230
|
-
widget.setText(json.dumps(params[k]["value"]))
|
231
|
-
else:
|
232
|
-
widget.setText(str(params[k]["value"]))
|
233
|
-
except Exception as e:
|
234
|
-
self.window.core.debug.log(e)
|
235
|
-
|
236
|
-
widget.setPlaceholderText(params[k]["type"])
|
237
|
-
inputs[loader][k] = widget
|
238
|
-
row = QHBoxLayout() # cols
|
239
|
-
row.addWidget(QLabel(k))
|
240
|
-
row.addWidget(widget)
|
241
|
-
group.addLayout(row)
|
242
|
-
group_widget = QWidget()
|
243
|
-
group_widget.setLayout(group)
|
244
|
-
groups[loader] = group_widget
|
245
|
-
|
246
|
-
return inputs, groups
|
@@ -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.14 22:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import datetime
|
13
13
|
import os.path
|
14
14
|
import shutil
|
15
|
+
from typing import Dict
|
15
16
|
|
16
17
|
from PySide6.QtGui import QAction, QIcon
|
17
18
|
|
@@ -165,7 +166,7 @@ class MediaPlayer(BaseTool):
|
|
165
166
|
else:
|
166
167
|
self.close()
|
167
168
|
|
168
|
-
def setup_menu(self) ->
|
169
|
+
def setup_menu(self) -> Dict[str, QAction]:
|
169
170
|
"""
|
170
171
|
Setup main menu
|
171
172
|
|
@@ -188,7 +189,7 @@ class MediaPlayer(BaseTool):
|
|
188
189
|
self.dialog = VideoPlayer(self.window)
|
189
190
|
self.dialog.setup()
|
190
191
|
|
191
|
-
def get_lang_mappings(self) ->
|
192
|
+
def get_lang_mappings(self) -> Dict[str, Dict]:
|
192
193
|
"""
|
193
194
|
Get language mappings
|
194
195
|
|
@@ -6,17 +6,19 @@
|
|
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.14 22:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import hashlib
|
13
13
|
import os
|
14
|
+
from typing import Dict, Optional
|
14
15
|
|
15
16
|
from PySide6.QtGui import QAction, QIcon
|
16
17
|
from PySide6.QtWidgets import QFileDialog
|
17
18
|
|
18
19
|
from pygpt_net.tools.base import BaseTool
|
19
20
|
from pygpt_net.tools.text_editor.ui.dialogs import DialogSpawner
|
21
|
+
from pygpt_net.ui.widget.dialog.base import BaseDialog
|
20
22
|
from pygpt_net.utils import trans
|
21
23
|
|
22
24
|
|
@@ -47,7 +49,13 @@ class TextEditor(BaseTool):
|
|
47
49
|
"""
|
48
50
|
return 'file_editor_' + hashlib.md5(file.encode('utf-8')).hexdigest()
|
49
51
|
|
50
|
-
def open_file(
|
52
|
+
def open_file(
|
53
|
+
self,
|
54
|
+
id: str,
|
55
|
+
auto_close: bool = True,
|
56
|
+
force: bool = False,
|
57
|
+
save: bool = False
|
58
|
+
):
|
51
59
|
"""
|
52
60
|
Open text file dialog
|
53
61
|
|
@@ -73,7 +81,12 @@ class TextEditor(BaseTool):
|
|
73
81
|
if path:
|
74
82
|
self.open(path, id, auto_close)
|
75
83
|
|
76
|
-
def clear(
|
84
|
+
def clear(
|
85
|
+
self,
|
86
|
+
id: str = None,
|
87
|
+
force: bool = False,
|
88
|
+
save: bool = False
|
89
|
+
):
|
77
90
|
"""
|
78
91
|
Clear current instance
|
79
92
|
|
@@ -101,8 +114,8 @@ class TextEditor(BaseTool):
|
|
101
114
|
|
102
115
|
def open(
|
103
116
|
self,
|
104
|
-
file: str = None,
|
105
|
-
current_id: str = None,
|
117
|
+
file: Optional[str] = None,
|
118
|
+
current_id: Optional[str] = None,
|
106
119
|
auto_close: bool = True,
|
107
120
|
force: bool = False):
|
108
121
|
"""
|
@@ -153,7 +166,11 @@ class TextEditor(BaseTool):
|
|
153
166
|
else:
|
154
167
|
self.window.core.filesystem.editor.clear(id) # clear editor if no file
|
155
168
|
|
156
|
-
def close(
|
169
|
+
def close(
|
170
|
+
self,
|
171
|
+
id: str,
|
172
|
+
save: bool = False
|
173
|
+
):
|
157
174
|
"""
|
158
175
|
Close file editor
|
159
176
|
|
@@ -180,7 +197,12 @@ class TextEditor(BaseTool):
|
|
180
197
|
id = self.save_as_file(id)
|
181
198
|
return id
|
182
199
|
|
183
|
-
def restore(
|
200
|
+
def restore(
|
201
|
+
self,
|
202
|
+
id: str,
|
203
|
+
force: bool = False,
|
204
|
+
save: bool = False
|
205
|
+
):
|
184
206
|
"""
|
185
207
|
Restore file content
|
186
208
|
|
@@ -225,7 +247,7 @@ class TextEditor(BaseTool):
|
|
225
247
|
self.window.core.filesystem.editor.save(id, path)
|
226
248
|
return id
|
227
249
|
|
228
|
-
def setup_menu(self) ->
|
250
|
+
def setup_menu(self) -> Dict[str, QAction]:
|
229
251
|
"""
|
230
252
|
Setup main menu
|
231
253
|
|
@@ -243,7 +265,11 @@ class TextEditor(BaseTool):
|
|
243
265
|
)
|
244
266
|
return actions
|
245
267
|
|
246
|
-
def get_instance(
|
268
|
+
def get_instance(
|
269
|
+
self,
|
270
|
+
type_id: str,
|
271
|
+
dialog_id: Optional[str] = None
|
272
|
+
) -> Optional[BaseDialog]:
|
247
273
|
"""
|
248
274
|
Spawn and return dialog instance
|
249
275
|
|
@@ -254,7 +280,7 @@ class TextEditor(BaseTool):
|
|
254
280
|
if type_id == "text_editor":
|
255
281
|
return self.spawner.setup(dialog_id)
|
256
282
|
|
257
|
-
def get_lang_mappings(self) ->
|
283
|
+
def get_lang_mappings(self) -> Dict[str, Dict]:
|
258
284
|
"""
|
259
285
|
Get language mappings
|
260
286
|
|
@@ -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.14 19:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
from PySide6.QtCore import Qt
|
@@ -192,7 +192,7 @@ class Output:
|
|
192
192
|
right_layout.addWidget(self.window.ui.nodes['prompt.context'])
|
193
193
|
right_layout.addWidget(QLabel(" "))
|
194
194
|
right_layout.addWidget(self.window.ui.nodes['input.counter'])
|
195
|
-
right_layout.setContentsMargins(0,
|
195
|
+
right_layout.setContentsMargins(0, 8, 20, 0)
|
196
196
|
|
197
197
|
left_widget = QWidget()
|
198
198
|
left_widget.setLayout(left_layout)
|