pygpt-net 2.6.37__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 +7 -0
- pygpt_net/__init__.py +1 -1
- pygpt_net/controller/chat/handler/anthropic_stream.py +0 -2
- pygpt_net/controller/chat/handler/worker.py +6 -2
- pygpt_net/controller/debug/debug.py +6 -6
- 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/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 +1 -5
- pygpt_net/core/tabs/tab.py +24 -1
- pygpt_net/data/config/config.json +2 -2
- pygpt_net/data/config/models.json +2 -2
- 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/anthropic/tools.py +1 -1
- pygpt_net/provider/api/google/realtime/client.py +2 -2
- pygpt_net/provider/core/attachment/json_file.py +2 -2
- pygpt_net/tools/text_editor/tool.py +4 -1
- pygpt_net/tools/text_editor/ui/dialogs.py +1 -1
- 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 +14 -12
- pygpt_net/ui/dialog/plugins.py +26 -20
- 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 +2 -2
- pygpt_net/ui/widget/textarea/editor.py +0 -4
- {pygpt_net-2.6.37.dist-info → pygpt_net-2.6.38.dist-info}/METADATA +9 -2
- {pygpt_net-2.6.37.dist-info → pygpt_net-2.6.38.dist-info}/RECORD +51 -51
- {pygpt_net-2.6.37.dist-info → pygpt_net-2.6.38.dist-info}/LICENSE +0 -0
- {pygpt_net-2.6.37.dist-info → pygpt_net-2.6.38.dist-info}/WHEEL +0 -0
- {pygpt_net-2.6.37.dist-info → pygpt_net-2.6.38.dist-info}/entry_points.txt +0 -0
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
|
|
|
@@ -890,7 +890,7 @@ class GoogleLiveClient:
|
|
|
890
890
|
"arguments": json.dumps(args_dict, ensure_ascii=False),
|
|
891
891
|
}
|
|
892
892
|
})
|
|
893
|
-
self._rt_state["force_func_call"] = True
|
|
893
|
+
# self._rt_state["force_func_call"] = True
|
|
894
894
|
self._last_tool_calls = list(self._rt_state["tool_calls"])
|
|
895
895
|
turn_finished = True # let the app run tools now
|
|
896
896
|
|
|
@@ -1004,7 +1004,7 @@ class GoogleLiveClient:
|
|
|
1004
1004
|
if key not in seen:
|
|
1005
1005
|
self._rt_state["tool_calls"].append(c)
|
|
1006
1006
|
seen.add(key)
|
|
1007
|
-
self._rt_state["force_func_call"] = True
|
|
1007
|
+
# self._rt_state["force_func_call"] = True
|
|
1008
1008
|
self._last_tool_calls = list(self._rt_state["tool_calls"])
|
|
1009
1009
|
turn_finished = True
|
|
1010
1010
|
|
|
@@ -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: 2025.09.05 18:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
import json
|
|
@@ -162,7 +162,7 @@ class JsonFileProvider(BaseProvider):
|
|
|
162
162
|
attachment.name = data['name']
|
|
163
163
|
if 'path' in data:
|
|
164
164
|
attachment.path = data['path']
|
|
165
|
-
if '
|
|
165
|
+
if 'remote' in data:
|
|
166
166
|
attachment.remote = data['remote']
|
|
167
167
|
if 'send' in data:
|
|
168
168
|
attachment.send = data['send']
|
|
@@ -183,16 +183,19 @@ class TextEditor(BaseTool):
|
|
|
183
183
|
self.window.core.filesystem.editor.destroy(id) # unregister from memory
|
|
184
184
|
self.window.ui.dialogs.close(id)
|
|
185
185
|
|
|
186
|
-
def save(self, id: str) -> str:
|
|
186
|
+
def save(self, id: str, close: bool = False) -> str:
|
|
187
187
|
"""
|
|
188
188
|
Save content to current file
|
|
189
189
|
|
|
190
190
|
:param id: editor id
|
|
191
|
+
:param close: close editor after save
|
|
191
192
|
:return: new editor id
|
|
192
193
|
"""
|
|
193
194
|
file = self.window.ui.dialog[id].file
|
|
194
195
|
if file:
|
|
195
196
|
self.window.core.filesystem.editor.save(id)
|
|
197
|
+
if close:
|
|
198
|
+
self.close(id)
|
|
196
199
|
else:
|
|
197
200
|
id = self.save_as_file(id)
|
|
198
201
|
return id
|
|
@@ -47,7 +47,7 @@ class DialogSpawner:
|
|
|
47
47
|
lambda: self.window.tools.get("editor").restore(id)
|
|
48
48
|
)
|
|
49
49
|
self.window.ui.nodes['editor.custom.btn.save'].clicked.connect(
|
|
50
|
-
lambda: self.window.tools.get("editor").save(id)
|
|
50
|
+
lambda: self.window.tools.get("editor").save(id, close=True)
|
|
51
51
|
)
|
|
52
52
|
|
|
53
53
|
bottom_layout = QHBoxLayout()
|