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
@@ -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.26 11:00:00 #
9
+ # Updated Date: 2026.01.03 02:10:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from packaging.version import parse as parse_version, Version
@@ -75,7 +75,7 @@ class Patch:
75
75
  base_model = from_base(model)
76
76
  if base_model:
77
77
  data[model] = base_model
78
- updated = True
78
+ updated = True
79
79
 
80
80
  # < 2.6.67 <--- add missing image input
81
81
  if old < parse_version("2.6.67"):
@@ -100,7 +100,21 @@ class Patch:
100
100
  m = data[model]
101
101
  if not m.is_image_input():
102
102
  m.input.append("image")
103
- updated = True
103
+ updated = True
104
+
105
+ # < 2.7.5 <--- add: gemini-2.5-computer-use-preview-10-2025
106
+ if old < parse_version("2.7.5"):
107
+ print("Migrating models from < 2.7.5...")
108
+ models_to_add = [
109
+ "gemini-2.5-computer-use-preview-10-2025",
110
+ "deep-research-pro-preview-12-2025"
111
+ ]
112
+ for model in models_to_add:
113
+ if model not in data:
114
+ base_model = from_base(model)
115
+ if base_model:
116
+ data[model] = base_model
117
+ updated = True
104
118
 
105
119
  # update file
106
120
  if updated:
@@ -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.08.28 09:00:00 #
9
+ # Updated Date: 2026.01.02 19:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import json
@@ -77,9 +77,12 @@ class JsonFileProvider(BaseProvider):
77
77
  if filename.endswith(".json"):
78
78
  path = os.path.join(self.window.core.config.get_user_dir('presets'), filename)
79
79
  with open(path, 'r', encoding="utf-8") as f:
80
- preset = PresetItem()
81
- self.deserialize(json.load(f), preset)
82
- items[filename[:-5]] = preset
80
+ try:
81
+ preset = PresetItem()
82
+ self.deserialize(json.load(f), preset)
83
+ items[filename[:-5]] = preset
84
+ except Exception as e:
85
+ pass
83
86
  except Exception as e:
84
87
  self.window.core.debug.log(e)
85
88
 
@@ -104,9 +107,12 @@ class JsonFileProvider(BaseProvider):
104
107
  filename
105
108
  )
106
109
  with open(path, 'r', encoding="utf-8") as f:
107
- preset = PresetItem()
108
- self.deserialize(json.load(f), preset)
109
- items[filename[:-5]] = preset
110
+ try:
111
+ preset = PresetItem()
112
+ self.deserialize(json.load(f), preset)
113
+ items[filename[:-5]] = preset
114
+ except Exception as e:
115
+ pass
110
116
  except Exception as e:
111
117
  self.window.core.debug.log(e)
112
118
 
@@ -6,5 +6,5 @@
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.04.26 23:00:00 #
9
+ # Updated Date: 2026.01.02 20:00:00 #
10
10
  # ================================================== #
@@ -6,20 +6,20 @@
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.14 22:00:00 #
9
+ # Updated Date: 2026.01.02 20:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from typing import Dict
13
13
  from packaging.version import Version
14
14
 
15
- from pygpt_net.item.assistant import AssistantFileItem
15
+ from pygpt_net.item.store import RemoteFileItem
16
16
 
17
17
 
18
18
  class BaseProvider:
19
19
  def __init__(self, window=None):
20
20
  self.window = window
21
21
  self.id = ""
22
- self.type = "assistant_file"
22
+ self.type = "remote_file"
23
23
 
24
24
  def attach(self, window):
25
25
  self.window = window
@@ -30,25 +30,25 @@ class BaseProvider:
30
30
  def patch(self, version: Version) -> bool:
31
31
  pass
32
32
 
33
- def create(self, file: AssistantFileItem):
33
+ def create(self, file: RemoteFileItem):
34
34
  pass
35
35
 
36
- def load(self, id) -> AssistantFileItem:
36
+ def load(self, id) -> RemoteFileItem:
37
37
  pass
38
38
 
39
- def load_all(self) -> Dict[str, AssistantFileItem]:
39
+ def load_all(self, provider: str) -> Dict[str, RemoteFileItem]:
40
40
  pass
41
41
 
42
- def save(self, file: AssistantFileItem):
42
+ def save(self, file: RemoteFileItem):
43
43
  pass
44
44
 
45
- def save_all(self, items: Dict[str, AssistantFileItem]):
45
+ def save_all(self, items: Dict[str, RemoteFileItem]):
46
46
  pass
47
47
 
