pygpt-net 2.4.37__py3-none-any.whl → 2.4.41__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 +29 -0
- README.md +44 -115
- pygpt_net/CHANGELOG.txt +29 -0
- pygpt_net/__init__.py +3 -3
- 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 +25 -4
- pygpt_net/controller/calendar/__init__.py +23 -4
- pygpt_net/controller/calendar/note.py +57 -11
- pygpt_net/controller/camera.py +3 -2
- pygpt_net/controller/chat/__init__.py +5 -3
- pygpt_net/controller/chat/attachment.py +34 -7
- 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 +52 -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/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 +71 -3
- pygpt_net/core/audio/context.py +7 -2
- pygpt_net/core/bridge/__init__.py +22 -6
- pygpt_net/core/bridge/context.py +5 -3
- 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/tabs.py +5 -2
- 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/idx/__init__.py +34 -25
- pygpt_net/core/idx/chat.py +40 -16
- pygpt_net/core/idx/context.py +6 -2
- pygpt_net/core/idx/indexing.py +84 -35
- 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/llm/__init__.py +13 -3
- pygpt_net/core/locale.py +34 -8
- pygpt_net/core/models.py +4 -3
- pygpt_net/core/notepad.py +9 -4
- pygpt_net/core/plugins.py +7 -6
- pygpt_net/core/presets.py +19 -10
- pygpt_net/core/profile.py +12 -6
- 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/renderer.py +313 -63
- pygpt_net/core/settings.py +9 -4
- pygpt_net/core/tabs/__init__.py +290 -103
- pygpt_net/core/tabs/tab.py +17 -4
- pygpt_net/core/tokens.py +44 -11
- pygpt_net/core/updater/__init__.py +20 -7
- pygpt_net/core/vision/analyzer.py +29 -6
- pygpt_net/core/web.py +130 -2
- 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 +17 -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 +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_input/simple.py +21 -5
- pygpt_net/plugin/audio_output/__init__.py +4 -1
- pygpt_net/plugin/base/config.py +4 -2
- pygpt_net/plugin/base/plugin.py +26 -6
- pygpt_net/plugin/base/worker.py +37 -9
- 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 +43 -1
- pygpt_net/provider/core/ctx/base.py +4 -1
- pygpt_net/provider/core/ctx/db_sqlite/__init__.py +10 -1
- pygpt_net/provider/core/ctx/db_sqlite/storage.py +22 -1
- pygpt_net/provider/gpt/assistants.py +10 -9
- pygpt_net/provider/gpt/audio.py +3 -2
- pygpt_net/provider/gpt/chat.py +8 -7
- pygpt_net/provider/gpt/completion.py +6 -4
- pygpt_net/provider/gpt/image.py +9 -2
- pygpt_net/provider/gpt/store.py +14 -13
- pygpt_net/provider/gpt/vision.py +6 -5
- 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/chat/input.py +10 -18
- pygpt_net/ui/layout/chat/output.py +26 -44
- 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/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.41.dist-info}/METADATA +45 -116
- {pygpt_net-2.4.37.dist-info → pygpt_net-2.4.41.dist-info}/RECORD +255 -247
- /pygpt_net/data/css/{web.dark.css → web-blocks.dark.css} +0 -0
- {pygpt_net-2.4.37.dist-info → pygpt_net-2.4.41.dist-info}/LICENSE +0 -0
- {pygpt_net-2.4.37.dist-info → pygpt_net-2.4.41.dist-info}/WHEEL +0 -0
- {pygpt_net-2.4.37.dist-info → pygpt_net-2.4.41.dist-info}/entry_points.txt +0 -0
@@ -6,9 +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
|
+
from typing import Dict, Any, List
|
13
|
+
|
14
|
+
from pygpt_net.ui.widget.option.dictionary import OptionDict
|
12
15
|
from pygpt_net.utils import trans
|
13
16
|
|
14
17
|
|
@@ -25,7 +28,7 @@ class Dictionary:
|
|
25
28
|
self,
|
26
29
|
parent_id: str,
|
27
30
|
key: str,
|
28
|
-
option:
|
31
|
+
option: Dict[str, Any]
|
29
32
|
):
|
30
33
|
"""
|
31
34
|
Apply values to dictionary
|
@@ -44,7 +47,7 @@ class Dictionary:
|
|
44
47
|
self,
|
45
48
|
parent_id: str,
|
46
49
|
key: str,
|
47
|
-
values:
|
50
|
+
values: Dict[str, Any],
|
48
51
|
idx: int
|
49
52
|
):
|
50
53
|
"""
|
@@ -64,8 +67,8 @@ class Dictionary:
|
|
64
67
|
self,
|
65
68
|
parent_id: str,
|
66
69
|
key: str,
|
67
|
-
option:
|
68
|
-
) ->
|
70
|
+
option: Dict[str, Any]
|
71
|
+
) -> List[Dict[str, Any]]:
|
69
72
|
"""
|
70
73
|
Get dictionary values
|
71
74
|
|
@@ -78,7 +81,7 @@ class Dictionary:
|
|
78
81
|
|
79
82
|
def delete_item(
|
80
83
|
self,
|
81
|
-
parent_object,
|
84
|
+
parent_object: OptionDict,
|
82
85
|
id: str,
|
83
86
|
force: bool = False,
|
84
87
|
hooks: bool = True
|
@@ -117,8 +120,8 @@ class Dictionary:
|
|
117
120
|
def to_options(
|
118
121
|
self,
|
119
122
|
parent_id: str,
|
120
|
-
option:
|
121
|
-
) ->
|
123
|
+
option: Dict[str, Any]
|
124
|
+
) -> Dict[str, Any]:
|
122
125
|
"""
|
123
126
|
Convert dictionary items option to options
|
124
127
|
|
@@ -145,8 +148,8 @@ class Dictionary:
|
|
145
148
|
def append_editor(
|
146
149
|
self,
|
147
150
|
id: str,
|
148
|
-
option:
|
149
|
-
data:
|
151
|
+
option: Dict[str, Any],
|
152
|
+
data: Dict[str, Any]
|
150
153
|
):
|
151
154
|
"""
|
152
155
|
Apply dict item option sub-values to dict editor
|
@@ -173,7 +176,7 @@ class Dictionary:
|
|
173
176
|
self,
|
174
177
|
option_key: str,
|
175
178
|
parent: str,
|
176
|
-
fields:
|
179
|
+
fields: Dict[str, Dict[str, Any]],
|
177
180
|
hooks: bool = True
|
178
181
|
):
|
179
182
|
"""
|
@@ -6,9 +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
|
+
from typing import Any, Dict, Optional, Union
|
13
|
+
|
14
|
+
|
12
15
|
class Input:
|
13
16
|
def __init__(self, window=None):
|
14
17
|
"""
|
@@ -22,7 +25,7 @@ class Input:
|
|
22
25
|
self,
|
23
26
|
parent_id: str,
|
24
27
|
key: str,
|
25
|
-
option:
|
28
|
+
option: Dict[str, Any]
|
26
29
|
):
|
27
30
|
"""
|
28
31
|
Apply value to input
|
@@ -60,8 +63,8 @@ class Input:
|
|
60
63
|
self,
|
61
64
|
parent_id: str,
|
62
65
|
key: str,
|
63
|
-
option:
|
64
|
-
value:
|
66
|
+
option: Dict[str, Any],
|
67
|
+
value: Any,
|
65
68
|
hooks: bool = True
|
66
69
|
):
|
67
70
|
"""
|
@@ -90,8 +93,8 @@ class Input:
|
|
90
93
|
self,
|
91
94
|
parent_id: str,
|
92
95
|
key: str,
|
93
|
-
option:
|
94
|
-
) ->
|
96
|
+
option: Dict[str, Any]
|
97
|
+
) -> Optional[Union[int, float, str]]:
|
95
98
|
"""
|
96
99
|
Get value from input
|
97
100
|
|
@@ -6,9 +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
|
+
from typing import Any, Optional, Dict, Union
|
13
|
+
|
14
|
+
|
12
15
|
class Slider:
|
13
16
|
def __init__(self, window=None):
|
14
17
|
"""
|
@@ -22,8 +25,8 @@ class Slider:
|
|
22
25
|
self,
|
23
26
|
parent_id: str,
|
24
27
|
key: str,
|
25
|
-
option:
|
26
|
-
type: str = None
|
28
|
+
option: Dict[str, Any],
|
29
|
+
type: Optional[str] = None
|
27
30
|
):
|
28
31
|
"""
|
29
32
|
Apply value to slider
|
@@ -89,9 +92,9 @@ class Slider:
|
|
89
92
|
self,
|
90
93
|
parent_id: str,
|
91
94
|
key: str,
|
92
|
-
option:
|
93
|
-
value:
|
94
|
-
type: str = None,
|
95
|
+
option: Dict[str, Any],
|
96
|
+
value: Any,
|
97
|
+
type: Optional[str] = None,
|
95
98
|
hooks: bool = True
|
96
99
|
):
|
97
100
|
"""
|
@@ -121,8 +124,8 @@ class Slider:
|
|
121
124
|
self,
|
122
125
|
parent_id: str,
|
123
126
|
key: str,
|
124
|
-
option:
|
125
|
-
) ->
|
127
|
+
option: Dict[str, Any]
|
128
|
+
) -> Union[int, float]:
|
126
129
|
"""
|
127
130
|
Get slider value
|
128
131
|
|
@@ -6,9 +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
|
+
from typing import Any, Dict
|
13
|
+
|
14
|
+
|
12
15
|
class Textarea:
|
13
16
|
def __init__(self, window=None):
|
14
17
|
"""
|
@@ -22,7 +25,7 @@ class Textarea:
|
|
22
25
|
self,
|
23
26
|
parent_id: str,
|
24
27
|
key: str,
|
25
|
-
option:
|
28
|
+
option: Dict[str, Any]
|
26
29
|
):
|
27
30
|
"""
|
28
31
|
Apply value to textarea
|
@@ -38,8 +41,8 @@ class Textarea:
|
|
38
41
|
self,
|
39
42
|
parent_id: str,
|
40
43
|
key: str,
|
41
|
-
option:
|
42
|
-
value:
|
44
|
+
option: Dict[str, Any],
|
45
|
+
value: Any,
|
43
46
|
hooks: bool = True
|
44
47
|
):
|
45
48
|
"""
|
@@ -68,7 +71,7 @@ class Textarea:
|
|
68
71
|
self,
|
69
72
|
parent_id: str,
|
70
73
|
key: str,
|
71
|
-
option:
|
74
|
+
option: Dict[str, Any]
|
72
75
|
) -> str:
|
73
76
|
"""
|
74
77
|
Get value of textarea
|
@@ -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 Dict, Any, List
|
13
|
+
|
12
14
|
from pygpt_net.core.types import (
|
13
15
|
MODE_AGENT_LLAMA,
|
14
16
|
MODE_LANGCHAIN,
|
@@ -26,7 +28,7 @@ class Placeholder:
|
|
26
28
|
"""
|
27
29
|
self.window = window
|
28
30
|
|
29
|
-
def apply(self, option:
|
31
|
+
def apply(self, option: Dict[str, Any]):
|
30
32
|
"""
|
31
33
|
Apply placeholders to option
|
32
34
|
|
@@ -52,7 +54,7 @@ class Placeholder:
|
|
52
54
|
if "use" in option and option["use"] is not None:
|
53
55
|
option["keys"] = self.apply_by_id(option["use"])
|
54
56
|
|
55
|
-
def apply_by_id(self, id: str) ->
|
57
|
+
def apply_by_id(self, id: str) -> List[Dict[str, str]]:
|
56
58
|
"""
|
57
59
|
Apply placeholders by id
|
58
60
|
|
@@ -86,6 +88,8 @@ class Placeholder:
|
|
86
88
|
return self.get_agent_providers()
|
87
89
|
elif id == "syntax_styles":
|
88
90
|
return self.get_syntax_styles()
|
91
|
+
elif id == "styles":
|
92
|
+
return self.get_styles()
|
89
93
|
elif id == "idx":
|
90
94
|
return self.get_idx()
|
91
95
|
elif id == "keys":
|
@@ -98,10 +102,24 @@ class Placeholder:
|
|
98
102
|
return self.get_speech_synthesis_actions()
|
99
103
|
elif id == "voice_control_actions":
|
100
104
|
return self.get_voice_control_actions()
|
105
|
+
elif id == "audio_input_devices":
|
106
|
+
return self.get_audio_input_devices()
|
101
107
|
else:
|
102
108
|
return []
|
103
109
|
|
104
|
-
def
|
110
|
+
def get_audio_input_devices(self) -> List[Dict[str, str]]:
|
111
|
+
"""
|
112
|
+
Get audio input devices list
|
113
|
+
|
114
|
+
:return: placeholders list
|
115
|
+
"""
|
116
|
+
devices = self.window.core.audio.get_input_devices()
|
117
|
+
data = []
|
118
|
+
for device in devices:
|
119
|
+
data.append({str(device[0]): device[1]})
|
120
|
+
return data
|
121
|
+
|
122
|
+
def get_langchain_providers(self) -> List[Dict[str, str]]:
|
105
123
|
"""
|
106
124
|
Get Langchain LLM provider placeholders list
|
107
125
|
|
@@ -113,7 +131,7 @@ class Placeholder:
|
|
113
131
|
data.append({id: id})
|
114
132
|
return data
|
115
133
|
|
116
|
-
def get_llama_index_providers(self) ->
|
134
|
+
def get_llama_index_providers(self) -> List[Dict[str, str]]:
|
117
135
|
"""
|
118
136
|
Get Llama-index LLM provider placeholders list
|
119
137
|
|
@@ -125,7 +143,7 @@ class Placeholder:
|
|
125
143
|
data.append({id: id})
|
126
144
|
return data
|
127
145
|
|
128
|
-
def get_agent_providers(self) ->
|
146
|
+
def get_agent_providers(self) -> List[Dict[str, str]]:
|
129
147
|
"""
|
130
148
|
Get Llama-index agent provider placeholders list
|
131
149
|
|
@@ -137,7 +155,7 @@ class Placeholder:
|
|
137
155
|
data.append({id: id})
|
138
156
|
return data
|
139
157
|
|
140
|
-
def get_embeddings_providers(self) ->
|
158
|
+
def get_embeddings_providers(self) -> List[Dict[str, str]]:
|
141
159
|
"""
|
142
160
|
Get embeddings placeholders list
|
143
161
|
|
@@ -149,7 +167,7 @@ class Placeholder:
|
|
149
167
|
data.append({id: id})
|
150
168
|
return data
|
151
169
|
|
152
|
-
def get_llama_index_chat_modes(self) ->
|
170
|
+
def get_llama_index_chat_modes(self) -> List[Dict[str, str]]:
|
153
171
|
"""
|
154
172
|
Get llama chat modes list
|
155
173
|
|
@@ -165,7 +183,7 @@ class Placeholder:
|
|
165
183
|
{"openai": "openai"},
|
166
184
|
]
|
167
185
|
|
168
|
-
def get_llama_index_loaders(self, type: str = "all") ->
|
186
|
+
def get_llama_index_loaders(self, type: str = "all") -> List[Dict[str, str]]:
|
169
187
|
"""
|
170
188
|
Get data loaders placeholders list
|
171
189
|
|
@@ -187,7 +205,7 @@ class Placeholder:
|
|
187
205
|
data.append(choice)
|
188
206
|
return data
|
189
207
|
|
190
|
-
def get_vector_storage(self) ->
|
208
|
+
def get_vector_storage(self) -> List[Dict[str, str]]:
|
191
209
|
"""
|
192
210
|
Get vector storage placeholders list
|
193
211
|
|
@@ -199,7 +217,7 @@ class Placeholder:
|
|
199
217
|
data.append({id: id})
|
200
218
|
return data
|
201
219
|
|
202
|
-
def get_var_types(self) ->
|
220
|
+
def get_var_types(self) -> List[Dict[str, str]]:
|
203
221
|
"""
|
204
222
|
Get langchain placeholders list
|
205
223
|
|
@@ -211,7 +229,7 @@ class Placeholder:
|
|
211
229
|
data.append({type: type})
|
212
230
|
return data
|
213
231
|
|
214
|
-
def get_presets(self) ->
|
232
|
+
def get_presets(self) -> List[Dict[str, str]]:
|
215
233
|
"""
|
216
234
|
Get presets placeholders list
|
217
235
|
|
@@ -226,7 +244,7 @@ class Placeholder:
|
|
226
244
|
data.append({id: id}) # TODO: name
|
227
245
|
return data
|
228
246
|
|
229
|
-
def get_models(self) ->
|
247
|
+
def get_models(self) -> List[Dict[str, str]]:
|
230
248
|
"""
|
231
249
|
Get models placeholders list
|
232
250
|
|
@@ -238,7 +256,7 @@ class Placeholder:
|
|
238
256
|
data.append({id: id}) # TODO: name
|
239
257
|
return data
|
240
258
|
|
241
|
-
def get_agent_modes(self) ->
|
259
|
+
def get_agent_modes(self) -> List[Dict[str, str]]:
|
242
260
|
"""
|
243
261
|
Get agent/expert modes placeholders list
|
244
262
|
|
@@ -250,7 +268,7 @@ class Placeholder:
|
|
250
268
|
data.append({id: id}) # TODO: name
|
251
269
|
return data
|
252
270
|
|
253
|
-
def get_idx(self) ->
|
271
|
+
def get_idx(self) -> List[Dict[str, str]]:
|
254
272
|
"""
|
255
273
|
Get indexes placeholders list
|
256
274
|
|
@@ -263,7 +281,7 @@ class Placeholder:
|
|
263
281
|
data.append({id: id})
|
264
282
|
return data
|
265
283
|
|
266
|
-
def get_syntax_styles(self) ->
|
284
|
+
def get_syntax_styles(self) -> List[Dict[str, str]]:
|
267
285
|
"""
|
268
286
|
Get highlighter styles list
|
269
287
|
|
@@ -276,7 +294,20 @@ class Placeholder:
|
|
276
294
|
data.append({id: id})
|
277
295
|
return data
|
278
296
|
|
279
|
-
def
|
297
|
+
def get_styles(self) -> List[Dict[str, str]]:
|
298
|
+
"""
|
299
|
+
Get styles list
|
300
|
+
|
301
|
+
:return: placeholders list
|
302
|
+
"""
|
303
|
+
styles = self.window.controller.theme.common.get_styles_list()
|
304
|
+
styles.sort()
|
305
|
+
data = []
|
306
|
+
for id in styles:
|
307
|
+
data.append({id: id})
|
308
|
+
return data
|
309
|
+
|
310
|
+
def get_keys(self) -> List[Dict[str, str]]:
|
280
311
|
"""
|
281
312
|
Get keys
|
282
313
|
|
@@ -284,7 +315,7 @@ class Placeholder:
|
|
284
315
|
"""
|
285
316
|
return self.window.core.access.shortcuts.get_keys_choices()
|
286
317
|
|
287
|
-
def get_modifiers(self) ->
|
318
|
+
def get_modifiers(self) -> List[Dict[str, str]]:
|
288
319
|
"""
|
289
320
|
Get modifiers
|
290
321
|
|
@@ -292,7 +323,7 @@ class Placeholder:
|
|
292
323
|
"""
|
293
324
|
return self.window.core.access.shortcuts.get_modifiers_choices()
|
294
325
|
|
295
|
-
def get_access_actions(self) ->
|
326
|
+
def get_access_actions(self) -> List[Dict[str, str]]:
|
296
327
|
"""
|
297
328
|
Get access actions list
|
298
329
|
|
@@ -307,7 +338,7 @@ class Placeholder:
|
|
307
338
|
translated_choices.sort(key=lambda x: list(x.values())[0])
|
308
339
|
return translated_choices
|
309
340
|
|
310
|
-
def get_speech_synthesis_actions(self) ->
|
341
|
+
def get_speech_synthesis_actions(self) -> List[Dict[str, str]]:
|
311
342
|
"""
|
312
343
|
Get speech actions list
|
313
344
|
|
@@ -322,7 +353,7 @@ class Placeholder:
|
|
322
353
|
translated_choices.sort(key=lambda x: list(x.values())[0])
|
323
354
|
return translated_choices
|
324
355
|
|
325
|
-
def get_voice_control_actions(self) ->
|
356
|
+
def get_voice_control_actions(self) -> List[Dict[str, str]]:
|
326
357
|
"""
|
327
358
|
Get voice control actions list
|
328
359
|
|