pygpt-net 2.7.4__py3-none-any.whl → 2.7.5__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.
Files changed (133) hide show
  1. pygpt_net/CHANGELOG.txt +7 -0
  2. pygpt_net/__init__.py +3 -3
  3. pygpt_net/app_core.py +4 -2
  4. pygpt_net/controller/__init__.py +5 -1
  5. pygpt_net/controller/assistant/assistant.py +1 -4
  6. pygpt_net/controller/assistant/batch.py +5 -504
  7. pygpt_net/controller/assistant/editor.py +5 -5
  8. pygpt_net/controller/assistant/files.py +16 -16
  9. pygpt_net/controller/chat/handler/google_stream.py +307 -1
  10. pygpt_net/controller/chat/handler/worker.py +8 -1
  11. pygpt_net/controller/chat/image.py +2 -2
  12. pygpt_net/controller/dialogs/confirm.py +73 -101
  13. pygpt_net/controller/lang/mapping.py +9 -9
  14. pygpt_net/controller/painter/capture.py +50 -1
  15. pygpt_net/controller/presets/presets.py +2 -1
  16. pygpt_net/controller/remote_store/__init__.py +12 -0
  17. pygpt_net/{provider/core/assistant_file/db_sqlite → controller/remote_store/google}/__init__.py +2 -2
  18. pygpt_net/controller/remote_store/google/batch.py +402 -0
  19. pygpt_net/controller/remote_store/google/store.py +615 -0
  20. pygpt_net/controller/remote_store/openai/__init__.py +12 -0
  21. pygpt_net/controller/remote_store/openai/batch.py +524 -0
  22. pygpt_net/controller/{assistant → remote_store/openai}/store.py +63 -60
  23. pygpt_net/controller/remote_store/remote_store.py +35 -0
  24. pygpt_net/controller/ui/ui.py +20 -1
  25. pygpt_net/core/assistants/assistants.py +3 -15
  26. pygpt_net/core/db/database.py +5 -3
  27. pygpt_net/core/locale/placeholder.py +35 -0
  28. pygpt_net/core/remote_store/__init__.py +12 -0
  29. pygpt_net/core/remote_store/google/__init__.py +11 -0
  30. pygpt_net/core/remote_store/google/files.py +224 -0
  31. pygpt_net/core/remote_store/google/store.py +248 -0
  32. pygpt_net/core/remote_store/openai/__init__.py +11 -0
  33. pygpt_net/core/{assistants → remote_store/openai}/files.py +26 -19
  34. pygpt_net/core/{assistants → remote_store/openai}/store.py +32 -15
  35. pygpt_net/core/remote_store/remote_store.py +24 -0
  36. pygpt_net/data/config/config.json +8 -4
  37. pygpt_net/data/config/models.json +77 -3
  38. pygpt_net/data/config/settings.json +45 -0
  39. pygpt_net/data/locale/locale.de.ini +41 -41
  40. pygpt_net/data/locale/locale.en.ini +53 -43
  41. pygpt_net/data/locale/locale.es.ini +41 -41
  42. pygpt_net/data/locale/locale.fr.ini +41 -41
  43. pygpt_net/data/locale/locale.it.ini +41 -41
  44. pygpt_net/data/locale/locale.pl.ini +42 -42
  45. pygpt_net/data/locale/locale.uk.ini +41 -41
  46. pygpt_net/data/locale/locale.zh.ini +41 -41
  47. pygpt_net/data/locale/plugin.cmd_history.de.ini +1 -1
  48. pygpt_net/data/locale/plugin.cmd_history.en.ini +1 -1
  49. pygpt_net/data/locale/plugin.cmd_history.es.ini +1 -1
  50. pygpt_net/data/locale/plugin.cmd_history.fr.ini +1 -1
  51. pygpt_net/data/locale/plugin.cmd_history.it.ini +1 -1
  52. pygpt_net/data/locale/plugin.cmd_history.pl.ini +1 -1
  53. pygpt_net/data/locale/plugin.cmd_history.uk.ini +1 -1
  54. pygpt_net/data/locale/plugin.cmd_history.zh.ini +1 -1
  55. pygpt_net/data/locale/plugin.cmd_mouse_control.en.ini +14 -0
  56. pygpt_net/data/locale/plugin.cmd_web.de.ini +1 -1
  57. pygpt_net/data/locale/plugin.cmd_web.en.ini +1 -1
  58. pygpt_net/data/locale/plugin.cmd_web.es.ini +1 -1
  59. pygpt_net/data/locale/plugin.cmd_web.fr.ini +1 -1
  60. pygpt_net/data/locale/plugin.cmd_web.it.ini +1 -1
  61. pygpt_net/data/locale/plugin.cmd_web.pl.ini +1 -1
  62. pygpt_net/data/locale/plugin.cmd_web.uk.ini +1 -1
  63. pygpt_net/data/locale/plugin.cmd_web.zh.ini +1 -1
  64. pygpt_net/data/locale/plugin.idx_llama_index.de.ini +2 -2
  65. pygpt_net/data/locale/plugin.idx_llama_index.en.ini +2 -2
  66. pygpt_net/data/locale/plugin.idx_llama_index.es.ini +2 -2
  67. pygpt_net/data/locale/plugin.idx_llama_index.fr.ini +2 -2
  68. pygpt_net/data/locale/plugin.idx_llama_index.it.ini +2 -2
  69. pygpt_net/data/locale/plugin.idx_llama_index.pl.ini +2 -2
  70. pygpt_net/data/locale/plugin.idx_llama_index.uk.ini +2 -2
  71. pygpt_net/data/locale/plugin.idx_llama_index.zh.ini +2 -2
  72. pygpt_net/item/assistant.py +1 -211
  73. pygpt_net/item/ctx.py +3 -1
  74. pygpt_net/item/store.py +238 -0
  75. pygpt_net/migrations/Version20260102190000.py +35 -0
  76. pygpt_net/migrations/__init__.py +3 -1
  77. pygpt_net/plugin/cmd_mouse_control/config.py +470 -1
  78. pygpt_net/plugin/cmd_mouse_control/plugin.py +488 -22
  79. pygpt_net/plugin/cmd_mouse_control/worker.py +464 -87
  80. pygpt_net/plugin/cmd_mouse_control/worker_sandbox.py +729 -0
  81. pygpt_net/plugin/idx_llama_index/config.py +2 -2
  82. pygpt_net/provider/api/google/__init__.py +16 -54
  83. pygpt_net/provider/api/google/chat.py +546 -129
  84. pygpt_net/provider/api/google/computer.py +190 -0
  85. pygpt_net/provider/api/google/realtime/realtime.py +2 -2
  86. pygpt_net/provider/api/google/remote_tools.py +93 -0
  87. pygpt_net/provider/api/google/store.py +546 -0
  88. pygpt_net/provider/api/google/worker/__init__.py +0 -0
  89. pygpt_net/provider/api/google/worker/importer.py +392 -0
  90. pygpt_net/provider/api/openai/computer.py +10 -1
  91. pygpt_net/provider/api/openai/store.py +6 -6
  92. pygpt_net/provider/api/openai/worker/importer.py +24 -24
  93. pygpt_net/provider/core/config/patch.py +16 -1
  94. pygpt_net/provider/core/config/patches/patch_before_2_6_42.py +3 -3
  95. pygpt_net/provider/core/model/patch.py +17 -3
  96. pygpt_net/provider/core/preset/json_file.py +13 -7
  97. pygpt_net/provider/core/{assistant_file → remote_file}/__init__.py +1 -1
  98. pygpt_net/provider/core/{assistant_file → remote_file}/base.py +9 -9
  99. pygpt_net/provider/core/remote_file/db_sqlite/__init__.py +12 -0
  100. pygpt_net/provider/core/{assistant_file → remote_file}/db_sqlite/patch.py +1 -1
  101. pygpt_net/provider/core/{assistant_file → remote_file}/db_sqlite/provider.py +23 -20
  102. pygpt_net/provider/core/{assistant_file → remote_file}/db_sqlite/storage.py +35 -27
  103. pygpt_net/provider/core/{assistant_file → remote_file}/db_sqlite/utils.py +5 -4
  104. pygpt_net/provider/core/{assistant_store → remote_store}/__init__.py +1 -1
  105. pygpt_net/provider/core/{assistant_store → remote_store}/base.py +10 -10
  106. pygpt_net/provider/core/{assistant_store → remote_store}/db_sqlite/__init__.py +1 -1
  107. pygpt_net/provider/core/{assistant_store → remote_store}/db_sqlite/patch.py +1 -1
  108. pygpt_net/provider/core/{assistant_store → remote_store}/db_sqlite/provider.py +16 -15
  109. pygpt_net/provider/core/{assistant_store → remote_store}/db_sqlite/storage.py +30 -23
  110. pygpt_net/provider/core/{assistant_store → remote_store}/db_sqlite/utils.py +5 -4
  111. pygpt_net/provider/core/{assistant_store → remote_store}/json_file.py +9 -9
  112. pygpt_net/provider/llms/google.py +2 -2
  113. pygpt_net/ui/base/config_dialog.py +3 -2
  114. pygpt_net/ui/dialog/assistant.py +3 -3
  115. pygpt_net/ui/dialog/plugins.py +3 -1
  116. pygpt_net/ui/dialog/remote_store_google.py +539 -0
  117. pygpt_net/ui/dialog/{assistant_store.py → remote_store_openai.py} +95 -95
  118. pygpt_net/ui/dialogs.py +5 -3
  119. pygpt_net/ui/layout/chat/attachments_uploaded.py +3 -3
  120. pygpt_net/ui/layout/toolbox/computer_env.py +26 -8
  121. pygpt_net/ui/menu/tools.py +13 -5
  122. pygpt_net/ui/widget/dialog/remote_store_google.py +56 -0
  123. pygpt_net/ui/widget/dialog/{assistant_store.py → remote_store_openai.py} +9 -9
  124. pygpt_net/ui/widget/element/button.py +4 -4
  125. pygpt_net/ui/widget/lists/remote_store_google.py +248 -0
  126. pygpt_net/ui/widget/lists/{assistant_store.py → remote_store_openai.py} +21 -21
  127. pygpt_net/ui/widget/option/checkbox_list.py +47 -9
  128. pygpt_net/ui/widget/option/combo.py +39 -3
  129. {pygpt_net-2.7.4.dist-info → pygpt_net-2.7.5.dist-info}/METADATA +33 -2
  130. {pygpt_net-2.7.4.dist-info → pygpt_net-2.7.5.dist-info}/RECORD +133 -108
  131. {pygpt_net-2.7.4.dist-info → pygpt_net-2.7.5.dist-info}/LICENSE +0 -0
  132. {pygpt_net-2.7.4.dist-info → pygpt_net-2.7.5.dist-info}/WHEEL +0 -0
  133. {pygpt_net-2.7.4.dist-info → pygpt_net-2.7.5.dist-info}/entry_points.txt +0 -0
