pygpt-net 2.4.41__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 +8 -0
- README.md +135 -70
- pygpt_net/CHANGELOG.txt +8 -0
- pygpt_net/__init__.py +3 -3
- pygpt_net/app.py +3 -1
- pygpt_net/controller/audio/__init__.py +2 -2
- pygpt_net/controller/camera.py +1 -10
- pygpt_net/controller/chat/audio.py +2 -2
- pygpt_net/controller/config/placeholder.py +15 -1
- pygpt_net/controller/ui/mode.py +16 -21
- pygpt_net/core/audio/__init__.py +4 -1
- pygpt_net/core/audio/whisper.py +37 -0
- pygpt_net/core/bridge/worker.py +2 -2
- pygpt_net/core/debug/events.py +22 -10
- pygpt_net/core/debug/tabs.py +6 -3
- pygpt_net/core/history.py +3 -2
- pygpt_net/core/idx/__init__.py +16 -4
- pygpt_net/core/idx/chat.py +15 -5
- pygpt_net/core/idx/indexing.py +24 -8
- pygpt_net/core/installer.py +2 -4
- pygpt_net/core/models.py +62 -17
- pygpt_net/core/modes.py +11 -13
- pygpt_net/core/notepad.py +4 -4
- pygpt_net/core/plugins.py +27 -16
- pygpt_net/core/presets.py +20 -9
- pygpt_net/core/profile.py +11 -3
- pygpt_net/core/render/web/parser.py +3 -1
- pygpt_net/core/settings.py +5 -5
- pygpt_net/core/tabs/tab.py +10 -2
- pygpt_net/core/tokens.py +8 -6
- pygpt_net/core/web/__init__.py +105 -0
- pygpt_net/core/{web.py → web/helpers.py} +93 -67
- pygpt_net/data/config/config.json +3 -3
- pygpt_net/data/config/models.json +3 -3
- pygpt_net/data/config/modes.json +3 -3
- pygpt_net/data/locale/locale.en.ini +1 -0
- pygpt_net/data/locale/plugin.cmd_web.en.ini +2 -0
- pygpt_net/data/locale/plugin.mailer.en.ini +21 -0
- pygpt_net/item/ctx.py +13 -2
- pygpt_net/plugin/agent/__init__.py +7 -2
- pygpt_net/plugin/audio_output/__init__.py +6 -1
- pygpt_net/plugin/base/plugin.py +58 -26
- pygpt_net/plugin/base/worker.py +20 -17
- pygpt_net/plugin/cmd_history/config.py +2 -2
- pygpt_net/plugin/cmd_web/__init__.py +3 -4
- pygpt_net/plugin/cmd_web/config.py +71 -3
- pygpt_net/plugin/cmd_web/websearch.py +20 -12
- pygpt_net/plugin/cmd_web/worker.py +67 -4
- pygpt_net/plugin/idx_llama_index/config.py +3 -3
- pygpt_net/plugin/mailer/__init__.py +123 -0
- pygpt_net/plugin/mailer/config.py +149 -0
- pygpt_net/plugin/mailer/runner.py +285 -0
- pygpt_net/plugin/mailer/worker.py +123 -0
- pygpt_net/provider/agents/base.py +5 -2
- pygpt_net/provider/agents/openai.py +4 -2
- pygpt_net/provider/agents/openai_assistant.py +4 -2
- pygpt_net/provider/agents/planner.py +4 -2
- pygpt_net/provider/agents/react.py +4 -2
- pygpt_net/provider/audio_output/openai_tts.py +5 -11
- pygpt_net/provider/core/assistant/base.py +5 -3
- pygpt_net/provider/core/assistant/json_file.py +8 -5
- pygpt_net/provider/core/assistant_file/base.py +4 -3
- pygpt_net/provider/core/assistant_file/db_sqlite/__init__.py +4 -3
- pygpt_net/provider/core/assistant_file/db_sqlite/storage.py +3 -2
- pygpt_net/provider/core/assistant_store/base.py +6 -4
- pygpt_net/provider/core/assistant_store/db_sqlite/__init__.py +5 -4
- pygpt_net/provider/core/assistant_store/db_sqlite/storage.py +5 -3
- pygpt_net/provider/core/attachment/base.py +5 -3
- pygpt_net/provider/core/attachment/json_file.py +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/ctx/base.py +27 -25
- pygpt_net/provider/core/ctx/db_sqlite/__init__.py +51 -35
- pygpt_net/provider/core/ctx/db_sqlite/storage.py +42 -31
- 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 +15 -6
- pygpt_net/provider/gpt/audio.py +5 -5
- pygpt_net/provider/gpt/chat.py +7 -5
- pygpt_net/provider/gpt/completion.py +8 -4
- pygpt_net/provider/gpt/image.py +3 -3
- pygpt_net/provider/gpt/store.py +46 -12
- pygpt_net/provider/gpt/vision.py +16 -11
- pygpt_net/provider/llms/anthropic.py +7 -2
- pygpt_net/provider/llms/azure_openai.py +26 -5
- pygpt_net/provider/llms/base.py +47 -9
- pygpt_net/provider/llms/google.py +7 -2
- pygpt_net/provider/llms/hugging_face.py +13 -3
- pygpt_net/provider/llms/hugging_face_api.py +18 -4
- pygpt_net/provider/llms/local.py +7 -2
- pygpt_net/provider/llms/ollama.py +30 -6
- pygpt_net/provider/llms/openai.py +32 -6
- pygpt_net/provider/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 +13 -5
- pygpt_net/tools/audio_transcriber/__init__.py +4 -3
- pygpt_net/tools/base.py +15 -8
- pygpt_net/tools/code_interpreter/__init__.py +4 -3
- pygpt_net/tools/html_canvas/__init__.py +4 -3
- pygpt_net/tools/image_viewer/__init__.py +10 -4
- pygpt_net/tools/indexer/__init__.py +8 -7
- pygpt_net/tools/media_player/__init__.py +4 -3
- pygpt_net/tools/text_editor/__init__.py +36 -10
- pygpt_net/ui/layout/chat/output.py +2 -2
- pygpt_net/ui/menu/audio.py +12 -1
- {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.42.dist-info}/METADATA +136 -71
- {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.42.dist-info}/RECORD +139 -132
- {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.42.dist-info}/LICENSE +0 -0
- {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.42.dist-info}/WHEEL +0 -0
- {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.42.dist-info}/entry_points.txt +0 -0
pygpt_net/tools/base.py
CHANGED
@@ -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.12.
|
9
|
+
# Updated Date: 2024.12.14 22:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
|
+
from typing import Optional, Dict
|
13
|
+
|
12
14
|
from PySide6.QtCore import QObject
|
15
|
+
from PySide6.QtGui import QAction
|
13
16
|
from PySide6.QtWidgets import QWidget
|
14
17
|
|
15
18
|
from pygpt_net.core.tabs.tab import Tab
|
@@ -63,13 +66,13 @@ class BaseTool(QObject):
|
|
63
66
|
"""
|
64
67
|
self.window = window
|
65
68
|
|
66
|
-
def setup_menu(self) ->
|
69
|
+
def setup_menu(self) -> Dict[str, QAction]:
|
67
70
|
"""
|
68
71
|
Setup main menu
|
69
72
|
|
70
|
-
:return
|
73
|
+
:return dict with menu actions
|
71
74
|
"""
|
72
|
-
return
|
75
|
+
return {}
|
73
76
|
|
74
77
|
def setup_dialogs(self):
|
75
78
|
"""Setup dialogs (static)"""
|
@@ -79,16 +82,20 @@ class BaseTool(QObject):
|
|
79
82
|
"""Setup theme"""
|
80
83
|
pass
|
81
84
|
|
82
|
-
def get_instance(
|
85
|
+
def get_instance(
|
86
|
+
self,
|
87
|
+
type_id: str,
|
88
|
+
dialog_id: Optional[str] = None
|
89
|
+
) -> Optional[BaseDialog]:
|
83
90
|
"""
|
84
91
|
Spawn and return dialog instance
|
85
92
|
|
86
|
-
:param
|
93
|
+
:param type_id: dialog instance ID
|
87
94
|
:param dialog_id: dialog instance ID
|
88
95
|
"""
|
89
96
|
return None
|
90
97
|
|
91
|
-
def as_tab(self, tab: Tab) -> QWidget
|
98
|
+
def as_tab(self, tab: Tab) -> Optional[QWidget]:
|
92
99
|
"""
|
93
100
|
Spawn and return tab instance
|
94
101
|
|
@@ -97,7 +104,7 @@ class BaseTool(QObject):
|
|
97
104
|
"""
|
98
105
|
return None
|
99
106
|
|
100
|
-
def get_lang_mappings(self) ->
|
107
|
+
def get_lang_mappings(self) -> Dict[str, Dict]:
|
101
108
|
"""
|
102
109
|
Get language mappings
|
103
110
|
|
@@ -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.12.
|
9
|
+
# Updated Date: 2024.12.14 22:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import os
|
13
|
+
from typing import Dict
|
13
14
|
|
14
15
|
from PySide6.QtCore import QTimer
|
15
16
|
from PySide6.QtGui import QTextCursor, QAction, QIcon
|
@@ -507,7 +508,7 @@ class CodeInterpreter(BaseTool):
|
|
507
508
|
cur.movePosition(QTextCursor.End)
|
508
509
|
self.get_widget_history().setTextCursor(cur)
|
509
510
|
|
510
|
-
def setup_menu(self) ->
|
511
|
+
def setup_menu(self) -> Dict[str, QAction]:
|
511
512
|
"""
|
512
513
|
Setup main menu
|
513
514
|
|
@@ -549,7 +550,7 @@ class CodeInterpreter(BaseTool):
|
|
549
550
|
"""Setup theme"""
|
550
551
|
self.get_widget_output().value = self.window.core.config.get('font_size')
|
551
552
|
|
552
|
-
def get_lang_mappings(self) ->
|
553
|
+
def get_lang_mappings(self) -> Dict[str, Dict]:
|
553
554
|
"""
|
554
555
|
Get language mappings
|
555
556
|
|
@@ -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.12.
|
9
|
+
# Updated Date: 2024.12.14 22:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import os
|
13
|
+
from typing import Dict
|
13
14
|
|
14
15
|
from PySide6.QtCore import QTimer, Slot
|
15
16
|
from PySide6.QtGui import QAction, QIcon
|
@@ -265,7 +266,7 @@ class HtmlCanvas(BaseTool):
|
|
265
266
|
# fix: QTimer required here to prevent crash if signal emitted from WebEngine window
|
266
267
|
QTimer.singleShot(0, lambda: self.window.controller.chat.common.save_text(text, type))
|
267
268
|
|
268
|
-
def setup_menu(self) ->
|
269
|
+
def setup_menu(self) -> Dict[str, QAction]:
|
269
270
|
"""
|
270
271
|
Setup main menu
|
271
272
|
|
@@ -306,7 +307,7 @@ class HtmlCanvas(BaseTool):
|
|
306
307
|
"""Setup theme"""
|
307
308
|
pass
|
308
309
|
|
309
|
-
def get_lang_mappings(self) ->
|
310
|
+
def get_lang_mappings(self) -> Dict[str, Dict]:
|
310
311
|
"""
|
311
312
|
Get language mappings
|
312
313
|
|
@@ -6,12 +6,13 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date: 2024.
|
9
|
+
# Updated Date: 2024.12.14 22:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import hashlib
|
13
13
|
import os
|
14
14
|
import shutil
|
15
|
+
from typing import Dict, Optional
|
15
16
|
|
16
17
|
from PySide6 import QtGui, QtCore
|
17
18
|
from PySide6.QtGui import QAction, QIcon
|
@@ -19,6 +20,7 @@ from PySide6.QtWidgets import QFileDialog
|
|
19
20
|
|
20
21
|
from pygpt_net.tools.base import BaseTool
|
21
22
|
from pygpt_net.tools.image_viewer.ui.dialogs import DialogSpawner
|
23
|
+
from pygpt_net.ui.widget.dialog.base import BaseDialog
|
22
24
|
from pygpt_net.utils import trans
|
23
25
|
|
24
26
|
|
@@ -255,7 +257,7 @@ class ImageViewer(BaseTool):
|
|
255
257
|
except Exception as e:
|
256
258
|
self.window.core.debug.log(e)
|
257
259
|
|
258
|
-
def setup_menu(self) ->
|
260
|
+
def setup_menu(self) -> Dict[str, QAction]:
|
259
261
|
"""
|
260
262
|
Setup main menu
|
261
263
|
|
@@ -273,7 +275,11 @@ class ImageViewer(BaseTool):
|
|
273
275
|
)
|
274
276
|
return actions
|
275
277
|
|
276
|
-
def get_instance(
|
278
|
+
def get_instance(
|
279
|
+
self,
|
280
|
+
type_id: str,
|
281
|
+
dialog_id: Optional[str] = None
|
282
|
+
) -> Optional[BaseDialog]:
|
277
283
|
"""
|
278
284
|
Spawn and return dialog instance
|
279
285
|
|
@@ -284,7 +290,7 @@ class ImageViewer(BaseTool):
|
|
284
290
|
if type_id == "image_viewer":
|
285
291
|
return self.spawner.setup(dialog_id)
|
286
292
|
|
287
|
-
def get_lang_mappings(self) ->
|
293
|
+
def get_lang_mappings(self) -> Dict[str, Dict]:
|
288
294
|
"""
|
289
295
|
Get language mappings
|
290
296
|
|
@@ -6,11 +6,12 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date: 2024.
|
9
|
+
# Updated Date: 2024.12.14 22:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import datetime
|
13
13
|
import json
|
14
|
+
from typing import Dict, Any, List
|
14
15
|
|
15
16
|
from PySide6.QtCore import Slot
|
16
17
|
from PySide6.QtGui import QAction, QIcon, QTextCursor
|
@@ -200,7 +201,7 @@ class IndexerTool(BaseTool):
|
|
200
201
|
last_str = datetime.datetime.fromtimestamp(last_ts).strftime('%Y-%m-%d %H:%M:%S')
|
201
202
|
self.window.ui.nodes['tool.indexer.ctx.last_auto'].setText(last_str)
|
202
203
|
|
203
|
-
def update_tab_files(self):
|
204
|
+
def update_tab_files(self) -> List[str]:
|
204
205
|
"""
|
205
206
|
Update files tab
|
206
207
|
|
@@ -420,7 +421,7 @@ class IndexerTool(BaseTool):
|
|
420
421
|
self.refresh()
|
421
422
|
|
422
423
|
@Slot(object)
|
423
|
-
def handle_log(self, data:
|
424
|
+
def handle_log(self, data: Any):
|
424
425
|
"""
|
425
426
|
Handle log message
|
426
427
|
|
@@ -428,7 +429,7 @@ class IndexerTool(BaseTool):
|
|
428
429
|
"""
|
429
430
|
self.log(data)
|
430
431
|
|
431
|
-
def log(self, data:
|
432
|
+
def log(self, data: Any):
|
432
433
|
"""
|
433
434
|
Log message to console or logger window
|
434
435
|
|
@@ -451,7 +452,7 @@ class IndexerTool(BaseTool):
|
|
451
452
|
"""Clear log"""
|
452
453
|
self.window.ui.nodes["tool.indexer.status"].clear()
|
453
454
|
|
454
|
-
def get_tables(self) ->
|
455
|
+
def get_tables(self) -> Dict[str, Dict]:
|
455
456
|
"""
|
456
457
|
Get tables configuration
|
457
458
|
|
@@ -513,7 +514,7 @@ class IndexerTool(BaseTool):
|
|
513
514
|
}
|
514
515
|
return tables
|
515
516
|
|
516
|
-
def setup_menu(self) ->
|
517
|
+
def setup_menu(self) -> Dict[str, QAction]:
|
517
518
|
"""
|
518
519
|
Setup main menu (Tools)
|
519
520
|
|
@@ -536,7 +537,7 @@ class IndexerTool(BaseTool):
|
|
536
537
|
self.dialog = DialogBuilder(self.window)
|
537
538
|
self.dialog.setup()
|
538
539
|
|
539
|
-
def get_lang_mappings(self) ->
|
540
|
+
def get_lang_mappings(self) -> Dict[str, Dict]:
|
540
541
|
"""
|
541
542
|
Get language mappings
|
542
543
|
|
@@ -6,12 +6,13 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date: 2024.
|
9
|
+
# Updated Date: 2024.12.14 22:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import datetime
|
13
13
|
import os.path
|
14
14
|
import shutil
|
15
|
+
from typing import Dict
|
15
16
|
|
16
17
|
from PySide6.QtGui import QAction, QIcon
|
17
18
|
|
@@ -165,7 +166,7 @@ class MediaPlayer(BaseTool):
|
|
165
166
|
else:
|
166
167
|
self.close()
|
167
168
|
|
168
|
-
def setup_menu(self) ->
|
169
|
+
def setup_menu(self) -> Dict[str, QAction]:
|
169
170
|
"""
|
170
171
|
Setup main menu
|
171
172
|
|
@@ -188,7 +189,7 @@ class MediaPlayer(BaseTool):
|
|
188
189
|
self.dialog = VideoPlayer(self.window)
|
189
190
|
self.dialog.setup()
|
190
191
|
|
191
|
-
def get_lang_mappings(self) ->
|
192
|
+
def get_lang_mappings(self) -> Dict[str, Dict]:
|
192
193
|
"""
|
193
194
|
Get language mappings
|
194
195
|
|
@@ -6,17 +6,19 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date: 2024.
|
9
|
+
# Updated Date: 2024.12.14 22:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import hashlib
|
13
13
|
import os
|
14
|
+
from typing import Dict, Optional
|
14
15
|
|
15
16
|
from PySide6.QtGui import QAction, QIcon
|
16
17
|
from PySide6.QtWidgets import QFileDialog
|
17
18
|
|
18
19
|
from pygpt_net.tools.base import BaseTool
|
19
20
|
from pygpt_net.tools.text_editor.ui.dialogs import DialogSpawner
|
21
|
+
from pygpt_net.ui.widget.dialog.base import BaseDialog
|
20
22
|
from pygpt_net.utils import trans
|
21
23
|
|
22
24
|
|
@@ -47,7 +49,13 @@ class TextEditor(BaseTool):
|
|
47
49
|
"""
|
48
50
|
return 'file_editor_' + hashlib.md5(file.encode('utf-8')).hexdigest()
|
49
51
|
|
50
|
-
def open_file(
|
52
|
+
def open_file(
|
53
|
+
self,
|
54
|
+
id: str,
|
55
|
+
auto_close: bool = True,
|
56
|
+
force: bool = False,
|
57
|
+
save: bool = False
|
58
|
+
):
|
51
59
|
"""
|
52
60
|
Open text file dialog
|
53
61
|
|
@@ -73,7 +81,12 @@ class TextEditor(BaseTool):
|
|
73
81
|
if path:
|
74
82
|
self.open(path, id, auto_close)
|
75
83
|
|
76
|
-
def clear(
|
84
|
+
def clear(
|
85
|
+
self,
|
86
|
+
id: str = None,
|
87
|
+
force: bool = False,
|
88
|
+
save: bool = False
|
89
|
+
):
|
77
90
|
"""
|
78
91
|
Clear current instance
|
79
92
|
|
@@ -101,8 +114,8 @@ class TextEditor(BaseTool):
|
|
101
114
|
|
102
115
|
def open(
|
103
116
|
self,
|
104
|
-
file: str = None,
|
105
|
-
current_id: str = None,
|
117
|
+
file: Optional[str] = None,
|
118
|
+
current_id: Optional[str] = None,
|
106
119
|
auto_close: bool = True,
|
107
120
|
force: bool = False):
|
108
121
|
"""
|
@@ -153,7 +166,11 @@ class TextEditor(BaseTool):
|
|
153
166
|
else:
|
154
167
|
self.window.core.filesystem.editor.clear(id) # clear editor if no file
|
155
168
|
|
156
|
-
def close(
|
169
|
+
def close(
|
170
|
+
self,
|
171
|
+
id: str,
|
172
|
+
save: bool = False
|
173
|
+
):
|
157
174
|
"""
|
158
175
|
Close file editor
|
159
176
|
|
@@ -180,7 +197,12 @@ class TextEditor(BaseTool):
|
|
180
197
|
id = self.save_as_file(id)
|
181
198
|
return id
|
182
199
|
|
183
|
-
def restore(
|
200
|
+
def restore(
|
201
|
+
self,
|
202
|
+
id: str,
|
203
|
+
force: bool = False,
|
204
|
+
save: bool = False
|
205
|
+
):
|
184
206
|
"""
|
185
207
|
Restore file content
|
186
208
|
|
@@ -225,7 +247,7 @@ class TextEditor(BaseTool):
|
|
225
247
|
self.window.core.filesystem.editor.save(id, path)
|
226
248
|
return id
|
227
249
|
|
228
|
-
def setup_menu(self) ->
|
250
|
+
def setup_menu(self) -> Dict[str, QAction]:
|
229
251
|
"""
|
230
252
|
Setup main menu
|
231
253
|
|
@@ -243,7 +265,11 @@ class TextEditor(BaseTool):
|
|
243
265
|
)
|
244
266
|
return actions
|
245
267
|
|
246
|
-
def get_instance(
|
268
|
+
def get_instance(
|
269
|
+
self,
|
270
|
+
type_id: str,
|
271
|
+
dialog_id: Optional[str] = None
|
272
|
+
) -> Optional[BaseDialog]:
|
247
273
|
"""
|
248
274
|
Spawn and return dialog instance
|
249
275
|
|
@@ -254,7 +280,7 @@ class TextEditor(BaseTool):
|
|
254
280
|
if type_id == "text_editor":
|
255
281
|
return self.spawner.setup(dialog_id)
|
256
282
|
|
257
|
-
def get_lang_mappings(self) ->
|
283
|
+
def get_lang_mappings(self) -> Dict[str, Dict]:
|
258
284
|
"""
|
259
285
|
Get language mappings
|
260
286
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date: 2024.12.
|
9
|
+
# Updated Date: 2024.12.14 19:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
from PySide6.QtCore import Qt
|
@@ -192,7 +192,7 @@ class Output:
|
|
192
192
|
right_layout.addWidget(self.window.ui.nodes['prompt.context'])
|
193
193
|
right_layout.addWidget(QLabel(" "))
|
194
194
|
right_layout.addWidget(self.window.ui.nodes['input.counter'])
|
195
|
-
right_layout.setContentsMargins(0,
|
195
|
+
right_layout.setContentsMargins(0, 8, 20, 0)
|
196
196
|
|
197
197
|
left_widget = QWidget()
|
198
198
|
left_widget.setLayout(left_layout)
|
pygpt_net/ui/menu/audio.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date: 2024.
|
9
|
+
# Updated Date: 2024.12.14 18:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
from PySide6.QtGui import QAction, QIcon
|
@@ -52,6 +52,13 @@ class Audio:
|
|
52
52
|
checkable=False,
|
53
53
|
)
|
54
54
|
|
55
|
+
self.window.ui.menu['audio.stop'] = QAction(
|
56
|
+
QIcon(":/icons/mute.svg"),
|
57
|
+
trans("menu.audio.stop"),
|
58
|
+
self.window,
|
59
|
+
checkable=False,
|
60
|
+
)
|
61
|
+
|
55
62
|
self.window.ui.menu['audio.output'].triggered.connect(
|
56
63
|
lambda: self.window.controller.plugins.toggle('audio_output')
|
57
64
|
)
|
@@ -67,6 +74,9 @@ class Audio:
|
|
67
74
|
self.window.ui.menu['audio.cache.clear'].triggered.connect(
|
68
75
|
lambda: self.window.controller.audio.clear_cache()
|
69
76
|
)
|
77
|
+
self.window.ui.menu['audio.stop'].triggered.connect(
|
78
|
+
lambda: self.window.controller.audio.stop_audio()
|
79
|
+
)
|
70
80
|
|
71
81
|
self.window.ui.menu['menu.audio'] = self.window.menuBar().addMenu(trans("menu.audio"))
|
72
82
|
self.window.ui.menu['menu.audio'].addAction(self.window.ui.menu['audio.input'])
|
@@ -76,3 +86,4 @@ class Audio:
|
|
76
86
|
self.window.ui.menu['menu.audio'].addAction(self.window.ui.menu['audio.control.global'])
|
77
87
|
self.window.ui.menu['menu.audio'].addSeparator()
|
78
88
|
self.window.ui.menu['menu.audio'].addAction(self.window.ui.menu['audio.cache.clear'])
|
89
|
+
self.window.ui.menu['menu.audio'].addAction(self.window.ui.menu['audio.stop'])
|