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,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 Dict, Any, Optional
|
13
|
+
|
12
14
|
from packaging.version import Version
|
13
15
|
|
14
16
|
from pygpt_net.item.index import IndexItem
|
@@ -29,70 +31,174 @@ class BaseProvider:
|
|
29
31
|
def patch(self, version: Version) -> bool:
|
30
32
|
pass
|
31
33
|
|
32
|
-
def load(
|
34
|
+
def load(
|
35
|
+
self,
|
36
|
+
store_id: str
|
37
|
+
) -> Dict[str, IndexItem]:
|
33
38
|
pass
|
34
39
|
|
35
|
-
def append_file(
|
40
|
+
def append_file(
|
41
|
+
self,
|
42
|
+
store_id: str,
|
43
|
+
idx: str,
|
44
|
+
data: Dict[str, Any]
|
45
|
+
) -> int:
|
36
46
|
pass
|
37
47
|
|
38
|
-
def append_ctx_meta(
|
48
|
+
def append_ctx_meta(
|
49
|
+
self,
|
50
|
+
store_id: str,
|
51
|
+
idx: str,
|
52
|
+
meta_id: int,
|
53
|
+
doc_id: str
|
54
|
+
) -> int:
|
39
55
|
pass
|
40
56
|
|
41
|
-
def append_external(
|
57
|
+
def append_external(
|
58
|
+
self,
|
59
|
+
store_id: str,
|
60
|
+
idx: str,
|
61
|
+
data: Dict[str, Any]
|
62
|
+
) -> int:
|
42
63
|
pass
|
43
64
|
|
44
|
-
def update_file(
|
65
|
+
def update_file(
|
66
|
+
self,
|
67
|
+
id: int,
|
68
|
+
doc_id: str,
|
69
|
+
ts: int
|
70
|
+
) -> bool:
|
45
71
|
pass
|
46
72
|
|
47
|
-
def update_ctx_meta(
|
73
|
+
def update_ctx_meta(
|
74
|
+
self,
|
75
|
+
id: int,
|
76
|
+
doc_id: str
|
77
|
+
) -> bool:
|
48
78
|
pass
|
49
79
|
|
50
|
-
def update_external(
|
80
|
+
def update_external(
|
81
|
+
self,
|
82
|
+
content: str,
|
83
|
+
type: str,
|
84
|
+
doc_id: str,
|
85
|
+
ts: int
|
86
|
+
) -> bool:
|
51
87
|
pass
|
52
88
|
|
53
|
-
def is_meta_indexed(
|
89
|
+
def is_meta_indexed(
|
90
|
+
self,
|
91
|
+
store_id: str,
|
92
|
+
idx: str,
|
93
|
+
meta_id: int
|
94
|
+
) -> bool:
|
54
95
|
pass
|
55
96
|
|
56
|
-
def is_file_indexed(
|
97
|
+
def is_file_indexed(
|
98
|
+
self,
|
99
|
+
store_id: str,
|
100
|
+
idx: str,
|
101
|
+
file_id: str
|
102
|
+
) -> bool:
|
57
103
|
pass
|
58
104
|
|
59
|
-
def is_external_indexed(
|
105
|
+
def is_external_indexed(
|
106
|
+
self,
|
107
|
+
store_id: str,
|
108
|
+
idx: str,
|
109
|
+
content: str,
|
110
|
+
type: str
|
111
|
+
) -> bool:
|
60
112
|
pass
|
61
113
|
|
62
|
-
def get_meta_doc_id(
|
114
|
+
def get_meta_doc_id(
|
115
|
+
self,
|
116
|
+
store_id: str,
|
117
|
+
idx: str,
|
118
|
+
meta_id: int
|
119
|
+
) -> str:
|
63
120
|
pass
|
64
121
|
|
65
|
-
def get_file_doc_id(
|
122
|
+
def get_file_doc_id(
|
123
|
+
self,
|
124
|
+
store_id: str,
|
125
|
+
idx: str,
|
126
|
+
file_id: str
|
127
|
+
) -> str:
|
66
128
|
pass
|
67
129
|
|
68
|
-
def get_external_doc_id(
|
130
|
+
def get_external_doc_id(
|
131
|
+
self,
|
132
|
+
store_id: str,
|
133
|
+
idx: str,
|
134
|
+
content: str,
|
135
|
+
type: str
|
136
|
+
) -> str:
|
69
137
|
pass
|
70
138
|
|
71
|
-
def remove_file(
|
139
|
+
def remove_file(
|
140
|
+
self,
|
141
|
+
store_id: str,
|
142
|
+
idx: str,
|
143
|
+
doc_id: str
|
144
|
+
):
|
72
145
|
pass
|
73
146
|
|
74
|
-
def remove_external(
|
147
|
+
def remove_external(
|
148
|
+
self,
|
149
|
+
store_id: str,
|
150
|
+
idx: str,
|
151
|
+
doc_id: str
|
152
|
+
):
|
75
153
|
pass
|
76
154
|
|
77
|
-
def remove_ctx_meta(
|
155
|
+
def remove_ctx_meta(
|
156
|
+
self,
|
157
|
+
store_id: str,
|
158
|
+
idx: str,
|
159
|
+
meta_id: str
|
160
|
+
):
|
78
161
|
pass
|
79
162
|
|
80
|
-
def truncate(
|
163
|
+
def truncate(
|
164
|
+
self,
|
165
|
+
store_id: str,
|
166
|
+
idx: str
|
167
|
+
):
|
81
168
|
pass
|
82
169
|
|
83
|
-
def truncate_all(
|
170
|
+
def truncate_all(
|
171
|
+
self,
|
172
|
+
store_id: Optional[str] = None,
|
173
|
+
idx: Optional[str] = None
|
174
|
+
) -> bool:
|
84
175
|
pass
|
85
176
|
|
86
|
-
def truncate_files(
|
177
|
+
def truncate_files(
|
178
|
+
self,
|
179
|
+
store_id: Optional[str] = None,
|
180
|
+
idx: Optional[str] = None
|
181
|
+
) -> bool:
|
87
182
|
pass
|
88
183
|
|
89
|
-
def truncate_ctx(
|
184
|
+
def truncate_ctx(
|
185
|
+
self,
|
186
|
+
store_id: Optional[str] = None,
|
187
|
+
idx: Optional[str] = None
|
188
|
+
) -> bool:
|
90
189
|
pass
|
91
190
|
|
92
|
-
def truncate_external(
|
191
|
+
def truncate_external(
|
192
|
+
self,
|
193
|
+
store_id: Optional[str] = None,
|
194
|
+
idx: Optional[str] = None
|
195
|
+
) -> bool:
|
93
196
|
pass
|
94
197
|
|
95
|
-
def get_counters(
|
198
|
+
def get_counters(
|
199
|
+
self,
|
200
|
+
type: str
|
201
|
+
) -> Dict[str, Dict[str, int]]:
|
96
202
|
pass
|
97
203
|
|
98
204
|
def dump(self, index: IndexItem) -> str:
|
@@ -6,11 +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.
|
9
|
+
# Updated Date: 2024.12.14 22:00:00 #
|
10
10
|
# ================================================== #
|
11
11
|
|
12
|
+
from typing import Dict, Any, Optional
|
13
|
+
|
12
14
|
from packaging.version import Version
|
13
15
|
|
16
|
+
from pygpt_net.item.index import IndexItem
|
14
17
|
from pygpt_net.provider.core.index.base import BaseProvider
|
15
18
|
from .patch import Patch
|
16
19
|
from .storage import Storage
|
@@ -42,7 +45,10 @@ class DbSqliteProvider(BaseProvider):
|
|
42
45
|
"""
|
43
46
|
return self.patcher.execute(version)
|
44
47
|
|
45
|
-
def load(
|
48
|
+
def load(
|
49
|
+
self,
|
50
|
+
store_id: str
|
51
|
+
) -> Dict[str, IndexItem]:
|
46
52
|
"""
|
47
53
|
Load items for index provider
|
48
54
|
|
@@ -51,7 +57,12 @@ class DbSqliteProvider(BaseProvider):
|
|
51
57
|
"""
|
52
58
|
return self.storage.get_items(store_id)
|
53
59
|
|
54
|
-
def append_file(
|
60
|
+
def append_file(
|
61
|
+
self,
|
62
|
+
store_id: str,
|
63
|
+
idx: str,
|
64
|
+
data: Dict[str, Any]
|
65
|
+
) -> int:
|
55
66
|
"""
|
56
67
|
Append file to index
|
57
68
|
|
@@ -62,7 +73,13 @@ class DbSqliteProvider(BaseProvider):
|
|
62
73
|
"""
|
63
74
|
return self.storage.insert_file(store_id, idx, data)
|
64
75
|
|
65
|
-
def append_ctx_meta(
|
76
|
+
def append_ctx_meta(
|
77
|
+
self,
|
78
|
+
store_id: str,
|
79
|
+
idx: str,
|
80
|
+
meta_id: int,
|
81
|
+
doc_id: str
|
82
|
+
) -> int:
|
66
83
|
"""
|
67
84
|
Append context meta to index
|
68
85
|
|
@@ -74,7 +91,12 @@ class DbSqliteProvider(BaseProvider):
|
|
74
91
|
"""
|
75
92
|
return self.storage.insert_ctx_meta(store_id, idx, meta_id, doc_id)
|
76
93
|
|
77
|
-
def append_external(
|
94
|
+
def append_external(
|
95
|
+
self,
|
96
|
+
store_id: str,
|
97
|
+
idx: str,
|
98
|
+
data: Dict[str, Any]
|
99
|
+
) -> int:
|
78
100
|
"""
|
79
101
|
Append external data to index
|
80
102
|
|
@@ -85,7 +107,12 @@ class DbSqliteProvider(BaseProvider):
|
|
85
107
|
"""
|
86
108
|
return self.storage.insert_external(store_id, idx, data)
|
87
109
|
|
88
|
-
def is_meta_indexed(
|
110
|
+
def is_meta_indexed(
|
111
|
+
self,
|
112
|
+
store_id: str,
|
113
|
+
idx: str,
|
114
|
+
meta_id: int
|
115
|
+
) -> bool:
|
89
116
|
"""
|
90
117
|
Check if context meta is indexed
|
91
118
|
|
@@ -96,7 +123,12 @@ class DbSqliteProvider(BaseProvider):
|
|
96
123
|
"""
|
97
124
|
return self.storage.is_meta_indexed(store_id, idx, meta_id)
|
98
125
|
|
99
|
-
def is_file_indexed(
|
126
|
+
def is_file_indexed(
|
127
|
+
self,
|
128
|
+
store_id: str,
|
129
|
+
idx: str,
|
130
|
+
file_id: str
|
131
|
+
) -> bool:
|
100
132
|
"""
|
101
133
|
Check if file is indexed
|
102
134
|
|
@@ -107,7 +139,13 @@ class DbSqliteProvider(BaseProvider):
|
|
107
139
|
"""
|
108
140
|
return self.storage.is_file_indexed(store_id, idx, file_id)
|
109
141
|
|
110
|
-
def is_external_indexed(
|
142
|
+
def is_external_indexed(
|
143
|
+
self,
|
144
|
+
store_id: str,
|
145
|
+
idx: str,
|
146
|
+
content: str,
|
147
|
+
type: str
|
148
|
+
) -> bool:
|
111
149
|
"""
|
112
150
|
Check if external data is indexed
|
113
151
|
|
@@ -119,7 +157,12 @@ class DbSqliteProvider(BaseProvider):
|
|
119
157
|
"""
|
120
158
|
return self.storage.is_external_indexed(store_id, idx, content, type)
|
121
159
|
|
122
|
-
def get_meta_doc_id(
|
160
|
+
def get_meta_doc_id(
|
161
|
+
self,
|
162
|
+
store_id: str,
|
163
|
+
idx: str,
|
164
|
+
meta_id: int
|
165
|
+
) -> str:
|
123
166
|
"""
|
124
167
|
Get indexed document id by meta id
|
125
168
|
|
@@ -130,7 +173,12 @@ class DbSqliteProvider(BaseProvider):
|
|
130
173
|
"""
|
131
174
|
return self.storage.get_meta_doc_id(store_id, idx, meta_id)
|
132
175
|
|
133
|
-
def get_file_doc_id(
|
176
|
+
def get_file_doc_id(
|
177
|
+
self,
|
178
|
+
store_id: str,
|
179
|
+
idx: str,
|
180
|
+
file_id: str
|
181
|
+
) -> str:
|
134
182
|
"""
|
135
183
|
Get indexed document id by file id
|
136
184
|
|
@@ -141,7 +189,13 @@ class DbSqliteProvider(BaseProvider):
|
|
141
189
|
"""
|
142
190
|
return self.storage.get_file_doc_id(store_id, idx, file_id)
|
143
191
|
|
144
|
-
def get_external_doc_id(
|
192
|
+
def get_external_doc_id(
|
193
|
+
self,
|
194
|
+
store_id: str,
|
195
|
+
idx: str,
|
196
|
+
content: str,
|
197
|
+
type: str
|
198
|
+
) -> str:
|
145
199
|
"""
|
146
200
|
Get indexed document id by file id
|
147
201
|
|
@@ -153,7 +207,12 @@ class DbSqliteProvider(BaseProvider):
|
|
153
207
|
"""
|
154
208
|
return self.storage.get_external_doc_id(store_id, idx, content, type)
|
155
209
|
|
156
|
-
def update_file(
|
210
|
+
def update_file(
|
211
|
+
self,
|
212
|
+
id: int,
|
213
|
+
doc_id: str,
|
214
|
+
ts: int
|
215
|
+
) -> bool:
|
157
216
|
"""
|
158
217
|
Update indexed timestamp of indexed file
|
159
218
|
|
@@ -163,7 +222,11 @@ class DbSqliteProvider(BaseProvider):
|
|
163
222
|
"""
|
164
223
|
return self.storage.update_file(id, doc_id, ts)
|
165
224
|
|
166
|
-
def update_ctx_meta(
|
225
|
+
def update_ctx_meta(
|
226
|
+
self,
|
227
|
+
meta_id: int,
|
228
|
+
doc_id: str
|
229
|
+
) -> bool:
|
167
230
|
"""
|
168
231
|
Update indexed timestamp of indexed context meta
|
169
232
|
|
@@ -172,7 +235,13 @@ class DbSqliteProvider(BaseProvider):
|
|
172
235
|
"""
|
173
236
|
return self.storage.update_ctx_meta(meta_id, doc_id)
|
174
237
|
|
175
|
-
def update_external(
|
238
|
+
def update_external(
|
239
|
+
self,
|
240
|
+
content: str,
|
241
|
+
type: str,
|
242
|
+
doc_id: str,
|
243
|
+
ts: int
|
244
|
+
) -> bool:
|
176
245
|
"""
|
177
246
|
Update indexed timestamp of indexed external
|
178
247
|
|
@@ -183,7 +252,12 @@ class DbSqliteProvider(BaseProvider):
|
|
183
252
|
"""
|
184
253
|
return self.storage.update_external(content, type, doc_id, ts)
|
185
254
|
|
186
|
-
def remove_file(
|
255
|
+
def remove_file(
|
256
|
+
self,
|
257
|
+
store_id: str,
|
258
|
+
idx: str,
|
259
|
+
doc_id: str
|
260
|
+
):
|
187
261
|
"""
|
188
262
|
Remove file from index
|
189
263
|
|
@@ -193,7 +267,12 @@ class DbSqliteProvider(BaseProvider):
|
|
193
267
|
"""
|
194
268
|
self.storage.remove_file(store_id, idx, doc_id)
|
195
269
|
|
196
|
-
def remove_ctx_meta(
|
270
|
+
def remove_ctx_meta(
|
271
|
+
self,
|
272
|
+
store_id: str,
|
273
|
+
idx: str,
|
274
|
+
meta_id: str
|
275
|
+
):
|
197
276
|
"""
|
198
277
|
Remove file from index
|
199
278
|
|
@@ -203,7 +282,12 @@ class DbSqliteProvider(BaseProvider):
|
|
203
282
|
"""
|
204
283
|
self.storage.remove_ctx_meta(store_id, idx, meta_id)
|
205
284
|
|
206
|
-
def remove_external(
|
285
|
+
def remove_external(
|
286
|
+
self,
|
287
|
+
store_id: str,
|
288
|
+
idx: str,
|
289
|
+
doc_id: str
|
290
|
+
):
|
207
291
|
"""
|
208
292
|
Remove external from index
|
209
293
|
|
@@ -213,7 +297,11 @@ class DbSqliteProvider(BaseProvider):
|
|
213
297
|
"""
|
214
298
|
self.storage.remove_external(store_id, idx, doc_id)
|
215
299
|
|
216
|
-
def truncate(
|
300
|
+
def truncate(
|
301
|
+
self,
|
302
|
+
store_id: str,
|
303
|
+
idx: str
|
304
|
+
) -> bool:
|
217
305
|
"""
|
218
306
|
Truncate idx (remove all items)
|
219
307
|
|
@@ -223,7 +311,11 @@ class DbSqliteProvider(BaseProvider):
|
|
223
311
|
"""
|
224
312
|
return self.storage.truncate_all(store_id, idx)
|
225
313
|
|
226
|
-
def truncate_all(
|
314
|
+
def truncate_all(
|
315
|
+
self,
|
316
|
+
store_id: Optional[str] = None,
|
317
|
+
idx: Optional[str] = None
|
318
|
+
) -> bool:
|
227
319
|
"""
|
228
320
|
Truncate idx (remove all items) - all store and indexes
|
229
321
|
|
@@ -233,7 +325,11 @@ class DbSqliteProvider(BaseProvider):
|
|
233
325
|
"""
|
234
326
|
return self.storage.truncate_all(store_id, idx)
|
235
327
|
|
236
|
-
def truncate_files(
|
328
|
+
def truncate_files(
|
329
|
+
self,
|
330
|
+
store_id: Optional[str] = None,
|
331
|
+
idx: Optional[str] = None
|
332
|
+
) -> bool:
|
237
333
|
"""
|
238
334
|
Truncate files idx (remove all items) - all store and indexes
|
239
335
|
|
@@ -243,7 +339,11 @@ class DbSqliteProvider(BaseProvider):
|
|
243
339
|
"""
|
244
340
|
return self.storage.truncate_files(store_id, idx)
|
245
341
|
|
246
|
-
def truncate_ctx(
|
342
|
+
def truncate_ctx(
|
343
|
+
self,
|
344
|
+
store_id: Optional[str] = None,
|
345
|
+
idx: Optional[str] = None
|
346
|
+
) -> bool:
|
247
347
|
"""
|
248
348
|
Truncate context meta idx (remove all items) - all store and indexes
|
249
349
|
|
@@ -253,7 +353,11 @@ class DbSqliteProvider(BaseProvider):
|
|
253
353
|
"""
|
254
354
|
return self.storage.truncate_ctx(store_id, idx)
|
255
355
|
|
256
|
-
def truncate_external(
|
356
|
+
def truncate_external(
|
357
|
+
self,
|
358
|
+
store_id: Optional[str] = None,
|
359
|
+
idx: Optional[str] = None
|
360
|
+
) -> bool:
|
257
361
|
"""
|
258
362
|
Truncate external idx (remove all items) - all store and indexes
|
259
363
|
|
@@ -263,7 +367,10 @@ class DbSqliteProvider(BaseProvider):
|
|
263
367
|
"""
|
264
368
|
return self.storage.truncate_external(store_id, idx)
|
265
369
|
|
266
|
-
def get_counters(
|
370
|
+
def get_counters(
|
371
|
+
self,
|
372
|
+
type: str
|
373
|
+
) -> Dict[str, Dict[str, int]]:
|
267
374
|
"""
|
268
375
|
Get counters (stats, count items by type [file, ctx, external])
|
269
376
|
|