pygpt-net 2.4.30__py3-none-any.whl → 2.4.34__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 +24 -0
- README.md +46 -5
- pygpt_net/CHANGELOG.txt +24 -0
- pygpt_net/__init__.py +3 -3
- pygpt_net/controller/access/__init__.py +5 -5
- pygpt_net/controller/access/control.py +3 -2
- pygpt_net/controller/attachment.py +67 -1
- pygpt_net/controller/audio/__init__.py +34 -6
- pygpt_net/controller/chat/__init__.py +3 -1
- pygpt_net/controller/chat/attachment.py +239 -37
- pygpt_net/controller/chat/audio.py +99 -0
- pygpt_net/controller/chat/input.py +10 -3
- pygpt_net/controller/chat/output.py +4 -1
- pygpt_net/controller/chat/text.py +7 -3
- pygpt_net/controller/dialogs/confirm.py +17 -1
- pygpt_net/controller/lang/custom.py +3 -1
- pygpt_net/controller/mode.py +2 -1
- pygpt_net/controller/presets/editor.py +11 -2
- pygpt_net/core/access/voice.py +2 -2
- pygpt_net/core/agents/legacy.py +3 -1
- pygpt_net/core/attachments/__init__.py +11 -7
- pygpt_net/core/attachments/context.py +226 -44
- pygpt_net/core/{audio.py → audio/__init__.py} +1 -1
- pygpt_net/core/audio/context.py +34 -0
- pygpt_net/core/bridge/context.py +29 -1
- pygpt_net/core/ctx/__init__.py +4 -1
- pygpt_net/core/db/__init__.py +4 -2
- pygpt_net/core/debug/attachments.py +3 -1
- pygpt_net/core/debug/context.py +5 -1
- pygpt_net/core/debug/presets.py +3 -1
- pygpt_net/core/events/event.py +2 -1
- pygpt_net/core/experts/__init__.py +3 -1
- pygpt_net/core/idx/chat.py +28 -6
- pygpt_net/core/idx/indexing.py +123 -15
- pygpt_net/core/modes.py +3 -1
- pygpt_net/core/presets.py +13 -2
- pygpt_net/core/render/markdown/pid.py +2 -1
- pygpt_net/core/render/plain/pid.py +2 -1
- pygpt_net/core/render/web/body.py +34 -12
- pygpt_net/core/render/web/pid.py +2 -1
- pygpt_net/core/render/web/renderer.py +8 -3
- pygpt_net/core/tokens.py +4 -2
- pygpt_net/core/types/mode.py +2 -1
- pygpt_net/data/config/config.json +5 -3
- pygpt_net/data/config/models.json +190 -5
- pygpt_net/data/config/modes.json +11 -5
- pygpt_net/data/config/presets/current.audio.json +34 -0
- pygpt_net/data/config/settings.json +15 -1
- pygpt_net/data/css/web.css +70 -0
- pygpt_net/data/css/web.dark.css +4 -1
- pygpt_net/data/css/web.light.css +1 -1
- pygpt_net/data/locale/locale.de.ini +26 -13
- pygpt_net/data/locale/locale.en.ini +61 -46
- pygpt_net/data/locale/locale.es.ini +26 -13
- pygpt_net/data/locale/locale.fr.ini +28 -15
- pygpt_net/data/locale/locale.it.ini +26 -13
- pygpt_net/data/locale/locale.pl.ini +30 -17
- pygpt_net/data/locale/locale.uk.ini +26 -13
- pygpt_net/data/locale/locale.zh.ini +33 -20
- pygpt_net/data/locale/plugin.cmd_files.de.ini +4 -4
- pygpt_net/data/locale/plugin.cmd_files.en.ini +4 -4
- pygpt_net/data/locale/plugin.cmd_files.es.ini +4 -4
- pygpt_net/data/locale/plugin.cmd_files.fr.ini +4 -4
- pygpt_net/data/locale/plugin.cmd_files.it.ini +4 -4
- pygpt_net/data/locale/plugin.cmd_files.pl.ini +4 -4
- pygpt_net/data/locale/plugin.cmd_files.uk.ini +4 -4
- pygpt_net/data/locale/plugin.cmd_files.zh.ini +4 -4
- pygpt_net/data/locale/plugin.cmd_web.de.ini +5 -5
- pygpt_net/data/locale/plugin.cmd_web.en.ini +5 -5
- pygpt_net/data/locale/plugin.cmd_web.es.ini +5 -5
- pygpt_net/data/locale/plugin.cmd_web.fr.ini +5 -5
- pygpt_net/data/locale/plugin.cmd_web.it.ini +5 -5
- pygpt_net/data/locale/plugin.cmd_web.pl.ini +5 -5
- pygpt_net/data/locale/plugin.cmd_web.uk.ini +5 -5
- pygpt_net/data/locale/plugin.cmd_web.zh.ini +5 -5
- pygpt_net/data/locale/plugin.idx_llama_index.de.ini +12 -12
- pygpt_net/data/locale/plugin.idx_llama_index.en.ini +12 -12
- pygpt_net/data/locale/plugin.idx_llama_index.es.ini +12 -12
- pygpt_net/data/locale/plugin.idx_llama_index.fr.ini +12 -12
- pygpt_net/data/locale/plugin.idx_llama_index.it.ini +12 -12
- pygpt_net/data/locale/plugin.idx_llama_index.pl.ini +12 -12
- pygpt_net/data/locale/plugin.idx_llama_index.uk.ini +12 -12
- pygpt_net/data/locale/plugin.idx_llama_index.zh.ini +12 -12
- pygpt_net/item/attachment.py +9 -1
- pygpt_net/item/ctx.py +9 -1
- pygpt_net/item/preset.py +5 -1
- pygpt_net/launcher.py +3 -1
- pygpt_net/migrations/Version20241126170000.py +28 -0
- pygpt_net/migrations/__init__.py +3 -1
- pygpt_net/plugin/audio_input/__init__.py +11 -1
- pygpt_net/plugin/audio_input/worker.py +9 -1
- pygpt_net/plugin/audio_output/__init__.py +37 -7
- pygpt_net/plugin/audio_output/worker.py +38 -41
- pygpt_net/plugin/cmd_code_interpreter/runner.py +2 -2
- pygpt_net/plugin/cmd_mouse_control/__init__.py +4 -2
- pygpt_net/plugin/openai_dalle/__init__.py +3 -1
- pygpt_net/plugin/openai_vision/__init__.py +3 -1
- pygpt_net/provider/core/attachment/json_file.py +4 -1
- pygpt_net/provider/core/config/patch.py +16 -0
- pygpt_net/provider/core/ctx/db_sqlite/storage.py +14 -4
- pygpt_net/provider/core/ctx/db_sqlite/utils.py +19 -2
- pygpt_net/provider/core/model/patch.py +7 -1
- pygpt_net/provider/core/preset/json_file.py +5 -1
- pygpt_net/provider/gpt/__init__.py +14 -2
- pygpt_net/provider/gpt/audio.py +63 -0
- pygpt_net/provider/gpt/chat.py +76 -44
- pygpt_net/provider/gpt/utils.py +27 -0
- pygpt_net/provider/gpt/vision.py +37 -15
- pygpt_net/provider/loaders/base.py +10 -1
- pygpt_net/provider/loaders/web_yt.py +19 -1
- pygpt_net/tools/image_viewer/ui/dialogs.py +3 -1
- pygpt_net/ui/dialog/preset.py +3 -1
- pygpt_net/ui/dialog/url.py +29 -0
- pygpt_net/ui/dialogs.py +5 -1
- pygpt_net/ui/layout/chat/attachments.py +42 -6
- pygpt_net/ui/layout/chat/attachments_ctx.py +14 -4
- pygpt_net/ui/layout/chat/attachments_uploaded.py +8 -4
- pygpt_net/ui/widget/dialog/url.py +59 -0
- pygpt_net/ui/widget/lists/attachment.py +22 -17
- pygpt_net/ui/widget/lists/attachment_ctx.py +65 -3
- pygpt_net/ui/widget/textarea/url.py +43 -0
- {pygpt_net-2.4.30.dist-info → pygpt_net-2.4.34.dist-info}/METADATA +48 -7
- {pygpt_net-2.4.30.dist-info → pygpt_net-2.4.34.dist-info}/RECORD +126 -117
- {pygpt_net-2.4.30.dist-info → pygpt_net-2.4.34.dist-info}/LICENSE +0 -0
- {pygpt_net-2.4.30.dist-info → pygpt_net-2.4.34.dist-info}/WHEEL +0 -0
- {pygpt_net-2.4.30.dist-info → pygpt_net-2.4.34.dist-info}/entry_points.txt +0 -0
CHANGELOG.md
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 2.4.34 (2024-11-26)
|
4
|
+
|
5
|
+
- Added a new mode: `Chat with Audio`, with built-in multimodal support for audio input/output. Currently in beta, the execution of commands and tools in this mode is temporarily unavailable.
|
6
|
+
- Added new models: `gpt-4o-audio-preview`, `gpt-4o-2024-11-20`, `chatgpt-4o-latest`.
|
7
|
+
- Force disabled integration with the native system menu.
|
8
|
+
|
9
|
+
## 2.4.33 (2024-11-26)
|
10
|
+
|
11
|
+
- Improved CSS and rendering of file and image lists.
|
12
|
+
- Added displaying of used attachments in the chat window.
|
13
|
+
|
14
|
+
## 2.4.32 (2024-11-26)
|
15
|
+
|
16
|
+
- The "Add URL" option added to the "Attachments" tab allows users to include content from a given website as additional context. Currently, it only supports standard web pages and video transcription for YouTube links. More "web" options will be added in the future.
|
17
|
+
- Added UTF-8 as default in attachments content text read/write.
|
18
|
+
|
19
|
+
## 2.4.31 (2024-11-25)
|
20
|
+
|
21
|
+
- Added an option checkbox `Auto-index on upload` in the `Attachments` tab:
|
22
|
+
|
23
|
+
**Tip:** To use the `Query only` mode, the file must be indexed in the vector database. This occurs automatically at the time of upload if the `Auto-index on upload` option in the `Attachments` tab is enabled. When uploading large files, such indexing might take a while - therefore, if you are using the `Full context` option, which does not use the index, you can disable the `Auto-index` option to speed up the upload of the attachment. In this case, it will only be indexed when the `Query only` option is called for the first time, and until then, attachment will be available in the form of `Full context` and `Summary`.
|
24
|
+
|
25
|
+
- Added context menu options in `Uploaded attachments` tab: `Open`, `Open Source directory` and `Open Storage directory`.
|
26
|
+
|
3
27
|
## 2.4.30 (2024-11-25)
|
4
28
|
|
5
29
|
- Added instruction to model about mapped data directory in both legacy and IPython code interepreter.
|
README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[](https://snapcraft.io/pygpt)
|
4
4
|
|
5
|
-
Release: **2.4.
|
5
|
+
Release: **2.4.34** | build: **2024.11.26** | Python: **>=3.10, <3.12**
|
6
6
|
|
7
7
|
> Official website: https://pygpt.net | Documentation: https://pygpt.readthedocs.io
|
8
8
|
>
|
@@ -155,11 +155,11 @@ pip install pygpt-net
|
|
155
155
|
pygpt
|
156
156
|
```
|
157
157
|
|
158
|
-
##
|
158
|
+
## Running from GitHub source code
|
159
159
|
|
160
160
|
An alternative method is to download the source code from `GitHub` and execute the application using the Python interpreter (>=3.10, <3.12).
|
161
161
|
|
162
|
-
###
|
162
|
+
### Install with pip
|
163
163
|
|
164
164
|
1. Clone git repository or download .zip file:
|
165
165
|
|
@@ -187,7 +187,7 @@ pip install -r requirements.txt
|
|
187
187
|
python3 run.py
|
188
188
|
```
|
189
189
|
|
190
|
-
|
190
|
+
### Install with Poetry
|
191
191
|
|
192
192
|
1. Clone git repository or download .zip file:
|
193
193
|
|
@@ -356,7 +356,7 @@ This mode in **PyGPT** mirrors `ChatGPT`, allowing you to chat with models such
|
|
356
356
|
|
357
357
|
The main part of the interface is a chat window where conversations appear. Right below that is where you type your messages. On the right side of the screen, there's a section to set up or change your system prompts. You can also save these setups as presets to quickly switch between different models or tasks.
|
358
358
|
|
359
|
-
Above where you type your messages, the interface shows you the number of tokens your message will use up as you type it – this helps to keep track of usage. There's also a feature to upload files in this area. Go to the `
|
359
|
+
Above where you type your messages, the interface shows you the number of tokens your message will use up as you type it – this helps to keep track of usage. There's also a feature to upload files in this area. Go to the `Attachments` tab to manage your uploads or add attachments to send to the OpenAI API (but this makes effect only in `Assisant` and `Vision` modes).
|
360
360
|
|
361
361
|

|
362
362
|
|
@@ -374,6 +374,17 @@ Plugin allows you to generate images in Chat mode:
|
|
374
374
|
|
375
375
|

|
376
376
|
|
377
|
+
|
378
|
+
## Chat with Audio
|
379
|
+
|
380
|
+
2024-11-26: currently in beta.
|
381
|
+
|
382
|
+
This mode works like the Chat mode but with native support for audio input and output using a multimodal model - `gpt-4o-audio`. In this mode, audio input and output are directed to and from the model directly, without the use of external plugins. This enables faster and better audio communication.
|
383
|
+
|
384
|
+
More info: https://platform.openai.com/docs/guides/audio/quickstart
|
385
|
+
|
386
|
+
**INFO:** The execution of commands and tools in this mode is temporarily unavailable.
|
387
|
+
|
377
388
|
## Completion
|
378
389
|
|
379
390
|
This mode provides in-depth access to a broader range of capabilities offered by Large Language Models (LLMs). While it maintains a chat-like interface for user interaction, it introduces additional settings and functional richness beyond typical chat exchanges. Users can leverage this mode to prompt models for complex text completions, role-play dialogues between different characters, perform text analysis, and execute a variety of other sophisticated tasks. It supports any model provided by the OpenAI API as well as other models through `Langchain`.
|
@@ -1097,6 +1108,10 @@ The content from the uploaded attachments will be used in the current conversati
|
|
1097
1108
|
|
1098
1109
|
**Note:** Only text files from the list above are included in the additional context. Images will not be included in the context but will be used by the vision model in real-time. Adding image files to the context will be available in future versions.
|
1099
1110
|
|
1111
|
+
**Uploading larger files and auto-index:**
|
1112
|
+
|
1113
|
+
To use the `Query only` mode, the file must be indexed in the vector database. This occurs automatically at the time of upload if the `Auto-index on upload` option in the `Attachments` tab is enabled. When uploading large files, such indexing might take a while - therefore, if you are using the `Full context` option, which does not use the index, you can disable the `Auto-index` option to speed up the upload of the attachment. In this case, it will only be indexed when the `Query only` option is called for the first time, and until then, attachment will be available in the form of `Full context` and `Summary`.
|
1114
|
+
|
1100
1115
|
## Files (download, code generation)
|
1101
1116
|
|
1102
1117
|
**PyGPT** enables the automatic download and saving of files created by the model. This is carried out in the background, with the files being saved to an `data` folder located within the user's working directory. To view or manage these files, users can navigate to the `Files` tab which features a file browser for this specific directory. Here, users have the interface to handle all files sent by the AI.
|
@@ -1565,6 +1580,8 @@ Python code to a file, which the `Code Interpreter` can execute it and return it
|
|
1565
1580
|
- `Files I/O` - provides access to the local filesystem, enabling GPT to read and write files,
|
1566
1581
|
as well as list and create directories.
|
1567
1582
|
|
1583
|
+
- `System (OS)` - allows you to create and execute custom commands on your system.
|
1584
|
+
|
1568
1585
|
- `Mouse and Keyboard` - provides the ability to control the mouse and keyboard by the model.
|
1569
1586
|
|
1570
1587
|
- `Web Search` - provides the ability to connect to the Web, search web pages for current data, and index external content using Llama-index data loaders.
|
@@ -3652,6 +3669,30 @@ may consume additional tokens that are not displayed in the main window.
|
|
3652
3669
|
|
3653
3670
|
## Recent changes:
|
3654
3671
|
|
3672
|
+
**2.4.34 (2024-11-26)**
|
3673
|
+
|
3674
|
+
- Added a new mode: `Chat with Audio`, with built-in multimodal support for audio input/output. Currently in `beta`, the execution of commands and tools in this mode is temporarily unavailable.
|
3675
|
+
- Added new models: `gpt-4o-audio-preview`, `gpt-4o-2024-11-20`, `chatgpt-4o-latest`.
|
3676
|
+
- Force disabled integration with the native system menu.
|
3677
|
+
|
3678
|
+
**2.4.33 (2024-11-26)**
|
3679
|
+
|
3680
|
+
- Improved CSS and rendering of file and image lists.
|
3681
|
+
- Added displaying of used attachments in the chat window.
|
3682
|
+
|
3683
|
+
**2.4.32 (2024-11-26)**
|
3684
|
+
|
3685
|
+
- The "Add URL" option added to the "Attachments" tab allows users to include content from a given website as additional context. Currently, it only supports standard web pages and video transcription for YouTube links. More "web" options will be added in the future.
|
3686
|
+
- Added UTF-8 as default in attachments content text read/write.
|
3687
|
+
|
3688
|
+
**2.4.31 (2024-11-25)**
|
3689
|
+
|
3690
|
+
- Added an option checkbox `Auto-index on upload` in the `Attachments` tab:
|
3691
|
+
|
3692
|
+
**Tip:** To use the `Query only` mode, the file must be indexed in the vector database. This occurs automatically at the time of upload if the `Auto-index on upload` option in the `Attachments` tab is enabled. When uploading large files, such indexing might take a while - therefore, if you are using the `Full context` option, which does not use the index, you can disable the `Auto-index` option to speed up the upload of the attachment. In this case, it will only be indexed when the `Query only` option is called for the first time, and until then, attachment will be available in the form of `Full context` and `Summary`.
|
3693
|
+
|
3694
|
+
- Added context menu options in `Uploaded attachments` tab: `Open`, `Open Source directory` and `Open Storage directory`.
|
3695
|
+
|
3655
3696
|
**2.4.30 (2024-11-25)**
|
3656
3697
|
|
3657
3698
|
- Added instruction to model about mapped data directory in both legacy and IPython code interepreter.
|
pygpt_net/CHANGELOG.txt
CHANGED
@@ -1,3 +1,27 @@
|
|
1
|
+
2.4.34 (2024-11-26)
|
2
|
+
|
3
|
+
- Added a new mode: Chat with Audio, with built-in multimodal support for audio input/output. Currently in beta, the execution of commands and tools in this mode is temporarily unavailable.
|
4
|
+
- Added new models: gpt-4o-audio-preview, gpt-4o-2024-11-20, chatgpt-4o-latest.
|
5
|
+
- Force disabled integration with the native system menu.
|
6
|
+
|
7
|
+
2.4.33 (2024-11-26)
|
8
|
+
|
9
|
+
- Improved CSS and rendering of file and image lists.
|
10
|
+
- Added displaying of used attachments in the chat window.
|
11
|
+
|
12
|
+
2.4.32 (2024-11-26)
|
13
|
+
|
14
|
+
- The "Add URL" option added to the "Attachments" tab allows users to include content from a given website as additional context. Currently, it only supports standard web pages and video transcription for YouTube links. More "web" options will be added in the future.
|
15
|
+
- Added UTF-8 as default in attachments content text read/write.
|
16
|
+
|
17
|
+
2.4.31 (2024-11-25)
|
18
|
+
|
19
|
+
- Added an option checkbox `Auto-index on upload` in the `Attachments` tab:
|
20
|
+
|
21
|
+
Tip: To use the `Query only` mode, the file must be indexed in the vector database. This occurs automatically at the time of upload if the `Auto-index on upload` option in the `Attachments` tab is enabled. When uploading large files, such indexing might take a while - therefore, if you are using the `Full context` option, which does not use the index, you can disable the `Auto-index` option to speed up the upload of the attachment. In this case, it will only be indexed when the `Query only` option is called for the first time, and until then, attachment will be available in the form of `Full context` and `Summary`.
|
22
|
+
|
23
|
+
- Added context menu options in `Uploaded attachments` tab: `Open`, `Open Source directory` and `Open Storage directory`.
|
24
|
+
|
1
25
|
2.4.30 (2024-11-25)
|
2
26
|
|
3
27
|
- Added instruction to model about mapped data directory in both legacy and IPython code interepreter.
|
pygpt_net/__init__.py
CHANGED
@@ -6,15 +6,15 @@
|
|
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.11.
|
9
|
+
# Updated Date: 2024.11.26 21:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
__author__ = "Marcin Szczygliński"
|
13
13
|
__copyright__ = "Copyright 2024, Marcin Szczygliński"
|
14
14
|
__credits__ = ["Marcin Szczygliński"]
|
15
15
|
__license__ = "MIT"
|
16
|
-
__version__ = "2.4.
|
17
|
-
__build__ = "2024.11.
|
16
|
+
__version__ = "2.4.34"
|
17
|
+
__build__ = "2024.11.26"
|
18
18
|
__maintainer__ = "Marcin Szczygliński"
|
19
19
|
__github__ = "https://github.com/szczyglis-dev/py-gpt"
|
20
20
|
__website__ = "https://pygpt.net"
|
@@ -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.11.
|
9
|
+
# Updated Date: 2024.11.26 19:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
from pygpt_net.core.events import BaseEvent, ControlEvent, AppEvent
|
@@ -73,9 +73,9 @@ class Access:
|
|
73
73
|
self.window.core.plugins.get("audio_input").handler_simple.stop_recording(timeout=True)
|
74
74
|
|
75
75
|
# stop audio output if playing
|
76
|
-
if self.window.controller.audio.is_playing():
|
77
|
-
|
76
|
+
#if self.window.controller.audio.is_playing():
|
77
|
+
self.window.controller.audio.stop_output()
|
78
78
|
|
79
79
|
# stop generating if active
|
80
|
-
if self.window.controller.chat.input.generating:
|
81
|
-
|
80
|
+
#if self.window.controller.chat.input.generating:
|
81
|
+
self.window.controller.kernel.stop()
|
@@ -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.11.
|
9
|
+
# Updated Date: 2024.11.26 19:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import re
|
@@ -22,7 +22,8 @@ from pygpt_net.core.types import (
|
|
22
22
|
MODE_EXPERT,
|
23
23
|
MODE_LANGCHAIN,
|
24
24
|
MODE_LLAMA_INDEX,
|
25
|
-
MODE_VISION,
|
25
|
+
MODE_VISION,
|
26
|
+
MODE_IMAGE,
|
26
27
|
)
|
27
28
|
from pygpt_net.core.tabs.tab import Tab
|
28
29
|
from pygpt_net.core.events import ControlEvent
|
@@ -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.11.
|
9
|
+
# Updated Date: 2024.11.26 02:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import os
|
13
13
|
from datetime import datetime
|
14
|
+
from urllib.parse import urlparse
|
14
15
|
|
15
16
|
from PySide6.QtGui import QImage
|
16
17
|
from PySide6.QtWidgets import QFileDialog, QApplication
|
@@ -51,6 +52,13 @@ class Attachment:
|
|
51
52
|
else:
|
52
53
|
self.window.ui.nodes['attachments.capture_clear'].setChecked(False)
|
53
54
|
|
55
|
+
# auto-index
|
56
|
+
if self.window.core.config.has('attachments_auto_index') \
|
57
|
+
and self.window.core.config.get('attachments_auto_index'):
|
58
|
+
self.window.ui.nodes['attachments.auto_index'].setChecked(True)
|
59
|
+
else:
|
60
|
+
self.window.ui.nodes['attachments.auto_index'].setChecked(False)
|
61
|
+
|
54
62
|
self.window.core.attachments.load()
|
55
63
|
self.update()
|
56
64
|
|
@@ -268,6 +276,38 @@ class Attachment:
|
|
268
276
|
self.window.core.attachments.save()
|
269
277
|
self.update()
|
270
278
|
|
279
|
+
def open_add_url(self):
|
280
|
+
"""Open add attachment URL dialog"""
|
281
|
+
self.window.ui.dialog['url'].id = "attachment"
|
282
|
+
self.window.ui.dialog['url'].input.setText("")
|
283
|
+
self.window.ui.dialog['url'].current = ""
|
284
|
+
self.window.ui.dialog['url'].show()
|
285
|
+
self.window.ui.dialog['url'].input.setFocus()
|
286
|
+
|
287
|
+
def add_url(self, url: str):
|
288
|
+
"""
|
289
|
+
Add URL
|
290
|
+
|
291
|
+
:param url: URL
|
292
|
+
"""
|
293
|
+
if not url:
|
294
|
+
return
|
295
|
+
mode = self.window.core.config.get('mode')
|
296
|
+
try:
|
297
|
+
domain = urlparse(url).netloc
|
298
|
+
except Exception as e:
|
299
|
+
domain = os.path.basename(url)
|
300
|
+
attachment = self.window.core.attachments.new(
|
301
|
+
mode=mode,
|
302
|
+
name=domain,
|
303
|
+
path=url,
|
304
|
+
auto_save=False,
|
305
|
+
type=AttachmentItem.TYPE_URL,
|
306
|
+
)
|
307
|
+
self.window.core.attachments.save()
|
308
|
+
self.update()
|
309
|
+
self.window.ui.dialog['url'].close()
|
310
|
+
|
271
311
|
def open_dir(self, mode: str, idx: int):
|
272
312
|
"""
|
273
313
|
Open in directory
|
@@ -321,6 +361,24 @@ class Attachment:
|
|
321
361
|
return ''
|
322
362
|
return data.path
|
323
363
|
|
364
|
+
def get_by_idx(self, mode: str, idx: int) -> str:
|
365
|
+
"""
|
366
|
+
Get attachment by index
|
367
|
+
|
368
|
+
:param mode: mode
|
369
|
+
:param idx: index
|
370
|
+
:return: path
|
371
|
+
"""
|
372
|
+
file_id = self.window.core.attachments.get_id_by_idx(
|
373
|
+
mode=mode,
|
374
|
+
idx=idx,
|
375
|
+
)
|
376
|
+
data = self.window.core.attachments.get_by_id(
|
377
|
+
mode=mode,
|
378
|
+
id=file_id,
|
379
|
+
)
|
380
|
+
return data
|
381
|
+
|
324
382
|
def has(self, mode: str) -> bool:
|
325
383
|
"""
|
326
384
|
Return True if current mode has attachments
|
@@ -411,6 +469,14 @@ class Attachment:
|
|
411
469
|
"""
|
412
470
|
self.window.core.config.set('attachments_capture_clear', value)
|
413
471
|
|
472
|
+
def toggle_auto_index(self, value: bool):
|
473
|
+
"""
|
474
|
+
Toggle auto index
|
475
|
+
|
476
|
+
:param value: value of the checkbox
|
477
|
+
"""
|
478
|
+
self.window.core.config.set('attachments_auto_index', value)
|
479
|
+
|
414
480
|
def is_capture_clear(self) -> bool:
|
415
481
|
"""
|
416
482
|
Return True if capture clear is enabled
|
@@ -6,13 +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.11.
|
9
|
+
# Updated Date: 2024.11.26 19:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import os
|
13
13
|
|
14
14
|
from pygpt_net.core.events import Event, BaseEvent
|
15
|
-
from pygpt_net.plugin.audio_output.worker import PlayWorker
|
16
15
|
from pygpt_net.item.ctx import CtxItem
|
17
16
|
from pygpt_net.utils import trans
|
18
17
|
|
@@ -64,6 +63,12 @@ class Audio:
|
|
64
63
|
self.window.core.config.save()
|
65
64
|
self.update()
|
66
65
|
|
66
|
+
def enable_input(self):
|
67
|
+
"""Enable audio input"""
|
68
|
+
self.window.controller.plugins.enable('audio_input')
|
69
|
+
self.window.core.config.save()
|
70
|
+
self.update()
|
71
|
+
|
67
72
|
def disable_input(self, update: bool = True):
|
68
73
|
"""
|
69
74
|
Disable audio input
|
@@ -104,6 +109,16 @@ class Audio:
|
|
104
109
|
return True
|
105
110
|
return False
|
106
111
|
|
112
|
+
def is_input_enabled(self) -> bool:
|
113
|
+
"""
|
114
|
+
Check if any audio input is enabled
|
115
|
+
|
116
|
+
:return: True if enabled
|
117
|
+
"""
|
118
|
+
if self.window.controller.plugins.is_enabled('audio_input'):
|
119
|
+
return True
|
120
|
+
return False
|
121
|
+
|
107
122
|
def update_listeners(self):
|
108
123
|
"""Update audio listeners"""
|
109
124
|
is_output = False
|
@@ -161,16 +176,29 @@ class Audio:
|
|
161
176
|
}
|
162
177
|
self.window.dispatch(event, all=all)
|
163
178
|
|
179
|
+
def play_chat_audio(self, path: str):
|
180
|
+
"""
|
181
|
+
Play audio file (chat multimodal response)
|
182
|
+
|
183
|
+
:param path: audio file path
|
184
|
+
"""
|
185
|
+
if not self.is_output_enabled():
|
186
|
+
return
|
187
|
+
self.play_audio(path)
|
188
|
+
|
164
189
|
def play_audio(self, path: str):
|
165
190
|
"""
|
166
191
|
Play audio file
|
167
192
|
|
168
193
|
:param path: audio file path
|
169
194
|
"""
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
195
|
+
ctx = CtxItem()
|
196
|
+
event = Event(Event.AUDIO_PLAYBACK)
|
197
|
+
event.ctx = ctx
|
198
|
+
event.data = {
|
199
|
+
'audio_file': path,
|
200
|
+
}
|
201
|
+
self.window.dispatch(event, all=True)
|
174
202
|
|
175
203
|
def play_sound(self, filename: str):
|
176
204
|
"""
|
@@ -6,13 +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.11.
|
9
|
+
# Updated Date: 2024.11.26 19:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
from pygpt_net.core.events import AppEvent
|
13
13
|
from pygpt_net.item.ctx import CtxItem
|
14
14
|
|
15
15
|
from .attachment import Attachment
|
16
|
+
from .audio import Audio
|
16
17
|
from .command import Command
|
17
18
|
from .common import Common
|
18
19
|
from .files import Files
|
@@ -35,6 +36,7 @@ class Chat:
|
|
35
36
|
"""
|
36
37
|
self.window = window
|
37
38
|
self.attachment = Attachment(window)
|
39
|
+
self.audio = Audio(window)
|
38
40
|
self.command = Command(window)
|
39
41
|
self.common = Common(window)
|
40
42
|
self.files = Files(window)
|