pygpt_net/CHANGELOG.txt CHANGED
@@ -1,3 +1,10 @@
1
+ 2.7.5 (2026-01-03)
2
+
3
+ - Added Sandbox/Playwright option to Computer Use mode.
4
+ - Added support for Google models in Computer Use mode and introduced a new model: gemini-2.5-computer-use-preview-10-2025.
5
+ - Added support for Google models in Research mode and introduced a new model: deep-research-pro-preview-12-2025.
6
+ - Added the Google Vector Stores tool.
7
+
1
8
  2.7.4 (2025-12-31)
2
9
 
3
10
  - Added a splash screen.
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: 2025.12.31 00:00:00 #
9
+ # Updated Date: 2026-01-03 00:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  __author__ = "Marcin Szczygliński"
13
13
  __copyright__ = "Copyright 2025, Marcin Szczygliński"
14
14
  __credits__ = ["Marcin Szczygliński"]
15
15
  __license__ = "MIT"
16
- __version__ = "2.7.4"
17
- __build__ = "2025-12-31"
16
+ __version__ = "2.7.5"
17
+ __build__ = "2026-01-03"
18
18
  __maintainer__ = "Marcin Szczygliński"
19
19
  __github__ = "https://github.com/szczyglis-dev/py-gpt"
20
20
  __report__ = "https://github.com/szczyglis-dev/py-gpt/issues"