48
48
  def remove(self, id):
49
49
  pass
50
50
 
51
- def truncate(self):
51
+ def truncate(self, provider: str):
52
52
  pass
53
53
 
54
54
  def get_version(self) -> str:
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ # ================================================== #
4
+ # This file is a part of PYGPT package #
5
+ # Website: https://pygpt.net #
6
+ # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
+ # MIT License #
8
+ # Created By : Marcin Szczygliński #
9
+ # Updated Date: 2026.01.02 20:00:00 #
10
+ # ================================================== #
11
+
12
+ from .provider import *
@@ -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.04.26 23:00:00 #
9
+ # Updated Date: 2026.01.02 20:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from packaging.version import parse as parse_version, Version
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.12.14 22:00:00 #
9
+ # Updated Date: 2026.01.02 20:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import uuid
@@ -14,8 +14,8 @@ from typing import Dict
14
14
 
15
15
  from packaging.version import Version
16
16
 
17
- from pygpt_net.item.assistant import AssistantFileItem
18
- from pygpt_net.provider.core.assistant_file.base import BaseProvider
17
+ from pygpt_net.item.store import RemoteFileItem
18
+ from pygpt_net.provider.core.remote_file.base import BaseProvider
19
19
 
20
20
  from .patch import Patch
21
21
  from .storage import Storage
@@ -28,7 +28,7 @@ class DbSqliteProvider(BaseProvider):
28
28
  self.patcher = Patch(window, self)
29
29
  self.storage = Storage(window)
30
30
  self.id = "db_sqlite"
31
- self.type = "assistant_file"
31
+ self.type = "remote_file"
32
32
 
33
33
  def attach(self, window):
34
34
  """
@@ -56,11 +56,11 @@ class DbSqliteProvider(BaseProvider):
56
56
  """
57
57
  return str(uuid.uuid4())
58
58
 
59
- def create(self, file: AssistantFileItem) -> int:
59
+ def create(self, file: RemoteFileItem) -> int:
60
60
  """
61
61
  Create new and return its ID
62
62
 
63
- :param file: AssistantFileItem
63
+ :param file: RemoteFileItem
64
64
  :return: file ID
65
65
  """
66
66
  if file.record_id is None or file.record_id == "":
@@ -68,15 +68,16 @@ class DbSqliteProvider(BaseProvider):
68
68
  file.record_id = self.storage.insert(file)
69
69
  return file.record_id
70
70
 
71
- def load_all(self) -> Dict[str, AssistantFileItem]:
71
+ def load_all(self, provider: str) -> Dict[str, RemoteFileItem]:
72
72
  """
73
73
  Load files from DB
74
74
 
75
+ :param provider: provider ID
75
76
  :return: files dict
76
77
  """
77
- return self.storage.get_all()
78
+ return self.storage.get_all(provider)
78
79
 
79
- def load(self, id: int) -> AssistantFileItem:
80
+ def load(self, id: int) -> RemoteFileItem:
80
81
  """
81
82
  Load file from DB
82
83
 
@@ -85,11 +86,11 @@ class DbSqliteProvider(BaseProvider):
85
86
  """
86
87
  return self.storage.get_by_id(id)
87
88
 
88
- def save(self, file: AssistantFileItem):
89
+ def save(self, file: RemoteFileItem):
89
90
  """
90
91
  Save file to DB
91
92
 
92
- :param file: AssistantFileItem
93
+ :param file: RemoteFileItem
93
94
  """
94
95
  try:
95
96
  self.storage.save(file)
@@ -97,11 +98,11 @@ class DbSqliteProvider(BaseProvider):
97
98
  self.window.core.debug.log(e)
98
99
  print("Error while saving filed: {}".format(str(e)))
99
100
 
100
- def save_all(self, items: Dict[str, AssistantFileItem]):
101
+ def save_all(self, items: Dict[str, RemoteFileItem]):
101
102
  """
102
103
  Save all files to DB
103
104
 
104
- :param items: dict of AssistantFileItem objects
105
+ :param items: dict of RemoteFileItem objects
105
106
  """
106
107
  try:
107
108
  for id in items:
@@ -113,15 +114,15 @@ class DbSqliteProvider(BaseProvider):
113
114
 
114
115
  def get_by_store_or_thread(self, store_id: str, thread_id: str) -> dict:
115
116
  """
116
- Return dict with AssistantFileItem objects, indexed by record ID
117
+ Return dict with RemoteFileItem objects, indexed by record ID
117
118
 
118
- :return: dict of AssistantFileItem objects
119
+ :return: dict of RemoteFileItem objects
119
120
  """
