pygpt-net 2.6.42__py3-none-any.whl → 2.6.43__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 +5 -0
- pygpt_net/__init__.py +3 -3
- pygpt_net/controller/__init__.py +2 -0
- pygpt_net/controller/launcher/launcher.py +2 -2
- pygpt_net/controller/presets/presets.py +10 -0
- pygpt_net/core/models/models.py +11 -1
- pygpt_net/core/updater/updater.py +18 -7
- pygpt_net/data/config/config.json +3 -3
- pygpt_net/data/config/models.json +4 -10
- pygpt_net/data/css/web-blocks.css +4 -0
- pygpt_net/data/css/web-chatgpt.css +4 -0
- pygpt_net/data/css/web-chatgpt_wide.css +4 -0
- pygpt_net/provider/core/config/patch.py +15 -2459
- pygpt_net/provider/core/config/patches/__init__.py +0 -0
- pygpt_net/provider/core/config/patches/patch_before_2_6_42.py +2510 -0
- pygpt_net/provider/core/model/patch.py +12 -764
- pygpt_net/provider/core/model/patches/__init__.py +0 -0
- pygpt_net/provider/core/model/patches/patch_before_2_6_42.py +813 -0
- pygpt_net/provider/core/preset/patch.py +12 -221
- pygpt_net/provider/core/preset/patches/__init__.py +0 -0
- pygpt_net/provider/core/preset/patches/patch_before_2_6_42.py +272 -0
- pygpt_net/ui/dialog/settings.py +5 -4
- {pygpt_net-2.6.42.dist-info → pygpt_net-2.6.43.dist-info}/METADATA +10 -129
- {pygpt_net-2.6.42.dist-info → pygpt_net-2.6.43.dist-info}/RECORD +27 -21
- {pygpt_net-2.6.42.dist-info → pygpt_net-2.6.43.dist-info}/LICENSE +0 -0
- {pygpt_net-2.6.42.dist-info → pygpt_net-2.6.43.dist-info}/WHEEL +0 -0
- {pygpt_net-2.6.42.dist-info → pygpt_net-2.6.43.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.
|
|
9
|
+
# Updated Date: 2025.09.12 00:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
import os
|
|
@@ -14,6 +14,8 @@ import shutil
|
|
|
14
14
|
|
|
15
15
|
from packaging.version import parse as parse_version, Version
|
|
16
16
|
|
|
17
|
+
# old patches moved here
|
|
18
|
+
from .patches.patch_before_2_6_42 import Patch as PatchBefore2_6_42
|
|
17
19
|
|
|
18
20
|
class Patch:
|
|
19
21
|
def __init__(self, window=None):
|
|
@@ -26,20 +28,8 @@ class Patch:
|
|
|
26
28
|
:param version: current app version
|
|
27
29
|
:return: True if migrated
|
|
28
30
|
"""
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
is_expert = False
|
|
32
|
-
is_agent_llama = False
|
|
33
|
-
is_agent_assistant = False
|
|
34
|
-
is_agent_code_act = False
|
|
35
|
-
is_agent_react_workflow = False
|
|
36
|
-
is_agent_openai = False
|
|
37
|
-
is_computer = False
|
|
38
|
-
is_bot = False
|
|
39
|
-
is_evolve = False
|
|
40
|
-
is_b2b = False
|
|
41
|
-
is_workflow = False
|
|
42
|
-
is_supervisor = False
|
|
31
|
+
patcher = PatchBefore2_6_42(self.window) # old patches (< 2.6.42) moved here
|
|
32
|
+
migrated = patcher.execute(version)
|
|
43
33
|
|
|
44
34
|
for k in self.window.core.presets.items:
|
|
45
35
|
data = self.window.core.presets.items[k]
|
|
@@ -50,214 +40,15 @@ class Patch:
|
|
|
50
40
|
if data.version is None or data.version == "":
|
|
51
41
|
continue
|
|
52
42
|
|
|
53
|
-
old = parse_version(data.version)
|
|
54
|
-
|
|
55
43
|
# check if presets file is older than current app version
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
# < 2.0.53
|
|
63
|
-
if old < parse_version("2.0.53") and k == 'current.assistant':
|
|
64
|
-
print("Migrating preset file from < 2.0.53...")
|
|
65
|
-
dst = os.path.join(self.window.core.config.get_user_dir('presets'), 'current.assistant.json')
|
|
66
|
-
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config', 'presets',
|
|
67
|
-
'current.assistant.json')
|
|
68
|
-
shutil.copyfile(src, dst)
|
|
69
|
-
updated = True
|
|
70
|
-
print("Patched file: {}.".format(dst))
|
|
71
|
-
|
|
72
|
-
# < 2.0.102
|
|
73
|
-
if old < parse_version("2.0.102"):
|
|
74
|
-
if 'current.llama_index' not in self.window.core.presets.items and not is_llama:
|
|
75
|
-
print("Migrating preset file from < 2.0.102...")
|
|
76
|
-
dst = os.path.join(self.window.core.config.get_user_dir('presets'), 'current.llama_index.json')
|
|
77
|
-
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config', 'presets',
|
|
78
|
-
'current.llama_index.json')
|
|
79
|
-
shutil.copyfile(src, dst)
|
|
80
|
-
updated = True
|
|
81
|
-
is_llama = True # prevent multiple copies
|
|
82
|
-
print("Patched file: {}.".format(dst))
|
|
83
|
-
|
|
84
|
-
# < 2.2.7
|
|
85
|
-
if old < parse_version("2.2.7"):
|
|
86
|
-
if not is_expert:
|
|
87
|
-
print("Migrating preset files from < 2.2.7...")
|
|
88
|
-
dst = os.path.join(self.window.core.config.get_user_dir('presets'), 'current.expert.json')
|
|
89
|
-
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config', 'presets', 'current.expert.json')
|
|
90
|
-
shutil.copyfile(src, dst)
|
|
91
|
-
print("Patched file: {}.".format(dst))
|
|
92
|
-
dst = os.path.join(self.window.core.config.get_user_dir('presets'), 'current.agent.json')
|
|
93
|
-
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config', 'presets', 'current.agent.json')
|
|
94
|
-
shutil.copyfile(src, dst)
|
|
95
|
-
print("Patched file: {}.".format(dst))
|
|
96
|
-
dst = os.path.join(self.window.core.config.get_user_dir('presets'), 'joke_expert.json')
|
|
97
|
-
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config', 'presets', 'joke_expert.json')
|
|
98
|
-
shutil.copyfile(src, dst)
|
|
99
|
-
print("Patched file: {}.".format(dst))
|
|
100
|
-
updated = True
|
|
101
|
-
is_expert = True # prevent multiple copies
|
|
102
|
-
|
|
103
|
-
# < 2.4.10
|
|
104
|
-
if old < parse_version("2.4.10"):
|
|
105
|
-
if 'current.agent_llama' not in self.window.core.presets.items and not is_agent_llama:
|
|
106
|
-
print("Migrating preset file from < 2.4.10...")
|
|
107
|
-
files = [
|
|
108
|
-
'current.agent_llama.json',
|
|
109
|
-
'agent_openai.json',
|
|
110
|
-
'agent_planner.json',
|
|
111
|
-
'agent_react.json',
|
|
112
|
-
]
|
|
113
|
-
for file in files:
|
|
114
|
-
dst = os.path.join(self.window.core.config.get_user_dir('presets'), file)
|
|
115
|
-
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config', 'presets', file)
|
|
116
|
-
shutil.copyfile(src, dst)
|
|
117
|
-
print("Patched file: {}.".format(dst))
|
|
118
|
-
|
|
119
|
-
updated = True
|
|
120
|
-
is_agent_llama = True # prevent multiple copies
|
|
121
|
-
|
|
122
|
-
# < 2.4.11
|
|
123
|
-
if old < parse_version("2.4.11"):
|
|
124
|
-
if 'agent_openai_assistant' not in self.window.core.presets.items and not is_agent_assistant:
|
|
125
|
-
print("Migrating preset file from < 2.4.11...")
|
|
126
|
-
files = [
|
|
127
|
-
'agent_openai_assistant.json',
|
|
128
|
-
]
|
|
129
|
-
for file in files:
|
|
130
|
-
dst = os.path.join(self.window.core.config.get_user_dir('presets'), file)
|
|
131
|
-
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config',
|
|
132
|
-
'presets', file)
|
|
133
|
-
shutil.copyfile(src, dst)
|
|
134
|
-
print("Patched file: {}.".format(dst))
|
|
135
|
-
|
|
136
|
-
updated = True
|
|
137
|
-
is_agent_assistant = True # prevent multiple copies
|
|
138
|
-
|
|
139
|
-
# < 2.5.33
|
|
140
|
-
if old < parse_version("2.5.33"):
|
|
141
|
-
if 'agent_code_act' not in self.window.core.presets.items and not is_agent_code_act:
|
|
142
|
-
print("Migrating preset file from < 2.5.33...")
|
|
143
|
-
files = [
|
|
144
|
-
'agent_code_act.json',
|
|
145
|
-
]
|
|
146
|
-
for file in files:
|
|
147
|
-
dst = os.path.join(self.window.core.config.get_user_dir('presets'), file)
|
|
148
|
-
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config',
|
|
149
|
-
'presets', file)
|
|
150
|
-
shutil.copyfile(src, dst)
|
|
151
|
-
print("Patched file: {}.".format(dst))
|
|
152
|
-
|
|
153
|
-
updated = True
|
|
154
|
-
is_agent_code_act = True # prevent multiple copies
|
|
155
|
-
|
|
156
|
-
# < 2.5.71
|
|
157
|
-
if old < parse_version("2.5.71"):
|
|
158
|
-
if 'current.computer' not in self.window.core.presets.items and not is_computer:
|
|
159
|
-
print("Migrating preset file from < 2.5.71...")
|
|
160
|
-
dst = os.path.join(self.window.core.config.get_user_dir('presets'), 'current.computer.json')
|
|
161
|
-
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config', 'presets',
|
|
162
|
-
'current.computer.json')
|
|
163
|
-
shutil.copyfile(src, dst)
|
|
164
|
-
updated = True
|
|
165
|
-
is_computer = True # prevent multiple copies
|
|
166
|
-
print("Patched file: {}.".format(dst))
|
|
167
|
-
|
|
168
|
-
# < 2.5.76
|
|
169
|
-
if old < parse_version("2.5.76"):
|
|
170
|
-
if 'current.agent_openai' not in self.window.core.presets.items and not is_agent_openai:
|
|
171
|
-
print("Migrating preset file from < 2.5.76...")
|
|
172
|
-
files = [
|
|
173
|
-
'current.agent_openai.json',
|
|
174
|
-
'agent_openai_simple.json',
|
|
175
|
-
'agent_openai_expert.json',
|
|
176
|
-
]
|
|
177
|
-
for file in files:
|
|
178
|
-
dst = os.path.join(self.window.core.config.get_user_dir('presets'), file)
|
|
179
|
-
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config',
|
|
180
|
-
'presets', file)
|
|
181
|
-
shutil.copyfile(src, dst)
|
|
182
|
-
print("Patched file: {}.".format(dst))
|
|
183
|
-
|
|
184
|
-
updated = True
|
|
185
|
-
is_agent_openai = True # prevent multiple copies
|
|
186
|
-
|
|
187
|
-
# < 2.5.82
|
|
188
|
-
if old < parse_version("2.5.82"):
|
|
189
|
-
if 'agent_openai_researcher' not in self.window.core.presets.items and not is_bot:
|
|
190
|
-
print("Migrating preset file from < 2.5.82...")
|
|
191
|
-
files = [
|
|
192
|
-
'agent_openai_coder.json',
|
|
193
|
-
'agent_openai_planner.json',
|
|
194
|
-
'agent_openai_researcher.json',
|
|
195
|
-
'agent_openai_writer.json',
|
|
196
|
-
]
|
|
197
|
-
for file in files:
|
|
198
|
-
dst = os.path.join(self.window.core.config.get_user_dir('presets'), file)
|
|
199
|
-
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config',
|
|
200
|
-
'presets', file)
|
|
201
|
-
shutil.copyfile(src, dst)
|
|
202
|
-
print("Patched file: {}.".format(dst))
|
|
203
|
-
updated = True
|
|
204
|
-
is_bot = True # prevent multiple copies
|
|
205
|
-
|
|
206
|
-
# < 2.5.86
|
|
207
|
-
if old < parse_version("2.5.86"):
|
|
208
|
-
if 'agent_openai_evolve' not in self.window.core.presets.items and not is_evolve:
|
|
209
|
-
print("Migrating preset file from < 2.5.86...")
|
|
210
|
-
files = [
|
|
211
|
-
'agent_openai_evolve.json',
|
|
212
|
-
]
|
|
213
|
-
for file in files:
|
|
214
|
-
dst = os.path.join(self.window.core.config.get_user_dir('presets'), file)
|
|
215
|
-
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config',
|
|
216
|
-
'presets', file)
|
|
217
|
-
shutil.copyfile(src, dst)
|
|
218
|
-
print("Patched file: {}.".format(dst))
|
|
219
|
-
updated = True
|
|
220
|
-
is_evolve = True # prevent multiple copies
|
|
221
|
-
|
|
222
|
-
# < 2.5.94
|
|
223
|
-
if old < parse_version("2.5.94"):
|
|
224
|
-
if 'agent_openai_b2b' not in self.window.core.presets.items and not is_b2b:
|
|
225
|
-
print("Migrating preset file from < 2.5.94...")
|
|
226
|
-
files = [
|
|
227
|
-
'agent_openai_b2b.json',
|
|
228
|
-
]
|
|
229
|
-
for file in files:
|
|
230
|
-
dst = os.path.join(self.window.core.config.get_user_dir('presets'), file)
|
|
231
|
-
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config',
|
|
232
|
-
'presets', file)
|
|
233
|
-
shutil.copyfile(src, dst)
|
|
234
|
-
print("Patched file: {}.".format(dst))
|
|
235
|
-
updated = True
|
|
236
|
-
is_b2b = True # prevent multiple copies
|
|
237
|
-
|
|
238
|
-
# < 2.6.1
|
|
239
|
-
if old < parse_version("2.6.1"):
|
|
240
|
-
if data.agent_provider == "react_workflow":
|
|
241
|
-
data.agent_provider = "react"
|
|
242
|
-
updated = True
|
|
243
|
-
save = True
|
|
44
|
+
old = parse_version(data.version)
|
|
45
|
+
if version > old >= parse_version("2.6.42"):
|
|
46
|
+
# --------------------------------------------
|
|
47
|
+
# previous patches for versions before 2.6.42 was moved to external patcher
|
|
48
|
+
# --------------------------------------------
|
|
244
49
|
|
|
245
|
-
#
|
|
246
|
-
|
|
247
|
-
if 'agent_openai_supervisor' not in self.window.core.presets.items and not is_supervisor:
|
|
248
|
-
print("Migrating preset file from < 2.6.9...")
|
|
249
|
-
files = [
|
|
250
|
-
'agent_openai_supervisor.json',
|
|
251
|
-
'agent_supervisor.json',
|
|
252
|
-
]
|
|
253
|
-
for file in files:
|
|
254
|
-
dst = os.path.join(self.window.core.config.get_user_dir('presets'), file)
|
|
255
|
-
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config',
|
|
256
|
-
'presets', file)
|
|
257
|
-
shutil.copyfile(src, dst)
|
|
258
|
-
print("Patched file: {}.".format(dst))
|
|
259
|
-
updated = True
|
|
260
|
-
is_supervisor = True # prevent multiple copies
|
|
50
|
+
# > 2.6.42 below:
|
|
51
|
+
pass
|
|
261
52
|
|
|
262
53
|
# update file
|
|
263
54
|
if updated:
|
|
File without changes
|
|
@@ -0,0 +1,272 @@
|
|
|
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: 2025.09.12 00:00:00 #
|
|
10
|
+
# ================================================== #
|
|
11
|
+
|
|
12
|
+
import os
|
|
13
|
+
import shutil
|
|
14
|
+
from typing import Tuple
|
|
15
|
+
|
|
16
|
+
from packaging.version import parse as parse_version, Version
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class Patch:
|
|
20
|
+
def __init__(self, window=None):
|
|
21
|
+
self.window = window
|
|
22
|
+
|
|
23
|
+
def execute(self, version: Version) -> bool:
|
|
24
|
+
"""
|
|
25
|
+
Migrate to current app version
|
|
26
|
+
|
|
27
|
+
:param version: current app version
|
|
28
|
+
:return: (data, updated, save) - data dict, True if migrated, True if need to save
|
|
29
|
+
"""
|
|
30
|
+
migrated = False
|
|
31
|
+
is_llama = False
|
|
32
|
+
is_expert = False
|
|
33
|
+
is_agent_llama = False
|
|
34
|
+
is_agent_assistant = False
|
|
35
|
+
is_agent_code_act = False
|
|
36
|
+
is_agent_react_workflow = False
|
|
37
|
+
is_agent_openai = False
|
|
38
|
+
is_computer = False
|
|
39
|
+
is_bot = False
|
|
40
|
+
is_evolve = False
|
|
41
|
+
is_b2b = False
|
|
42
|
+
is_workflow = False
|
|
43
|
+
is_supervisor = False
|
|
44
|
+
|
|
45
|
+
for k in self.window.core.presets.items:
|
|
46
|
+
data = self.window.core.presets.items[k]
|
|
47
|
+
updated = False
|
|
48
|
+
save = False
|
|
49
|
+
|
|
50
|
+
# get version of preset
|
|
51
|
+
if data.version is None or data.version == "":
|
|
52
|
+
continue
|
|
53
|
+
|
|
54
|
+
old = parse_version(data.version)
|
|
55
|
+
|
|
56
|
+
# check if presets file is older than current app version
|
|
57
|
+
if old < version:
|
|
58
|
+
# < 2.0.0
|
|
59
|
+
if old < parse_version("2.0.0"):
|
|
60
|
+
print("Migrating presets dir from < 2.0.0...")
|
|
61
|
+
self.window.core.updater.patch_file('presets', True) # force replace file
|
|
62
|
+
|
|
63
|
+
# < 2.0.53
|
|
64
|
+
if old < parse_version("2.0.53") and k == 'current.assistant':
|
|
65
|
+
print("Migrating preset file from < 2.0.53...")
|
|
66
|
+
dst = os.path.join(self.window.core.config.get_user_dir('presets'), 'current.assistant.json')
|
|
67
|
+
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config', 'presets',
|
|
68
|
+
'current.assistant.json')
|
|
69
|
+
shutil.copyfile(src, dst)
|
|
70
|
+
updated = True
|
|
71
|
+
print("Patched file: {}.".format(dst))
|
|
72
|
+
|
|
73
|
+
# < 2.0.102
|
|
74
|
+
if old < parse_version("2.0.102"):
|
|
75
|
+
if 'current.llama_index' not in self.window.core.presets.items and not is_llama:
|
|
76
|
+
print("Migrating preset file from < 2.0.102...")
|
|
77
|
+
dst = os.path.join(self.window.core.config.get_user_dir('presets'), 'current.llama_index.json')
|
|
78
|
+
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config', 'presets',
|
|
79
|
+
'current.llama_index.json')
|
|
80
|
+
shutil.copyfile(src, dst)
|
|
81
|
+
updated = True
|
|
82
|
+
is_llama = True # prevent multiple copies
|
|
83
|
+
print("Patched file: {}.".format(dst))
|
|
84
|
+
|
|
85
|
+
# < 2.2.7
|
|
86
|
+
if old < parse_version("2.2.7"):
|
|
87
|
+
if not is_expert:
|
|
88
|
+
print("Migrating preset files from < 2.2.7...")
|
|
89
|
+
dst = os.path.join(self.window.core.config.get_user_dir('presets'), 'current.expert.json')
|
|
90
|
+
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config', 'presets', 'current.expert.json')
|
|
91
|
+
shutil.copyfile(src, dst)
|
|
92
|
+
print("Patched file: {}.".format(dst))
|
|
93
|
+
dst = os.path.join(self.window.core.config.get_user_dir('presets'), 'current.agent.json')
|
|
94
|
+
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config', 'presets', 'current.agent.json')
|
|
95
|
+
shutil.copyfile(src, dst)
|
|
96
|
+
print("Patched file: {}.".format(dst))
|
|
97
|
+
dst = os.path.join(self.window.core.config.get_user_dir('presets'), 'joke_expert.json')
|
|
98
|
+
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config', 'presets', 'joke_expert.json')
|
|
99
|
+
shutil.copyfile(src, dst)
|
|
100
|
+
print("Patched file: {}.".format(dst))
|
|
101
|
+
updated = True
|
|
102
|
+
is_expert = True # prevent multiple copies
|
|
103
|
+
|
|
104
|
+
# < 2.4.10
|
|
105
|
+
if old < parse_version("2.4.10"):
|
|
106
|
+
if 'current.agent_llama' not in self.window.core.presets.items and not is_agent_llama:
|
|
107
|
+
print("Migrating preset file from < 2.4.10...")
|
|
108
|
+
files = [
|
|
109
|
+
'current.agent_llama.json',
|
|
110
|
+
'agent_openai.json',
|
|
111
|
+
'agent_planner.json',
|
|
112
|
+
'agent_react.json',
|
|
113
|
+
]
|
|
114
|
+
for file in files:
|
|
115
|
+
dst = os.path.join(self.window.core.config.get_user_dir('presets'), file)
|
|
116
|
+
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config', 'presets', file)
|
|
117
|
+
shutil.copyfile(src, dst)
|
|
118
|
+
print("Patched file: {}.".format(dst))
|
|
119
|
+
|
|
120
|
+
updated = True
|
|
121
|
+
is_agent_llama = True # prevent multiple copies
|
|
122
|
+
|
|
123
|
+
# < 2.4.11
|
|
124
|
+
if old < parse_version("2.4.11"):
|
|
125
|
+
if 'agent_openai_assistant' not in self.window.core.presets.items and not is_agent_assistant:
|
|
126
|
+
print("Migrating preset file from < 2.4.11...")
|
|
127
|
+
files = [
|
|
128
|
+
'agent_openai_assistant.json',
|
|
129
|
+
]
|
|
130
|
+
for file in files:
|
|
131
|
+
dst = os.path.join(self.window.core.config.get_user_dir('presets'), file)
|
|
132
|
+
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config',
|
|
133
|
+
'presets', file)
|
|
134
|
+
shutil.copyfile(src, dst)
|
|
135
|
+
print("Patched file: {}.".format(dst))
|
|
136
|
+
|
|
137
|
+
updated = True
|
|
138
|
+
is_agent_assistant = True # prevent multiple copies
|
|
139
|
+
|
|
140
|
+
# < 2.5.33
|
|
141
|
+
if old < parse_version("2.5.33"):
|
|
142
|
+
if 'agent_code_act' not in self.window.core.presets.items and not is_agent_code_act:
|
|
143
|
+
print("Migrating preset file from < 2.5.33...")
|
|
144
|
+
files = [
|
|
145
|
+
'agent_code_act.json',
|
|
146
|
+
]
|
|
147
|
+
for file in files:
|
|
148
|
+
dst = os.path.join(self.window.core.config.get_user_dir('presets'), file)
|
|
149
|
+
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config',
|
|
150
|
+
'presets', file)
|
|
151
|
+
shutil.copyfile(src, dst)
|
|
152
|
+
print("Patched file: {}.".format(dst))
|
|
153
|
+
|
|
154
|
+
updated = True
|
|
155
|
+
is_agent_code_act = True # prevent multiple copies
|
|
156
|
+
|
|
157
|
+
# < 2.5.71
|
|
158
|
+
if old < parse_version("2.5.71"):
|
|
159
|
+
if 'current.computer' not in self.window.core.presets.items and not is_computer:
|
|
160
|
+
print("Migrating preset file from < 2.5.71...")
|
|
161
|
+
dst = os.path.join(self.window.core.config.get_user_dir('presets'), 'current.computer.json')
|
|
162
|
+
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config', 'presets',
|
|
163
|
+
'current.computer.json')
|
|
164
|
+
shutil.copyfile(src, dst)
|
|
165
|
+
updated = True
|
|
166
|
+
is_computer = True # prevent multiple copies
|
|
167
|
+
print("Patched file: {}.".format(dst))
|
|
168
|
+
|
|
169
|
+
# < 2.5.76
|
|
170
|
+
if old < parse_version("2.5.76"):
|
|
171
|
+
if 'current.agent_openai' not in self.window.core.presets.items and not is_agent_openai:
|
|
172
|
+
print("Migrating preset file from < 2.5.76...")
|
|
173
|
+
files = [
|
|
174
|
+
'current.agent_openai.json',
|
|
175
|
+
'agent_openai_simple.json',
|
|
176
|
+
'agent_openai_expert.json',
|
|
177
|
+
]
|
|
178
|
+
for file in files:
|
|
179
|
+
dst = os.path.join(self.window.core.config.get_user_dir('presets'), file)
|
|
180
|
+
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config',
|
|
181
|
+
'presets', file)
|
|
182
|
+
shutil.copyfile(src, dst)
|
|
183
|
+
print("Patched file: {}.".format(dst))
|
|
184
|
+
|
|
185
|
+
updated = True
|
|
186
|
+
is_agent_openai = True # prevent multiple copies
|
|
187
|
+
|
|
188
|
+
# < 2.5.82
|
|
189
|
+
if old < parse_version("2.5.82"):
|
|
190
|
+
if 'agent_openai_researcher' not in self.window.core.presets.items and not is_bot:
|
|
191
|
+
print("Migrating preset file from < 2.5.82...")
|
|
192
|
+
files = [
|
|
193
|
+
'agent_openai_coder.json',
|
|
194
|
+
'agent_openai_planner.json',
|
|
195
|
+
'agent_openai_researcher.json',
|
|
196
|
+
'agent_openai_writer.json',
|
|
197
|
+
]
|
|
198
|
+
for file in files:
|
|
199
|
+
dst = os.path.join(self.window.core.config.get_user_dir('presets'), file)
|
|
200
|
+
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config',
|
|
201
|
+
'presets', file)
|
|
202
|
+
shutil.copyfile(src, dst)
|
|
203
|
+
print("Patched file: {}.".format(dst))
|
|
204
|
+
updated = True
|
|
205
|
+
is_bot = True # prevent multiple copies
|
|
206
|
+
|
|
207
|
+
# < 2.5.86
|
|
208
|
+
if old < parse_version("2.5.86"):
|
|
209
|
+
if 'agent_openai_evolve' not in self.window.core.presets.items and not is_evolve:
|
|
210
|
+
print("Migrating preset file from < 2.5.86...")
|
|
211
|
+
files = [
|
|
212
|
+
'agent_openai_evolve.json',
|
|
213
|
+
]
|
|
214
|
+
for file in files:
|
|
215
|
+
dst = os.path.join(self.window.core.config.get_user_dir('presets'), file)
|
|
216
|
+
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config',
|
|
217
|
+
'presets', file)
|
|
218
|
+
shutil.copyfile(src, dst)
|
|
219
|
+
print("Patched file: {}.".format(dst))
|
|
220
|
+
updated = True
|
|
221
|
+
is_evolve = True # prevent multiple copies
|
|
222
|
+
|
|
223
|
+
# < 2.5.94
|
|
224
|
+
if old < parse_version("2.5.94"):
|
|
225
|
+
if 'agent_openai_b2b' not in self.window.core.presets.items and not is_b2b:
|
|
226
|
+
print("Migrating preset file from < 2.5.94...")
|
|
227
|
+
files = [
|
|
228
|
+
'agent_openai_b2b.json',
|
|
229
|
+
]
|
|
230
|
+
for file in files:
|
|
231
|
+
dst = os.path.join(self.window.core.config.get_user_dir('presets'), file)
|
|
232
|
+
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config',
|
|
233
|
+
'presets', file)
|
|
234
|
+
shutil.copyfile(src, dst)
|
|
235
|
+
print("Patched file: {}.".format(dst))
|
|
236
|
+
updated = True
|
|
237
|
+
is_b2b = True # prevent multiple copies
|
|
238
|
+
|
|
239
|
+
# < 2.6.1
|
|
240
|
+
if old < parse_version("2.6.1"):
|
|
241
|
+
if data.agent_provider == "react_workflow":
|
|
242
|
+
data.agent_provider = "react"
|
|
243
|
+
updated = True
|
|
244
|
+
save = True
|
|
245
|
+
|
|
246
|
+
# < 2.6.9
|
|
247
|
+
if old < parse_version("2.6.9"):
|
|
248
|
+
if 'agent_openai_supervisor' not in self.window.core.presets.items and not is_supervisor:
|
|
249
|
+
print("Migrating preset file from < 2.6.9...")
|
|
250
|
+
files = [
|
|
251
|
+
'agent_openai_supervisor.json',
|
|
252
|
+
'agent_supervisor.json',
|
|
253
|
+
]
|
|
254
|
+
for file in files:
|
|
255
|
+
dst = os.path.join(self.window.core.config.get_user_dir('presets'), file)
|
|
256
|
+
src = os.path.join(self.window.core.config.get_app_path(), 'data', 'config',
|
|
257
|
+
'presets', file)
|
|
258
|
+
shutil.copyfile(src, dst)
|
|
259
|
+
print("Patched file: {}.".format(dst))
|
|
260
|
+
updated = True
|
|
261
|
+
is_supervisor = True # prevent multiple copies
|
|
262
|
+
|
|
263
|
+
# update file
|
|
264
|
+
if updated:
|
|
265
|
+
if save:
|
|
266
|
+
self.window.core.presets.save(k)
|
|
267
|
+
self.window.core.presets.load() # reload presets from patched files
|
|
268
|
+
self.window.core.presets.save(k) # re-save presets
|
|
269
|
+
migrated = True
|
|
270
|
+
print("Preset {} patched to version {}.".format(k, version))
|
|
271
|
+
|
|
272
|
+
return migrated
|
pygpt_net/ui/dialog/settings.py
CHANGED
|
@@ -37,6 +37,7 @@ class Settings(BaseConfigDialog):
|
|
|
37
37
|
id = "settings"
|
|
38
38
|
path = self.window.core.config.path
|
|
39
39
|
sections = self.window.core.settings.get_sections()
|
|
40
|
+
setup_idx = idx
|
|
40
41
|
|
|
41
42
|
# buttons
|
|
42
43
|
self.window.ui.nodes['settings.btn.defaults.user'] = QPushButton(trans("dialog.settings.btn.defaults.user"))
|
|
@@ -280,12 +281,12 @@ class Settings(BaseConfigDialog):
|
|
|
280
281
|
self.window.ui.dialog['config.' + id].setWindowTitle(trans('dialog.settings'))
|
|
281
282
|
|
|
282
283
|
# restore current opened tab if idx is set
|
|
283
|
-
if
|
|
284
|
+
if setup_idx is not None:
|
|
284
285
|
try:
|
|
285
|
-
self.window.ui.tabs['settings.section'].setCurrentIndex(
|
|
286
|
-
self.window.controller.settings.set_by_tab(
|
|
286
|
+
self.window.ui.tabs['settings.section'].setCurrentIndex(setup_idx)
|
|
287
|
+
self.window.controller.settings.set_by_tab(setup_idx)
|
|
287
288
|
except Exception as e:
|
|
288
|
-
print('Failed restore settings tab: {}'.format(
|
|
289
|
+
print('Failed restore settings tab: {}'.format(setup_idx))
|
|
289
290
|
else:
|
|
290
291
|
self.window.controller.settings.set_by_tab(0)
|
|
291
292
|
|