pygpt_net/app_core.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: 2025.09.15 23:00:00 #
9
+ # Updated Date: 2026.01.02 20:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from .config import Config
@@ -38,6 +38,7 @@ from .core.platforms import Platforms
38
38
  from .core.plugins import Plugins
39
39
  from .core.presets import Presets
40
40
  from .core.prompt import Prompt
41
+ from .core.remote_store import RemoteStore
41
42
  from .core.settings import Settings
42
43
  from .core.tabs import Tabs
43
44
  from .core.text import Text
@@ -87,7 +88,8 @@ class Core:
87
88
  self.platforms = Platforms(window)
88
89
  self.plugins = Plugins(window)
89
90
  self.presets = Presets(window)
90
- self.prompt = Prompt(window)
91
+ self.prompt = Prompt(window)
92
+ self.remote_store = RemoteStore(window)
91
93
  self.settings = Settings(window)
92
94
  self.tabs = Tabs(window)
93
95
  self.text = Text(window)
@@ -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: 2025.09.16 22:00:00 #
9
+ # Updated Date: 2026.01.02 19:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from .access import Access
@@ -36,6 +36,7 @@ from .notepad import Notepad
36
36
  from .painter import Painter
37
37
  from .plugins import Plugins
38
38
  from .realtime import Realtime