120
121
  return self.storage.get_by_store_or_thread(store_id, thread_id)
121
122
 
122
123
  def count_by_store_or_thread(self, store_id: str, thread_id: str) -> int:
123
124
  """
124
- Count AssistantFileItem objects, indexed by ID
125
+ Count RemoteFileItem objects, indexed by ID
125
126
 
126
127
  :return: number of files
127
128
  """
@@ -163,13 +164,14 @@ class DbSqliteProvider(BaseProvider):
163
164
  """
164
165
  return self.storage.clear_store_from_files(store_id)
165
166
 
166
- def clear_all_stores_from_files(self) -> bool:
167
+ def clear_all_stores_from_files(self, provider: str) -> bool:
167
168
  """
168
169
  Clear all stores from files
169
170
 
171
+ :param provider: provider ID
170
172
  :return: True if deleted
171
173
  """
172
- return self.storage.clear_all_stores_from_files()
174
+ return self.storage.clear_all_stores_from_files(provider)
173
175
 
174
176
  def rename_file(self, record_id: int, name: str) -> bool:
175
177
  """
@@ -181,13 +183,14 @@ class DbSqliteProvider(BaseProvider):
181
183
  """
182
184
  return self.storage.rename_file(record_id, name)
183
185
 
184
- def truncate_all(self) -> bool:
186
+ def truncate_all(self, provider: str) -> bool:
185
187
  """
186
188
  Truncate all files
187
189
 
190
+ :param provider: provider ID
188
191
  :return: True if truncated
189
192
  """
190
- return self.storage.truncate_all()
193
+ return self.storage.truncate_all(provider)
191
194
 
192
195
  def truncate_by_store(self, store_id: str) -> bool:
193
196
  """
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.12.14 22:00:00 #
9
+ # Updated Date: 2026.01.02 20:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import time
@@ -14,7 +14,7 @@ from typing import Dict
14
14
 
15
15
  from sqlalchemy import text
16
16
 
17
- from pygpt_net.item.assistant import AssistantFileItem
17
+ from pygpt_net.item.store import RemoteFileItem
18
18
  from .utils import pack_item_value, unpack_file
19
19
 
20
20
 
@@ -35,36 +35,37 @@ class Storage:
35
35
  """
36
36
  self.window = window
37
37
 
38
- def get_all(self) -> Dict[str, AssistantFileItem]:
38
+ def get_all(self, provider: str) -> Dict[str, RemoteFileItem]:
39
39
  """
40
- Return dict with AssistantFileItem objects, indexed by ID
40
+ Return dict with RemoteFileItem objects, indexed by ID
41
41
 
42
- :return: dict of AssistantFileItem objects
42
+ :param provider: provider ID
43
+ :return: dict of RemoteFileItem objects
43
44
  """
44
45
  stmt = text("""
45
- SELECT * FROM remote_file
46
- """)
46
+ SELECT * FROM remote_file WHERE provider = :provider
47
+ """).bindparams(provider=provider)
47
48
  items = {}
48
49
  db = self.window.core.db.get_db()
49
50
  with db.connect() as conn:
50
51
  result = conn.execute(stmt)
51
52
  for row in result:
52
- file = AssistantFileItem()
53
+ file = RemoteFileItem()
53
54
  unpack_file(file, row._asdict())
54
55
  items[file.id] = file # index by ID
55
56
  return items
56
57
 
57
- def get_by_id(self, id: int) -> AssistantFileItem:
58
+ def get_by_id(self, id: int) -> RemoteFileItem:
58
59
  """
59
- Return AssistantFileItem by ID
60
+ Return RemoteFileItem by ID
60
61
 
61
62
  :param id: file item ID
62
- :return: AssistantFileItem
63
+ :return: RemoteFileItem
63
64
  """
64
65
  stmt = text("""
65
66
  SELECT * FROM remote_file WHERE id = :id LIMIT 1
66
67
  """).bindparams(idx=id)
67
- file = AssistantFileItem()
68
+ file = RemoteFileItem()
68
69
  db = self.window.core.db.get_db()
69
70
  with db.connect() as conn:
70
71
  result = conn.execute(stmt)
@@ -74,9 +75,9 @@ class Storage:
74
75
 
75
76
  def get_by_store_or_thread(self, store_id: str, thread_id: str) -> dict:
76
77
  """
77
- Return dict with AssistantFileItem objects, indexed by ID
78
+ Return dict with RemoteFileItem objects, indexed by ID
78
79
 
79
- :return: dict of AssistantFileItem objects
80
+ :return: dict of RemoteFileItem objects
80
81
  """
