pygpt-net 2.4.41__py3-none-any.whl → 2.4.44__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 +19 -0
- README.md +151 -71
- pygpt_net/CHANGELOG.txt +19 -0
- pygpt_net/__init__.py +3 -3
- pygpt_net/app.py +3 -1
- pygpt_net/controller/attachment.py +31 -3
- pygpt_net/controller/audio/__init__.py +2 -2
- pygpt_net/controller/camera.py +1 -10
- pygpt_net/controller/chat/attachment.py +37 -36
- pygpt_net/controller/chat/audio.py +2 -2
- pygpt_net/controller/config/placeholder.py +20 -4
- pygpt_net/controller/idx/common.py +7 -3
- pygpt_net/controller/ui/mode.py +16 -21
- pygpt_net/core/attachments/__init__.py +7 -2
- pygpt_net/core/attachments/context.py +52 -34
- 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/db/__init__.py +2 -1
- pygpt_net/core/debug/attachments.py +1 -0
- 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 +23 -6
- pygpt_net/core/idx/chat.py +15 -5
- pygpt_net/core/idx/indexing.py +47 -14
- pygpt_net/core/idx/ui/__init__.py +22 -0
- pygpt_net/core/idx/ui/loaders.py +217 -0
- 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 +4 -4
- pygpt_net/data/config/models.json +3 -3
- pygpt_net/data/config/modes.json +3 -3
- pygpt_net/data/config/settings.json +5 -5
- pygpt_net/data/locale/locale.de.ini +3 -3
- pygpt_net/data/locale/locale.en.ini +12 -9
- pygpt_net/data/locale/locale.es.ini +3 -3
- pygpt_net/data/locale/locale.fr.ini +3 -3
- pygpt_net/data/locale/locale.it.ini +3 -3
- pygpt_net/data/locale/locale.pl.ini +3 -3
- pygpt_net/data/locale/locale.uk.ini +3 -3
- pygpt_net/data/locale/locale.zh.ini +3 -3
- pygpt_net/data/locale/plugin.cmd_web.en.ini +2 -0
- pygpt_net/data/locale/plugin.mailer.en.ini +21 -0
- pygpt_net/item/attachment.py +5 -1
- pygpt_net/item/ctx.py +111 -3
- pygpt_net/migrations/Version20241215110000.py +25 -0
- pygpt_net/migrations/__init__.py +3 -1
- 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_files/__init__.py +3 -2
- 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 +7 -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 +6 -0
- 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 +92 -38
- pygpt_net/provider/core/ctx/db_sqlite/utils.py +37 -11
- 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/loaders/base.py +14 -0
- pygpt_net/provider/loaders/hub/yt/base.py +5 -0
- pygpt_net/provider/loaders/web_database.py +13 -5
- pygpt_net/provider/loaders/web_github_issues.py +5 -1
- pygpt_net/provider/loaders/web_google_calendar.py +9 -1
- pygpt_net/provider/loaders/web_google_docs.py +6 -1
- pygpt_net/provider/loaders/web_google_drive.py +10 -1
- pygpt_net/provider/loaders/web_google_gmail.py +2 -1
- pygpt_net/provider/loaders/web_google_keep.py +5 -1
- pygpt_net/provider/loaders/web_google_sheets.py +5 -1
- pygpt_net/provider/loaders/web_microsoft_onedrive.py +15 -1
- pygpt_net/provider/loaders/web_page.py +4 -2
- pygpt_net/provider/loaders/web_rss.py +2 -1
- pygpt_net/provider/loaders/web_sitemap.py +2 -1
- pygpt_net/provider/loaders/web_twitter.py +4 -2
- pygpt_net/provider/loaders/web_yt.py +17 -2
- 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 +32 -13
- 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 +15 -46
- pygpt_net/tools/indexer/ui/web.py +20 -78
- 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/layout/ctx/ctx_list.py +86 -18
- pygpt_net/ui/menu/audio.py +12 -1
- pygpt_net/ui/widget/dialog/url.py +151 -14
- pygpt_net/ui/widget/element/group.py +15 -2
- pygpt_net/ui/widget/lists/context.py +23 -9
- pygpt_net/utils.py +1 -1
- {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.44.dist-info}/METADATA +152 -72
- {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.44.dist-info}/RECORD +183 -173
- {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.44.dist-info}/LICENSE +0 -0
- {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.44.dist-info}/WHEEL +0 -0
- {pygpt_net-2.4.41.dist-info → pygpt_net-2.4.44.dist-info}/entry_points.txt +0 -0
@@ -6,10 +6,11 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date: 2024.
|
9
|
+
# Updated Date: 2024.12.14 22:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import os.path
|
13
|
+
from typing import Optional
|
13
14
|
|
14
15
|
from llama_index.core import StorageContext, load_index_from_storage
|
15
16
|
from llama_index.core.indices.base import BaseIndex
|
@@ -32,7 +33,7 @@ class CtxAttachmentProvider(BaseStore):
|
|
32
33
|
self.id = "CtxAttachmentVectorStore"
|
33
34
|
self.index = None
|
34
35
|
|
35
|
-
def get_path(self) -> str:
|
36
|
+
def get_path(self, id: str) -> str:
|
36
37
|
"""
|
37
38
|
Get database path
|
38
39
|
|
@@ -40,40 +41,53 @@ class CtxAttachmentProvider(BaseStore):
|
|
40
41
|
"""
|
41
42
|
return self.path
|
42
43
|
|
43
|
-
def exists(
|
44
|
+
def exists(
|
45
|
+
self,
|
46
|
+
id: Optional[str] = None
|
47
|
+
) -> bool:
|
44
48
|
"""
|
45
49
|
Check if index exists
|
46
50
|
|
47
51
|
:return: True if exists
|
48
52
|
"""
|
49
|
-
path = self.get_path()
|
53
|
+
path = self.get_path("")
|
50
54
|
if os.path.exists(path):
|
51
55
|
store = os.path.join(path, "docstore.json")
|
52
56
|
if os.path.exists(store):
|
53
57
|
return True
|
54
58
|
return False
|
55
59
|
|
56
|
-
def create(self):
|
57
|
-
"""
|
58
|
-
|
60
|
+
def create(self, id: str):
|
61
|
+
"""
|
62
|
+
Create empty index
|
63
|
+
|
64
|
+
:param id: index name (not used)
|
65
|
+
"""
|
66
|
+
path = self.get_path(id)
|
59
67
|
if not os.path.exists(path):
|
60
68
|
index = self.index_from_empty() # create empty index
|
61
69
|
self.store(
|
70
|
+
id=id,
|
62
71
|
index=index,
|
63
72
|
)
|
64
73
|
else:
|
65
74
|
self.index = self.index_from_empty()
|
66
75
|
|
67
|
-
def get(
|
76
|
+
def get(
|
77
|
+
self,
|
78
|
+
id: str,
|
79
|
+
service_context: Optional[ServiceContext] = None
|
80
|
+
) -> BaseIndex:
|
68
81
|
"""
|
69
82
|
Get index
|
70
83
|
|
84
|
+
:param id: index name (not used)
|
71
85
|
:param service_context: Service context
|
72
86
|
:return: index instance
|
73
87
|
"""
|
74
88
|
if not self.exists():
|
75
|
-
self.create()
|
76
|
-
path = self.get_path()
|
89
|
+
self.create(id)
|
90
|
+
path = self.get_path(id)
|
77
91
|
storage_context = StorageContext.from_defaults(
|
78
92
|
persist_dir=path,
|
79
93
|
)
|
@@ -84,13 +98,18 @@ class CtxAttachmentProvider(BaseStore):
|
|
84
98
|
|
85
99
|
return self.index
|
86
100
|
|
87
|
-
def store(
|
101
|
+
def store(
|
102
|
+
self,
|
103
|
+
id: str,
|
104
|
+
index: Optional[BaseIndex] = None
|
105
|
+
):
|
88
106
|
"""
|
89
107
|
Store index
|
90
108
|
|
109
|
+
:param id: index name (not used)
|
91
110
|
:param index: index instance
|
92
111
|
"""
|
93
|
-
path = self.get_path()
|
112
|
+
path = self.get_path(id)
|
94
113
|
index.storage_context.persist(
|
95
114
|
persist_dir=path,
|
96
115
|
)
|
@@ -99,6 +118,6 @@ class CtxAttachmentProvider(BaseStore):
|
|
99
118
|
def clean(self):
|
100
119
|
"""Clean index"""
|
101
120
|
self.index = None
|
102
|
-
path = self.get_path()
|
121
|
+
path = self.get_path("")
|
103
122
|
if os.path.exists(path):
|
104
123
|
os.remove(path)
|
@@ -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 os.path
|
14
|
+
from typing import Optional
|
14
15
|
|
15
16
|
from llama_index.core.indices.base import BaseIndex
|
16
17
|
from llama_index.core.indices.service_context import ServiceContext
|
@@ -67,7 +68,11 @@ class ElasticsearchProvider(BaseStore):
|
|
67
68
|
**additional_args
|
68
69
|
)
|
69
70
|
|
70
|
-
def get(
|
71
|
+
def get(
|
72
|
+
self,
|
73
|
+
id: str,
|
74
|
+
service_context: Optional[ServiceContext] = None
|
75
|
+
) -> BaseIndex:
|
71
76
|
"""
|
72
77
|
Get index
|
73
78
|
|
@@ -84,7 +89,11 @@ class ElasticsearchProvider(BaseStore):
|
|
84
89
|
self.indexes[id] = self.index_from_store(vector_store, storage_context, service_context)
|
85
90
|
return self.indexes[id]
|
86
91
|
|
87
|
-
def store(
|
92
|
+
def store(
|
93
|
+
self,
|
94
|
+
id: str,
|
95
|
+
index: Optional[BaseIndex] = None
|
96
|
+
):
|
88
97
|
"""
|
89
98
|
Store index
|
90
99
|
|
@@ -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 os.path
|
14
|
+
from typing import Optional
|
14
15
|
|
15
16
|
from pinecone import Pinecone, ServerlessSpec
|
16
17
|
|
@@ -122,7 +123,11 @@ class PinecodeProvider(BaseStore):
|
|
122
123
|
pinecone_index=pinecone_index,
|
123
124
|
)
|
124
125
|
|
125
|
-
def get(
|
126
|
+
def get(
|
127
|
+
self,
|
128
|
+
id: str,
|
129
|
+
service_context: Optional[ServiceContext] = None
|
130
|
+
) -> BaseIndex:
|
126
131
|
"""
|
127
132
|
Get index
|
128
133
|
|
@@ -139,7 +144,11 @@ class PinecodeProvider(BaseStore):
|
|
139
144
|
self.indexes[id] = self.index_from_store(vector_store, storage_context, service_context)
|
140
145
|
return self.indexes[id]
|
141
146
|
|
142
|
-
def store(
|
147
|
+
def store(
|
148
|
+
self,
|
149
|
+
id: str,
|
150
|
+
index: Optional[BaseIndex] = None
|
151
|
+
):
|
143
152
|
"""
|
144
153
|
Store index
|
145
154
|
|
@@ -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 os.path
|
14
|
+
from typing import Optional
|
14
15
|
|
15
16
|
from llama_index.core import StorageContext
|
16
17
|
from llama_index.core.indices.base import BaseIndex
|
@@ -67,7 +68,11 @@ class RedisProvider(BaseStore):
|
|
67
68
|
**additional_args
|
68
69
|
)
|
69
70
|
|
70
|
-
def get(
|
71
|
+
def get(
|
72
|
+
self,
|
73
|
+
id: str,
|
74
|
+
service_context: Optional[ServiceContext] = None
|
75
|
+
) -> BaseIndex:
|
71
76
|
"""
|
72
77
|
Get index
|
73
78
|
|
@@ -84,7 +89,11 @@ class RedisProvider(BaseStore):
|
|
84
89
|
self.indexes[id] = self.index_from_store(vector_store, storage_context, service_context)
|
85
90
|
return self.indexes[id]
|
86
91
|
|
87
|
-
def store(
|
92
|
+
def store(
|
93
|
+
self,
|
94
|
+
id: str,
|
95
|
+
index: Optional[BaseIndex] = None
|
96
|
+
):
|
88
97
|
"""
|
89
98
|
Store index
|
90
99
|
|
@@ -6,10 +6,11 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date: 2024.
|
9
|
+
# Updated Date: 2024.12.14 22:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import os.path
|
13
|
+
from typing import Optional
|
13
14
|
|
14
15
|
from llama_index.core import StorageContext, load_index_from_storage
|
15
16
|
from llama_index.core.indices.base import BaseIndex
|
@@ -46,7 +47,11 @@ class SimpleProvider(BaseStore):
|
|
46
47
|
index=index,
|
47
48
|
)
|
48
49
|
|
49
|
-
def get(
|
50
|
+
def get(
|
51
|
+
self,
|
52
|
+
id: str,
|
53
|
+
service_context: Optional[ServiceContext] = None
|
54
|
+
) -> BaseIndex:
|
50
55
|
"""
|
51
56
|
Get index
|
52
57
|
|
@@ -66,7 +71,11 @@ class SimpleProvider(BaseStore):
|
|
66
71
|
)
|
67
72
|
return self.indexes[id]
|
68
73
|
|
69
|
-
def store(
|
74
|
+
def store(
|
75
|
+
self,
|
76
|
+
id: str,
|
77
|
+
index: Optional[BaseIndex] = None
|
78
|
+
):
|
70
79
|
"""
|
71
80
|
Store index
|
72
81
|
|
@@ -6,10 +6,11 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date: 2024.
|
9
|
+
# Updated Date: 2024.12.14 22:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import os.path
|
13
|
+
from typing import Optional
|
13
14
|
|
14
15
|
from llama_index.core import StorageContext, load_index_from_storage
|
15
16
|
from llama_index.core.indices.base import BaseIndex
|
@@ -64,7 +65,10 @@ class TempProvider(BaseStore):
|
|
64
65
|
)
|
65
66
|
return path
|
66
67
|
|
67
|
-
def exists(
|
68
|
+
def exists(
|
69
|
+
self,
|
70
|
+
id: Optional[str] = None
|
71
|
+
) -> bool:
|
68
72
|
"""
|
69
73
|
Check if index with id exists
|
70
74
|
|
@@ -100,7 +104,11 @@ class TempProvider(BaseStore):
|
|
100
104
|
else:
|
101
105
|
self.indexes[id] = self.index_from_empty()
|
102
106
|
|
103
|
-
def get(
|
107
|
+
def get(
|
108
|
+
self,
|
109
|
+
id: str,
|
110
|
+
service_context: Optional[ServiceContext] = None
|
111
|
+
) -> BaseIndex:
|
104
112
|
"""
|
105
113
|
Get index
|
106
114
|
|
@@ -123,7 +131,11 @@ class TempProvider(BaseStore):
|
|
123
131
|
|
124
132
|
return self.indexes[id]
|
125
133
|
|
126
|
-
def store(
|
134
|
+
def store(
|
135
|
+
self,
|
136
|
+
id: str,
|
137
|
+
index: Optional[BaseIndex] = None
|
138
|
+
):
|
127
139
|
"""
|
128
140
|
Store index
|
129
141
|
|
pygpt_net/provider/web/base.py
CHANGED
@@ -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 22:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
|
+
from typing import List, Dict
|
13
|
+
|
12
14
|
from pygpt_net.plugin.base.plugin import BasePlugin
|
13
15
|
|
14
16
|
|
@@ -45,7 +47,12 @@ class BaseProvider:
|
|
45
47
|
"""Initialize provider options (for plugin settings)"""
|
46
48
|
pass
|
47
49
|
|
48
|
-
def search(
|
50
|
+
def search(
|
51
|
+
self,
|
52
|
+
query,
|
53
|
+
limit: int = 10,
|
54
|
+
offset: int = 0
|
55
|
+
) -> List[str]:
|
49
56
|
"""
|
50
57
|
Execute search query and return list of urls
|
51
58
|
|
@@ -56,7 +63,7 @@ class BaseProvider:
|
|
56
63
|
"""
|
57
64
|
pass
|
58
65
|
|
59
|
-
def is_configured(self, cmds:
|
66
|
+
def is_configured(self, cmds: List[Dict]) -> bool:
|
60
67
|
"""
|
61
68
|
Check if provider is configured
|
62
69
|
|
@@ -6,10 +6,11 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date: 2024.
|
9
|
+
# Updated Date: 2024.12.14 22:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import json
|
13
|
+
from typing import List, Dict
|
13
14
|
from urllib.parse import quote
|
14
15
|
from .base import BaseProvider
|
15
16
|
|
@@ -63,7 +64,12 @@ class GoogleCustomSearch(BaseProvider):
|
|
63
64
|
urls=url_cx,
|
64
65
|
)
|
65
66
|
|
66
|
-
def search(
|
67
|
+
def search(
|
68
|
+
self,
|
69
|
+
query: str,
|
70
|
+
limit: int = 10,
|
71
|
+
offset: int = 0
|
72
|
+
) -> List[str]:
|
67
73
|
"""
|
68
74
|
Execute search query and return list of urls
|
69
75
|
|
@@ -103,7 +109,7 @@ class GoogleCustomSearch(BaseProvider):
|
|
103
109
|
|
104
110
|
return urls
|
105
111
|
|
106
|
-
def is_configured(self, cmds:
|
112
|
+
def is_configured(self, cmds: List[Dict]) -> bool:
|
107
113
|
"""
|
108
114
|
Check if provider is configured (required API keys, etc.)
|
109
115
|
|
@@ -6,10 +6,11 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date: 2024.
|
9
|
+
# Updated Date: 2024.12.14 22:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import json
|
13
|
+
from typing import List, Dict
|
13
14
|
from urllib.parse import quote
|
14
15
|
|
15
16
|
import requests
|
@@ -60,7 +61,12 @@ class MicrosoftBingSearch(BaseProvider):
|
|
60
61
|
tab="microsoft_bing",
|
61
62
|
)
|
62
63
|
|
63
|
-
def search(
|
64
|
+
def search(
|
65
|
+
self,
|
66
|
+
query: str,
|
67
|
+
limit: int = 10,
|
68
|
+
offset: int = 0
|
69
|
+
) -> List[str]:
|
64
70
|
"""
|
65
71
|
Execute search query and return list of urls
|
66
72
|
|
@@ -97,7 +103,7 @@ class MicrosoftBingSearch(BaseProvider):
|
|
97
103
|
print('Error:', response.status_code, response.text)
|
98
104
|
return urls
|
99
105
|
|
100
|
-
def is_configured(self, cmds:
|
106
|
+
def is_configured(self, cmds: List[Dict]) -> bool:
|
101
107
|
"""
|
102
108
|
Check if provider is configured (required API keys, etc.)
|
103
109
|
|
pygpt_net/tools/__init__.py
CHANGED
@@ -6,9 +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 Dict, Optional
|
13
|
+
|
14
|
+
from PySide6.QtGui import QAction
|
15
|
+
|
12
16
|
from pygpt_net.ui.widget.dialog.base import BaseDialog
|
13
17
|
from .base import BaseTool
|
14
18
|
|
@@ -42,7 +46,7 @@ class Tools:
|
|
42
46
|
if id in self.tools:
|
43
47
|
return self.tools[id]
|
44
48
|
|
45
|
-
def get_all(self) ->
|
49
|
+
def get_all(self) -> Dict[str, BaseTool]:
|
46
50
|
"""
|
47
51
|
Get all tools
|
48
52
|
|
@@ -83,7 +87,7 @@ class Tools:
|
|
83
87
|
for id in self.tools:
|
84
88
|
self.tools[id].on_reload()
|
85
89
|
|
86
|
-
def setup_menu_actions(self) ->
|
90
|
+
def setup_menu_actions(self) -> Dict[str, QAction]:
|
87
91
|
"""
|
88
92
|
Setup Tools menu actions
|
89
93
|
|
@@ -110,7 +114,11 @@ class Tools:
|
|
110
114
|
for id in self.tools:
|
111
115
|
self.tools[id].setup_theme()
|
112
116
|
|
113
|
-
def get_instance(
|
117
|
+
def get_instance(
|
118
|
+
self,
|
119
|
+
type_id: str,
|
120
|
+
dialog_id: Optional[str] = None
|
121
|
+
) -> Optional[BaseDialog]:
|
114
122
|
"""
|
115
123
|
Spawn and return dialog instance
|
116
124
|
|
@@ -123,7 +131,7 @@ class Tools:
|
|
123
131
|
if instance is not None:
|
124
132
|
return instance
|
125
133
|
|
126
|
-
def get_lang_mappings(self) -> dict:
|
134
|
+
def get_lang_mappings(self) -> Dict[str, dict]:
|
127
135
|
"""
|
128
136
|
Get language mappings
|
129
137
|
|
@@ -6,10 +6,11 @@
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
7
7
|
# MIT License #
|
8
8
|
# Created By : Marcin Szczygliński #
|
9
|
-
# Updated Date: 2024.
|
9
|
+
# Updated Date: 2024.12.14 22:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
12
|
import os
|
13
|
+
from typing import Dict
|
13
14
|
|
14
15
|
from PySide6.QtGui import QAction, QIcon
|
15
16
|
from PySide6.QtWidgets import QFileDialog
|
@@ -255,7 +256,7 @@ class AudioTranscriber(BaseTool):
|
|
255
256
|
self.window.ui.nodes['audio.transcribe.status'].setText("")
|
256
257
|
self.store("")
|
257
258
|
|
258
|
-
def setup_menu(self) ->
|
259
|
+
def setup_menu(self) -> Dict[str, QAction]:
|
259
260
|
"""
|
260
261
|
Setup main menu
|
261
262
|
|
@@ -278,7 +279,7 @@ class AudioTranscriber(BaseTool):
|
|
278
279
|
self.dialog = AudioTranscribe(self.window)
|
279
280
|
self.dialog.setup()
|
280
281
|
|
281
|
-
def get_lang_mappings(self) ->
|
282
|
+
def get_lang_mappings(self) -> Dict[str, Dict]:
|
282
283
|
"""
|
283
284
|
Get language mappings
|
284
285
|
|
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
|
|