39
+ from .remote_store import RemoteStore
39
40
  from .presets import Presets
40
41
  from .settings import Settings
41
42
  from .theme import Theme
@@ -81,6 +82,7 @@ class Controller:
81
82
  self.plugins = Plugins(window)
82
83
  self.presets = Presets(window)
83
84
  self.realtime = Realtime(window)
85
+ self.remote_store = RemoteStore(window)
84
86
  self.settings = Settings(window)
85
87
  self.theme = Theme(window)
86
88
  self.tools = Tools(window)
@@ -101,6 +103,7 @@ class Controller:
101
103
  # setup controllers
102
104
  self.lang.setup()
103
105
  self.assistant.setup()
106
+ self.remote_store.setup()
104
107
  self.chat.setup()
105
108
  self.agent.setup()
106
109
  self.tools.setup()
@@ -164,6 +167,7 @@ class Controller:
164
167
 
165
168
  self.settings.reload()
166
169
  self.assistant.reload()
170
+ self.remote_store.reload()
167
171
  self.attachment.reload()
168
172
  self.window.core.agents.custom.reload()
169
173
  self.presets.reload()
@@ -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: 2025.12.28 00:00:00 #
9
+ # Updated Date: 2026.01.02 19:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from typing import Optional
@@ -16,7 +16,6 @@ from pygpt_net.item.assistant import AssistantItem
16
16
  from .batch import Batch
17
17
  from .editor import Editor
18
18
  from .files import Files
19
- from .store import VectorStore
20
19
  from .threads import Threads
21
20
 
22
21
  from pygpt_net.core.text.utils import has_unclosed_code_tag
@@ -38,7 +37,6 @@ class Assistant:
38
37
  self.editor = Editor(window)
39
38
  self.files = Files(window)
40
39
  self.threads = Threads(window)
41
- self.store = VectorStore(window)
42
40
 
43
41
  def setup(self):
44
42
  """Setup assistants"""
@@ -328,4 +326,3 @@ class Assistant:
328
326
  def reload(self):
329
327
  """Reload assistants"""
330
328
  self.setup()
331
- self.store.reset()
@@ -6,13 +6,10 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2025.12.27 00:00:00 #
9
+ # Updated Date: 2026.01.02 19:00:00 #
10
10
  # ================================================== #
11
11
 
12
- from typing import Optional, Any, Union
13
-
14
- from PySide6.QtCore import QTimer
15
- from PySide6.QtWidgets import QFileDialog, QApplication
12
+ from typing import Any
16
13
 
17
14
  from pygpt_net.utils import trans
18
15
 
@@ -45,276 +42,6 @@ class Batch:
45
42
  self.window.update_status("Importing assistants...please wait...")
46
43
  self.window.core.api.openai.assistants.importer.import_assistants()
47
44
 
