pygpt-net 2.6.36__py3-none-any.whl → 2.6.38__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 +12 -0
- pygpt_net/__init__.py +3 -3
- pygpt_net/controller/chat/handler/anthropic_stream.py +164 -0
- pygpt_net/controller/chat/handler/google_stream.py +181 -0
- pygpt_net/controller/chat/handler/langchain_stream.py +24 -0
- pygpt_net/controller/chat/handler/llamaindex_stream.py +47 -0
- pygpt_net/controller/chat/handler/openai_stream.py +260 -0
- pygpt_net/controller/chat/handler/utils.py +210 -0
- pygpt_net/controller/chat/handler/worker.py +570 -0
- pygpt_net/controller/chat/handler/xai_stream.py +135 -0
- pygpt_net/controller/chat/stream.py +1 -1
- pygpt_net/controller/ctx/ctx.py +1 -1
- pygpt_net/controller/debug/debug.py +6 -6
- pygpt_net/controller/model/editor.py +3 -0
- pygpt_net/controller/model/importer.py +9 -2
- pygpt_net/controller/plugins/plugins.py +11 -3
- pygpt_net/controller/presets/presets.py +2 -2
- pygpt_net/core/bridge/context.py +35 -35
- pygpt_net/core/bridge/worker.py +40 -16
- pygpt_net/core/ctx/bag.py +7 -2
- pygpt_net/core/ctx/reply.py +17 -2
- pygpt_net/core/db/viewer.py +19 -34
- pygpt_net/core/render/plain/pid.py +12 -1
- pygpt_net/core/render/web/body.py +30 -39
- pygpt_net/core/tabs/tab.py +24 -1
- pygpt_net/data/config/config.json +10 -3
- pygpt_net/data/config/models.json +3 -3
- pygpt_net/data/config/settings.json +105 -0
- pygpt_net/data/css/style.dark.css +2 -3
- pygpt_net/data/css/style.light.css +2 -3
- pygpt_net/data/locale/locale.de.ini +3 -1
- pygpt_net/data/locale/locale.en.ini +19 -1
- pygpt_net/data/locale/locale.es.ini +3 -1
- pygpt_net/data/locale/locale.fr.ini +3 -1
- pygpt_net/data/locale/locale.it.ini +3 -1
- pygpt_net/data/locale/locale.pl.ini +4 -2
- pygpt_net/data/locale/locale.uk.ini +3 -1
- pygpt_net/data/locale/locale.zh.ini +3 -1
- pygpt_net/item/assistant.py +51 -2
- pygpt_net/item/attachment.py +21 -20
- pygpt_net/item/calendar_note.py +19 -2
- pygpt_net/item/ctx.py +115 -2
- pygpt_net/item/index.py +9 -2
- pygpt_net/item/mode.py +9 -6
- pygpt_net/item/model.py +20 -3
- pygpt_net/item/notepad.py +14 -2
- pygpt_net/item/preset.py +42 -2
- pygpt_net/item/prompt.py +8 -2
- pygpt_net/plugin/cmd_files/plugin.py +2 -2
- pygpt_net/provider/api/__init__.py +5 -3
- pygpt_net/provider/api/anthropic/__init__.py +190 -29
- pygpt_net/provider/api/anthropic/audio.py +30 -0
- pygpt_net/provider/api/anthropic/chat.py +341 -0
- pygpt_net/provider/api/anthropic/image.py +25 -0
- pygpt_net/provider/api/anthropic/tools.py +266 -0
- pygpt_net/provider/api/anthropic/vision.py +142 -0
- pygpt_net/provider/api/google/chat.py +2 -2
- pygpt_net/provider/api/google/realtime/client.py +2 -2
- pygpt_net/provider/api/google/tools.py +58 -48
- pygpt_net/provider/api/google/vision.py +7 -1
- pygpt_net/provider/api/openai/chat.py +1 -0
- pygpt_net/provider/api/openai/vision.py +6 -0
- pygpt_net/provider/api/x_ai/__init__.py +247 -0
- pygpt_net/provider/api/x_ai/audio.py +32 -0
- pygpt_net/provider/api/x_ai/chat.py +968 -0
- pygpt_net/provider/api/x_ai/image.py +208 -0
- pygpt_net/provider/api/x_ai/remote.py +262 -0
- pygpt_net/provider/api/x_ai/tools.py +120 -0
- pygpt_net/provider/api/x_ai/vision.py +119 -0
- pygpt_net/provider/core/attachment/json_file.py +2 -2
- pygpt_net/provider/core/config/patch.py +28 -0
- pygpt_net/provider/llms/anthropic.py +4 -2
- pygpt_net/tools/text_editor/tool.py +4 -1
- pygpt_net/tools/text_editor/ui/dialogs.py +1 -1
- pygpt_net/ui/base/config_dialog.py +5 -11
- pygpt_net/ui/dialog/db.py +177 -59
- pygpt_net/ui/dialog/dictionary.py +57 -59
- pygpt_net/ui/dialog/editor.py +3 -2
- pygpt_net/ui/dialog/image.py +1 -1
- pygpt_net/ui/dialog/logger.py +3 -2
- pygpt_net/ui/dialog/models.py +16 -16
- pygpt_net/ui/dialog/plugins.py +63 -60
- pygpt_net/ui/layout/ctx/ctx_list.py +3 -4
- pygpt_net/ui/layout/toolbox/__init__.py +2 -2
- pygpt_net/ui/layout/toolbox/assistants.py +8 -9
- pygpt_net/ui/layout/toolbox/presets.py +2 -2
- pygpt_net/ui/main.py +9 -4
- pygpt_net/ui/widget/element/labels.py +20 -4
- pygpt_net/ui/widget/textarea/editor.py +0 -4
- pygpt_net/ui/widget/textarea/web.py +1 -1
- {pygpt_net-2.6.36.dist-info → pygpt_net-2.6.38.dist-info}/METADATA +18 -6
- {pygpt_net-2.6.36.dist-info → pygpt_net-2.6.38.dist-info}/RECORD +95 -76
- pygpt_net/controller/chat/handler/stream_worker.py +0 -1136
- {pygpt_net-2.6.36.dist-info → pygpt_net-2.6.38.dist-info}/LICENSE +0 -0
- {pygpt_net-2.6.36.dist-info → pygpt_net-2.6.38.dist-info}/WHEEL +0 -0
- {pygpt_net-2.6.36.dist-info → pygpt_net-2.6.38.dist-info}/entry_points.txt +0 -0
pygpt_net/item/assistant.py
CHANGED
|
@@ -6,16 +6,33 @@
|
|
|
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.
|
|
9
|
+
# Updated Date: 2025.09.05 18:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
import json
|
|
13
13
|
import time
|
|
14
|
+
from dataclasses import dataclass, field
|
|
15
|
+
from typing import Optional
|
|
14
16
|
|
|
15
17
|
from pygpt_net.item.attachment import AttachmentItem
|
|
16
18
|
|
|
17
19
|
|
|
20
|
+
@dataclass(slots=True)
|
|
18
21
|
class AssistantItem:
|
|
22
|
+
id: Optional[object] = None
|
|
23
|
+
name: Optional[object] = None
|
|
24
|
+
description: Optional[object] = None
|
|
25
|
+
instructions: Optional[object] = None
|
|
26
|
+
model: Optional[object] = None
|
|
27
|
+
meta: dict = field(default_factory=dict)
|
|
28
|
+
files: dict = field(default_factory=dict)
|
|
29
|
+
attachments: dict = field(default_factory=dict)
|
|
30
|
+
vector_store: str = ""
|
|
31
|
+
tools: dict = field(default_factory=lambda: {
|
|
32
|
+
"code_interpreter": False,
|
|
33
|
+
"file_search": False,
|
|
34
|
+
"function": [],
|
|
35
|
+
})
|
|
19
36
|
|
|
20
37
|
def __init__(self):
|
|
21
38
|
"""Assistant item"""
|
|
@@ -203,7 +220,26 @@ class AssistantItem:
|
|
|
203
220
|
return self.dump()
|
|
204
221
|
|
|
205
222
|
|
|
223
|
+
@dataclass(slots=True)
|
|
206
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
|
+
|
|
207
243
|
def __init__(self):
|
|
208
244
|
"""Assistant vector store item"""
|
|
209
245
|
self.id = None
|
|
@@ -300,7 +336,20 @@ class AssistantStoreItem:
|
|
|
300
336
|
return self.dump()
|
|
301
337
|
|
|
302
338
|
|
|
339
|
+
@dataclass(slots=True)
|
|
303
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
|
+
|
|
304
353
|
def __init__(self):
|
|
305
354
|
"""Assistant file item"""
|
|
306
355
|
self.id = None
|
|
@@ -379,4 +428,4 @@ class AssistantFileItem:
|
|
|
379
428
|
|
|
380
429
|
def __str__(self):
|
|
381
430
|
"""To string"""
|
|
382
|
-
return self.dump()
|
|
431
|
+
return self.dump()
|
pygpt_net/item/attachment.py
CHANGED
|
@@ -6,34 +6,33 @@
|
|
|
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.
|
|
9
|
+
# Updated Date: 2025.09.05 18:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
import json
|
|
13
|
+
from dataclasses import dataclass, field
|
|
14
|
+
from typing import Optional
|
|
13
15
|
|
|
14
16
|
|
|
17
|
+
@dataclass(slots=True)
|
|
15
18
|
class AttachmentItem:
|
|
16
19
|
|
|
17
20
|
TYPE_FILE = 'file'
|
|
18
21
|
TYPE_URL = 'url'
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
self.size = 0
|
|
34
|
-
self.send = False
|
|
35
|
-
self.type = self.TYPE_FILE
|
|
36
|
-
self.extra = {}
|
|
23
|
+
name: Optional[str] = None
|
|
24
|
+
id: Optional[str] = None
|
|
25
|
+
uuid: Optional[str] = None
|
|
26
|
+
path: Optional[str] = None
|
|
27
|
+
remote: Optional[str] = None
|
|
28
|
+
vector_store_ids: list = field(default_factory=list)
|
|
29
|
+
meta_id: Optional[int] = None
|
|
30
|
+
ctx: bool = False
|
|
31
|
+
consumed: bool = False
|
|
32
|
+
size: int = 0
|
|
33
|
+
send: bool = False
|
|
34
|
+
type: str = TYPE_FILE
|
|
35
|
+
extra: dict = field(default_factory=dict)
|
|
37
36
|
|
|
38
37
|
def serialize(self) -> dict:
|
|
39
38
|
"""
|
|
@@ -72,8 +71,10 @@ class AttachmentItem:
|
|
|
72
71
|
self.path = data['path']
|
|
73
72
|
if 'size' in data:
|
|
74
73
|
self.size = data['size']
|
|
75
|
-
if '
|
|
74
|
+
if 'remote' in data:
|
|
76
75
|
self.remote = data['remote']
|
|
76
|
+
elif 'remote_id' in data:
|
|
77
|
+
self.remote = data['remote_id']
|
|
77
78
|
if 'ctx' in data:
|
|
78
79
|
self.ctx = data['ctx']
|
|
79
80
|
if 'vector_store_ids' in data:
|
|
@@ -101,4 +102,4 @@ class AttachmentItem:
|
|
|
101
102
|
|
|
102
103
|
def __str__(self):
|
|
103
104
|
"""To string"""
|
|
104
|
-
return self.dump()
|
|
105
|
+
return self.dump()
|
pygpt_net/item/calendar_note.py
CHANGED
|
@@ -6,15 +6,32 @@
|
|
|
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.
|
|
9
|
+
# Updated Date: 2025.09.05 18:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
import datetime
|
|
13
13
|
import json
|
|
14
14
|
import time
|
|
15
|
+
from dataclasses import dataclass
|
|
16
|
+
from typing import Optional
|
|
15
17
|
|
|
16
18
|
|
|
19
|
+
@dataclass(slots=True)
|
|
17
20
|
class CalendarNoteItem:
|
|
21
|
+
id: int = 0
|
|
22
|
+
uuid: Optional[object] = None
|
|
23
|
+
idx: int = 0
|
|
24
|
+
year: int = 0
|
|
25
|
+
month: int = 0
|
|
26
|
+
day: int = 0
|
|
27
|
+
status: int = 0
|
|
28
|
+
title: str = ""
|
|
29
|
+
content: str = ""
|
|
30
|
+
deleted: bool = False
|
|
31
|
+
created: int = 0
|
|
32
|
+
updated: int = 0
|
|
33
|
+
important: bool = False
|
|
34
|
+
initialized: bool = False
|
|
18
35
|
|
|
19
36
|
def __init__(self):
|
|
20
37
|
self.id = 0
|
|
@@ -74,4 +91,4 @@ class CalendarNoteItem:
|
|
|
74
91
|
|
|
75
92
|
def __str__(self):
|
|
76
93
|
"""To string"""
|
|
77
|
-
return self.dump()
|
|
94
|
+
return self.dump()
|
pygpt_net/item/ctx.py
CHANGED
|
@@ -6,17 +6,89 @@
|
|
|
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.
|
|
9
|
+
# Updated Date: 2025.09.05 18:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
import copy
|
|
13
13
|
import datetime
|
|
14
14
|
import json
|
|
15
15
|
import time
|
|
16
|
+
|
|
16
17
|
from typing import Optional
|
|
18
|
+
from dataclasses import dataclass, field
|
|
17
19
|
|
|
18
20
|
|
|
21
|
+
@dataclass(slots=True)
|
|
19
22
|
class CtxItem:
|
|
23
|
+
mode: Optional[str] = None
|
|
24
|
+
additional_ctx: list = field(default_factory=list)
|
|
25
|
+
agent_call: bool = False
|
|
26
|
+
agent_final_response: str = ""
|
|
27
|
+
async_disabled: bool = False
|
|
28
|
+
attachments: list = field(default_factory=list)
|
|
29
|
+
attachments_before: list = field(default_factory=list)
|
|
30
|
+
audio_expires_ts: int = 0
|
|
31
|
+
audio_id: Optional[object] = None
|
|
32
|
+
audio_output: Optional[object] = None
|
|
33
|
+
bag: Optional[object] = None
|
|
34
|
+
cmds: list = field(default_factory=list)
|
|
35
|
+
cmds_before: list = field(default_factory=list)
|
|
36
|
+
current: bool = False
|
|
37
|
+
doc_ids: list = field(default_factory=list)
|
|
38
|
+
external_id: Optional[object] = None
|
|
39
|
+
extra: dict = field(default_factory=dict)
|
|
40
|
+
extra_ctx: Optional[object] = None
|
|
41
|
+
files: list = field(default_factory=list)
|
|
42
|
+
files_before: list = field(default_factory=list)
|
|
43
|
+
first: bool = False
|
|
44
|
+
force_call: bool = False
|
|
45
|
+
hidden: bool = False
|
|
46
|
+
hidden_input: Optional[str] = None
|
|
47
|
+
hidden_output: Optional[str] = None
|
|
48
|
+
id: Optional[object] = None
|
|
49
|
+
idx: int = 0
|
|
50
|
+
images: list = field(default_factory=list)
|
|
51
|
+
images_before: list = field(default_factory=list)
|
|
52
|
+
index_meta: dict = field(default_factory=dict)
|
|
53
|
+
input: Optional[str] = None
|
|
54
|
+
input_name: Optional[str] = None
|
|
55
|
+
input_timestamp: Optional[int] = None
|
|
56
|
+
input_tokens: int = 0
|
|
57
|
+
internal: bool = False
|
|
58
|
+
is_audio: bool = False
|
|
59
|
+
is_vision: bool = False
|
|
60
|
+
live: bool = False
|
|
61
|
+
live_output: str = ""
|
|
62
|
+
meta: Optional["CtxMeta"] = None
|
|
63
|
+
meta_id: Optional[object] = None
|
|
64
|
+
model: Optional[object] = None
|
|
65
|
+
msg_id: Optional[object] = None
|
|
66
|
+
output: Optional[str] = None
|
|
67
|
+
output_name: Optional[str] = None
|
|
68
|
+
output_timestamp: Optional[int] = None
|
|
69
|
+
output_tokens: int = 0
|
|
70
|
+
partial: bool = False
|
|
71
|
+
pid: int = 0
|
|
72
|
+
prev_ctx: Optional["CtxItem"] = None
|
|
73
|
+
reply: bool = False
|
|
74
|
+
response: Optional[object] = None
|
|
75
|
+
results: list = field(default_factory=list)
|
|
76
|
+
run_id: Optional[object] = None
|
|
77
|
+
stopped: bool = False
|
|
78
|
+
stream: Optional[object] = None
|
|
79
|
+
stream_agent_output: bool = True
|
|
80
|
+
sub_call: bool = False
|
|
81
|
+
sub_calls: int = 0
|
|
82
|
+
sub_reply: bool = False
|
|
83
|
+
sub_tool_call: bool = False
|
|
84
|
+
thread: Optional[object] = None
|
|
85
|
+
tool_calls: list = field(default_factory=list)
|
|
86
|
+
total_tokens: int = 0
|
|
87
|
+
urls: list = field(default_factory=list)
|
|
88
|
+
urls_before: list = field(default_factory=list)
|
|
89
|
+
use_agent_final_response: bool = False
|
|
90
|
+
use_responses_api: bool = False
|
|
91
|
+
ai_name: Optional[str] = None
|
|
20
92
|
|
|
21
93
|
def __init__(self, mode: Optional[str] = None):
|
|
22
94
|
"""
|
|
@@ -92,6 +164,7 @@ class CtxItem:
|
|
|
92
164
|
self.urls_before = []
|
|
93
165
|
self.use_agent_final_response = False # use agent final response
|
|
94
166
|
self.use_responses_api = False # use responses API format
|
|
167
|
+
self.ai_name = None # AI name
|
|
95
168
|
|
|
96
169
|
@property
|
|
97
170
|
def final_input(self) -> Optional[str]:
|
|
@@ -364,7 +437,6 @@ class CtxItem:
|
|
|
364
437
|
self.urls = g("urls", [])
|
|
365
438
|
self.urls_before = g("urls_before", [])
|
|
366
439
|
|
|
367
|
-
|
|
368
440
|
def dump(self, dump: bool = True) -> str:
|
|
369
441
|
"""
|
|
370
442
|
Dump context item to JSON string
|
|
@@ -392,7 +464,38 @@ class CtxItem:
|
|
|
392
464
|
return self.dump(True)
|
|
393
465
|
|
|
394
466
|
|
|
467
|
+
@dataclass(slots=True)
|
|
395
468
|
class CtxMeta:
|
|
469
|
+
id: Optional[int] = None
|
|
470
|
+
additional_ctx: list = field(default_factory=list)
|
|
471
|
+
archived: bool = False
|
|
472
|
+
assistant: Optional[object] = None
|
|
473
|
+
created: int = field(default_factory=lambda: int(time.time()))
|
|
474
|
+
date: str = field(default_factory=lambda: datetime.datetime.now().strftime("%Y-%m-%d"))
|
|
475
|
+
deleted: bool = False
|
|
476
|
+
external_id: Optional[object] = None
|
|
477
|
+
extra: Optional[object] = None
|
|
478
|
+
group: Optional["CtxGroup"] = None
|
|
479
|
+
group_id: Optional[object] = None
|
|
480
|
+
important: bool = False
|
|
481
|
+
indexed: Optional[object] = None
|
|
482
|
+
indexes: dict = field(default_factory=dict)
|
|
483
|
+
initialized: bool = False
|
|
484
|
+
label: int = 0
|
|
485
|
+
last_mode: Optional[object] = None
|
|
486
|
+
last_model: Optional[object] = None
|
|
487
|
+
model: Optional[object] = None
|
|
488
|
+
mode: Optional[object] = None
|
|
489
|
+
name: Optional[str] = None
|
|
490
|
+
owner_uuid: Optional[object] = None
|
|
491
|
+
parent_id: Optional[object] = None
|
|
492
|
+
preset: Optional[object] = None
|
|
493
|
+
root_id: Optional[object] = None
|
|
494
|
+
run: Optional[object] = None
|
|
495
|
+
status: Optional[object] = None
|
|
496
|
+
thread: Optional[object] = None
|
|
497
|
+
updated: int = field(default_factory=lambda: int(time.time()))
|
|
498
|
+
uuid: Optional[object] = None
|
|
396
499
|
|
|
397
500
|
def __init__(self, id: Optional[int] = None):
|
|
398
501
|
"""
|
|
@@ -592,7 +695,17 @@ class CtxMeta:
|
|
|
592
695
|
"""
|
|
593
696
|
return self.dump()
|
|
594
697
|
|
|
698
|
+
|
|
699
|
+
@dataclass(slots=True)
|
|
595
700
|
class CtxGroup:
|
|
701
|
+
id: Optional[int] = None
|
|
702
|
+
name: Optional[str] = None
|
|
703
|
+
additional_ctx: list = field(default_factory=list)
|
|
704
|
+
count: int = 0
|
|
705
|
+
created: int = field(default_factory=lambda: int(time.time()))
|
|
706
|
+
items: list = field(default_factory=list)
|
|
707
|
+
updated: int = field(default_factory=lambda: int(time.time()))
|
|
708
|
+
uuid: Optional[object] = None
|
|
596
709
|
|
|
597
710
|
def __init__(self, id: Optional[int] = None, name: Optional[str] = None):
|
|
598
711
|
"""
|
pygpt_net/item/index.py
CHANGED
|
@@ -6,13 +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: 2025.
|
|
9
|
+
# Updated Date: 2025.09.05 18:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
import json
|
|
13
|
+
from dataclasses import dataclass, field
|
|
14
|
+
from typing import Optional
|
|
13
15
|
|
|
14
16
|
|
|
17
|
+
@dataclass(slots=True)
|
|
15
18
|
class IndexItem:
|
|
19
|
+
id: Optional[object] = None
|
|
20
|
+
name: Optional[object] = None
|
|
21
|
+
store: Optional[object] = None
|
|
22
|
+
items: dict = field(default_factory=dict)
|
|
16
23
|
|
|
17
24
|
def __init__(self):
|
|
18
25
|
"""
|
|
@@ -66,4 +73,4 @@ class IndexItem:
|
|
|
66
73
|
|
|
67
74
|
def __str__(self):
|
|
68
75
|
"""To string"""
|
|
69
|
-
return self.dump()
|
|
76
|
+
return self.dump()
|
pygpt_net/item/mode.py
CHANGED
|
@@ -6,13 +6,16 @@
|
|
|
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.
|
|
9
|
+
# Updated Date: 2025.09.05 18:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
|
+
from dataclasses import dataclass
|
|
13
|
+
from typing import Optional
|
|
12
14
|
|
|
13
|
-
class ModeItem:
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
@dataclass(slots=True)
|
|
17
|
+
class ModeItem:
|
|
18
|
+
id: Optional[object] = None
|
|
19
|
+
name: str = ""
|
|
20
|
+
label: str = ""
|
|
21
|
+
default: bool = False
|
pygpt_net/item/model.py
CHANGED
|
@@ -6,11 +6,12 @@
|
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
|
7
7
|
# MIT License #
|
|
8
8
|
# Created By : Marcin Szczygliński #
|
|
9
|
-
# Updated Date: 2025.09.
|
|
9
|
+
# Updated Date: 2025.09.05 18:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
import json
|
|
13
13
|
from typing import Optional
|
|
14
|
+
from dataclasses import dataclass, field
|
|
14
15
|
|
|
15
16
|
from pygpt_net.core.types import (
|
|
16
17
|
MODE_CHAT,
|
|
@@ -22,7 +23,23 @@ from pygpt_net.core.types import (
|
|
|
22
23
|
MULTIMODAL_VIDEO,
|
|
23
24
|
)
|
|
24
25
|
|
|
26
|
+
@dataclass(slots=True)
|
|
25
27
|
class ModelItem:
|
|
28
|
+
id: Optional[str] = None
|
|
29
|
+
ctx: int = 0
|
|
30
|
+
default: bool = False
|
|
31
|
+
extra: dict = field(default_factory=dict)
|
|
32
|
+
imported: bool = False
|
|
33
|
+
input: list = field(default_factory=lambda: ["text"])
|
|
34
|
+
langchain: dict = field(default_factory=dict)
|
|
35
|
+
llama_index: dict = field(default_factory=dict)
|
|
36
|
+
mode: list = field(default_factory=lambda: ["chat"])
|
|
37
|
+
multimodal: list = field(default_factory=lambda: ["text"])
|
|
38
|
+
name: Optional[str] = None
|
|
39
|
+
output: list = field(default_factory=lambda: ["text"])
|
|
40
|
+
provider: str = "openai"
|
|
41
|
+
tokens: int = 0
|
|
42
|
+
tool_calls: bool = False
|
|
26
43
|
|
|
27
44
|
def __init__(self, id: Optional[str] = None):
|
|
28
45
|
"""
|
|
@@ -79,7 +96,7 @@ class ModelItem:
|
|
|
79
96
|
self.tokens = data['tokens']
|
|
80
97
|
if 'tool_calls' in data:
|
|
81
98
|
self.tool_calls = data['tool_calls']
|
|
82
|
-
|
|
99
|
+
|
|
83
100
|
# llama index
|
|
84
101
|
if 'llama_index.provider' in data:
|
|
85
102
|
self.llama_index['provider'] = data['llama_index.provider'] # backward compatibility < v2.5.20
|
|
@@ -326,4 +343,4 @@ class ModelItem:
|
|
|
326
343
|
|
|
327
344
|
:return: Dumped JSON string
|
|
328
345
|
"""
|
|
329
|
-
return self.dump()
|
|
346
|
+
return self.dump()
|
pygpt_net/item/notepad.py
CHANGED
|
@@ -6,14 +6,26 @@
|
|
|
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.
|
|
9
|
+
# Updated Date: 2025.09.05 18:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
import json
|
|
13
13
|
import time
|
|
14
|
+
from dataclasses import dataclass
|
|
15
|
+
from typing import Optional
|
|
14
16
|
|
|
15
17
|
|
|
18
|
+
@dataclass(slots=True)
|
|
16
19
|
class NotepadItem:
|
|
20
|
+
id: int = 0
|
|
21
|
+
uuid: Optional[object] = None
|
|
22
|
+
idx: int = 0
|
|
23
|
+
title: str = ""
|
|
24
|
+
content: str = ""
|
|
25
|
+
deleted: bool = False
|
|
26
|
+
created: int = 0
|
|
27
|
+
updated: int = 0
|
|
28
|
+
initialized: bool = False
|
|
17
29
|
|
|
18
30
|
def __init__(self):
|
|
19
31
|
self.id = 0
|
|
@@ -55,4 +67,4 @@ class NotepadItem:
|
|
|
55
67
|
|
|
56
68
|
def __str__(self):
|
|
57
69
|
"""To string"""
|
|
58
|
-
return self.dump()
|
|
70
|
+
return self.dump()
|
pygpt_net/item/preset.py
CHANGED
|
@@ -6,13 +6,53 @@
|
|
|
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.
|
|
9
|
+
# Updated Date: 2025.09.05 18:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
import json
|
|
13
13
|
import uuid
|
|
14
|
+
from dataclasses import dataclass, field
|
|
15
|
+
from typing import Optional, List, Dict, Any
|
|
14
16
|
|
|
17
|
+
|
|
18
|
+
@dataclass(slots=True)
|
|
15
19
|
class PresetItem:
|
|
20
|
+
agent: bool = False
|
|
21
|
+
agent_llama: bool = False
|
|
22
|
+
agent_openai: bool = False
|
|
23
|
+
agent_provider: Optional[str] = None
|
|
24
|
+
agent_provider_openai: Optional[str] = None
|
|
25
|
+
ai_avatar: str = ""
|
|
26
|
+
ai_name: str = ""
|
|
27
|
+
ai_personalize: bool = False
|
|
28
|
+
assistant: bool = False
|
|
29
|
+
assistant_id: str = ""
|
|
30
|
+
audio: bool = False
|
|
31
|
+
chat: bool = False
|
|
32
|
+
completion: bool = False
|
|
33
|
+
computer: bool = False
|
|
34
|
+
description: str = ""
|
|
35
|
+
enabled: bool = True
|
|
36
|
+
expert: bool = False
|
|
37
|
+
experts: List[Any] = field(default_factory=list) # agent mode
|
|
38
|
+
extra: Dict[str, Any] = field(default_factory=dict)
|
|
39
|
+
filename: Optional[str] = None
|
|
40
|
+
img: bool = False
|
|
41
|
+
idx: Optional[int] = None
|
|
42
|
+
langchain: bool = False
|
|
43
|
+
llama_index: bool = False
|
|
44
|
+
model: Optional[str] = None
|
|
45
|
+
name: str = "*"
|
|
46
|
+
prompt: str = ""
|
|
47
|
+
research: bool = False
|
|
48
|
+
remote_tools: List[Any] = field(default_factory=list)
|
|
49
|
+
temperature: float = 1.0
|
|
50
|
+
tools: Dict[str, Any] = field(default_factory=lambda: {"function": []})
|
|
51
|
+
uuid: Optional[str] = None
|
|
52
|
+
user_name: str = ""
|
|
53
|
+
version: Optional[str] = None
|
|
54
|
+
vision: bool = False
|
|
55
|
+
|
|
16
56
|
def __init__(self):
|
|
17
57
|
self.agent = False
|
|
18
58
|
self.agent_llama = False
|
|
@@ -230,4 +270,4 @@ class PresetItem:
|
|
|
230
270
|
|
|
231
271
|
:return: serialized item
|
|
232
272
|
"""
|
|
233
|
-
return self.dump()
|
|
273
|
+
return self.dump()
|
pygpt_net/item/prompt.py
CHANGED
|
@@ -6,13 +6,19 @@
|
|
|
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.
|
|
9
|
+
# Updated Date: 2025.09.05 18:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
import json
|
|
13
|
+
from dataclasses import dataclass
|
|
14
|
+
from typing import Optional
|
|
13
15
|
|
|
14
16
|
|
|
17
|
+
@dataclass(slots=True)
|
|
15
18
|
class PromptItem:
|
|
19
|
+
id: Optional[object] = None
|
|
20
|
+
name: Optional[str] = None
|
|
21
|
+
content: Optional[str] = None
|
|
16
22
|
|
|
17
23
|
def __init__(self):
|
|
18
24
|
"""
|
|
@@ -61,4 +67,4 @@ class PromptItem:
|
|
|
61
67
|
|
|
62
68
|
def __str__(self):
|
|
63
69
|
"""To string"""
|
|
64
|
-
return self.dump()
|
|
70
|
+
return self.dump()
|
|
@@ -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.
|
|
9
|
+
# Updated Date: 2025.09.05 18:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
import os
|
|
@@ -108,7 +108,7 @@ class Plugin(BasePlugin):
|
|
|
108
108
|
:param ctx: CtxItem
|
|
109
109
|
:return: updated system prompt
|
|
110
110
|
"""
|
|
111
|
-
if self.get_option_value("auto_cwd"):
|
|
111
|
+
if self.get_option_value("auto_cwd") and self.window.core.command.is_cmd(inline=False):
|
|
112
112
|
prompt += "\n\nCURRENT WORKING DIRECTORY: " + self.window.core.config.get_user_dir('data')
|
|
113
113
|
return prompt
|
|
114
114
|
|
|
@@ -6,22 +6,24 @@
|
|
|
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.
|
|
9
|
+
# Updated Date: 2025.09.05 01:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
from .anthropic import ApiAnthropic
|
|
13
13
|
from .google import ApiGoogle
|
|
14
14
|
from .openai import ApiOpenAI
|
|
15
|
+
from .x_ai import ApiXAI
|
|
15
16
|
|
|
16
17
|
class Api:
|
|
17
18
|
|
|
18
19
|
def __init__(self, window=None):
|
|
19
20
|
"""
|
|
20
|
-
API wrappers
|
|
21
|
+
API wrappers
|
|
21
22
|
|
|
22
23
|
:param window: Window instance
|
|
23
24
|
"""
|
|
24
25
|
self.window = window
|
|
25
26
|
self.anthropic = ApiAnthropic(window)
|
|
26
27
|
self.google = ApiGoogle(window)
|
|
27
|
-
self.openai = ApiOpenAI(window)
|
|
28
|
+
self.openai = ApiOpenAI(window)
|
|
29
|
+
self.xai = ApiXAI(window)
|