pygpt-net 2.4.37__py3-none-any.whl → 2.4.42__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 +37 -0
- README.md +176 -182
- pygpt_net/CHANGELOG.txt +37 -0
- pygpt_net/__init__.py +3 -3
- pygpt_net/app.py +3 -1
- pygpt_net/controller/__init__.py +7 -3
- pygpt_net/controller/access/control.py +1 -1
- pygpt_net/controller/access/voice.py +11 -5
- pygpt_net/controller/agent/experts.py +11 -6
- pygpt_net/controller/agent/legacy.py +8 -6
- pygpt_net/controller/agent/llama.py +4 -2
- pygpt_net/controller/assistant/__init__.py +9 -4
- pygpt_net/controller/assistant/batch.py +38 -21
- pygpt_net/controller/assistant/editor.py +7 -6
- pygpt_net/controller/assistant/files.py +23 -7
- pygpt_net/controller/assistant/store.py +20 -7
- pygpt_net/controller/assistant/threads.py +34 -8
- pygpt_net/controller/attachment.py +29 -10
- pygpt_net/controller/audio/__init__.py +26 -5
- pygpt_net/controller/calendar/__init__.py +23 -4
- pygpt_net/controller/calendar/note.py +57 -11
- pygpt_net/controller/camera.py +4 -12
- pygpt_net/controller/chat/__init__.py +5 -3
- pygpt_net/controller/chat/attachment.py +34 -7
- pygpt_net/controller/chat/audio.py +2 -2
- pygpt_net/controller/chat/command.py +4 -2
- pygpt_net/controller/chat/common.py +11 -4
- pygpt_net/controller/chat/files.py +10 -3
- pygpt_net/controller/chat/image.py +17 -5
- pygpt_net/controller/chat/input.py +10 -7
- pygpt_net/controller/chat/output.py +21 -6
- pygpt_net/controller/chat/render.py +100 -21
- pygpt_net/controller/chat/response.py +34 -7
- pygpt_net/controller/chat/stream.py +4 -2
- pygpt_net/controller/chat/text.py +6 -4
- pygpt_net/controller/command.py +11 -3
- pygpt_net/controller/config/__init__.py +34 -6
- pygpt_net/controller/config/field/checkbox.py +7 -4
- pygpt_net/controller/config/field/cmd.py +7 -5
- pygpt_net/controller/config/field/combo.py +14 -6
- pygpt_net/controller/config/field/dictionary.py +14 -11
- pygpt_net/controller/config/field/input.py +9 -6
- pygpt_net/controller/config/field/slider.py +11 -8
- pygpt_net/controller/config/field/textarea.py +8 -5
- pygpt_net/controller/config/placeholder.py +66 -21
- pygpt_net/controller/ctx/__init__.py +138 -49
- pygpt_net/controller/ctx/common.py +15 -4
- pygpt_net/controller/ctx/extra.py +11 -3
- pygpt_net/controller/ctx/summarizer.py +24 -5
- pygpt_net/controller/debug/__init__.py +27 -6
- pygpt_net/controller/dialogs/confirm.py +34 -7
- pygpt_net/controller/dialogs/debug.py +4 -2
- pygpt_net/controller/dialogs/info.py +7 -2
- pygpt_net/controller/files.py +48 -10
- pygpt_net/controller/finder.py +11 -5
- pygpt_net/controller/idx/__init__.py +10 -3
- pygpt_net/controller/idx/common.py +4 -2
- pygpt_net/controller/idx/indexer.py +25 -17
- pygpt_net/controller/idx/settings.py +9 -3
- pygpt_net/controller/kernel/__init__.py +34 -8
- pygpt_net/controller/kernel/reply.py +12 -3
- pygpt_net/controller/kernel/stack.py +5 -3
- pygpt_net/controller/lang/custom.py +2 -7
- pygpt_net/controller/lang/mapping.py +5 -3
- pygpt_net/controller/layout.py +2 -2
- pygpt_net/controller/mode.py +16 -4
- pygpt_net/controller/model/__init__.py +14 -3
- pygpt_net/controller/model/editor.py +8 -3
- pygpt_net/controller/notepad.py +26 -12
- pygpt_net/controller/painter/capture.py +23 -4
- pygpt_net/controller/painter/common.py +9 -7
- pygpt_net/controller/plugins/__init__.py +19 -5
- pygpt_net/controller/plugins/presets.py +15 -6
- pygpt_net/controller/plugins/settings.py +9 -3
- pygpt_net/controller/presets/__init__.py +55 -16
- pygpt_net/controller/presets/editor.py +26 -10
- pygpt_net/controller/settings/__init__.py +3 -2
- pygpt_net/controller/settings/editor.py +29 -7
- pygpt_net/controller/settings/profile.py +22 -5
- pygpt_net/controller/theme/__init__.py +54 -12
- pygpt_net/controller/theme/common.py +24 -2
- pygpt_net/controller/theme/markdown.py +32 -16
- pygpt_net/controller/theme/menu.py +26 -5
- pygpt_net/controller/theme/nodes.py +2 -5
- pygpt_net/controller/tools/__init__.py +40 -2
- pygpt_net/controller/ui/__init__.py +4 -6
- pygpt_net/controller/ui/mode.py +16 -21
- pygpt_net/controller/ui/tabs.py +363 -65
- pygpt_net/core/access/actions.py +6 -4
- pygpt_net/core/access/shortcuts.py +4 -3
- pygpt_net/core/access/voice.py +6 -5
- pygpt_net/core/agents/legacy.py +4 -2
- pygpt_net/core/agents/memory.py +7 -2
- pygpt_net/core/agents/observer/evaluation.py +15 -7
- pygpt_net/core/agents/provider.py +9 -4
- pygpt_net/core/agents/runner.py +61 -15
- pygpt_net/core/agents/tools.py +23 -5
- pygpt_net/core/assistants/__init__.py +6 -4
- pygpt_net/core/assistants/files.py +35 -12
- pygpt_net/core/assistants/store.py +20 -10
- pygpt_net/core/attachments/__init__.py +54 -15
- pygpt_net/core/attachments/context.py +92 -29
- pygpt_net/core/audio/__init__.py +74 -3
- pygpt_net/core/audio/context.py +7 -2
- pygpt_net/core/audio/whisper.py +37 -0
- pygpt_net/core/bridge/__init__.py +22 -6
- pygpt_net/core/bridge/context.py +5 -3
- pygpt_net/core/bridge/worker.py +2 -2
- pygpt_net/core/calendar/__init__.py +57 -11
- pygpt_net/core/chain/__init__.py +8 -2
- pygpt_net/core/chain/chat.py +10 -8
- pygpt_net/core/chain/completion.py +10 -7
- pygpt_net/core/command.py +62 -17
- pygpt_net/core/ctx/__init__.py +260 -58
- pygpt_net/core/ctx/bag.py +25 -4
- pygpt_net/core/ctx/container.py +28 -17
- pygpt_net/core/ctx/idx.py +45 -8
- pygpt_net/core/ctx/output.py +95 -74
- pygpt_net/core/ctx/reply.py +5 -2
- pygpt_net/core/db/__init__.py +8 -7
- pygpt_net/core/db/viewer.py +17 -11
- pygpt_net/core/debug/__init__.py +10 -9
- pygpt_net/core/debug/events.py +22 -10
- pygpt_net/core/debug/tabs.py +9 -3
- pygpt_net/core/docker/__init__.py +11 -5
- pygpt_net/core/docker/builder.py +11 -3
- pygpt_net/core/events/app.py +5 -3
- pygpt_net/core/events/base.py +11 -5
- pygpt_net/core/events/control.py +5 -3
- pygpt_net/core/events/event.py +17 -7
- pygpt_net/core/events/kernel.py +5 -3
- pygpt_net/core/events/render.py +5 -3
- pygpt_net/core/experts/__init__.py +5 -4
- pygpt_net/core/filesystem/__init__.py +52 -34
- pygpt_net/core/filesystem/actions.py +8 -5
- pygpt_net/core/filesystem/editor.py +13 -3
- pygpt_net/core/filesystem/types.py +12 -7
- pygpt_net/core/filesystem/url.py +7 -3
- pygpt_net/core/history.py +3 -2
- pygpt_net/core/idx/__init__.py +48 -27
- pygpt_net/core/idx/chat.py +51 -17
- pygpt_net/core/idx/context.py +6 -2
- pygpt_net/core/idx/indexing.py +107 -42
- pygpt_net/core/idx/llm.py +11 -3
- pygpt_net/core/idx/metadata.py +13 -3
- pygpt_net/core/idx/types/ctx.py +32 -6
- pygpt_net/core/idx/types/external.py +41 -7
- pygpt_net/core/idx/types/files.py +31 -6
- pygpt_net/core/image.py +15 -4
- pygpt_net/core/installer.py +2 -4
- pygpt_net/core/llm/__init__.py +13 -3
- pygpt_net/core/locale.py +34 -8
- pygpt_net/core/models.py +63 -17
- pygpt_net/core/modes.py +11 -13
- pygpt_net/core/notepad.py +10 -5
- pygpt_net/core/plugins.py +31 -19
- pygpt_net/core/presets.py +37 -17
- pygpt_net/core/profile.py +21 -7
- pygpt_net/core/prompt/__init__.py +10 -3
- pygpt_net/core/prompt/custom.py +7 -6
- pygpt_net/core/prompt/template.py +9 -3
- pygpt_net/core/render/base.py +117 -22
- pygpt_net/core/render/markdown/body.py +27 -7
- pygpt_net/core/render/markdown/renderer.py +119 -22
- pygpt_net/core/render/plain/body.py +22 -5
- pygpt_net/core/render/plain/renderer.py +97 -21
- pygpt_net/core/render/web/body.py +75 -25
- pygpt_net/core/render/web/parser.py +3 -1
- pygpt_net/core/render/web/renderer.py +313 -63
- pygpt_net/core/settings.py +10 -5
- pygpt_net/core/tabs/__init__.py +290 -103
- pygpt_net/core/tabs/tab.py +26 -5
- pygpt_net/core/tokens.py +47 -12
- pygpt_net/core/updater/__init__.py +20 -7
- pygpt_net/core/vision/analyzer.py +29 -6
- pygpt_net/core/{web.py → web/__init__.py} +29 -7
- pygpt_net/core/web/helpers.py +237 -0
- pygpt_net/data/config/config.json +15 -4
- pygpt_net/data/config/models.json +3 -3
- pygpt_net/data/config/modes.json +3 -3
- pygpt_net/data/config/settings.json +55 -10
- pygpt_net/data/config/settings_section.json +3 -0
- pygpt_net/data/css/style.light.css +1 -0
- pygpt_net/data/css/{web.css → web-blocks.css} +162 -133
- pygpt_net/data/css/{web.light.css → web-blocks.light.css} +7 -0
- pygpt_net/data/css/web-chatgpt.css +350 -0
- pygpt_net/data/css/web-chatgpt.dark.css +64 -0
- pygpt_net/data/css/web-chatgpt.light.css +75 -0
- pygpt_net/data/css/web-chatgpt_wide.css +350 -0
- pygpt_net/data/css/web-chatgpt_wide.dark.css +64 -0
- pygpt_net/data/css/web-chatgpt_wide.light.css +75 -0
- pygpt_net/data/icons/split_screen.svg +1 -0
- pygpt_net/data/locale/locale.de.ini +12 -0
- pygpt_net/data/locale/locale.en.ini +18 -2
- pygpt_net/data/locale/locale.es.ini +12 -0
- pygpt_net/data/locale/locale.fr.ini +12 -0
- pygpt_net/data/locale/locale.it.ini +12 -0
- pygpt_net/data/locale/locale.pl.ini +12 -0
- pygpt_net/data/locale/locale.uk.ini +12 -0
- pygpt_net/data/locale/locale.zh.ini +12 -0
- pygpt_net/data/locale/plugin.cmd_web.de.ini +2 -0
- pygpt_net/data/locale/plugin.cmd_web.en.ini +22 -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/data/locale/plugin.mailer.en.ini +21 -0
- pygpt_net/icons.qrc +1 -0
- pygpt_net/icons_rc.py +165 -136
- pygpt_net/item/ctx.py +58 -25
- pygpt_net/plugin/agent/__init__.py +7 -2
- pygpt_net/plugin/audio_input/simple.py +21 -5
- pygpt_net/plugin/audio_output/__init__.py +9 -1
- pygpt_net/plugin/base/config.py +4 -2
- pygpt_net/plugin/base/plugin.py +75 -23
- pygpt_net/plugin/base/worker.py +42 -11
- pygpt_net/plugin/cmd_code_interpreter/__init__.py +39 -37
- pygpt_net/plugin/cmd_code_interpreter/runner.py +25 -12
- pygpt_net/plugin/cmd_history/config.py +2 -2
- pygpt_net/plugin/cmd_web/__init__.py +48 -9
- pygpt_net/plugin/cmd_web/config.py +135 -41
- pygpt_net/plugin/cmd_web/websearch.py +74 -33
- pygpt_net/plugin/cmd_web/worker.py +142 -13
- 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 +4 -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 +43 -1
- pygpt_net/provider/core/ctx/base.py +30 -25
- pygpt_net/provider/core/ctx/db_sqlite/__init__.py +59 -34
- pygpt_net/provider/core/ctx/db_sqlite/storage.py +62 -30
- pygpt_net/provider/core/ctx/db_sqlite/utils.py +11 -9
- 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 +21 -11
- pygpt_net/provider/gpt/audio.py +6 -5
- pygpt_net/provider/gpt/chat.py +10 -7
- pygpt_net/provider/gpt/completion.py +11 -5
- pygpt_net/provider/gpt/image.py +9 -2
- pygpt_net/provider/gpt/store.py +53 -18
- pygpt_net/provider/gpt/vision.py +17 -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/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 +31 -12
- 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 +20 -4
- pygpt_net/tools/audio_transcriber/__init__.py +4 -3
- pygpt_net/tools/base.py +28 -7
- pygpt_net/tools/code_interpreter/__init__.py +177 -77
- 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 +81 -25
- pygpt_net/tools/html_canvas/ui/dialogs.py +46 -62
- pygpt_net/tools/html_canvas/ui/widgets.py +96 -3
- pygpt_net/tools/image_viewer/__init__.py +10 -4
- pygpt_net/tools/indexer/__init__.py +8 -7
- pygpt_net/tools/media_player/__init__.py +4 -3
- pygpt_net/tools/text_editor/__init__.py +36 -10
- pygpt_net/ui/base/context_menu.py +2 -2
- pygpt_net/ui/layout/chat/input.py +10 -18
- pygpt_net/ui/layout/chat/output.py +27 -45
- pygpt_net/ui/layout/ctx/ctx_list.py +13 -4
- pygpt_net/ui/layout/toolbox/footer.py +18 -2
- pygpt_net/ui/main.py +2 -2
- pygpt_net/ui/menu/audio.py +12 -1
- pygpt_net/ui/menu/config.py +7 -11
- pygpt_net/ui/menu/debug.py +11 -1
- pygpt_net/ui/menu/theme.py +9 -2
- pygpt_net/ui/widget/filesystem/explorer.py +2 -2
- pygpt_net/ui/widget/lists/context.py +27 -5
- pygpt_net/ui/widget/tabs/Input.py +2 -2
- pygpt_net/ui/widget/tabs/body.py +2 -1
- pygpt_net/ui/widget/tabs/layout.py +195 -0
- pygpt_net/ui/widget/tabs/output.py +218 -55
- pygpt_net/ui/widget/textarea/html.py +11 -1
- pygpt_net/ui/widget/textarea/output.py +10 -1
- pygpt_net/ui/widget/textarea/search_input.py +4 -1
- pygpt_net/ui/widget/textarea/web.py +49 -9
- {pygpt_net-2.4.37.dist-info → pygpt_net-2.4.42.dist-info}/METADATA +177 -183
- {pygpt_net-2.4.37.dist-info → pygpt_net-2.4.42.dist-info}/RECORD +340 -325
- /pygpt_net/data/css/{web.dark.css → web-blocks.dark.css} +0 -0
- {pygpt_net-2.4.37.dist-info → pygpt_net-2.4.42.dist-info}/LICENSE +0 -0
- {pygpt_net-2.4.37.dist-info → pygpt_net-2.4.42.dist-info}/WHEEL +0 -0
- {pygpt_net-2.4.37.dist-info → pygpt_net-2.4.42.dist-info}/entry_points.txt +0 -0
@@ -6,9 +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.14 08:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
|
+
from typing import List, Dict, Any
|
13
|
+
|
12
14
|
from PySide6.QtGui import QAction
|
13
15
|
|
14
16
|
from pygpt_net.core.types import (
|
@@ -368,7 +370,11 @@ class Plugins:
|
|
368
370
|
self.window.ui.nodes['chat.plugins'].setText(count_str)
|
369
371
|
self.window.ui.nodes['chat.plugins'].setToolTip(tooltip)
|
370
372
|
|
371
|
-
def apply_cmds_all(
|
373
|
+
def apply_cmds_all(
|
374
|
+
self,
|
375
|
+
ctx: CtxItem,
|
376
|
+
cmds: List[Dict[str, Any]]
|
377
|
+
):
|
372
378
|
"""
|
373
379
|
Apply all commands (inline or not)
|
374
380
|
|
@@ -381,7 +387,11 @@ class Plugins:
|
|
381
387
|
else:
|
382
388
|
return self.apply_cmds_inline(ctx, cmds)
|
383
389
|
|
384
|
-
def apply_cmds(
|
390
|
+
def apply_cmds(
|
391
|
+
self,
|
392
|
+
ctx: CtxItem,
|
393
|
+
cmds: List[Dict[str, Any]]
|
394
|
+
):
|
385
395
|
"""
|
386
396
|
Apply commands
|
387
397
|
|
@@ -418,7 +428,11 @@ class Plugins:
|
|
418
428
|
|
419
429
|
return ctx.results
|
420
430
|
|
421
|
-
def apply_cmds_inline(
|
431
|
+
def apply_cmds_inline(
|
432
|
+
self,
|
433
|
+
ctx: CtxItem,
|
434
|
+
cmds: List[Dict[str, Any]]
|
435
|
+
):
|
422
436
|
"""
|
423
437
|
Apply inline commands
|
424
438
|
|
@@ -462,7 +476,7 @@ class Plugins:
|
|
462
476
|
self.settings.setup()
|
463
477
|
self.update()
|
464
478
|
|
465
|
-
def log(self, data:
|
479
|
+
def log(self, data: Any):
|
466
480
|
"""
|
467
481
|
Log data to debug
|
468
482
|
|
@@ -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.14 08:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import copy
|
13
|
+
from typing import Dict
|
13
14
|
from uuid import uuid4
|
14
15
|
|
15
16
|
from PySide6.QtGui import QAction
|
@@ -156,7 +157,7 @@ class Presets:
|
|
156
157
|
self.update_list()
|
157
158
|
self.update_menu()
|
158
159
|
|
159
|
-
def store(self, presets:
|
160
|
+
def store(self, presets: Dict[str, Dict]):
|
160
161
|
"""
|
161
162
|
Store presets
|
162
163
|
|
@@ -185,7 +186,11 @@ class Presets:
|
|
185
186
|
self.toggle(id)
|
186
187
|
self.update_menu()
|
187
188
|
|
188
|
-
def delete_by_idx(
|
189
|
+
def delete_by_idx(
|
190
|
+
self,
|
191
|
+
idx: int,
|
192
|
+
force: bool = False
|
193
|
+
):
|
189
194
|
"""
|
190
195
|
Delete preset by index
|
191
196
|
|
@@ -241,7 +246,11 @@ class Presets:
|
|
241
246
|
self.toggle(id)
|
242
247
|
self.window.update_status("Preset cleared: " + presets[id]['name'])
|
243
248
|
|
244
|
-
def reset_by_idx(
|
249
|
+
def reset_by_idx(
|
250
|
+
self,
|
251
|
+
idx: int,
|
252
|
+
force: bool = False
|
253
|
+
):
|
245
254
|
"""
|
246
255
|
Reset preset by index
|
247
256
|
|
@@ -258,7 +267,7 @@ class Presets:
|
|
258
267
|
id = self.get_id_by_idx(idx)
|
259
268
|
self.reset(id)
|
260
269
|
|
261
|
-
def get_preset(self, id: str) ->
|
270
|
+
def get_preset(self, id: str) -> Dict:
|
262
271
|
"""
|
263
272
|
Get preset by id
|
264
273
|
|
@@ -269,7 +278,7 @@ class Presets:
|
|
269
278
|
if id in presets:
|
270
279
|
return presets[id]
|
271
280
|
|
272
|
-
def get_presets(self) ->
|
281
|
+
def get_presets(self) -> Dict[str, Dict]:
|
273
282
|
"""
|
274
283
|
Get presets dict
|
275
284
|
|
@@ -6,9 +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.14 00:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
|
+
from typing import Any
|
13
|
+
|
12
14
|
from pygpt_net.core.events import Event
|
13
15
|
from pygpt_net.utils import trans
|
14
16
|
|
@@ -49,7 +51,11 @@ class Settings:
|
|
49
51
|
self.config_initialized = True
|
50
52
|
if not self.config_dialog:
|
51
53
|
self.init()
|
52
|
-
self.window.ui.dialogs.open(
|
54
|
+
self.window.ui.dialogs.open(
|
55
|
+
'plugin_settings',
|
56
|
+
width=self.width,
|
57
|
+
height=self.height
|
58
|
+
)
|
53
59
|
self.config_dialog = True
|
54
60
|
|
55
61
|
def open_plugin(self, id: str):
|
@@ -161,7 +167,7 @@ class Settings:
|
|
161
167
|
self.init()
|
162
168
|
self.window.ui.dialogs.alert(trans('dialog.plugin.settings.defaults.app.result'))
|
163
169
|
|
164
|
-
def get_option(self, id: str, key: str) ->
|
170
|
+
def get_option(self, id: str, key: str) -> Any:
|
165
171
|
"""
|
166
172
|
Get plugin option
|
167
173
|
|
@@ -6,12 +6,14 @@
|
|
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 08:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import re
|
13
|
+
from typing import Optional, List, Dict
|
13
14
|
|
14
15
|
from PySide6.QtGui import QTextCursor
|
16
|
+
from PySide6.QtWidgets import QTextEdit
|
15
17
|
|
16
18
|
from pygpt_net.core.types import (
|
17
19
|
MODE_AGENT,
|
@@ -57,7 +59,7 @@ class Presets:
|
|
57
59
|
self.window.controller.model.select_current()
|
58
60
|
self.window.dispatch(AppEvent(AppEvent.PRESET_SELECTED)) # app event
|
59
61
|
|
60
|
-
def get_current(self) -> PresetItem
|
62
|
+
def get_current(self) -> Optional[PresetItem]:
|
61
63
|
"""
|
62
64
|
Get current preset
|
63
65
|
|
@@ -92,7 +94,11 @@ class Presets:
|
|
92
94
|
self.window.ui.nodes['preset.prompt'].toPlainText()
|
93
95
|
)
|
94
96
|
|
95
|
-
def paste_prompt(
|
97
|
+
def paste_prompt(
|
98
|
+
self,
|
99
|
+
idx: int,
|
100
|
+
parent: str = "global"
|
101
|
+
):
|
96
102
|
"""
|
97
103
|
Paste prompt from template
|
98
104
|
|
@@ -109,7 +115,11 @@ class Presets:
|
|
109
115
|
elif parent == "editor":
|
110
116
|
self.paste_to_textarea(self.window.ui.config["preset"]["prompt"], template['prompt'])
|
111
117
|
|
112
|
-
def paste_custom_prompt(
|
118
|
+
def paste_custom_prompt(
|
119
|
+
self,
|
120
|
+
idx: int,
|
121
|
+
parent: str = "global"
|
122
|
+
):
|
113
123
|
"""
|
114
124
|
Paste prompt from custom template
|
115
125
|
|
@@ -126,7 +136,11 @@ class Presets:
|
|
126
136
|
elif parent == "editor":
|
127
137
|
self.paste_to_textarea(self.window.ui.config["preset"]["prompt"], template.content)
|
128
138
|
|
129
|
-
def save_prompt(
|
139
|
+
def save_prompt(
|
140
|
+
self,
|
141
|
+
name: str = "",
|
142
|
+
force: bool = False
|
143
|
+
):
|
130
144
|
"""
|
131
145
|
Save prompt to file
|
132
146
|
|
@@ -147,7 +161,12 @@ class Presets:
|
|
147
161
|
self.window.core.prompt.custom.new(name, content)
|
148
162
|
self.window.update_status("Prompt saved")
|
149
163
|
|
150
|
-
def rename_prompt(
|
164
|
+
def rename_prompt(
|
165
|
+
self,
|
166
|
+
uuid: str,
|
167
|
+
name: str = "",
|
168
|
+
force: bool = False
|
169
|
+
):
|
151
170
|
"""
|
152
171
|
Rename prompt
|
153
172
|
|
@@ -169,7 +188,11 @@ class Presets:
|
|
169
188
|
self.window.core.prompt.custom.save()
|
170
189
|
self.window.update_status("Prompt renamed")
|
171
190
|
|
172
|
-
def delete_prompt(
|
191
|
+
def delete_prompt(
|
192
|
+
self,
|
193
|
+
uuid: str,
|
194
|
+
force: bool = False
|
195
|
+
):
|
173
196
|
"""
|
174
197
|
Delete prompt
|
175
198
|
|
@@ -189,7 +212,11 @@ class Presets:
|
|
189
212
|
self.window.core.prompt.custom.delete(uuid)
|
190
213
|
self.window.update_status("Prompt deleted")
|
191
214
|
|
192
|
-
def paste_to_textarea(
|
215
|
+
def paste_to_textarea(
|
216
|
+
self,
|
217
|
+
textarea: QTextEdit,
|
218
|
+
text: str
|
219
|
+
):
|
193
220
|
"""
|
194
221
|
Paste text to textarea
|
195
222
|
|
@@ -213,7 +240,11 @@ class Presets:
|
|
213
240
|
textarea.setTextCursor(cur)
|
214
241
|
textarea.setFocus()
|
215
242
|
|
216
|
-
def set(
|
243
|
+
def set(
|
244
|
+
self,
|
245
|
+
mode: str,
|
246
|
+
preset_id: str
|
247
|
+
):
|
217
248
|
"""
|
218
249
|
Set preset
|
219
250
|
|
@@ -227,7 +258,11 @@ class Presets:
|
|
227
258
|
self.window.core.config.data['current_preset'] = {}
|
228
259
|
self.window.core.config.data['current_preset'][mode] = preset_id
|
229
260
|
|
230
|
-
def set_by_idx(
|
261
|
+
def set_by_idx(
|
262
|
+
self,
|
263
|
+
mode: str,
|
264
|
+
idx: int
|
265
|
+
):
|
231
266
|
"""
|
232
267
|
Set preset by index
|
233
268
|
|
@@ -327,7 +362,7 @@ class Presets:
|
|
327
362
|
else:
|
328
363
|
self.window.core.config.set('prompt', None)
|
329
364
|
|
330
|
-
def get_current_functions(self) ->
|
365
|
+
def get_current_functions(self) -> Optional[List[Dict]]:
|
331
366
|
"""
|
332
367
|
Get current preset functions
|
333
368
|
|
@@ -404,7 +439,7 @@ class Presets:
|
|
404
439
|
filename = re.sub(r'[^a-zA-Z0-9_\-\.]', '_', filename)
|
405
440
|
return filename
|
406
441
|
|
407
|
-
def duplicate(self, idx: int = None):
|
442
|
+
def duplicate(self, idx: Optional[int] = None):
|
408
443
|
"""
|
409
444
|
Duplicate preset
|
410
445
|
|
@@ -422,7 +457,7 @@ class Presets:
|
|
422
457
|
self.editor.edit(idx)
|
423
458
|
self.window.update_status(trans('status.preset.duplicated'))
|
424
459
|
|
425
|
-
def enable(self, idx: int = None):
|
460
|
+
def enable(self, idx: Optional[int] = None):
|
426
461
|
"""
|
427
462
|
Enable preset
|
428
463
|
|
@@ -436,7 +471,7 @@ class Presets:
|
|
436
471
|
self.window.core.presets.enable(preset_id)
|
437
472
|
self.refresh()
|
438
473
|
|
439
|
-
def disable(self, idx: int = None):
|
474
|
+
def disable(self, idx: Optional[int] = None):
|
440
475
|
"""
|
441
476
|
Disable preset
|
442
477
|
|
@@ -486,7 +521,11 @@ class Presets:
|
|
486
521
|
if mode == MODE_ASSISTANT:
|
487
522
|
self.window.core.assistants.load()
|
488
523
|
|
489
|
-
def delete(
|
524
|
+
def delete(
|
525
|
+
self,
|
526
|
+
idx: Optional[int] = None,
|
527
|
+
force: bool = False
|
528
|
+
):
|
490
529
|
"""
|
491
530
|
Delete preset
|
492
531
|
|
@@ -533,7 +572,7 @@ class Presets:
|
|
533
572
|
self.window.core.presets.restore(mode)
|
534
573
|
self.refresh()
|
535
574
|
|
536
|
-
def is_current(self, idx: int = None) -> bool:
|
575
|
+
def is_current(self, idx: Optional[int] = None) -> bool:
|
537
576
|
"""
|
538
577
|
Check if preset is current
|
539
578
|
|
@@ -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.14 08:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import datetime
|
13
13
|
import os
|
14
|
+
from typing import Any, Optional, Dict
|
14
15
|
|
15
16
|
from pygpt_net.core.types import (
|
16
17
|
MODE_AGENT,
|
@@ -30,7 +31,6 @@ from pygpt_net.utils import trans
|
|
30
31
|
|
31
32
|
from .experts import Experts
|
32
33
|
|
33
|
-
|
34
34
|
class Editor:
|
35
35
|
def __init__(self, window=None):
|
36
36
|
"""
|
@@ -160,7 +160,7 @@ class Editor:
|
|
160
160
|
self.id = "preset"
|
161
161
|
self.current = None
|
162
162
|
|
163
|
-
def get_options(self) ->
|
163
|
+
def get_options(self) -> Dict[str, Dict[str, Any]]:
|
164
164
|
"""
|
165
165
|
Get preset options
|
166
166
|
|
@@ -168,7 +168,7 @@ class Editor:
|
|
168
168
|
"""
|
169
169
|
return self.options
|
170
170
|
|
171
|
-
def get_option(self, id: str) ->
|
171
|
+
def get_option(self, id: str) -> Dict[str, Any]:
|
172
172
|
"""
|
173
173
|
Get preset option
|
174
174
|
|
@@ -212,7 +212,14 @@ class Editor:
|
|
212
212
|
self.get_option(key),
|
213
213
|
)
|
214
214
|
|
215
|
-
def hook_update(
|
215
|
+
def hook_update(
|
216
|
+
self,
|
217
|
+
key: str,
|
218
|
+
value: Any,
|
219
|
+
caller,
|
220
|
+
*args,
|
221
|
+
**kwargs
|
222
|
+
):
|
216
223
|
"""
|
217
224
|
Hook: on settings update in real-time (prompt)
|
218
225
|
|
@@ -230,7 +237,7 @@ class Editor:
|
|
230
237
|
else:
|
231
238
|
self.window.controller.presets.from_global() # update current preset
|
232
239
|
|
233
|
-
def edit(self, idx: int = None):
|
240
|
+
def edit(self, idx: Optional[int] = None):
|
234
241
|
"""
|
235
242
|
Open preset editor
|
236
243
|
|
@@ -243,7 +250,7 @@ class Editor:
|
|
243
250
|
self.init(preset)
|
244
251
|
self.window.ui.dialogs.open_editor('editor.preset.presets', idx, width=800)
|
245
252
|
|
246
|
-
def init(self, id: str = None):
|
253
|
+
def init(self, id: Optional[str] = None):
|
247
254
|
"""
|
248
255
|
Initialize preset editor
|
249
256
|
|
@@ -337,7 +344,11 @@ class Editor:
|
|
337
344
|
self.window.ui.config[self.id]['name'].setFocus()
|
338
345
|
self.show_hide_by_mode()
|
339
346
|
|
340
|
-
def save(
|
347
|
+
def save(
|
348
|
+
self,
|
349
|
+
force: bool = False,
|
350
|
+
close: bool = True
|
351
|
+
):
|
341
352
|
"""
|
342
353
|
Save ore create preset
|
343
354
|
|
@@ -559,8 +570,13 @@ class Editor:
|
|
559
570
|
value=self.window.core.config.get('model'),
|
560
571
|
)
|
561
572
|
|
562
|
-
def update_from_global(self, key, value):
|
563
|
-
"""
|
573
|
+
def update_from_global(self, key: str, value: Any):
|
574
|
+
"""
|
575
|
+
Update field from global config
|
576
|
+
|
577
|
+
:param key: field key
|
578
|
+
:param value: field value
|
579
|
+
"""
|
564
580
|
preset_id = self.window.core.config.get('preset')
|
565
581
|
if preset_id is not None and preset_id != "":
|
566
582
|
if preset_id in self.window.core.presets.items:
|
@@ -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.14 00:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import os
|
13
|
+
from typing import Optional
|
13
14
|
|
14
15
|
from .editor import Editor
|
15
16
|
from .profile import Profile
|
@@ -149,7 +150,7 @@ class Settings:
|
|
149
150
|
i += 1
|
150
151
|
return section_idx
|
151
152
|
|
152
|
-
def toggle_file_editor(self, file: str = None):
|
153
|
+
def toggle_file_editor(self, file: Optional[str] = None):
|
153
154
|
"""
|
154
155
|
Toggle file editor
|
155
156
|
|
@@ -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.14 08:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import copy
|
13
|
+
from typing import Optional, Any, Dict
|
13
14
|
|
14
15
|
from pygpt_net.utils import trans
|
15
16
|
|
@@ -63,6 +64,7 @@ class Editor:
|
|
63
64
|
self.window.ui.add_hook("update.config.debug", self.hook_update)
|
64
65
|
self.window.ui.add_hook("update.config.notepad.num", self.hook_update)
|
65
66
|
self.window.ui.add_hook("update.config.render.code_syntax", self.hook_update)
|
67
|
+
self.window.ui.add_hook("update.config.theme.style", self.hook_update)
|
66
68
|
# self.window.ui.add_hook("llama.idx.storage", self.hook_update) # vector store update
|
67
69
|
# self.window.ui.add_hook("update.config.llama.idx.list", self.hook_update)
|
68
70
|
|
@@ -93,7 +95,7 @@ class Editor:
|
|
93
95
|
if initialize:
|
94
96
|
self.initialized = True
|
95
97
|
|
96
|
-
def save(self, id: str = None):
|
98
|
+
def save(self, id: Optional[str] = None):
|
97
99
|
"""
|
98
100
|
Save settings
|
99
101
|
|
@@ -163,6 +165,11 @@ class Editor:
|
|
163
165
|
value = self.window.core.config.get('render.code_syntax')
|
164
166
|
self.window.controller.theme.toggle_syntax(value, update_menu=True)
|
165
167
|
|
168
|
+
# style
|
169
|
+
if self.config_changed('theme.style'):
|
170
|
+
value = self.window.core.config.get('theme.style')
|
171
|
+
self.window.controller.theme.toggle_style(value)
|
172
|
+
|
166
173
|
# convert lists
|
167
174
|
if self.config_changed('ctx.convert_lists'):
|
168
175
|
self.window.controller.ctx.refresh()
|
@@ -206,7 +213,14 @@ class Editor:
|
|
206
213
|
return True
|
207
214
|
return False
|
208
215
|
|
209
|
-
def hook_update(
|
216
|
+
def hook_update(
|
217
|
+
self,
|
218
|
+
key: str,
|
219
|
+
value: Any,
|
220
|
+
caller,
|
221
|
+
*args,
|
222
|
+
**kwargs
|
223
|
+
):
|
210
224
|
"""
|
211
225
|
Hook: on settings update
|
212
226
|
|
@@ -301,7 +315,12 @@ class Editor:
|
|
301
315
|
self.window.core.config.set(key, value)
|
302
316
|
self.window.controller.debug.toggle_menu()
|
303
317
|
|
304
|
-
def toggle_collapsed(
|
318
|
+
def toggle_collapsed(
|
319
|
+
self,
|
320
|
+
id: str,
|
321
|
+
value: Any,
|
322
|
+
section: str
|
323
|
+
):
|
305
324
|
"""
|
306
325
|
Toggle collapsed state of section
|
307
326
|
|
@@ -386,7 +405,7 @@ class Editor:
|
|
386
405
|
return
|
387
406
|
self.window.core.settings.load_default_editor_app()
|
388
407
|
|
389
|
-
def get_sections(self) -> dict:
|
408
|
+
def get_sections(self) -> Dict[str, dict]:
|
390
409
|
"""
|
391
410
|
Return settings sections dict
|
392
411
|
|
@@ -394,7 +413,10 @@ class Editor:
|
|
394
413
|
"""
|
395
414
|
return self.sections
|
396
415
|
|
397
|
-
def get_options(
|
416
|
+
def get_options(
|
417
|
+
self,
|
418
|
+
section: Optional[str] = None
|
419
|
+
) -> Dict[str, Any]:
|
398
420
|
"""
|
399
421
|
Return settings options dict
|
400
422
|
|
@@ -411,7 +433,7 @@ class Editor:
|
|
411
433
|
options[key] = self.options[key]
|
412
434
|
return options
|
413
435
|
|
414
|
-
def get_option(self, key: str) ->
|
436
|
+
def get_option(self, key: str) -> Dict[str, Any]:
|
415
437
|
"""
|
416
438
|
Return settings option
|
417
439
|
|
@@ -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 08:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import copy
|
13
13
|
import os
|
14
14
|
from pathlib import Path
|
15
|
+
from typing import Optional, Dict, Any
|
15
16
|
from uuid import uuid4
|
16
17
|
|
17
18
|
from PySide6.QtGui import QAction
|
@@ -40,7 +41,12 @@ class Profile:
|
|
40
41
|
self.window.profiles.setup() # widget dialog
|
41
42
|
self.dialog_initialized = True
|
42
43
|
|
43
|
-
def switch(
|
44
|
+
def switch(
|
45
|
+
self,
|
46
|
+
uuid: str,
|
47
|
+
force: bool = False,
|
48
|
+
save_current: bool = True
|
49
|
+
):
|
44
50
|
"""
|
45
51
|
Switch profile
|
46
52
|
|
@@ -87,7 +93,7 @@ class Profile:
|
|
87
93
|
break
|
88
94
|
idx += 1
|
89
95
|
|
90
|
-
def get_profiles(self) ->
|
96
|
+
def get_profiles(self) -> Dict[str, Dict[str, Any]]:
|
91
97
|
"""
|
92
98
|
Get profiles
|
93
99
|
|
@@ -158,7 +164,13 @@ class Profile:
|
|
158
164
|
else:
|
159
165
|
self.open()
|
160
166
|
|
161
|
-
def handle_update(
|
167
|
+
def handle_update(
|
168
|
+
self,
|
169
|
+
mode: str,
|
170
|
+
name: str,
|
171
|
+
path: str,
|
172
|
+
uuid: Optional[str] = None
|
173
|
+
):
|
162
174
|
"""
|
163
175
|
Handle new/edit profile dialog
|
164
176
|
|
@@ -356,7 +368,12 @@ class Profile:
|
|
356
368
|
self.update_list()
|
357
369
|
self.update_menu()
|
358
370
|
|
359
|
-
def duplicate(
|
371
|
+
def duplicate(
|
372
|
+
self,
|
373
|
+
uuid: str,
|
374
|
+
new_name: str,
|
375
|
+
new_path: str
|
376
|
+
):
|
360
377
|
"""
|
361
378
|
Duplicate profile
|
362
379
|
|