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 18: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,38 @@ 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()
|
107
|
+
elif id == "audio_tts_whisper_voices":
|
108
|
+
return self.get_audio_tts_whisper_voices()
|
101
109
|
else:
|
102
110
|
return []
|
103
111
|
|
104
|
-
def
|
112
|
+
def get_audio_tts_whisper_voices(self) -> List[Dict[str, str]]:
|
113
|
+
"""
|
114
|
+
Get audio TTS whisper voices list
|
115
|
+
|
116
|
+
:return: placeholders list
|
117
|
+
"""
|
118
|
+
voices = self.window.core.audio.whisper.get_voices()
|
119
|
+
data = []
|
120
|
+
for voice in voices:
|
121
|
+
data.append({voice: voice})
|
122
|
+
return data
|
123
|
+
|
124
|
+
def get_audio_input_devices(self) -> List[Dict[str, str]]:
|
125
|
+
"""
|
126
|
+
Get audio input devices list
|
127
|
+
|
128
|
+
:return: placeholders list
|
129
|
+
"""
|
130
|
+
devices = self.window.core.audio.get_input_devices()
|
131
|
+
data = []
|
132
|
+
for device in devices:
|
133
|
+
data.append({str(device[0]): device[1]})
|
134
|
+
return data
|
135
|
+
|
136
|
+
def get_langchain_providers(self) -> List[Dict[str, str]]:
|
105
137
|
"""
|
106
138
|
Get Langchain LLM provider placeholders list
|
107
139
|
|
@@ -113,7 +145,7 @@ class Placeholder:
|
|
113
145
|
data.append({id: id})
|
114
146
|
return data
|
115
147
|
|
116
|
-
def get_llama_index_providers(self) ->
|
148
|
+
def get_llama_index_providers(self) -> List[Dict[str, str]]:
|
117
149
|
"""
|
118
150
|
Get Llama-index LLM provider placeholders list
|
119
151
|
|
@@ -125,7 +157,7 @@ class Placeholder:
|
|
125
157
|
data.append({id: id})
|
126
158
|
return data
|
127
159
|
|
128
|
-
def get_agent_providers(self) ->
|
160
|
+
def get_agent_providers(self) -> List[Dict[str, str]]:
|
129
161
|
"""
|
130
162
|
Get Llama-index agent provider placeholders list
|
131
163
|
|
@@ -137,7 +169,7 @@ class Placeholder:
|
|
137
169
|
data.append({id: id})
|
138
170
|
return data
|
139
171
|
|
140
|
-
def get_embeddings_providers(self) ->
|
172
|
+
def get_embeddings_providers(self) -> List[Dict[str, str]]:
|
141
173
|
"""
|
142
174
|
Get embeddings placeholders list
|
143
175
|
|
@@ -149,7 +181,7 @@ class Placeholder:
|
|
149
181
|
data.append({id: id})
|
150
182
|
return data
|
151
183
|
|
152
|
-
def get_llama_index_chat_modes(self) ->
|
184
|
+
def get_llama_index_chat_modes(self) -> List[Dict[str, str]]:
|
153
185
|
"""
|
154
186
|
Get llama chat modes list
|
155
187
|
|
@@ -165,7 +197,7 @@ class Placeholder:
|
|
165
197
|
{"openai": "openai"},
|
166
198
|
]
|
167
199
|
|
168
|
-
def get_llama_index_loaders(self, type: str = "all") ->
|
200
|
+
def get_llama_index_loaders(self, type: str = "all") -> List[Dict[str, str]]:
|
169
201
|
"""
|
170
202
|
Get data loaders placeholders list
|
171
203
|
|
@@ -187,7 +219,7 @@ class Placeholder:
|
|
187
219
|
data.append(choice)
|
188
220
|
return data
|
189
221
|
|
190
|
-
def get_vector_storage(self) ->
|
222
|
+
def get_vector_storage(self) -> List[Dict[str, str]]:
|
191
223
|
"""
|
192
224
|
Get vector storage placeholders list
|
193
225
|
|
@@ -199,7 +231,7 @@ class Placeholder:
|
|
199
231
|
data.append({id: id})
|
200
232
|
return data
|
201
233
|
|
202
|
-
def get_var_types(self) ->
|
234
|
+
def get_var_types(self) -> List[Dict[str, str]]:
|
203
235
|
"""
|
204
236
|
Get langchain placeholders list
|
205
237
|
|
@@ -211,7 +243,7 @@ class Placeholder:
|
|
211
243
|
data.append({type: type})
|
212
244
|
return data
|
213
245
|
|
214
|
-
def get_presets(self) ->
|
246
|
+
def get_presets(self) -> List[Dict[str, str]]:
|
215
247
|
"""
|
216
248
|
Get presets placeholders list
|
217
249
|
|
@@ -226,7 +258,7 @@ class Placeholder:
|
|
226
258
|
data.append({id: id}) # TODO: name
|
227
259
|
return data
|
228
260
|
|
229
|
-
def get_models(self) ->
|
261
|
+
def get_models(self) -> List[Dict[str, str]]:
|
230
262
|
"""
|
231
263
|
Get models placeholders list
|
232
264
|
|
@@ -238,7 +270,7 @@ class Placeholder:
|
|
238
270
|
data.append({id: id}) # TODO: name
|
239
271
|
return data
|
240
272
|
|
241
|
-
def get_agent_modes(self) ->
|
273
|
+
def get_agent_modes(self) -> List[Dict[str, str]]:
|
242
274
|
"""
|
243
275
|
Get agent/expert modes placeholders list
|
244
276
|
|
@@ -250,7 +282,7 @@ class Placeholder:
|
|
250
282
|
data.append({id: id}) # TODO: name
|
251
283
|
return data
|
252
284
|
|
253
|
-
def get_idx(self) ->
|
285
|
+
def get_idx(self) -> List[Dict[str, str]]:
|
254
286
|
"""
|
255
287
|
Get indexes placeholders list
|
256
288
|
|
@@ -263,7 +295,7 @@ class Placeholder:
|
|
263
295
|
data.append({id: id})
|
264
296
|
return data
|
265
297
|
|
266
|
-
def get_syntax_styles(self) ->
|
298
|
+
def get_syntax_styles(self) -> List[Dict[str, str]]:
|
267
299
|
"""
|
268
300
|
Get highlighter styles list
|
269
301
|
|
@@ -276,7 +308,20 @@ class Placeholder:
|
|
276
308
|
data.append({id: id})
|
277
309
|
return data
|
278
310
|
|
279
|
-
def
|
311
|
+
def get_styles(self) -> List[Dict[str, str]]:
|
312
|
+
"""
|
313
|
+
Get styles list
|
314
|
+
|
315
|
+
:return: placeholders list
|
316
|
+
"""
|
317
|
+
styles = self.window.controller.theme.common.get_styles_list()
|
318
|
+
styles.sort()
|
319
|
+
data = []
|
320
|
+
for id in styles:
|
321
|
+
data.append({id: id})
|
322
|
+
return data
|
323
|
+
|
324
|
+
def get_keys(self) -> List[Dict[str, str]]:
|
280
325
|
"""
|
281
326
|
Get keys
|
282
327
|
|
@@ -284,7 +329,7 @@ class Placeholder:
|
|
284
329
|
"""
|
285
330
|
return self.window.core.access.shortcuts.get_keys_choices()
|
286
331
|
|
287
|
-
def get_modifiers(self) ->
|
332
|
+
def get_modifiers(self) -> List[Dict[str, str]]:
|
288
333
|
"""
|
289
334
|
Get modifiers
|
290
335
|
|
@@ -292,7 +337,7 @@ class Placeholder:
|
|
292
337
|
"""
|
293
338
|
return self.window.core.access.shortcuts.get_modifiers_choices()
|
294
339
|
|
295
|
-
def get_access_actions(self) ->
|
340
|
+
def get_access_actions(self) -> List[Dict[str, str]]:
|
296
341
|
"""
|
297
342
|
Get access actions list
|
298
343
|
|
@@ -307,7 +352,7 @@ class Placeholder:
|
|
307
352
|
translated_choices.sort(key=lambda x: list(x.values())[0])
|
308
353
|
return translated_choices
|
309
354
|
|
310
|
-
def get_speech_synthesis_actions(self) ->
|
355
|
+
def get_speech_synthesis_actions(self) -> List[Dict[str, str]]:
|
311
356
|
"""
|
312
357
|
Get speech actions list
|
313
358
|
|
@@ -322,7 +367,7 @@ class Placeholder:
|
|
322
367
|
translated_choices.sort(key=lambda x: list(x.values())[0])
|
323
368
|
return translated_choices
|
324
369
|
|
325
|
-
def get_voice_control_actions(self) ->
|
370
|
+
def get_voice_control_actions(self) -> List[Dict[str, str]]:
|
326
371
|
"""
|
327
372
|
Get voice control actions list
|
328
373
|
|
@@ -6,10 +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
|
+
from typing import Optional, List
|
13
|
+
|
12
14
|
from PySide6.QtCore import QModelIndex
|
15
|
+
from PySide6.QtGui import QStandardItem
|
13
16
|
|
14
17
|
from pygpt_net.core.events import Event, AppEvent, RenderEvent
|
15
18
|
from pygpt_net.item.ctx import CtxItem
|
@@ -19,7 +22,7 @@ from .summarizer import Summarizer
|
|
19
22
|
from .extra import Extra
|
20
23
|
|
21
24
|
from pygpt_net.utils import trans
|
22
|
-
from pygpt_net.core.tabs import Tab
|
25
|
+
from pygpt_net.core.tabs.tab import Tab
|
23
26
|
|
24
27
|
|
25
28
|
class Ctx:
|
@@ -60,20 +63,6 @@ class Ctx:
|
|
60
63
|
# if no ctx then get first ctx
|
61
64
|
self.window.core.ctx.set_current(self.window.core.ctx.get_first())
|
62
65
|
|
63
|
-
# restore previous ctx
|
64
|
-
# 1) try to load from tabs data - if not exists, load from current
|
65
|
-
tab = self.window.core.tabs.get_first_by_type(Tab.TAB_CHAT)
|
66
|
-
loaded = False
|
67
|
-
if tab is not None:
|
68
|
-
meta_id = tab.data_id
|
69
|
-
if meta_id is not None:
|
70
|
-
self.load(meta_id)
|
71
|
-
loaded = True
|
72
|
-
|
73
|
-
# 2) load from current if not loaded yet
|
74
|
-
if not loaded:
|
75
|
-
self.load(self.window.core.ctx.get_current())
|
76
|
-
|
77
66
|
# restore search string if exists
|
78
67
|
if self.window.core.config.has("ctx.search.string"):
|
79
68
|
string = self.window.core.config.get("ctx.search.string")
|
@@ -89,7 +78,12 @@ class Ctx:
|
|
89
78
|
self.window.ui.nodes['ctx.list'].collapseAll() # collapse all items at start
|
90
79
|
self.restore_expanded_groups() # restore expanded groups
|
91
80
|
|
92
|
-
def update(
|
81
|
+
def update(
|
82
|
+
self,
|
83
|
+
reload: bool = True,
|
84
|
+
all: bool = True,
|
85
|
+
select: bool = True
|
86
|
+
):
|
93
87
|
"""
|
94
88
|
Update ctx list
|
95
89
|
|
@@ -122,7 +116,11 @@ class Ctx:
|
|
122
116
|
# update additional context attachments
|
123
117
|
self.window.controller.chat.attachment.update()
|
124
118
|
|
125
|
-
def select(
|
119
|
+
def select(
|
120
|
+
self,
|
121
|
+
id: int,
|
122
|
+
force: bool = False
|
123
|
+
):
|
126
124
|
"""
|
127
125
|
Select ctx by id
|
128
126
|
|
@@ -144,6 +142,19 @@ class Ctx:
|
|
144
142
|
# update additional context attachments
|
145
143
|
self.window.controller.chat.attachment.update()
|
146
144
|
|
145
|
+
def select_on_list_only(self, id: int):
|
146
|
+
"""
|
147
|
+
Select ctx by id only on list
|
148
|
+
|
149
|
+
:param id: context meta id
|
150
|
+
"""
|
151
|
+
self.window.core.ctx.select(id, restore_model=True)
|
152
|
+
self.window.core.ctx.set_current(id)
|
153
|
+
self.update_list(True)
|
154
|
+
self.select_by_current()
|
155
|
+
self.reload_config(all=False)
|
156
|
+
self.update()
|
157
|
+
|
147
158
|
def select_by_idx(self, idx: int):
|
148
159
|
"""
|
149
160
|
Select ctx by index
|
@@ -189,7 +200,7 @@ class Ctx:
|
|
189
200
|
self.set_group(None)
|
190
201
|
self.window.ui.nodes['ctx.list'].clearSelection()
|
191
202
|
|
192
|
-
def set_group(self, group_id: int = None):
|
203
|
+
def set_group(self, group_id: Optional[int] = None):
|
193
204
|
"""
|
194
205
|
Set current selected group
|
195
206
|
|
@@ -207,7 +218,11 @@ class Ctx:
|
|
207
218
|
self.group_id = None
|
208
219
|
self.new()
|
209
220
|
|
210
|
-
def new(
|
221
|
+
def new(
|
222
|
+
self,
|
223
|
+
force: bool = False,
|
224
|
+
group_id: Optional[int] = None
|
225
|
+
):
|
211
226
|
"""
|
212
227
|
Create new ctx
|
213
228
|
|
@@ -326,7 +341,11 @@ class Ctx:
|
|
326
341
|
event = RenderEvent(RenderEvent.CTX_APPEND, data)
|
327
342
|
self.window.dispatch(event)
|
328
343
|
|
329
|
-
def load(
|
344
|
+
def load(
|
345
|
+
self,
|
346
|
+
id: int,
|
347
|
+
restore_model: bool = True
|
348
|
+
):
|
330
349
|
"""
|
331
350
|
Load ctx data
|
332
351
|
|
@@ -348,6 +367,21 @@ class Ctx:
|
|
348
367
|
event = RenderEvent(RenderEvent.ON_LOAD, data)
|
349
368
|
self.window.dispatch(event)
|
350
369
|
|
370
|
+
self.reload_config()
|
371
|
+
|
372
|
+
# reload ctx list and select current ctx on list, without reloading all
|
373
|
+
self.update(reload=False, all=True)
|
374
|
+
|
375
|
+
# update tab title
|
376
|
+
if meta is not None:
|
377
|
+
self.window.controller.ui.tabs.on_load_ctx(meta)
|
378
|
+
|
379
|
+
def reload_config(self, all: bool = True):
|
380
|
+
"""
|
381
|
+
Reload config
|
382
|
+
|
383
|
+
:param all: reload all
|
384
|
+
"""
|
351
385
|
# get current settings stored in ctx
|
352
386
|
thread = self.window.core.ctx.get_thread()
|
353
387
|
mode = self.window.core.ctx.get_mode()
|
@@ -358,8 +392,9 @@ class Ctx:
|
|
358
392
|
# restore thread from ctx
|
359
393
|
self.window.core.config.set('assistant_thread', thread)
|
360
394
|
|
361
|
-
|
362
|
-
|
395
|
+
if all:
|
396
|
+
# clear before output and append ctx to output
|
397
|
+
self.refresh_output()
|
363
398
|
|
364
399
|
# switch mode to ctx mode
|
365
400
|
if mode is not None:
|
@@ -384,16 +419,9 @@ class Ctx:
|
|
384
419
|
if model is not None and self.window.core.models.has_model(mode, model):
|
385
420
|
self.window.controller.model.set(mode, model)
|
386
421
|
|
387
|
-
# reload ctx list and select current ctx on list, without reloading all
|
388
|
-
self.update(reload=False, all=True)
|
389
|
-
|
390
422
|
# update current ctx label in UI
|
391
423
|
self.common.update_label(mode, assistant_id)
|
392
424
|
|
393
|
-
# update tab title
|
394
|
-
if meta is not None:
|
395
|
-
self.window.controller.ui.tabs.update_title_current(meta.name)
|
396
|
-
|
397
425
|
def update_ctx(self):
|
398
426
|
"""Update current ctx mode if allowed"""
|
399
427
|
mode = self.window.core.config.get('mode')
|
@@ -415,7 +443,11 @@ class Ctx:
|
|
415
443
|
# update ctx label
|
416
444
|
self.common.update_label(mode, id)
|
417
445
|
|
418
|
-
def delete(
|
446
|
+
def delete(
|
447
|
+
self,
|
448
|
+
id: int,
|
449
|
+
force: bool = False
|
450
|
+
):
|
419
451
|
"""
|
420
452
|
Delete ctx by idx
|
421
453
|
|
@@ -469,7 +501,11 @@ class Ctx:
|
|
469
501
|
for idx in list(meta.indexes[store_id]):
|
470
502
|
self.window.core.ctx.idx.remove_meta_from_indexed(store_id, id, idx)
|
471
503
|
|
472
|
-
def delete_item(
|
504
|
+
def delete_item(
|
505
|
+
self,
|
506
|
+
id: int,
|
507
|
+
force: bool = False
|
508
|
+
):
|
473
509
|
"""
|
474
510
|
Delete ctx item by id
|
475
511
|
|
@@ -567,7 +603,11 @@ class Ctx:
|
|
567
603
|
self.window.ui.dialog['rename'].show()
|
568
604
|
self.update()
|
569
605
|
|
570
|
-
def set_important(
|
606
|
+
def set_important(
|
607
|
+
self,
|
608
|
+
id: int,
|
609
|
+
value: bool = True
|
610
|
+
):
|
571
611
|
"""
|
572
612
|
Set as important
|
573
613
|
|
@@ -593,7 +633,11 @@ class Ctx:
|
|
593
633
|
return meta.important
|
594
634
|
return False
|
595
635
|
|
596
|
-
def set_label(
|
636
|
+
def set_label(
|
637
|
+
self,
|
638
|
+
id: int,
|
639
|
+
label_id: int
|
640
|
+
):
|
597
641
|
"""
|
598
642
|
Set color label for ctx by idx
|
599
643
|
|
@@ -694,7 +738,7 @@ class Ctx:
|
|
694
738
|
self.window.ui.nodes['ctx.search'].setText(text)
|
695
739
|
self.search_string_change(text) # make search
|
696
740
|
|
697
|
-
def label_filters_changed(self, labels:
|
741
|
+
def label_filters_changed(self, labels: List[int]):
|
698
742
|
"""
|
699
743
|
Filters labels change
|
700
744
|
|
@@ -726,7 +770,7 @@ class Ctx:
|
|
726
770
|
"""
|
727
771
|
return self.window.controller.chat.input.generating
|
728
772
|
|
729
|
-
def select_index_by_id(self, id):
|
773
|
+
def select_index_by_id(self, id: int):
|
730
774
|
"""
|
731
775
|
Select item by ID on context list
|
732
776
|
|
@@ -737,7 +781,11 @@ class Ctx:
|
|
737
781
|
self.window.ui.nodes['ctx.list'].setCurrentIndex(index)
|
738
782
|
self.window.ui.nodes['ctx.list'].unlocked = False # tmp allow change if locked (disable)
|
739
783
|
|
740
|
-
def find_index_by_id(
|
784
|
+
def find_index_by_id(
|
785
|
+
self,
|
786
|
+
item: QStandardItem,
|
787
|
+
id: int
|
788
|
+
) -> QModelIndex:
|
741
789
|
"""
|
742
790
|
Return index of item with given ID, searching recursively through the model.
|
743
791
|
|
@@ -753,7 +801,11 @@ class Ctx:
|
|
753
801
|
return found_index
|
754
802
|
return QModelIndex()
|
755
803
|
|
756
|
-
def find_parent_index_by_id(
|
804
|
+
def find_parent_index_by_id(
|
805
|
+
self,
|
806
|
+
item: QStandardItem,
|
807
|
+
id: int
|
808
|
+
) -> QModelIndex:
|
757
809
|
"""
|
758
810
|
Return index of item with given ID, searching recursively through the model.
|
759
811
|
|
@@ -769,7 +821,7 @@ class Ctx:
|
|
769
821
|
return found_index
|
770
822
|
return QModelIndex()
|
771
823
|
|
772
|
-
def get_parent_index_by_id(self, id):
|
824
|
+
def get_parent_index_by_id(self, id: int) -> QModelIndex:
|
773
825
|
"""
|
774
826
|
Return QModelIndex of parent item based on its ID.
|
775
827
|
|
@@ -780,7 +832,11 @@ class Ctx:
|
|
780
832
|
root = model.invisibleRootItem()
|
781
833
|
return self.find_parent_index_by_id(root, id)
|
782
834
|
|
783
|
-
def get_children_index_by_id(
|
835
|
+
def get_children_index_by_id(
|
836
|
+
self,
|
837
|
+
parent_id: int,
|
838
|
+
child_id: int
|
839
|
+
) -> QModelIndex:
|
784
840
|
"""
|
785
841
|
Return QModelIndex of child item based on its ID and parent ID.
|
786
842
|
|
@@ -797,7 +853,11 @@ class Ctx:
|
|
797
853
|
parent_item = model.itemFromIndex(parent_index)
|
798
854
|
return self.find_index_by_id(parent_item, child_id)
|
799
855
|
|
800
|
-
def find_child_index_by_id(
|
856
|
+
def find_child_index_by_id(
|
857
|
+
self,
|
858
|
+
root_item: QStandardItem,
|
859
|
+
child_id: int
|
860
|
+
) -> QModelIndex:
|
801
861
|
"""
|
802
862
|
Find and return QModelIndex of child based on its ID, recursively searching through the model.
|
803
863
|
|
@@ -814,7 +874,7 @@ class Ctx:
|
|
814
874
|
return child_index
|
815
875
|
return QModelIndex()
|
816
876
|
|
817
|
-
def get_child_index_by_id(self, child_id):
|
877
|
+
def get_child_index_by_id(self, child_id: int) -> QModelIndex:
|
818
878
|
"""
|
819
879
|
Return QModelIndex of child item based on its ID.
|
820
880
|
|
@@ -848,7 +908,12 @@ class Ctx:
|
|
848
908
|
"""Save visible ctx list items"""
|
849
909
|
self.store_expanded_groups()
|
850
910
|
|
851
|
-
def move_to_group(
|
911
|
+
def move_to_group(
|
912
|
+
self,
|
913
|
+
meta_id: int,
|
914
|
+
group_id: int,
|
915
|
+
update: bool = True
|
916
|
+
):
|
852
917
|
"""
|
853
918
|
Move ctx to group
|
854
919
|
|
@@ -871,7 +936,10 @@ class Ctx:
|
|
871
936
|
self.group_id = None
|
872
937
|
self.update()
|
873
938
|
|
874
|
-
def new_group(
|
939
|
+
def new_group(
|
940
|
+
self,
|
941
|
+
meta_id: Optional[int] = None
|
942
|
+
):
|
875
943
|
"""
|
876
944
|
Open new group dialog
|
877
945
|
|
@@ -883,7 +951,11 @@ class Ctx:
|
|
883
951
|
self.window.ui.dialog['create'].show()
|
884
952
|
self.window.ui.dialog['create'].input.setFocus()
|
885
953
|
|
886
|
-
def create_group(
|
954
|
+
def create_group(
|
955
|
+
self,
|
956
|
+
name: Optional[str] = None,
|
957
|
+
meta_id: Optional[int] = None
|
958
|
+
):
|
887
959
|
"""
|
888
960
|
Make directory
|
889
961
|
|
@@ -910,7 +982,11 @@ class Ctx:
|
|
910
982
|
self.select_group(id)
|
911
983
|
self.group_id = id
|
912
984
|
|
913
|
-
def rename_group(
|
985
|
+
def rename_group(
|
986
|
+
self,
|
987
|
+
id: int,
|
988
|
+
force: bool = False
|
989
|
+
):
|
914
990
|
"""
|
915
991
|
Rename group
|
916
992
|
|
@@ -926,7 +1002,12 @@ class Ctx:
|
|
926
1002
|
self.window.ui.dialog['rename'].current = id
|
927
1003
|
self.window.ui.dialog['rename'].show()
|
928
1004
|
|
929
|
-
def update_group_name(
|
1005
|
+
def update_group_name(
|
1006
|
+
self,
|
1007
|
+
id: int,
|
1008
|
+
name: str,
|
1009
|
+
close: bool = True
|
1010
|
+
):
|
930
1011
|
"""
|
931
1012
|
Update group name
|
932
1013
|
|
@@ -967,7 +1048,11 @@ class Ctx:
|
|
967
1048
|
self.window.ui.nodes['ctx.list'].setCurrentIndex(index)
|
968
1049
|
self.window.ui.nodes['ctx.list'].unlocked = False # tmp allow change if locked (disable)
|
969
1050
|
|
970
|
-
def delete_group(
|
1051
|
+
def delete_group(
|
1052
|
+
self,
|
1053
|
+
id: int,
|
1054
|
+
force: bool = False
|
1055
|
+
):
|
971
1056
|
"""
|
972
1057
|
Delete group only
|
973
1058
|
|
@@ -988,7 +1073,11 @@ class Ctx:
|
|
988
1073
|
self.group_id = None
|
989
1074
|
self.update()
|
990
1075
|
|
991
|
-
def delete_group_all(
|
1076
|
+
def delete_group_all(
|
1077
|
+
self,
|
1078
|
+
id: int,
|
1079
|
+
force: bool = False
|
1080
|
+
):
|
992
1081
|
"""
|
993
1082
|
Delete group with all items
|
994
1083
|
|
@@ -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 Optional
|
13
|
+
|
12
14
|
from PySide6.QtWidgets import QApplication
|
13
15
|
|
14
16
|
from pygpt_net.core.tabs.tab import Tab
|
@@ -53,7 +55,11 @@ class Common:
|
|
53
55
|
# update ctx label
|
54
56
|
self.window.controller.ui.update_ctx_label(label)
|
55
57
|
|
56
|
-
def update_label(
|
58
|
+
def update_label(
|
59
|
+
self,
|
60
|
+
mode: str,
|
61
|
+
assistant_id: Optional[str] = None
|
62
|
+
):
|
57
63
|
"""
|
58
64
|
Update ctx label
|
59
65
|
|
@@ -91,10 +97,11 @@ class Common:
|
|
91
97
|
|
92
98
|
def focus_chat(self):
|
93
99
|
"""Focus chat"""
|
100
|
+
tabs = self.window.ui.layout.get_active_tabs()
|
94
101
|
if self.window.controller.ui.tabs.get_current_type() != Tab.TAB_CHAT:
|
95
102
|
idx = self.window.core.tabs.get_min_idx_by_type(Tab.TAB_CHAT)
|
96
103
|
if idx is not None:
|
97
|
-
|
104
|
+
tabs.setCurrentIndex(idx)
|
98
105
|
|
99
106
|
def restore_display_filter(self):
|
100
107
|
"""Restore display filter"""
|
@@ -159,7 +166,11 @@ class Common:
|
|
159
166
|
self.window.controller.chat.common.append_to_input(value, separator=" ")
|
160
167
|
QApplication.clipboard().setText(value)
|
161
168
|
|
162
|
-
def reset(
|
169
|
+
def reset(
|
170
|
+
self,
|
171
|
+
meta_id: int,
|
172
|
+
force: bool = False
|
173
|
+
):
|
163
174
|
"""
|
164
175
|
Reset by meta id
|
165
176
|
|