81
82
  if (store_id is None or store_id == "") and (thread_id is None or thread_id == ""):
82
83
  return {}
@@ -105,14 +106,14 @@ class Storage:
105
106
  with db.connect() as conn:
106
107
  result = conn.execute(stmt)
107
108
  for row in result:
108
- file = AssistantFileItem()
109
+ file = RemoteFileItem()
109
110
  unpack_file(file, row._asdict())
110
111
  items[file.id] = file # index by record ID
111
112
  return items
112
113
 
113
114
  def count_by_store_or_thread(self, store_id: str, thread_id: str) -> int:
114
115
  """
115
- Count AssistantFileItem objects
116
+ Count RemoteFileItem objects
116
117
 
117
118
  :return: num of files
118
119
  """
@@ -161,21 +162,22 @@ class Storage:
161
162
  with db.connect() as conn:
162
163
  result = conn.execute(stmt)
163
164
  for row in result:
164
- file = AssistantFileItem()
165
+ file = RemoteFileItem()
165
166
  unpack_file(file, row._asdict())
166
167
  items[file.id] = file
167
168
  return items
168
169
 
169
- def truncate_all(self) -> bool:
170
+ def truncate_all(self, provider: str) -> bool:
170
171
  """
171
172
  Truncate all files items
172
173
 
174
+ :param provider: provider ID
173
175
  :return: True if truncated
174
176
  """
175
177
  db = self.window.core.db.get_db()
176
178
  with db.begin() as conn:
177
- conn.execute(text("DELETE FROM remote_file"))
178
- conn.execute(text("DELETE FROM sqlite_sequence WHERE name='remote_file'"))
179
+ conn.execute(text("DELETE FROM remote_file WHERE provider = :provider").bindparams(provider=provider))
180
+ # conn.execute(text("DELETE FROM sqlite_sequence WHERE name='remote_file'"))
179
181
  return True
180
182
 
181
183
  def truncate_by_store(self, store_id: str) -> bool:
@@ -238,15 +240,16 @@ class Storage:
238
240
  conn.execute(stmt)
239
241
  return True
240
242
 
241
- def clear_all_stores_from_files(self) -> bool:
243
+ def clear_all_stores_from_files(self, provider: str) -> bool:
242
244
  """
243
245
  Clear all stores from files
244
246
 
247
+ :param provider: provider ID
245
248
  :return: True if cleared
246
249
  """
247
250
  stmt = text("""
248
- DELETE FROM remote_file WHERE store_id IS NOT NULL
249
- """)
251
+ DELETE FROM remote_file WHERE store_id IS NOT NULL AND provider = :provider
252
+ """).bindparams(provider=provider)
250
253
  db = self.window.core.db.get_db()
251
254
  with db.begin() as conn:
252
255
  conn.execute(stmt)
@@ -271,11 +274,11 @@ class Storage:
271
274
  conn.execute(stmt)
272
275
  return True
273
276
 
274
- def save(self, file: AssistantFileItem):
277
+ def save(self, file: RemoteFileItem):
275
278
  """
276
279
  Insert or update file item
277
280
 
278
- :param file: AssistantFileItem object
281
+ :param file: RemoteFileItem object
279
282
  """
280
283
  db = self.window.core.db.get_db()
281
284
  with db.begin() as conn:
@@ -284,6 +287,7 @@ class Storage:
284
287
  UPDATE remote_file
285
288
  SET
286
289
  name = :name,
290
+ provider = :provider,
287
291
  path = :path,
288
292
  file_id = :file_id,
289
293
  store_id = :store_id,
@@ -293,6 +297,7 @@ class Storage:
293
297
  """).bindparams(
294
298
  id=file.record_id,
295
299
  name=file.name,
300
+ provider=file.provider,
296
301
  path=file.path,
297
302
  file_id=file.file_id,
298
303
  store_id=file.store_id,
@@ -301,11 +306,11 @@ class Storage:
301
306
  )
302
307
  conn.execute(stmt)
303
308
 
304
- def insert(self, file: AssistantFileItem) -> int:
309
+ def insert(self, file: RemoteFileItem) -> int:
305
310
  """
306
311
  Insert file item
307
312
 
308
- :param file: AssistantFileItem object
313
+ :param file: RemoteFileItem object
309
314
  :return: file item ID
310
315
  """
311
316
  db = self.window.core.db.get_db()