48
- def import_stores(self, force: bool = False):
49
- """
50
- Import vector stores from API
51
-
52
- :param force: if true, imports without confirmation
53
- """
54
- if not force:
55
- self.window.ui.dialogs.confirm(
56
- type='assistant.store.import',
57
- id='',
58
- msg=trans('confirm.assistant.store.import'),
59
- )
60
- return
61
- # run asynchronous
62
- self.window.update_status("Importing vector stores...please wait...")
63
- self.window.core.assistants.store.truncate() # clear all stores
64
- self.window.core.api.openai.assistants.importer.import_vector_stores()
65
- self.window.controller.assistant.files.update()
66
- self.window.controller.assistant.store.update()
67
-
68
- def import_files_current(self):
69
- """Import files from API"""
70
- id = self.window.core.config.get('assistant')
71
- if id is None or id == "":
72
- return
73
- if self.window.core.assistants.has(id):
74
- assistant = self.window.core.assistants.get_by_id(id)
75
- store_id = assistant.vector_store
76
- if store_id is None or store_id == "":
77
- self.window.ui.dialogs.alert(trans("dialog.assistant.store.alert.assign"))
78
- return
79
- self.import_store_files(store_id)
80
-
81
- def import_files(self, force: bool = False):
82
- """
83
- Sync files with API (all)
84
-
85
- :param force: force sync files
86
- """
87
- if not force:
88
- self.window.ui.dialogs.confirm(
89
- type='assistant.files.import.all',
90
- id='',
91
- msg=trans('confirm.assistant.import_files'),
92
- )
93
- return
94
- try:
95
- self.window.controller.assistant.files.import_files() # all
96
- except Exception as e:
97
- self.window.core.debug.log(e)
98
- self.window.ui.dialogs.alert(e)
99
-
100
- def import_store_files(
101
- self,
102
- store_id: str,
103
- force: bool = False
104
- ):
105
- """
106
- Sync files with API (store)
107
-
108
- :param store_id: vector store ID
109
- :param force: force sync files
110
- """
111
- if store_id is None:
112
- self.window.ui.dialogs.alert(trans("dialog.assistant.store.alert.select"))
113
- return
114
-
115
- if not force:
116
- self.window.ui.dialogs.confirm(
117
- type='assistant.files.import.store',
118
- id=store_id,
119
- msg=trans('confirm.assistant.import_files.store'),
120
- )
121
- return
122
- try:
123
- self.window.controller.assistant.files.import_files(store_id) # by store
124
- except Exception as e:
125
- self.window.core.debug.log(e)
126
- self.window.ui.dialogs.alert(e)
127
-
128
- def truncate_files(self, force: bool = False):
129
- """
130
- Truncate all files in API
131
-
132
- :param force: if True, imports without confirmation
133
- """
134
- if not force:
135
- self.window.ui.dialogs.confirm(
136
- type='assistant.files.truncate',
137
- id='',
138
- msg=trans('confirm.assistant.files.truncate'),
139
- )
140
- return
141
- # run asynchronous
142
- self.window.update_status("Removing files...please wait...")
143
- QApplication.processEvents()
144
- self.window.core.api.openai.assistants.importer.truncate_files() # remove all files from API
145
-
146
- def truncate_store_files_by_idx(self, idx: Union[int, list], force: bool = False):
147
- """
148
- Truncate all files in API (store)
149
-
150
- :param idx: store index or list of indexes
151
- :param force: if True, imports without confirmation
152
- """
153
- store_ids = []
154
- ids = idx if isinstance(idx, list) else [idx]
155
- for i in ids:
156
- store_id = self.window.controller.assistant.store.get_by_tab_idx(i)
157
- store_ids.append(store_id)
158
- self.truncate_store_files(store_ids, force)
159
-
160
- def truncate_store_files(self, store_id: Union[str, list], force: bool = False):
161
- """
162
- Truncate all files in API (store)
163
-
164
- :param store_id: store ID
165
- :param force: if True, imports without confirmation
166
- """
167
- if store_id is None:
168
- self.window.ui.dialogs.alert(trans("dialog.assistant.store.alert.select"))
169
- return
170
-
171
- if not force:
172
- self.window.ui.dialogs.confirm(
173
- type='assistant.files.truncate.store',
174
- id=store_id,
175
- msg=trans('confirm.assistant.files.truncate.store'),
176
- )
177
- return
178
- # run asynchronous
179
- self.window.update_status("Removing files...please wait...")
180
- QApplication.processEvents()
181
- ids = store_id if isinstance(store_id, list) else [store_id]
182
- for store_id in ids:
183
- self.window.core.api.openai.assistants.importer.truncate_files(store_id) # remove all files from API
184
-
185
- def clear_store_files_by_idx(
186
- self,
187
- idx: Union[int, list],
188
- force: bool = False
189
- ):
190
- """
191
- Clear files (store, local only)
192
-
193
- :param idx: store index or list of indexes
194
- :param force: if True, clears without confirmation
195
- """
196
- store_ids = []
197
- ids = idx if isinstance(idx, list) else [idx]
198
- for i in ids:
199
- store_id = self.window.controller.assistant.store.get_by_tab_idx(i)
200
- store_ids.append(store_id)
201
- self.clear_store_files(store_ids, force)
202
-
203
- def clear_store_files(
204
- self,
205
- store_id: Optional[Union[str, list]] = None,
206
- force: bool = False
207
- ):
208
- """
209
- Clear files (store, local only)
210
-
211
- :param store_id: store ID or list of store IDs
212
- :param force: if True, clears without confirmation
213
- """
214
- if store_id is None:
215
- self.window.ui.dialogs.alert(trans("dialog.assistant.store.alert.select"))
216
- return
217
-
218
- if not force:
219
- self.window.ui.dialogs.confirm(
220
- type='assistant.files.clear.store',
221
- id=store_id,
222
- msg=trans('confirm.assistant.files.clear'),
223
- )
224
- return
225
- self.window.update_status("Clearing store files...please wait...")
226
- QApplication.processEvents()
227
-
228
- ids = store_id if isinstance(store_id, list) else [store_id]
229
- for store_id in ids:
230
- self.window.core.assistants.files.truncate_local(store_id) # clear files local
231
-
232
- self.window.controller.assistant.files.update()
233
- self.window.update_status("OK. All store files cleared.")
234
- self.window.ui.dialogs.alert(trans("status.finished"))
235
-
236
- def clear_files(self, force: bool = False):
237
- """
238
- Clear files (all, local only)
239
-
240
- :param force: if True, clears without confirmation
241
- """
242
- if not force:
243
- self.window.ui.dialogs.confirm(
244
- type='assistant.files.clear.all',
245
- id='',
246
- msg=trans('confirm.assistant.files.clear'),
247
- )
248
- return
249
- self.window.update_status("Clearing files...please wait...")
250
- QApplication.processEvents()
251
- self.window.core.assistants.files.truncate_local() # clear files local
252
- self.window.controller.assistant.files.update()
253
- self.window.update_status("OK. All files cleared.")
254
- self.window.ui.dialogs.alert(trans("status.finished"))
255
-
256
- def clear_stores(self, force: bool = False):
257
- """
258
- Clear vector stores (local only)
259
-
260
- :param force: if True, clears without confirmation
261
- """
262
- if not force:
263
- self.window.ui.dialogs.confirm(
264
- type='assistant.store.clear',
265
- id='',
266
- msg=trans('confirm.assistant.store.clear'),
267
- )
268
- return
269
- self.window.update_status("Clearing vector stores...please wait...")
270
- QApplication.processEvents()
271
- self.window.core.assistants.store.truncate() # clear all stores
272
- self.window.controller.assistant.files.update()
273
- self.window.controller.assistant.store.update()
274
- self.window.update_status("OK. All stores cleared.")
275
- self.window.controller.assistant.store.current = None
276
- self.window.controller.assistant.store.init()
277
-
278
- def truncate_stores(self, force: bool = False):
279
- """
280
- Truncate vector stores in API
281
-
282
- :param force: if True, truncates without confirmation
283
- """
284
- if not force:
285
- self.window.ui.dialogs.confirm(
286
- type='assistant.store.truncate',
287
- id='',
288
- msg=trans('confirm.assistant.store.truncate'),
289
- )
290
- return
291
- # run asynchronous
292
- self.window.update_status("Removing vector stores...please wait...")
293
- QApplication.processEvents()
294
- self.window.core.assistants.store.truncate() # clear all stores
295
- self.window.core.api.openai.assistants.importer.truncate_vector_stores()
296
- self.window.controller.assistant.files.update()
297
- self.window.controller.assistant.store.update()
298
- self.window.controller.assistant.store.current = None
299
- self.window.controller.assistant.store.init()
300
-
301
- def refresh_stores(self, force: bool = False):
302
- """
303
- Refresh all vector stores
304
-
305
- :param force: if True, refresh without confirmation
306
- """
307
- if not force:
308
- self.window.ui.dialogs.confirm(
309
- type='assistant.store.refresh',
310
- id='',
311
- msg=trans('confirm.assistant.store.refresh'),
312
- )
313
- return
314
- self.window.update_status("Refreshing vector stores...please wait...")
315
- QApplication.processEvents()
316
- self.window.core.api.openai.assistants.importer.refresh_vector_stores()
317
-
318
45
  def handle_imported_assistants(self, num: int):
