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.
- pygpt_net/CHANGELOG.txt +7 -0
- pygpt_net/__init__.py +3 -3
- pygpt_net/app_core.py +4 -2
- pygpt_net/controller/__init__.py +5 -1
- pygpt_net/controller/assistant/assistant.py +1 -4
- pygpt_net/controller/assistant/batch.py +5 -504
- pygpt_net/controller/assistant/editor.py +5 -5
- pygpt_net/controller/assistant/files.py +16 -16
- pygpt_net/controller/chat/handler/google_stream.py +307 -1
- pygpt_net/controller/chat/handler/worker.py +8 -1
- pygpt_net/controller/chat/image.py +2 -2
- pygpt_net/controller/dialogs/confirm.py +73 -101
- pygpt_net/controller/lang/mapping.py +9 -9
- pygpt_net/controller/painter/capture.py +50 -1
- pygpt_net/controller/presets/presets.py +2 -1
- pygpt_net/controller/remote_store/__init__.py +12 -0
- pygpt_net/{provider/core/assistant_file/db_sqlite → controller/remote_store/google}/__init__.py +2 -2
- pygpt_net/controller/remote_store/google/batch.py +402 -0
- pygpt_net/controller/remote_store/google/store.py +615 -0
- pygpt_net/controller/remote_store/openai/__init__.py +12 -0
- pygpt_net/controller/remote_store/openai/batch.py +524 -0
- pygpt_net/controller/{assistant → remote_store/openai}/store.py +63 -60
- pygpt_net/controller/remote_store/remote_store.py +35 -0
- pygpt_net/controller/ui/ui.py +20 -1
- pygpt_net/core/assistants/assistants.py +3 -15
- pygpt_net/core/db/database.py +5 -3
- pygpt_net/core/locale/placeholder.py +35 -0
- pygpt_net/core/remote_store/__init__.py +12 -0
- pygpt_net/core/remote_store/google/__init__.py +11 -0
- pygpt_net/core/remote_store/google/files.py +224 -0
- pygpt_net/core/remote_store/google/store.py +248 -0
- pygpt_net/core/remote_store/openai/__init__.py +11 -0
- pygpt_net/core/{assistants → remote_store/openai}/files.py +26 -19
- pygpt_net/core/{assistants → remote_store/openai}/store.py +32 -15
- pygpt_net/core/remote_store/remote_store.py +24 -0
- pygpt_net/data/config/config.json +8 -4
- pygpt_net/data/config/models.json +77 -3
- pygpt_net/data/config/settings.json +45 -0
- pygpt_net/data/locale/locale.de.ini +41 -41
- pygpt_net/data/locale/locale.en.ini +53 -43
- pygpt_net/data/locale/locale.es.ini +41 -41
- pygpt_net/data/locale/locale.fr.ini +41 -41
- pygpt_net/data/locale/locale.it.ini +41 -41
- pygpt_net/data/locale/locale.pl.ini +42 -42
- pygpt_net/data/locale/locale.uk.ini +41 -41
- pygpt_net/data/locale/locale.zh.ini +41 -41
- pygpt_net/data/locale/plugin.cmd_history.de.ini +1 -1
- pygpt_net/data/locale/plugin.cmd_history.en.ini +1 -1
- pygpt_net/data/locale/plugin.cmd_history.es.ini +1 -1
- pygpt_net/data/locale/plugin.cmd_history.fr.ini +1 -1
- pygpt_net/data/locale/plugin.cmd_history.it.ini +1 -1
- pygpt_net/data/locale/plugin.cmd_history.pl.ini +1 -1
- pygpt_net/data/locale/plugin.cmd_history.uk.ini +1 -1
- pygpt_net/data/locale/plugin.cmd_history.zh.ini +1 -1
- pygpt_net/data/locale/plugin.cmd_mouse_control.en.ini +14 -0
- pygpt_net/data/locale/plugin.cmd_web.de.ini +1 -1
- pygpt_net/data/locale/plugin.cmd_web.en.ini +1 -1
- pygpt_net/data/locale/plugin.cmd_web.es.ini +1 -1
- pygpt_net/data/locale/plugin.cmd_web.fr.ini +1 -1
- pygpt_net/data/locale/plugin.cmd_web.it.ini +1 -1
- pygpt_net/data/locale/plugin.cmd_web.pl.ini +1 -1
- pygpt_net/data/locale/plugin.cmd_web.uk.ini +1 -1
- pygpt_net/data/locale/plugin.cmd_web.zh.ini +1 -1
- pygpt_net/data/locale/plugin.idx_llama_index.de.ini +2 -2
- pygpt_net/data/locale/plugin.idx_llama_index.en.ini +2 -2
- pygpt_net/data/locale/plugin.idx_llama_index.es.ini +2 -2
- pygpt_net/data/locale/plugin.idx_llama_index.fr.ini +2 -2
- pygpt_net/data/locale/plugin.idx_llama_index.it.ini +2 -2
- pygpt_net/data/locale/plugin.idx_llama_index.pl.ini +2 -2
- pygpt_net/data/locale/plugin.idx_llama_index.uk.ini +2 -2
- pygpt_net/data/locale/plugin.idx_llama_index.zh.ini +2 -2
- pygpt_net/item/assistant.py +1 -211
- pygpt_net/item/ctx.py +3 -1
- pygpt_net/item/store.py +238 -0
- pygpt_net/migrations/Version20260102190000.py +35 -0
- pygpt_net/migrations/__init__.py +3 -1
- pygpt_net/plugin/cmd_mouse_control/config.py +470 -1
- pygpt_net/plugin/cmd_mouse_control/plugin.py +488 -22
- pygpt_net/plugin/cmd_mouse_control/worker.py +464 -87
- pygpt_net/plugin/cmd_mouse_control/worker_sandbox.py +729 -0
- pygpt_net/plugin/idx_llama_index/config.py +2 -2
- pygpt_net/provider/api/google/__init__.py +16 -54
- pygpt_net/provider/api/google/chat.py +546 -129
- pygpt_net/provider/api/google/computer.py +190 -0
- pygpt_net/provider/api/google/realtime/realtime.py +2 -2
- pygpt_net/provider/api/google/remote_tools.py +93 -0
- pygpt_net/provider/api/google/store.py +546 -0
- pygpt_net/provider/api/google/worker/__init__.py +0 -0
- pygpt_net/provider/api/google/worker/importer.py +392 -0
- pygpt_net/provider/api/openai/computer.py +10 -1
- pygpt_net/provider/api/openai/store.py +6 -6
- pygpt_net/provider/api/openai/worker/importer.py +24 -24
- pygpt_net/provider/core/config/patch.py +16 -1
- pygpt_net/provider/core/config/patches/patch_before_2_6_42.py +3 -3
- pygpt_net/provider/core/model/patch.py +17 -3
- pygpt_net/provider/core/preset/json_file.py +13 -7
- pygpt_net/provider/core/{assistant_file → remote_file}/__init__.py +1 -1
- pygpt_net/provider/core/{assistant_file → remote_file}/base.py +9 -9
- pygpt_net/provider/core/remote_file/db_sqlite/__init__.py +12 -0
- pygpt_net/provider/core/{assistant_file → remote_file}/db_sqlite/patch.py +1 -1
- pygpt_net/provider/core/{assistant_file → remote_file}/db_sqlite/provider.py +23 -20
- pygpt_net/provider/core/{assistant_file → remote_file}/db_sqlite/storage.py +35 -27
- pygpt_net/provider/core/{assistant_file → remote_file}/db_sqlite/utils.py +5 -4
- pygpt_net/provider/core/{assistant_store → remote_store}/__init__.py +1 -1
- pygpt_net/provider/core/{assistant_store → remote_store}/base.py +10 -10
- pygpt_net/provider/core/{assistant_store → remote_store}/db_sqlite/__init__.py +1 -1
- pygpt_net/provider/core/{assistant_store → remote_store}/db_sqlite/patch.py +1 -1
- pygpt_net/provider/core/{assistant_store → remote_store}/db_sqlite/provider.py +16 -15
- pygpt_net/provider/core/{assistant_store → remote_store}/db_sqlite/storage.py +30 -23
- pygpt_net/provider/core/{assistant_store → remote_store}/db_sqlite/utils.py +5 -4
- pygpt_net/provider/core/{assistant_store → remote_store}/json_file.py +9 -9
- pygpt_net/provider/llms/google.py +2 -2
- pygpt_net/ui/base/config_dialog.py +3 -2
- pygpt_net/ui/dialog/assistant.py +3 -3
- pygpt_net/ui/dialog/plugins.py +3 -1
- pygpt_net/ui/dialog/remote_store_google.py +539 -0
- pygpt_net/ui/dialog/{assistant_store.py → remote_store_openai.py} +95 -95
- pygpt_net/ui/dialogs.py +5 -3
- pygpt_net/ui/layout/chat/attachments_uploaded.py +3 -3
- pygpt_net/ui/layout/toolbox/computer_env.py +26 -8
- pygpt_net/ui/menu/tools.py +13 -5
- pygpt_net/ui/widget/dialog/remote_store_google.py +56 -0
- pygpt_net/ui/widget/dialog/{assistant_store.py → remote_store_openai.py} +9 -9
- pygpt_net/ui/widget/element/button.py +4 -4
- pygpt_net/ui/widget/lists/remote_store_google.py +248 -0
- pygpt_net/ui/widget/lists/{assistant_store.py → remote_store_openai.py} +21 -21
- pygpt_net/ui/widget/option/checkbox_list.py +47 -9
- pygpt_net/ui/widget/option/combo.py +39 -3
- {pygpt_net-2.7.4.dist-info → pygpt_net-2.7.5.dist-info}/METADATA +33 -2
- {pygpt_net-2.7.4.dist-info → pygpt_net-2.7.5.dist-info}/RECORD +133 -108
- {pygpt_net-2.7.4.dist-info → pygpt_net-2.7.5.dist-info}/LICENSE +0 -0
- {pygpt_net-2.7.4.dist-info → pygpt_net-2.7.5.dist-info}/WHEEL +0 -0
- {pygpt_net-2.7.4.dist-info → pygpt_net-2.7.5.dist-info}/entry_points.txt +0 -0
pygpt_net/item/assistant.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:
|
|
9
|
+
# Updated Date: 2026.01.02 20:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
import json
|
|
@@ -219,213 +219,3 @@ class AssistantItem:
|
|
|
219
219
|
"""To string"""
|
|
220
220
|
return self.dump()
|
|
221
221
|
|
|
222
|
-
|
|
223
|
-
@dataclass(slots=True)
|
|
224
|
-
class AssistantStoreItem:
|
|
225
|
-
id: Optional[object] = None
|
|
226
|
-
record_id: Optional[object] = None
|
|
227
|
-
uuid: Optional[object] = None
|
|
228
|
-
name: Optional[object] = None
|
|
229
|
-
description: Optional[object] = None
|
|
230
|
-
status: dict = field(default_factory=dict)
|
|
231
|
-
last_status: str = ""
|
|
232
|
-
expire_days: int = 0
|
|
233
|
-
usage_bytes: int = 0
|
|
234
|
-
bytes: int = 0
|
|
235
|
-
num_files: int = 0
|
|
236
|
-
is_thread: bool = False
|
|
237
|
-
created: int = 0
|
|
238
|
-
updated: int = 0
|
|
239
|
-
last_active: int = 0
|
|
240
|
-
last_sync: int = 0
|
|
241
|
-
file_ids: list = field(default_factory=list)
|
|
242
|
-
|
|
243
|
-
def __init__(self):
|
|
244
|
-
"""Assistant vector store item"""
|
|
245
|
-
self.id = None
|
|
246
|
-
self.record_id = None
|
|
247
|
-
self.uuid = None
|
|
248
|
-
self.name = None
|
|
249
|
-
self.description = None
|
|
250
|
-
self.status = {}
|
|
251
|
-
self.last_status = ""
|
|
252
|
-
self.expire_days = 0
|
|
253
|
-
self.usage_bytes = 0
|
|
254
|
-
self.bytes = 0
|
|
255
|
-
self.num_files = 0
|
|
256
|
-
self.is_thread = False
|
|
257
|
-
self.created = int(time.time())
|
|
258
|
-
self.updated = int(time.time())
|
|
259
|
-
self.last_active = int(time.time())
|
|
260
|
-
self.last_sync = int(time.time())
|
|
261
|
-
|
|
262
|
-
def reset(self):
|
|
263
|
-
"""Reset store"""
|
|
264
|
-
self.id = None
|
|
265
|
-
self.record_id = None
|
|
266
|
-
self.uuid = None
|
|
267
|
-
self.name = None
|
|
268
|
-
self.description = None
|
|
269
|
-
self.status = {}
|
|
270
|
-
self.last_status = ""
|
|
271
|
-
self.expire_days = 0
|
|
272
|
-
self.usage_bytes = 0
|
|
273
|
-
self.num_files = 0
|
|
274
|
-
self.bytes = 0
|
|
275
|
-
self.is_thread = False
|
|
276
|
-
self.last_active = int(time.time())
|
|
277
|
-
self.last_sync = int(time.time())
|
|
278
|
-
|
|
279
|
-
def to_dict(self) -> dict:
|
|
280
|
-
"""
|
|
281
|
-
Return as dictionary
|
|
282
|
-
|
|
283
|
-
:return: dictionary
|
|
284
|
-
"""
|
|
285
|
-
return {
|
|
286
|
-
"id": self.id,
|
|
287
|
-
"uuid": self.uuid,
|
|
288
|
-
"name": self.name,
|
|
289
|
-
"description": self.description,
|
|
290
|
-
"last_status": self.last_status,
|
|
291
|
-
"expire_days": self.expire_days,
|
|
292
|
-
"usage_bytes": self.usage_bytes,
|
|
293
|
-
"num_files": self.num_files,
|
|
294
|
-
"status": self.status,
|
|
295
|
-
"is_thread": self.is_thread,
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
def from_dict(self, data: dict):
|
|
299
|
-
"""
|
|
300
|
-
Load from dictionary
|
|
301
|
-
|
|
302
|
-
:param data: dictionary
|
|
303
|
-
"""
|
|
304
|
-
self.id = data.get('id', None)
|
|
305
|
-
self.name = data.get('name', None)
|
|
306
|
-
self.uuid = data.get('uuid', None)
|
|
307
|
-
self.expire_days = data.get('expire_days', 0)
|
|
308
|
-
self.status = data.get('status', {})
|
|
309
|
-
|
|
310
|
-
def get_file_count(self):
|
|
311
|
-
"""
|
|
312
|
-
Return number of files in store
|
|
313
|
-
|
|
314
|
-
:return: number of files
|
|
315
|
-
"""
|
|
316
|
-
num = self.num_files
|
|
317
|
-
if self.status and isinstance(self.status, dict) and 'file_counts' in self.status:
|
|
318
|
-
if 'completed' in self.status['file_counts']:
|
|
319
|
-
num = int(self.status['file_counts']['completed'] or 0)
|
|
320
|
-
return num
|
|
321
|
-
|
|
322
|
-
def dump(self) -> str:
|
|
323
|
-
"""
|
|
324
|
-
Dump item to string
|
|
325
|
-
|
|
326
|
-
:return: serialized item
|
|
327
|
-
"""
|
|
328
|
-
try:
|
|
329
|
-
return json.dumps(self.to_dict())
|
|
330
|
-
except Exception as e:
|
|
331
|
-
pass
|
|
332
|
-
return ""
|
|
333
|
-
|
|
334
|
-
def __str__(self):
|
|
335
|
-
"""To string"""
|
|
336
|
-
return self.dump()
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
@dataclass(slots=True)
|
|
340
|
-
class AssistantFileItem:
|
|
341
|
-
id: Optional[object] = None
|
|
342
|
-
record_id: Optional[object] = None
|
|
343
|
-
name: Optional[object] = None
|
|
344
|
-
path: Optional[object] = None
|
|
345
|
-
file_id: Optional[object] = None
|
|
346
|
-
store_id: Optional[object] = None
|
|
347
|
-
thread_id: Optional[object] = None
|
|
348
|
-
uuid: Optional[object] = None
|
|
349
|
-
size: int = 0
|
|
350
|
-
created: int = 0
|
|
351
|
-
updated: int = 0
|
|
352
|
-
|
|
353
|
-
def __init__(self):
|
|
354
|
-
"""Assistant file item"""
|
|
355
|
-
self.id = None
|
|
356
|
-
self.record_id = None
|
|
357
|
-
self.name = None
|
|
358
|
-
self.path = None
|
|
359
|
-
self.file_id = None
|
|
360
|
-
self.store_id = None
|
|
361
|
-
self.thread_id = None
|
|
362
|
-
self.uuid = None
|
|
363
|
-
self.size = 0
|
|
364
|
-
self.created = 0
|
|
365
|
-
self.updated = 0
|
|
366
|
-
|
|
367
|
-
def reset(self):
|
|
368
|
-
"""Reset store"""
|
|
369
|
-
self.id = None
|
|
370
|
-
self.record_id = None
|
|
371
|
-
self.name = None
|
|
372
|
-
self.path = None
|
|
373
|
-
self.file_id = None
|
|
374
|
-
self.store_id = None
|
|
375
|
-
self.thread_id = None
|
|
376
|
-
self.uuid = None
|
|
377
|
-
self.size = 0
|
|
378
|
-
self.created = 0
|
|
379
|
-
self.updated = 0
|
|
380
|
-
|
|
381
|
-
def to_dict(self) -> dict:
|
|
382
|
-
"""
|
|
383
|
-
Return as dictionary
|
|
384
|
-
|
|
385
|
-
:return: dictionary
|
|
386
|
-
"""
|
|
387
|
-
return {
|
|
388
|
-
"id": self.id,
|
|
389
|
-
"name": self.name,
|
|
390
|
-
"path": self.path,
|
|
391
|
-
"file_id": self.file_id,
|
|
392
|
-
"store_id": self.store_id,
|
|
393
|
-
"thread_id": self.thread_id,
|
|
394
|
-
"uuid": self.uuid,
|
|
395
|
-
"size": self.size,
|
|
396
|
-
"created": self.created,
|
|
397
|
-
"updated": self.updated,
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
def from_dict(self, data: dict):
|
|
401
|
-
"""
|
|
402
|
-
Load from dictionary
|
|
403
|
-
|
|
404
|
-
:param data: dictionary
|
|
405
|
-
"""
|
|
406
|
-
self.id = data.get('id', None)
|
|
407
|
-
self.name = data.get('name', None)
|
|
408
|
-
self.path = data.get('path', None)
|
|
409
|
-
self.file_id = data.get('file_id', None)
|
|
410
|
-
self.store_id = data.get('store_id', None)
|
|
411
|
-
self.thread_id = data.get('thread_id', None)
|
|
412
|
-
self.uuid = data.get('uuid', None)
|
|
413
|
-
self.size = data.get('size', 0)
|
|
414
|
-
self.created = data.get('created', 0)
|
|
415
|
-
self.updated = data.get('updated', 0)
|
|
416
|
-
|
|
417
|
-
def dump(self) -> str:
|
|
418
|
-
"""
|
|
419
|
-
Dump item to string
|
|
420
|
-
|
|
421
|
-
:return: serialized item
|
|
422
|
-
"""
|
|
423
|
-
try:
|
|
424
|
-
return json.dumps(self.to_dict())
|
|
425
|
-
except Exception as e:
|
|
426
|
-
pass
|
|
427
|
-
return ""
|
|
428
|
-
|
|
429
|
-
def __str__(self):
|
|
430
|
-
"""To string"""
|
|
431
|
-
return self.dump()
|
pygpt_net/item/ctx.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:
|
|
9
|
+
# Updated Date: 2026.01.03 02:10:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
import copy
|
|
@@ -88,6 +88,7 @@ class CtxItem:
|
|
|
88
88
|
urls_before: list = field(default_factory=list)
|
|
89
89
|
use_agent_final_response: bool = False
|
|
90
90
|
use_responses_api: bool = False
|
|
91
|
+
use_google_interactions_api : bool = False
|
|
91
92
|
ai_name: Optional[str] = None
|
|
92
93
|
|
|
93
94
|
def __init__(self, mode: Optional[str] = None):
|
|
@@ -164,6 +165,7 @@ class CtxItem:
|
|
|
164
165
|
self.urls_before = []
|
|
165
166
|
self.use_agent_final_response = False # use agent final response
|
|
166
167
|
self.use_responses_api = False # use responses API format
|
|
168
|
+
self.use_google_interactions_api = False # use Google Interactions API format
|
|
167
169
|
self.ai_name = None # AI name
|
|
168
170
|
|
|
169
171
|
@property
|
pygpt_net/item/store.py
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
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
|
+
import json
|
|
13
|
+
import time
|
|
14
|
+
from dataclasses import dataclass, field
|
|
15
|
+
from typing import Optional
|
|
16
|
+
|
|
17
|
+
from pygpt_net.item.attachment import AttachmentItem
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@dataclass(slots=True)
|
|
21
|
+
class RemoteStoreItem:
|
|
22
|
+
id: Optional[object] = None
|
|
23
|
+
record_id: Optional[object] = None
|
|
24
|
+
uuid: Optional[object] = None
|
|
25
|
+
name: Optional[object] = None
|
|
26
|
+
provider: Optional[object] = None
|
|
27
|
+
description: Optional[object] = None
|
|
28
|
+
status: dict = field(default_factory=dict)
|
|
29
|
+
last_status: str = ""
|
|
30
|
+
expire_days: int = 0
|
|
31
|
+
usage_bytes: int = 0
|
|
32
|
+
bytes: int = 0
|
|
33
|
+
num_files: int = 0
|
|
34
|
+
is_thread: bool = False
|
|
35
|
+
created: int = 0
|
|
36
|
+
updated: int = 0
|
|
37
|
+
last_active: int = 0
|
|
38
|
+
last_sync: int = 0
|
|
39
|
+
file_ids: list = field(default_factory=list)
|
|
40
|
+
|
|
41
|
+
def __init__(self):
|
|
42
|
+
"""Assistant vector store item"""
|
|
43
|
+
self.id = None
|
|
44
|
+
self.record_id = None
|
|
45
|
+
self.uuid = None
|
|
46
|
+
self.name = None
|
|
47
|
+
self.provider = None
|
|
48
|
+
self.description = None
|
|
49
|
+
self.status = {}
|
|
50
|
+
self.last_status = ""
|
|
51
|
+
self.expire_days = 0
|
|
52
|
+
self.usage_bytes = 0
|
|
53
|
+
self.bytes = 0
|
|
54
|
+
self.num_files = 0
|
|
55
|
+
self.is_thread = False
|
|
56
|
+
self.created = int(time.time())
|
|
57
|
+
self.updated = int(time.time())
|
|
58
|
+
self.last_active = int(time.time())
|
|
59
|
+
self.last_sync = int(time.time())
|
|
60
|
+
|
|
61
|
+
def reset(self):
|
|
62
|
+
"""Reset store"""
|
|
63
|
+
self.id = None
|
|
64
|
+
self.record_id = None
|
|
65
|
+
self.uuid = None
|
|
66
|
+
self.name = None
|
|
67
|
+
self.provider = None
|
|
68
|
+
self.description = None
|
|
69
|
+
self.status = {}
|
|
70
|
+
self.last_status = ""
|
|
71
|
+
self.expire_days = 0
|
|
72
|
+
self.usage_bytes = 0
|
|
73
|
+
self.num_files = 0
|
|
74
|
+
self.bytes = 0
|
|
75
|
+
self.is_thread = False
|
|
76
|
+
self.last_active = int(time.time())
|
|
77
|
+
self.last_sync = int(time.time())
|
|
78
|
+
|
|
79
|
+
def to_dict(self) -> dict:
|
|
80
|
+
"""
|
|
81
|
+
Return as dictionary
|
|
82
|
+
|
|
83
|
+
:return: dictionary
|
|
84
|
+
"""
|
|
85
|
+
return {
|
|
86
|
+
"id": self.id,
|
|
87
|
+
"uuid": self.uuid,
|
|
88
|
+
"name": self.name,
|
|
89
|
+
"provider": self.provider,
|
|
90
|
+
"description": self.description,
|
|
91
|
+
"last_status": self.last_status,
|
|
92
|
+
"expire_days": self.expire_days,
|
|
93
|
+
"usage_bytes": self.usage_bytes,
|
|
94
|
+
"num_files": self.num_files,
|
|
95
|
+
"status": self.status,
|
|
96
|
+
"is_thread": self.is_thread,
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
def from_dict(self, data: dict):
|
|
100
|
+
"""
|
|
101
|
+
Load from dictionary
|
|
102
|
+
|
|
103
|
+
:param data: dictionary
|
|
104
|
+
"""
|
|
105
|
+
self.id = data.get('id', None)
|
|
106
|
+
self.name = data.get('name', None)
|
|
107
|
+
self.provider = data.get('provider', None)
|
|
108
|
+
self.uuid = data.get('uuid', None)
|
|
109
|
+
self.expire_days = data.get('expire_days', 0)
|
|
110
|
+
self.status = data.get('status', {})
|
|
111
|
+
|
|
112
|
+
def get_file_count(self):
|
|
113
|
+
"""
|
|
114
|
+
Return number of files in store
|
|
115
|
+
|
|
116
|
+
:return: number of files
|
|
117
|
+
"""
|
|
118
|
+
num = self.num_files
|
|
119
|
+
if self.status and isinstance(self.status, dict) and 'file_counts' in self.status:
|
|
120
|
+
if 'completed' in self.status['file_counts']:
|
|
121
|
+
num = int(self.status['file_counts']['completed'] or 0)
|
|
122
|
+
return num
|
|
123
|
+
|
|
124
|
+
def dump(self) -> str:
|
|
125
|
+
"""
|
|
126
|
+
Dump item to string
|
|
127
|
+
|
|
128
|
+
:return: serialized item
|
|
129
|
+
"""
|
|
130
|
+
try:
|
|
131
|
+
return json.dumps(self.to_dict())
|
|
132
|
+
except Exception as e:
|
|
133
|
+
pass
|
|
134
|
+
return ""
|
|
135
|
+
|
|
136
|
+
def __str__(self):
|
|
137
|
+
"""To string"""
|
|
138
|
+
return self.dump()
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
@dataclass(slots=True)
|
|
142
|
+
class RemoteFileItem:
|
|
143
|
+
id: Optional[object] = None
|
|
144
|
+
record_id: Optional[object] = None
|
|
145
|
+
name: Optional[object] = None
|
|
146
|
+
provider: Optional[object] = None
|
|
147
|
+
path: Optional[object] = None
|
|
148
|
+
file_id: Optional[object] = None
|
|
149
|
+
store_id: Optional[object] = None
|
|
150
|
+
thread_id: Optional[object] = None
|
|
151
|
+
uuid: Optional[object] = None
|
|
152
|
+
size: int = 0
|
|
153
|
+
created: int = 0
|
|
154
|
+
updated: int = 0
|
|
155
|
+
|
|
156
|
+
def __init__(self):
|
|
157
|
+
"""Assistant file item"""
|
|
158
|
+
self.id = None
|
|
159
|
+
self.record_id = None
|
|
160
|
+
self.name = None
|
|
161
|
+
self.provider = None
|
|
162
|
+
self.path = None
|
|
163
|
+
self.file_id = None
|
|
164
|
+
self.store_id = None
|
|
165
|
+
self.thread_id = None
|
|
166
|
+
self.uuid = None
|
|
167
|
+
self.size = 0
|
|
168
|
+
self.created = 0
|
|
169
|
+
self.updated = 0
|
|
170
|
+
|
|
171
|
+
def reset(self):
|
|
172
|
+
"""Reset store"""
|
|
173
|
+
self.id = None
|
|
174
|
+
self.record_id = None
|
|
175
|
+
self.name = None
|
|
176
|
+
self.provider = None
|
|
177
|
+
self.path = None
|
|
178
|
+
self.file_id = None
|
|
179
|
+
self.store_id = None
|
|
180
|
+
self.thread_id = None
|
|
181
|
+
self.uuid = None
|
|
182
|
+
self.size = 0
|
|
183
|
+
self.created = 0
|
|
184
|
+
self.updated = 0
|
|
185
|
+
|
|
186
|
+
def to_dict(self) -> dict:
|
|
187
|
+
"""
|
|
188
|
+
Return as dictionary
|
|
189
|
+
|
|
190
|
+
:return: dictionary
|
|
191
|
+
"""
|
|
192
|
+
return {
|
|
193
|
+
"id": self.id,
|
|
194
|
+
"name": self.name,
|
|
195
|
+
"provider": self.provider,
|
|
196
|
+
"path": self.path,
|
|
197
|
+
"file_id": self.file_id,
|
|
198
|
+
"store_id": self.store_id,
|
|
199
|
+
"thread_id": self.thread_id,
|
|
200
|
+
"uuid": self.uuid,
|
|
201
|
+
"size": self.size,
|
|
202
|
+
"created": self.created,
|
|
203
|
+
"updated": self.updated,
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
def from_dict(self, data: dict):
|
|
207
|
+
"""
|
|
208
|
+
Load from dictionary
|
|
209
|
+
|
|
210
|
+
:param data: dictionary
|
|
211
|
+
"""
|
|
212
|
+
self.id = data.get('id', None)
|
|
213
|
+
self.name = data.get('name', None)
|
|
214
|
+
self.provider = data.get('provider', None)
|
|
215
|
+
self.path = data.get('path', None)
|
|
216
|
+
self.file_id = data.get('file_id', None)
|
|
217
|
+
self.store_id = data.get('store_id', None)
|
|
218
|
+
self.thread_id = data.get('thread_id', None)
|
|
219
|
+
self.uuid = data.get('uuid', None)
|
|
220
|
+
self.size = data.get('size', 0)
|
|
221
|
+
self.created = data.get('created', 0)
|
|
222
|
+
self.updated = data.get('updated', 0)
|
|
223
|
+
|
|
224
|
+
def dump(self) -> str:
|
|
225
|
+
"""
|
|
226
|
+
Dump item to string
|
|
227
|
+
|
|
228
|
+
:return: serialized item
|
|
229
|
+
"""
|
|
230
|
+
try:
|
|
231
|
+
return json.dumps(self.to_dict())
|
|
232
|
+
except Exception as e:
|
|
233
|
+
pass
|
|
234
|
+
return ""
|
|
235
|
+
|
|
236
|
+
def __str__(self):
|
|
237
|
+
"""To string"""
|
|
238
|
+
return self.dump()
|
|
@@ -0,0 +1,35 @@
|
|
|
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 sqlalchemy import text
|
|
13
|
+
|
|
14
|
+
from .base import BaseMigration
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class Version20260102190000(BaseMigration):
|
|
18
|
+
def __init__(self, window=None):
|
|
19
|
+
super(Version20260102190000, self).__init__(window)
|
|
20
|
+
self.window = window
|
|
21
|
+
|
|
22
|
+
def up(self, conn):
|
|
23
|
+
conn.execute(text("""
|
|
24
|
+
ALTER TABLE remote_store ADD COLUMN provider TEXT;
|
|
25
|
+
"""))
|
|
26
|
+
conn.execute(text("""
|
|
27
|
+
ALTER TABLE remote_file ADD COLUMN provider TEXT;
|
|
28
|
+
"""))
|
|
29
|
+
# set all to OpenAI by default
|
|
30
|
+
conn.execute(text("""
|
|
31
|
+
UPDATE remote_store SET provider = 'openai' WHERE provider IS NULL;
|
|
32
|
+
"""))
|
|
33
|
+
conn.execute(text("""
|
|
34
|
+
UPDATE remote_file SET provider = 'openai' WHERE provider IS NULL;
|
|
35
|
+
"""))
|
pygpt_net/migrations/__init__.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:
|
|
9
|
+
# Updated Date: 2026.01.02 20:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
from .Version20231227152900 import Version20231227152900 # 2.0.59
|
|
@@ -23,6 +23,7 @@ from .Version20240501030000 import Version20240501030000 # 2.2.7
|
|
|
23
23
|
from .Version20241122130000 import Version20241122130000 # 2.4.21
|
|
24
24
|
from .Version20241126170000 import Version20241126170000 # 2.4.34
|
|
25
25
|
from .Version20241215110000 import Version20241215110000 # 2.4.43
|
|
26
|
+
from .Version20260102190000 import Version20260102190000 # 2.7.5
|
|
26
27
|
|
|
27
28
|
class Migrations:
|
|
28
29
|
def __init__(self):
|
|
@@ -50,4 +51,5 @@ class Migrations:
|
|
|
50
51
|
Version20241122130000(), # 2.4.21
|
|
51
52
|
Version20241126170000(), # 2.4.34
|
|
52
53
|
Version20241215110000(), # 2.4.43
|
|
54
|
+
Version20260102190000(), # 2.7.5
|
|
53
55
|
]
|