@@ -315,6 +320,7 @@ class Storage:
315
320
  (
316
321
  uuid,
317
322
  name,
323
+ provider,
318
324
  path,
319
325
  size,
320
326
  file_id,
@@ -327,6 +333,7 @@ class Storage:
327
333
  (
328
334
  :uuid,
329
335
  :name,
336
+ :provider,
330
337
  :path,
331
338
  :size,
332
339
  :file_id,
@@ -338,6 +345,7 @@ class Storage:
338
345
  """).bindparams(
339
346
  uuid=file.uuid,
340
347
  name=file.name,
348
+ provider=file.provider,
341
349
  path=file.path,
342
350
  size=int(file.size or 0),
343
351
  file_id=file.file_id,
@@ -6,20 +6,20 @@
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.04.26 23:00:00 #
9
+ # Updated Date: 2026.01.02 20:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import json
13
13
 
14
14
  from pygpt_net.utils import unpack_var
15
- from pygpt_net.item.assistant import AssistantFileItem
15
+ from pygpt_net.item.store import RemoteFileItem
16
16
 
17
17
 
18
- def unpack_file(file: AssistantFileItem, row: dict) -> AssistantFileItem:
18
+ def unpack_file(file: RemoteFileItem, row: dict) -> RemoteFileItem:
19
19
  """
20
20
  Unpack file item from DB row
21
21
 
22
- :param file: file item (AssistantStoreItem)
22
+ :param file: file item (RemoteStoreItem)
23
23
  :param row: DB row
24
24
  :return: store item
25
25
  """
@@ -30,6 +30,7 @@ def unpack_file(file: AssistantFileItem, row: dict) -> AssistantFileItem:
30
30
  file.updated = unpack_var(row['updated_ts'], "int")
31
31
  file.size = unpack_var(row['size'], "int")
32
32
  file.name = row['name']
33
+ file.provider = row['provider']
33
34
  file.path = row['path']
34
35
  file.file_id = row['file_id']
35
36
  file.store_id = row['store_id']
@@ -6,5 +6,5 @@
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.04.26 23:00:00 #
9
+ # Updated Date: 2026.01.02 20:00:00 #
10
10
  # ================================================== #
@@ -6,21 +6,21 @@
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.14 22:00:00 #
9
+ # Updated Date: 2026.01.02 20:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from typing import Dict
13
13
 
14
14
  from packaging.version import Version
15
15
 
16
- from pygpt_net.item.assistant import AssistantStoreItem
16
+ from pygpt_net.item.store import RemoteStoreItem
17
17
 
18
18
 
19
19
  class BaseProvider:
20
20
  def __init__(self, window=None):
21
21
  self.window = window
22
22
  self.id = ""
23
- self.type = "assistant_store"
23
+ self.type = "remote_store"
24
24
 
25
25
  def attach(self, window):
26
26
  self.window = window
@@ -31,26 +31,26 @@ class BaseProvider:
31
31
  def patch(self, version: Version) -> bool:
32
32
  pass
33
33
 
34
- def create(self, store: AssistantStoreItem) -> str:
34
+ def create(self, store: RemoteStoreItem) -> str:
35
35
  pass
36
36
 
37
- def load(self, id) -> AssistantStoreItem:
37
+ def load(self, id) -> RemoteStoreItem:
38
38
  pass
39
39
 
40
- def load_all(self) -> Dict[str, AssistantStoreItem]:
40
+ def load_all(self, provider: str) -> Dict[str, RemoteStoreItem]:
41
41
  pass
42
42
 
43
- def save(self, file: AssistantStoreItem):
43
+ def save(self, file: RemoteStoreItem):
44
44
  pass
45
45
 
46
- def save_all(self, items: Dict[str, AssistantStoreItem]):
46
+ def save_all(self, items: Dict[str, RemoteStoreItem]):
47
47
  pass
48
48
 
49
49
  def remove(self, id: str):
50
50
  pass
51
51
 
52
- def truncate(self):
52
+ def truncate(self, provider: str):
53
53
  pass
54
54
 
55
- def dump(self, store: AssistantStoreItem) -> str:
55
+ def dump(self, store: RemoteStoreItem) -> str:
56
56
  pass
@@ -6,7 +6,7 @@
6
6
  # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
7
  # MIT License #
8
8
  # Created By : Marcin Szczygliński #
9
- # Updated Date: 2024.12.14 22:00:00 #
9
+ # Updated Date: 2026.01.02 20:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from .provider import *
@@ -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.04.26 23:00:00 #
9
+ # Updated Date: 2026.01.02 20:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  from packaging.version import parse as parse_version, Version