319
46
  """
320
47
  Handle imported assistants
@@ -322,7 +49,7 @@ class Batch:
322
49
  :param num: number of imported assistants
323
50
  """
324
51
  self.window.controller.assistant.update()
325
- self.window.controller.assistant.store.update()
52
+ self.window.controller.remote_store.openai.update()
326
53
  self.window.controller.assistant.files.update()
327
54
  self.window.update_status("OK. Imported assistants: " + str(num) + ".")
328
55
  self.window.ui.dialogs.alert(trans("status.finished"))
@@ -339,134 +66,6 @@ class Batch:
339
66
  self.window.update_status("Error importing assistants.")
340
67
  self.window.ui.dialogs.alert(error)
341
68
 
342
- def handle_refreshed_stores(self, num: int):
343
- """
344
- Handle refreshed stores
345
-
346
- :param num: number of refreshed files
347
- """
348
- self.window.controller.assistant.store.update_current()
349
- self.window.controller.assistant.store.update()
350
- self.window.ui.dialogs.alert(trans("status.finished"))
351
- self.window.update_status("OK. All stores refreshed.")
352
-
353
- def handle_refreshed_stores_failed(self, error: Any):
354
- """
355
- Handle error on refreshing stores
356
-
357
- :param error: error message
358
- """
359
- self.window.core.debug.log(error)
360
- print("Error refreshing stores", error)
361
- self.window.controller.assistant.files.update()
362
- self.window.controller.assistant.store.update()
363
- self.window.update_status("Error refreshing stores.")
364
- self.window.ui.dialogs.alert(error)
365
-
366
- def handle_imported_stores(self, num: int):
367
- """
368
- Handle imported stores
369
-
370
- :param num: number of imported files
371
- """
372
- self.window.controller.assistant.files.update()
373
- self.window.controller.assistant.store.update()
374
- self.window.update_status("OK. Imported stores: " + str(num) + ".")
375
- # alert on files import after stores
376
- # self.window.ui.dialogs.alert(trans("status.finished"))
377
-
378
- def handle_imported_stores_failed(self, error: Any):
379
- """
380
- Handle error on importing stores
381
-
382
- :param error: error message
383
- """
384
- self.window.core.debug.log(error)
385
- self.window.controller.assistant.files.update()
386
- self.window.controller.assistant.store.update()
387
- print("Error importing stores", error)
388
- self.window.update_status("Error importing stores.")
389
- self.window.ui.dialogs.alert(error)
390
-
391
- def handle_truncated_stores(self, num: int):
392
- """
393
- Handle truncated stores
394
-
395
- :param num: number of removed files
396
- """
397
- self.window.core.assistants.store.truncate()
398
- self.remove_all_stores_from_assistants()
399
- self.window.controller.assistant.files.update()
400
- self.window.controller.assistant.store.update()
401
- self.window.controller.assistant.store.current = None
402
- self.window.controller.assistant.store.init()
403
- self.window.update_status("OK. Removed stores: " + str(num) + ".")
404
- self.window.ui.dialogs.alert(trans("status.finished"))
405
-
406
- def handle_truncated_stores_failed(self, error: Any):
407
- """
408
- Handle error on truncating stores
409
-
410
- :param error: error message
411
- """
412
- self.window.core.debug.log(error)
413
- print("Error removing stores", error)
414
- self.window.controller.assistant.files.update()
415
- self.window.controller.assistant.store.update()
416
- self.window.update_status("Error removing stores.")
417
- self.window.ui.dialogs.alert(error)
418
-
419
- def handle_imported_files(self, num: int):
420
- """
421
- Handle imported files
422
-
423
- :param num: number of imported files
424
- """
425
- self.window.controller.assistant.files.update()
426
- self.window.update_status("OK. Imported files: " + str(num) + ".")
427
- self.window.ui.dialogs.alert(trans("status.finished"))
428
-
429
- def handle_imported_files_failed(self, error: Any):
430
- """
431
- Handle error on importing files
432
-
433
- :param error: error message
434
- """
435
- self.window.core.debug.log(error)
436
- self.window.controller.assistant.files.update()
437
- print("Error importing files")
438
- self.window.update_status("Error importing files.")
439
- self.window.ui.dialogs.alert(error)
440
-
441
- def handle_truncated_files(
442
- self,
443
- store_id: Optional[str] = None,
444
- num: int = 0
445
- ):
446
- """
447
- Handle truncated (in API) files
448
-
449
- :param store_id: vector store ID
450
- :param num: number of truncated files
451
- """
452
- self.window.update_status("OK. Truncated files: " + str(num) + ".")
453
- if store_id is not None:
454
- self.window.controller.assistant.store.refresh_by_store_id(store_id)
455
- self.window.controller.assistant.files.update()
456
- self.window.ui.dialogs.alert(trans("status.finished"))
457
-
458
- def handle_truncated_files_failed(self, error: Any):
459
- """
460
- Handle error on truncated files
461
-
462
- :param error: error message
463
- """
464
- self.window.core.debug.log(error)
465
- print("Error truncating files")
466
- self.window.controller.assistant.files.update()
467
- self.window.update_status("Error truncating files.")
468
- self.window.ui.dialogs.alert(error)
469
-
470
69
  def remove_store_from_assistants(self, store_id: str):
471
70
  """
472
71
  Remove vector store from all assistants after store deletion
@@ -480,7 +79,7 @@ class Batch:
480
79
  assistant.vector_store = None # remove from assistant
481
80
 
482
81
  self.window.core.assistants.save()
483
- self.window.core.assistants.files.on_store_deleted(store_id) # remove from files
82
+ self.window.core.remote_store.openai.files.on_store_deleted(store_id) # remove from files
484
83
 
485
84
  def remove_all_stores_from_assistants(self):
486
85
  """Remove all vector stores from all assistants"""
@@ -490,105 +89,7 @@ class Batch:
490
89
  assistant.vector_store = None
491
90
 
492
91
  self.window.core.assistants.save()
493
- self.window.core.assistants.files.on_all_stores_deleted() # remove all from files
494
-
495
- def open_upload_files(self):
496
- """Open upload files dialog"""
497
- if self.window.controller.assistant.store.current is None:
498
- self.window.ui.dialogs.alert("Please select vector store first.")
499
- return
500
-
501
- options = QFileDialog.Options()
502
- files, _ = QFileDialog.getOpenFileNames(
503
- self.window,
504
- "Select file(s)...",
505
- "",
506
- "All Files (*)",
507
- options=options
508
- )
509
- if files:
510
- self.files_to_upload = files
511
-
512
- if self.files_to_upload:
513
- msg = "Are you sure you want to upload {} file(s)?".format(len(self.files_to_upload))
514
- self.window.ui.dialogs.confirm(
515
- type="assistant.files.upload",
516
- id=0,
517
- msg=msg,
518
- )
519
-
520
- def open_upload_dir(self):
521
- """Open upload files dialog"""
522
- if self.window.controller.assistant.store.current is None:
523
- self.window.ui.dialogs.alert("Please select vector store first.")
524
- return
525
-
526
- options = QFileDialog.Options()
527
- directory = QFileDialog.getExistingDirectory(
528
- self.window,
529
- "Select directory...",
530
- options=options
531
- )
532
- if directory:
533
- self.files_to_upload = self.window.core.filesystem.get_files_from_dir(directory)
534
-
535
- if self.files_to_upload:
536
- msg = ("Are you sure you want to upload {} file(s) from directory {}?".
537
- format(len(self.files_to_upload), directory))
538
- self.window.ui.dialogs.confirm(
539
- type="assistant.files.upload",
540
- id=0,
541
- msg=msg,
542
- )
543
-
544
- def refresh_delayed(self, ms: int = 1000):
545
- """
546
- Refresh UI after delay
547
-
548
- :param ms: milliseconds to wait
549
- """
550
- self.window.update_status("Refreshing status...")
551
- QTimer.singleShot(ms, lambda: self.window.controller.assistant.store.refresh_status())
552
-
553
- def upload(self, force: bool = False):
554
- """
555
- Upload files to vector store
556
-
557
- :param force: if true, uploads without confirmation
558
- """
559
- if self.window.controller.assistant.store.current is None:
560
- self.window.ui.dialogs.alert(trans("dialog.assistant.store.alert.select"))
561
- return
562
-
563
- store_id = self.window.controller.assistant.store.current
564
- self.window.update_status("Uploading files...please wait...")
565
- QApplication.processEvents()
566
- self.window.core.api.openai.assistants.importer.upload_files(store_id, self.files_to_upload)
567
- self.files_to_upload = [] # clear files
568
-
569
- def handle_uploaded_files(self, num: int):
570
- """
571
- Handle uploaded files
572
-
573
- :param num: number of uploaded files
574
- """
575
- self.window.controller.assistant.files.update()
576
- self.window.update_status("OK. Uploaded files: " + str(num) + ".")
577
- self.window.ui.dialogs.alert("OK. Uploaded files: " + str(num) + ".")
578
- self.refresh_delayed(1500)
579
-
580
- def handle_uploaded_files_failed(self, error: Any):
581
- """
582
- Handle error on uploading files
583
-
584
- :param error: error message
585
- """
586
- self.window.core.debug.log(error)
587
- print("Error uploading files")
588
- self.window.controller.assistant.files.update()
589
- self.refresh_delayed(1500)
590
- self.window.update_status("Error uploading files.")
591
- self.window.ui.dialogs.alert(error)
92
+ self.window.core.remote_store.openai.files.on_all_stores_deleted() # remove all from files
592
93
 
593
94
  def handle_status_change(self, mode: str, msg: str):
594
95
  """