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.
@@ -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.09.07 05:00:00 #
9
+ # Updated Date: 2025.09.12 00:00:00 #
10
10
  # ================================================== #
11
11
 
12
12
  import copy
@@ -14,6 +14,9 @@ import os
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
19
+
17
20
 
18
21
  class Patch:
19
22
  def __init__(self, window=None):
@@ -41,2471 +44,24 @@ class Patch:
41
44
  # check if config file is older than current app version
42
45
  if old < version:
43
46
 
44
- # mark as older version
45
47
  is_old = True
46
48
 
47
- # < 0.9.1
48
- if old < parse_version("0.9.1"):
49
- print("Migrating config from < 0.9.1...")
50
- keys_to_remove = ['user_id', 'custom'] # not needed anymore
51
- for key in keys_to_remove:
52
- if key in data:
53
- del data[key]
54
- keys_to_add = ['organization_key']
55
- for key in keys_to_add:
56
- if key not in data:
57
- data[key] = ""
58
- updated = True
59
-
60
- # < 0.9.2
61
- if old < parse_version("0.9.2"):
62
- print("Migrating config from < 0.9.2...")
63
- keys_to_remove = ['ui.ctx.min_width',
64
- 'ui.ctx.max_width',
65
- 'ui.toolbox.min_width',
66
- 'ui.toolbox.max_width',
67
- 'ui.dialog.settings.width',
68
- 'ui.dialog.settings.height',
69
- 'ui.chatbox.font.color']
70
- for key in keys_to_remove:
71
- if key in data:
72
- del data[key]
73
- if 'theme' not in data:
74
- data['theme'] = "dark_teal"
75
- updated = True
76
-
77
- # < 0.9.4
78
- if old < parse_version("0.9.4"):
79
- print("Migrating config from < 0.9.4...")
80
- if 'plugins' not in data:
81
- data['plugins'] = {}
82
- if 'plugins_enabled' not in data:
83
- data['plugins_enabled'] = {}
84
- updated = True
85
-
86
- # < 0.9.6
87
- if old < parse_version("0.9.6"):
88
- print("Migrating config from < 0.9.6...")
89
- data['debug'] = True # enable debug by default
90
- updated = True
91
-
92
- # < 2.0.0
93
- if old < parse_version("2.0.0"):
94
- print("Migrating config from < 2.0.0...")
95
- data['theme'] = 'dark_teal' # force, because removed light themes!
96
- if 'cmd' not in data:
97
- data['cmd'] = True
98
- if 'stream' not in data:
99
- data['stream'] = True
100
- if 'attachments_send_clear' not in data:
101
- data['attachments_send_clear'] = True
102
- if 'assistant' not in data:
103
- data['assistant'] = None
104
- if 'assistant_thread' not in data:
105
- data['assistant_thread'] = None
106
- updated = True
107
-
108
- # < 2.0.1
109
- if old < parse_version("2.0.1"):
110
- print("Migrating config from < 2.0.1...")
111
- if 'send_mode' not in data:
112
- data['send_mode'] = 1
113
- if 'send_shift_enter' in data:
114
- del data['send_shift_enter']
115
- if 'font_size.input' not in data:
116
- data['font_size.input'] = 11
117
- if 'font_size.ctx' not in data:
118
- data['font_size.ctx'] = 9
119
- if 'ctx.auto_summary' not in data:
120
- data['ctx.auto_summary'] = True
121
- if 'ctx.auto_summary.system' not in data:
122
- data['ctx.auto_summary.system'] = "You are an expert in conversation summarization"
123
- if 'ctx.auto_summary.prompt' not in data:
124
- data['ctx.auto_summary.prompt'] = "Summarize topic of this conversation in one sentence. Use best " \
125
- "keywords to describe it. Summary must be in the same language " \
126
- "as the conversation and it will be used for conversation title " \
127
- "so it must be EXTREMELY SHORT and concise - use maximum 5 " \
128
- "words: \n\nUser: {input}\nAI Assistant: {output}"
129
- updated = True
130
-
131
- # < 2.0.6
132
- if old < parse_version("2.0.6"):
133
- print("Migrating config from < 2.0.6...")
134
- if 'layout.density' not in data:
135
- data['layout.density'] = -2
136
- updated = True
137
-
138
- # < 2.0.8
139
- if old < parse_version("2.0.8"):
140
- print("Migrating config from < 2.0.8...")
141
- if 'plugins' not in data:
142
- data['plugins'] = {}
143
- if 'cmd_web_google' not in data['plugins']:
144
- data['plugins']['cmd_web_google'] = {}
145
- data['plugins']['cmd_web_google'][
146
- 'prompt_summarize'] = "Summarize the English text in a maximum of 3 " \
147
- "paragraphs, trying to find the most " \
148
- "important content that can help answer the " \
149
- "following question: "
150
- data['plugins']['cmd_web_google']['chunk_size'] = 100000
151
- data['plugins']['cmd_web_google']['max_page_content_length'] = 0
152
- updated = True
153
-
154
- # < 2.0.13
155
- if old < parse_version("2.0.13"):
156
- print("Migrating config from < 2.0.13...")
157
- if 'layout.density' not in data:
158
- data['layout.density'] = 0
159
- else:
160
- if data['layout.density'] == -2:
161
- data['layout.density'] = 0
162
- updated = True
163
-
164
- # < 2.0.14
165
- if old < parse_version("2.0.14"):
166
- print("Migrating config from < 2.0.14...")
167
- if 'vision.capture.enabled' not in data:
168
- data['vision.capture.enabled'] = True
169
- if 'vision.capture.auto' not in data:
170
- data['vision.capture.auto'] = True
171
- if 'vision.capture.width' not in data:
172
- data['vision.capture.width'] = 800
173
- if 'vision.capture.height' not in data:
174
- data['vision.capture.height'] = 600
175
- updated = True
176
-
177
- # < 2.0.16
178
- if old < parse_version("2.0.16"):
179
- print("Migrating config from < 2.0.16...")
180
- if 'vision.capture.idx' not in data:
181
- data['vision.capture.idx'] = 0
182
- if 'img_raw' not in data:
183
- data['img_raw'] = True
184
- if 'img_prompt_model' not in data:
185
- data['img_prompt_model'] = "gpt-4-1106-preview"
186
- updated = True
187
-
188
- # < 2.0.19
189
- if old < parse_version("2.0.19"):
190
- print("Migrating config from < 2.0.19...")
191
- if 'img_raw' not in data:
192
- data['img_raw'] = True
193
- if not data['img_raw']:
194
- data['img_raw'] = True
195
- updated = True
196
-
197
- # < 2.0.25
198
- if old < parse_version("2.0.25"):
199
- print("Migrating config from < 2.0.25...")
200
- if 'cmd.prompt' not in data:
201
- data['cmd.prompt'] = cfg_get_base('cmd.prompt')
202
- if 'img_prompt' not in data:
203
- data['img_prompt'] = cfg_get_base('img_prompt')
204
- if 'vision.capture.quality' not in data:
205
- data['vision.capture.quality'] = 85
206
- if 'attachments_capture_clear' not in data:
207
- data['attachments_capture_clear'] = True
208
- if 'plugins' not in data:
209
- data['plugins'] = {}
210
- if 'cmd_web_google' not in data['plugins']:
211
- data['plugins']['cmd_web_google'] = {}
212
- data['plugins']['cmd_web_google']['prompt_summarize'] = "Summarize the English text in a maximum of 3 " \
213
- "paragraphs, trying to find the most " \
214
- "important content that can help answer the " \
215
- "following question: "
216
- updated = True
217
-
218
- # < 2.0.26
219
- if old < parse_version("2.0.26"):
220
- print("Migrating config from < 2.0.26...")
221
- if 'ctx.auto_summary.model' not in data:
222
- data['ctx.auto_summary.model'] = 'gpt-3.5-turbo-1106'
223
- updated = True
224
-
225
- # < 2.0.27
226
- if old < parse_version("2.0.27"):
227
- print("Migrating config from < 2.0.27...")
228
- if 'plugins' not in data:
229
- data['plugins'] = {}
230
- if 'cmd_web_google' not in data['plugins']:
231
- data['plugins']['cmd_web_google'] = {}
232
- data['plugins']['cmd_web_google'][
233
- 'prompt_summarize'] = "Summarize text in English in a maximum of 3 " \
234
- "paragraphs, trying to find the most " \
235
- "important content that can help answer the " \
236
- "following question: {query}"
237
- data['cmd.prompt'] = cfg_get_base('cmd.prompt') # fix
238
- updated = True
239
-
240
- # < 2.0.30
241
- if old < parse_version("2.0.30"):
242
- print("Migrating config from < 2.0.30...")
243
- if 'plugins' not in data:
244
- data['plugins'] = {}
245
- if 'audio_openai_whisper' not in data['plugins']:
246
- data['plugins']['audio_openai_whisper'] = {}
247
- data['plugins']['audio_openai_whisper']['timeout'] = 1
248
- data['plugins']['audio_openai_whisper']['phrase_length'] = 5
249
- data['plugins']['audio_openai_whisper']['min_energy'] = 2000
250
- updated = True
251
-
252
- # < 2.0.31
253
- if old < parse_version("2.0.31"):
254
- print("Migrating config from < 2.0.31...")
255
- if 'plugins' not in data:
256
- data['plugins'] = {}
257
- if 'audio_openai_whisper' not in data['plugins']:
258
- data['plugins']['audio_openai_whisper'] = {}
259
- data['plugins']['audio_openai_whisper']['continuous_listen'] = False
260
- data['plugins']['audio_openai_whisper']['timeout'] = 2
261
- data['plugins']['audio_openai_whisper']['phrase_length'] = 4
262
- data['plugins']['audio_openai_whisper']['magic_word_timeout'] = 1
263
- data['plugins']['audio_openai_whisper']['magic_word_phrase_length'] = 2
264
- data['plugins']['audio_openai_whisper']['min_energy'] = 1.3
265
- updated = True
266
-
267
- # < 2.0.34
268
- if old < parse_version("2.0.34"):
269
- print("Migrating config from < 2.0.34...")
270
- if 'lock_modes' not in data:
271
- data['lock_modes'] = True
272
- updated = True
273
-
274
- # < 2.0.37
275
- if old < parse_version("2.0.37"):
276
- print("Migrating config from < 2.0.37...")
277
- if 'font_size.toolbox' not in data:
278
- data['font_size.toolbox'] = 12
279
- updated = True
280
-
281
- # < 2.0.46
282
- if old < parse_version("2.0.46"):
283
- print("Migrating config from < 2.0.46...")
284
- data['cmd'] = False # disable on default
285
- updated = True
286
-
287
- # < 2.0.47
288
- if old < parse_version("2.0.47"):
289
- print("Migrating config from < 2.0.47...")
290
- if 'notepad.num' not in data:
291
- data['notepad.num'] = 5
292
- updated = True
293
-
294
- # < 2.0.52
295
- if old < parse_version("2.0.52"):
296
- print("Migrating config from < 2.0.52...")
297
- if 'layout.dpi.scaling' not in data:
298
- data['layout.dpi.scaling'] = True
299
- if 'layout.dpi.factor' not in data:
300
- data['layout.dpi.factor'] = 1.0
301
- updated = True
302
-
303
- # < 2.0.62
304
- if old < parse_version("2.0.62"):
305
- print("Migrating config from < 2.0.62...")
306
- if 'ctx.records.limit' not in data:
307
- data['ctx.records.limit'] = 0
308
- updated = True
309
-
310
- # < 2.0.65
311
- if old < parse_version("2.0.65"):
312
- print("Migrating config from < 2.0.65...")
313
- if 'ctx.search.string' not in data:
314
- data['ctx.search.string'] = ""
315
- updated = True
316
-
317
- # < 2.0.69
318
- if old < parse_version("2.0.69"):
319
- print("Migrating config from < 2.0.69...")
320
- data['img_prompt'] = "Whenever I provide a basic idea or concept for an image, such as 'a picture " \
321
- "of mountains', I want you to ALWAYS translate it into English and expand " \
322
- "and elaborate on this idea. Use your knowledge and creativity to add " \
323
- "details that would make the image more vivid and interesting. This could " \
324
- "include specifying the time of day, weather conditions, surrounding " \
325
- "environment, and any additional elements that could enhance the scene. Your " \
326
- "goal is to create a detailed and descriptive prompt that provides DALL-E " \
327
- "with enough information to generate a rich and visually appealing image. " \
328
- "Remember to maintain the original intent of my request while enriching the " \
329
- "description with your imaginative details."
330
- data['img_raw'] = False
331
- data['img_prompt_model'] = "gpt-4-1106-preview"
332
- updated = True
333
-
334
- # < 2.0.71
335
- if old < parse_version("2.0.71"):
336
- print("Migrating config from < 2.0.71...")
337
- prompt = 'IMAGE GENERATION: Whenever I provide a basic idea or concept for an image, such as \'a picture of ' \
338
- 'mountains\', I want you to ALWAYS translate it into English and expand and elaborate on this idea. ' \
339
- 'Use your knowledge and creativity to add details that would make the image more vivid and ' \
340
- 'interesting. This could include specifying the time of day, weather conditions, surrounding ' \
341
- 'environment, and any additional elements that could enhance the scene. Your goal is to create a ' \
342
- 'detailed and descriptive prompt that provides DALL-E with enough information to generate a rich ' \
343
- 'and visually appealing image. Remember to maintain the original intent of my request while ' \
344
- 'enriching the description with your imaginative details. HOW TO START IMAGE GENERATION: to start ' \
345
- 'image generation return to me prepared prompt in JSON format, all in one line, using following ' \
346
- 'syntax: ~###~{"cmd": "image", "params": {"query": "your query here"}}~###~. Use ONLY this syntax ' \
347
- 'and remember to surround JSON string with ~###~. DO NOT use any other syntax. Use English in the ' \
348
- 'generated JSON command, but conduct all the remaining parts of the discussion with me in the ' \
349
- 'language in which I am speaking to you. The image will be generated on my machine immediately ' \
350
- 'after the command is issued, allowing us to discuss the photo once it has been created. Please ' \
351
- 'engage with me about the photo itself, not only by giving the generate command. '
352
- if 'openai_dalle' not in data['plugins']:
353
- data['plugins']['openai_dalle'] = {}
354
- data['plugins']['openai_dalle']['prompt'] = prompt # fixed prompt
355
-
356
- data['plugins_enabled']['openai_dalle'] = True
357
- data['plugins_enabled']['openai_vision'] = True
358
-
359
- # deprecate vision and img modes
360
- if data['mode'] == 'vision' or data['mode'] == 'img':
361
- data['mode'] = 'chat'
362
-
363
- updated = True
364
-
365
- # < 2.0.72
366
- if old < parse_version("2.0.72"):
367
- print("Migrating config from < 2.0.72...")
368
- if 'theme.markdown' not in data:
369
- data['theme.markdown'] = True
370
- prompt = 'IMAGE GENERATION: Whenever I provide a basic idea or concept for an image, such as \'a picture of ' \
371
- 'mountains\', I want you to ALWAYS translate it into English and expand and elaborate on this idea. ' \
372
- 'Use your knowledge and creativity to add details that would make the image more vivid and ' \
373
- 'interesting. This could include specifying the time of day, weather conditions, surrounding ' \
374
- 'environment, and any additional elements that could enhance the scene. Your goal is to create a ' \
375
- 'detailed and descriptive prompt that provides DALL-E with enough information to generate a rich ' \
376
- 'and visually appealing image. Remember to maintain the original intent of my request while ' \
377
- 'enriching the description with your imaginative details. HOW TO START IMAGE GENERATION: to start ' \
378
- 'image generation return to me prepared prompt in JSON format, all in one line, using following ' \
379
- 'syntax: ~###~{"cmd": "image", "params": {"query": "your query here"}}~###~. Use ONLY this syntax ' \
380
- 'and remember to surround JSON string with ~###~. DO NOT use any other syntax. Use English in the ' \
381
- 'generated JSON command, but conduct all the remaining parts of the discussion with me in the ' \
382
- 'language in which I am speaking to you. The image will be generated on my machine immediately ' \
383
- 'after the command is issued, allowing us to discuss the photo once it has been created. Please ' \
384
- 'engage with me about the photo itself, not only by giving the generate command. '
385
- if 'openai_dalle' not in data['plugins']:
386
- data['plugins']['openai_dalle'] = {}
387
- data['plugins']['openai_dalle']['prompt'] = prompt # fixed prompt
388
- updated = True
389
-
390
- # < 2.0.75
391
- if old < parse_version("2.0.75"):
392
- print("Migrating config from < 2.0.75...")
393
- if 'updater.check.launch' not in data:
394
- data['updater.check.launch'] = True
395
- if 'updater.check.bg' not in data:
396
- data['updater.check.bg'] = False
397
- updated = True
398
-
399
- # < 2.0.78
400
- if old < parse_version("2.0.78"):
401
- print("Migrating config from < 2.0.78...")
402
- if 'render.plain' not in data:
403
- data['render.plain'] = False
404
- updated = True
405
-
406
- # < 2.0.81
407
- if old < parse_version("2.0.81"):
408
- print("Migrating config from < 2.0.81...")
409
- patch_css('markdown.light.css', True) # force replace file
410
- updated = True
411
-
412
- # < 2.0.85
413
- if old < parse_version("2.0.85"):
414
- print("Migrating config from < 2.0.85...")
415
- prompt = "AUTONOMOUS MODE:\n1. You will now enter self-dialogue mode, where you will be conversing with " \
416
- "yourself, not with a human.\n2. When you enter self-dialogue mode, remember that you are engaging " \
417
- "in a conversation with yourself. Any user input will be considered a reply featuring your previous response.\n" \
418
- "3. The objective of this self-conversation is well-defined—focus on achieving it.\n" \
419
- "4. Your new message should be a continuation of the last response you generated, essentially replying" \
420
- " to yourself and extending it.\n5. After each response, critically evaluate its effectiveness " \
421
- "and alignment with the goal. If necessary, refine your approach.\n6. Incorporate self-critique " \
422
- "after every response to capitalize on your strengths and address areas needing improvement.\n7. To " \
423
- "advance towards the goal, utilize all the strategic thinking and resources at your disposal.\n" \
424
- "8. Ensure that the dialogue remains coherent and logical, with each response serving as a stepping " \
425
- "stone towards the ultimate objective.\n9. Treat the entire dialogue as a monologue aimed at devising" \
426
- " the best possible solution to the problem.\n10. Conclude the self-dialogue upon realizing the " \
427
- "goal or reaching a pivotal conclusion that meets the initial criteria.\n11. You are allowed to use " \
428
- "any commands and tools without asking for it.\n12. While using commands, always use the correct " \
429
- "syntax and never interrupt the command before generating the full instruction.\n13. ALWAYS break " \
430
- "down the main task into manageable logical subtasks, systematically addressing and analyzing each" \
431
- " one in sequence.\n14. With each subsequent response, make an effort to enhance your previous " \
432
- "reply by enriching it with new ideas and do it automatically without asking for it.\n14. Any input " \
433
- "that begins with 'user: ' will come from me, and I will be able to provide you with ANY additional " \
434
- "commands or goal updates in this manner. The other inputs, not prefixed with 'user: ' will represent" \
435
- " your previous responses.\n15. Start by breaking down the task into as many smaller sub-tasks as " \
436
- "possible, then proceed to complete each one in sequence. Next, break down each sub-task into even " \
437
- "smaller tasks, carefully and step by step go through all of them until the required goal is fully " \
438
- "and correctly achieved.\n"
439
- if 'self_loop' not in data['plugins']:
440
- data['plugins']['self_loop'] = {}
441
- data['plugins']['self_loop']['prompt'] = prompt # fixed prompt
442
-
443
- # before fix (from 2.0.72)
444
- prompt = 'IMAGE GENERATION: Whenever I provide a basic idea or concept for an image, such as \'a picture of ' \
445
- 'mountains\', I want you to ALWAYS translate it into English and expand and elaborate on this idea. ' \
446
- 'Use your knowledge and creativity to add details that would make the image more vivid and ' \
447
- 'interesting. This could include specifying the time of day, weather conditions, surrounding ' \
448
- 'environment, and any additional elements that could enhance the scene. Your goal is to create a ' \
449
- 'detailed and descriptive prompt that provides DALL-E with enough information to generate a rich ' \
450
- 'and visually appealing image. Remember to maintain the original intent of my request while ' \
451
- 'enriching the description with your imaginative details. HOW TO START IMAGE GENERATION: to start ' \
452
- 'image generation return to me prepared prompt in JSON format, all in one line, using following ' \
453
- 'syntax: ~###~{"cmd": "image", "params": {"query": "your query here"}}~###~. Use ONLY this syntax ' \
454
- 'and remember to surround JSON string with ~###~. DO NOT use any other syntax. Use English in the ' \
455
- 'generated JSON command, but conduct all the remaining parts of the discussion with me in the ' \
456
- 'language in which I am speaking to you. The image will be generated on my machine immediately ' \
457
- 'after the command is issued, allowing us to discuss the photo once it has been created. Please ' \
458
- 'engage with me about the photo itself, not only by giving the generate command. '
459
- if 'openai_dalle' not in data['plugins']:
460
- data['plugins']['openai_dalle'] = {}
461
- data['plugins']['openai_dalle']['prompt'] = prompt # fixed prompt
462
-
463
- updated = True
464
-
465
- # < 2.0.88
466
- if old < parse_version("2.0.88"):
467
- print("Migrating config from < 2.0.88...")
468
- prompt = "AUTONOMOUS MODE:\n1. You will now enter self-dialogue mode, where you will be conversing with " \
469
- "yourself, not with a human.\n2. When you enter self-dialogue mode, remember that you are engaging " \
470
- "in a conversation with yourself. Any user input will be considered a reply featuring your previous response.\n" \
471
- "3. The objective of this self-conversation is well-defined—focus on achieving it.\n" \
472
- "4. Your new message should be a continuation of the last response you generated, essentially replying" \
473
- " to yourself and extending it.\n5. After each response, critically evaluate its effectiveness " \
474
- "and alignment with the goal. If necessary, refine your approach.\n6. Incorporate self-critique " \
475
- "after every response to capitalize on your strengths and address areas needing improvement.\n7. To " \
476
- "advance towards the goal, utilize all the strategic thinking and resources at your disposal.\n" \
477
- "8. Ensure that the dialogue remains coherent and logical, with each response serving as a stepping " \
478
- "stone towards the ultimate objective.\n9. Treat the entire dialogue as a monologue aimed at devising" \
479
- " the best possible solution to the problem.\n10. Conclude the self-dialogue upon realizing the " \
480
- "goal or reaching a pivotal conclusion that meets the initial criteria.\n11. You are allowed to use " \
481
- "any commands and tools without asking for it.\n12. While using commands, always use the correct " \
482
- "syntax and never interrupt the command before generating the full instruction.\n13. ALWAYS break " \
483
- "down the main task into manageable logical subtasks, systematically addressing and analyzing each" \
484
- " one in sequence.\n14. With each subsequent response, make an effort to enhance your previous " \
485
- "reply by enriching it with new ideas and do it automatically without asking for it.\n15. Any input " \
486
- "that begins with 'user: ' will come from me, and I will be able to provide you with ANY additional " \
487
- "commands or goal updates in this manner. The other inputs, not prefixed with 'user: ' will represent" \
488
- " your previous responses.\n16. Start by breaking down the task into as many smaller sub-tasks as " \
489
- "possible, then proceed to complete each one in sequence. Next, break down each sub-task into even " \
490
- "smaller tasks, carefully and step by step go through all of them until the required goal is fully " \
491
- "and correctly achieved.\n"
492
- if 'self_loop' not in data['plugins']:
493
- data['plugins']['self_loop'] = {}
494
- data['plugins']['self_loop']['prompt'] = prompt # fixed prompt
495
- updated = True
496
-
497
- # < 2.0.91
498
- if old < parse_version("2.0.91"):
499
- print("Migrating config from < 2.0.91...")
500
- patch_css('style.dark.css', True) # force replace file
501
- updated = True
502
-
503
- # < 2.0.96
504
- if old < parse_version("2.0.96"):
505
- print("Migrating config from < 2.0.96...")
506
- if 'img_quality' not in data:
507
- data['img_quality'] = "standard"
508
- updated = True
509
-
510
- # < 2.0.98
511
- if old < parse_version("2.0.98"):
512
- print("Migrating config from < 2.0.98...")
513
- data['img_resolution'] = "1792x1024" # char fix
514
- patch_css('style.css', True) # force replace file
515
- patch_css('style.light.css', True) # force replace file
516
- patch_css('style.dark.css', True) # force replace file
517
- updated = True
518
-
519
- # < 2.0.99
520
- if old < parse_version("2.0.99"):
521
- print("Migrating config from < 2.0.99...")
522
- if 'layout.splitters' in data:
523
- if 'calendar' in data['layout.splitters']:
524
- # restore if was hidden at < 2.0.99
525
- if len(data['layout.splitters']['calendar']) == 2 \
526
- and data['layout.splitters']['calendar'][1] == 0:
527
- data['layout.splitters']['calendar'] = [100, 100]
528
- if data['layout.density'] == 0:
529
- data['layout.density'] = -1
530
- updated = True
531
-
532
- # < 2.0.100
533
- if old < parse_version("2.0.100"):
534
- print("Migrating config from < 2.0.100...")
535
- # rename output dir to data dir
536
- src = os.path.join(self.window.core.config.path, 'output')
537
- dst = os.path.join(self.window.core.config.path, 'data')
538
-
539
- # migrate data dir name
540
- if os.path.exists(src):
541
- # backup old data dir
542
- if os.path.exists(dst):
543
- backup = os.path.join(self.window.core.config.path, 'data.backup')
544
- os.rename(dst, backup)
545
- # rename "output" to "data"
546
- if os.path.exists(src):
547
- os.rename(src, dst)
548
-
549
- # add llama-index config keys:
550
- if "llama.idx.auto" not in data:
551
- data["llama.idx.auto"] = False
552
- if "llama.idx.auto.index" not in data:
553
- data["llama.idx.auto.index"] = "base"
554
- if "llama.idx.current" not in data:
555
- data["llama.idx.current"] = "base"
556
- if "llama.idx.db.index" not in data:
557
- data["llama.idx.db.index"] = ""
558
- if "llama.idx.db.last" not in data:
559
- data["llama.idx.db.last"] = 0
560
- if "llama.idx.list" not in data:
561
- data["llama.idx.list"] = [
562
- {
563
- "id": "base",
564
- "name": "Base",
565
- }
566
- ]
567
- if "llama.idx.status" not in data:
568
- data["llama.idx.status"] = {}
569
-
570
- if "llama.log" not in data:
571
- data["llama.log"] = False
572
-
573
- updated = True
574
-
575
- # < 2.0.101
576
- if old < parse_version("2.0.101"):
577
- print("Migrating config from < 2.0.101...")
578
- if 'layout.tooltips' not in data:
579
- data['layout.tooltips'] = True
580
- updated = True
581
-
582
- # < 2.0.102
583
- if old < parse_version("2.0.102"):
584
- print("Migrating config from < 2.0.102...")
585
- if 'llama.hub.loaders' not in data:
586
- data['llama.hub.loaders'] = [
587
- {
588
- "ext": "pptx",
589
- "loader": "PptxReader"
590
- },
591
- {
592
- "ext": "png,jpg,jpeg",
593
- "loader": "ImageReader"
594
- }
595
- ]
596
- updated = True
597
-
598
- # < 2.0.112
599
- if old < parse_version("2.0.112"):
600
- print("Migrating config from < 2.0.112...")
601
- if 'img_dialog_open' not in data:
602
- data['img_dialog_open'] = True
603
- updated = True
604
-
605
- # < 2.0.114
606
- if old < parse_version("2.0.114"):
607
- print("Migrating config from < 2.0.114...")
608
- if 'llama.idx.storage' not in data:
609
- data['llama.idx.storage'] = "SimpleVectorStore"
610
- if 'llama.idx.storage.args' not in data:
611
- data['llama.idx.storage.args'] = []
612
- if 'llama.idx.raw' not in data:
613
- data['llama.idx.raw'] = False
614
- updated = True
615
-
616
- # < 2.0.116
617
- if old < parse_version("2.0.116"):
618
- print("Migrating config from < 2.0.116...")
619
- data['debug'] = False
620
- updated = True
621
-
622
- # < 2.0.118
623
- if old < parse_version("2.0.118"):
624
- print("Migrating config from < 2.0.118...")
625
- if 'layout.tray' not in data:
626
- data['layout.tray'] = True
627
- updated = True
628
-
629
- """
630
- # < 2.0.119
631
- if old < parse_version("2.0.119"):
632
- print("Migrating config from < 2.0.119...")
633
- if 'layout.minimized' not in data:
634
- data['layout.minimized'] = False
635
- updated = True
636
- """
637
-
638
- # < 2.0.121
639
- if old < parse_version("2.0.121"):
640
- print("Migrating config from < 2.0.121...")
641
- if 'openai_vision' not in data['plugins']:
642
- data['plugins']['openai_vision'] = {}
643
- data['plugins']['openai_vision']['model'] = "gpt-4-vision-preview"
644
- updated = True
645
-
646
- # < 2.0.123
647
- if old < parse_version("2.0.123"):
648
- print("Migrating config from < 2.0.123...")
649
- if 'llama.idx.recursive' not in data:
650
- data['llama.idx.recursive'] = False
651
- updated = True
652
-
653
- # < 2.0.127
654
- if old < parse_version("2.0.127"):
655
- print("Migrating config from < 2.0.127...")
656
- if 'upload.store' not in data:
657
- data['upload.store'] = True
658
- if 'upload.data_dir' not in data:
659
- data['upload.data_dir'] = False
660
- updated = True
661
-
662
- # < 2.0.131
663
- if old < parse_version("2.0.131"):
664
- print("Migrating config from < 2.0.131...")
665
- if 'self_loop' in data['plugins'] \
666
- and 'prompts' not in data['plugins']['self_loop'] \
667
- and 'prompt' in data['plugins']['self_loop'] \
668
- and 'extended_prompt' in data['plugins']['self_loop']:
669
-
670
- # copy old prompts to new list of prompts
671
- data['plugins']['self_loop']['prompts'] = [
672
- {
673
- "enabled": True,
674
- "name": "Default",
675
- "prompt": data['plugins']['self_loop']['prompt'],
676
- },
677
- {
678
- "enabled": False,
679
- "name": "Extended",
680
- "prompt": data['plugins']['self_loop']['extended_prompt'],
681
- },
682
- ]
683
- updated = True
684
-
685
- # < 2.0.132
686
- if old < parse_version("2.0.132"):
687
- print("Migrating config from < 2.0.132...")
688
- if 'agent.auto_stop' not in data:
689
- data['agent.auto_stop'] = True
690
- if 'agent.iterations' not in data:
691
- data['agent.iterations'] = 3
692
- updated = True
693
-
694
- # < 2.0.135
695
- if old < parse_version("2.0.135"):
696
- print("Migrating config from < 2.0.135...")
697
- if 'agent.mode' not in data:
698
- data['agent.mode'] = "chat"
699
- if 'agent.idx' not in data:
700
- data['agent.idx'] = "base"
701
- updated = True
702
-
703
- # < 2.0.138
704
- if old < parse_version("2.0.138"):
705
- print("Migrating config from < 2.0.138...")
706
- if 'layout.tray.minimize' not in data:
707
- data['layout.tray.minimize'] = False
708
- updated = True
709
-
710
- # < 2.0.139
711
- if old < parse_version("2.0.139"):
712
- print("Migrating config from < 2.0.139...")
713
- data['updater.check.bg'] = True
714
- if 'license.accepted' not in data:
715
- data['license.accepted'] = False
716
- if 'updater.check.bg.last_time' not in data:
717
- data['updater.check.bg.last_time'] = None
718
- if 'updater.check.bg.last_version' not in data:
719
- data['updater.check.bg.last_version'] = None
720
- updated = True
721
-
722
- # < 2.0.142
723
- if old < parse_version("2.0.142"):
724
- print("Migrating config from < 2.0.142...")
725
- if 'agent.goal.notify' not in data:
726
- data['agent.goal.notify'] = True
727
- updated = True
728
-
729
- # < 2.0.143
730
- if old < parse_version("2.0.143"):
731
- print("Migrating config from < 2.0.143...")
732
- if 'ctx.records.filter' not in data:
733
- data['ctx.records.filter'] = "all"
734
- updated = True
735
-
736
- # < 2.0.144
737
- if old < parse_version("2.0.144"):
738
- print("Migrating config from < 2.0.144...")
739
- if 'cmd_history' in data['plugins'] \
740
- and 'syntax_get_ctx_list_in_date_range' in data['plugins']['cmd_history']:
741
- # remove
742
- del data['plugins']['cmd_history']['syntax_get_ctx_list_in_date_range']
743
- if 'cmd_history' in data['plugins'] \
744
- and 'syntax_get_ctx_content_by_id' in data['plugins']['cmd_history']:
745
- # remove
746
- del data['plugins']['cmd_history']['syntax_get_ctx_content_by_id']
747
- updated = True
748
-
749
- # < 2.0.149
750
- if old < parse_version("2.0.149"):
751
- print("Migrating config from < 2.0.149...")
752
- # logger
753
- if 'log.dalle' not in data:
754
- data['log.dalle'] = False
755
- if 'log.level' not in data:
756
- data['log.level'] = "error"
757
- if 'log.plugins' not in data:
758
- data['log.plugins'] = False
759
- if 'log.assistants' not in data:
760
- data['log.assistants'] = False
761
- if 'log.llama' not in data:
762
- if 'llama.log' in data:
763
- data['log.llama'] = data['llama.log']
764
- del data['llama.log']
765
- else:
766
- data['log.llama'] = False
767
-
768
- # painter
769
- if 'painter.brush.color' not in data:
770
- data['painter.brush.color'] = 'Black'
771
- if 'painter.brush.mode' not in data:
772
- data['painter.brush.mode'] = 'brush'
773
- if 'painter.brush.size' not in data:
774
- data['painter.brush.size'] = 3
775
- updated = True
776
-
777
- # < 2.0.152
778
- if old < parse_version("2.0.152"):
779
- print("Migrating config from < 2.0.152...")
780
- data['cmd.prompt'] = cfg_get_base('cmd.prompt') # bg run fix
781
- updated = True
782
-
783
- # < 2.0.153
784
- if old < parse_version("2.0.153"):
785
- print("Migrating config from < 2.0.153...")
786
- if 'layout.dialog.geometry.store' not in data:
787
- data['layout.dialog.geometry.store'] = True
788
- updated = True
789
-
790
- # < 2.0.157
791
- if old < parse_version("2.0.157"):
792
- # decrease chunk size
793
- print("Migrating config from < 2.0.157...")
794
- if 'cmd_web_google' in data['plugins'] \
795
- and 'chunk_size' in data['plugins']['cmd_web_google']:
796
- if data['plugins']['cmd_web_google']['chunk_size'] > 20000:
797
- data['plugins']['cmd_web_google']['chunk_size'] = 20000
798
- updated = True
799
-
800
- # < 2.0.161
801
- if old < parse_version("2.0.161"):
802
- print("Migrating config from < 2.0.161...")
803
- if 'ctx.search_content' not in data:
804
- data['ctx.search_content'] = False
805
- if 'download.dir' not in data:
806
- data['download.dir'] = "download"
807
- updated = True
808
-
809
- # < 2.0.162 - migrate indexes into db
810
- if old < parse_version("2.0.162"):
811
- print("Migrating indexes from < 2.0.162...")
812
- if 'llama.idx.replace_old' not in data:
813
- data['llama.idx.replace_old'] = True
814
- self.window.core.idx.patch(old)
815
- updated = True
816
-
817
- # < 2.0.164 - migrate indexes into db
818
- if old < parse_version("2.0.164"):
819
- print("Migrating config from < 2.0.164...")
820
-
821
- # Migrate plugins to provider-based versions
822
-
823
- # rename cmd_web_google to cmd_web
824
- if 'cmd_web_google' in data["plugins"]:
825
- data["plugins"]["cmd_web"] = data["plugins"]["cmd_web_google"]
826
- del data["plugins"]["cmd_web_google"]
827
- if 'cmd_web_google' in data["plugins_enabled"]:
828
- data["plugins_enabled"]["cmd_web"] = data["plugins_enabled"]["cmd_web_google"]
829
- del data["plugins_enabled"]["cmd_web_google"]
830
-
831
- # rename audio_openai_whisper to audio_input
832
- if 'audio_openai_whisper' in data["plugins"]:
833
- data["plugins"]["audio_input"] = data["plugins"]["audio_openai_whisper"]
834
- del data["plugins"]["audio_openai_whisper"]
835
- if 'audio_openai_whisper' in data["plugins_enabled"]:
836
- data["plugins_enabled"]["audio_input"] = data["plugins_enabled"]["audio_openai_whisper"]
837
- del data["plugins_enabled"]["audio_openai_whisper"]
838
-
839
- # migrate model to whisper_model
840
- if 'audio_input' in data["plugins"] and "model" in data["plugins"]["audio_input"]:
841
- data["plugins"]["audio_input"]["whisper_model"] = data["plugins"]["audio_input"]["model"]
842
- del data["plugins"]["audio_input"]["model"]
843
-
844
- # rename audio_openai_tts to audio_output
845
- if 'audio_openai_tts' in data["plugins"]:
846
- data["plugins"]["audio_output"] = data["plugins"]["audio_openai_tts"]
847
- del data["plugins"]["audio_openai_tts"]
848
- if 'audio_openai_tts' in data["plugins_enabled"]:
849
- data["plugins_enabled"]["audio_output"] = data["plugins_enabled"]["audio_openai_tts"]
850
- del data["plugins_enabled"]["audio_openai_tts"]
851
-
852
- # migrate model and voice to openai_model and openai_voice
853
- if 'audio_output' in data["plugins"] and "model" in data["plugins"]["audio_output"]:
854
- data["plugins"]["audio_output"]["openai_model"] = data["plugins"]["audio_output"]["model"]
855
- del data["plugins"]["audio_output"]["model"]
856
- if 'audio_output' in data["plugins"] and "voice" in data["plugins"]["audio_output"]:
857
- data["plugins"]["audio_output"]["openai_voice"] = data["plugins"]["audio_output"]["voice"]
858
- del data["plugins"]["audio_output"]["voice"]
859
-
860
- # migrate azure settings
861
- if 'audio_azure' in data["plugins"] and "azure_api_key" in data["plugins"]["audio_azure"]:
862
- data["plugins"]["audio_output"]["azure_api_key"] = data["plugins"]["audio_azure"]["azure_api_key"]
863
- if 'audio_azure' in data["plugins"] and "azure_region" in data["plugins"]["audio_azure"]:
864
- data["plugins"]["audio_output"]["azure_region"] = data["plugins"]["audio_azure"]["azure_region"]
865
- if 'audio_azure' in data["plugins"] and "voice_en" in data["plugins"]["audio_azure"]:
866
- data["plugins"]["audio_output"]["azure_voice_en"] = data["plugins"]["audio_azure"]["voice_en"]
867
- if 'audio_azure' in data["plugins"] and "voice_pl" in data["plugins"]["audio_azure"]:
868
- data["plugins"]["audio_output"]["azure_voice_pl"] = data["plugins"]["audio_azure"]["voice_pl"]
869
-
870
- # remove audio voice
871
- if 'audio_output' in data["plugins"] and "voice_en" in data["plugins"]["audio_output"]:
872
- del data["plugins"]["audio_output"]["voice_en"]
873
- if 'audio_output' in data["plugins"] and "voice_pl" in data["plugins"]["audio_output"]:
874
- del data["plugins"]["audio_output"]["voice_pl"]
875
-
876
- # remove audio_azure
877
- if 'audio_azure' in data["plugins"]:
878
- del data["plugins"]["audio_azure"]
879
- if 'audio_azure' in data["plugins_enabled"]:
880
- del data["plugins_enabled"]["audio_azure"]
881
-
882
- updated = True
883
-
884
- # < 2.0.165
885
- if old < parse_version("2.0.165"):
886
- print("Migrating config from < 2.0.165...")
887
- if 'llama.idx.excluded_ext' not in data:
888
- data['llama.idx.excluded_ext'] = "3g2,3gp,7z,a,aac,aiff,alac,apk,apk,apng,app,ar,avi,avif," \
889
- "bin,bmp,bz2,cab,class,deb,deb,dll,dmg,dmg,drv,dsd,dylib," \
890
- "dylib,ear,egg,elf,esd,exe,flac,flv,gif,gz,heic,heif,ico," \
891
- "img,iso,jar,jpeg,jpg,ko,lib,lz,lz4,m2v,m4a,m4v,mkv,mov,mp3," \
892
- "mp4,mpc,msi,nrg,o,ogg,ogv,pcm,pkg,pkg,png,psd,pyc,rar,rpm,rpm," \
893
- "so,so,svg,swm,sys,tar,tiff,vdi,vhd,vhdx,vmdk,vob,war,wav," \
894
- "webm,webp,whl,wim,wma,wmv,xz,zip,zst"
895
- if 'cmd_custom' in data["plugins"]:
896
- if 'cmds' in data["plugins"]["cmd_custom"]:
897
- for i, cmd in enumerate(data["plugins"]["cmd_custom"]["cmds"]):
898
- if "enabled" not in cmd:
899
- data["plugins"]["cmd_custom"]["cmds"][i]["enabled"] = True
900
- updated = True
901
-
902
- # < 2.0.166 - migrate self_loop plugin to agent
903
- if old < parse_version("2.0.166"):
904
- print("Migrating config from < 2.0.166...")
905
- if 'self_loop' in data["plugins"]:
906
- data["plugins"]["agent"] = data["plugins"]["self_loop"]
907
- del data["plugins"]["self_loop"]
908
- if 'self_loop' in data["plugins_enabled"]:
909
- data["plugins_enabled"]["agent"] = data["plugins_enabled"]["self_loop"]
910
- del data["plugins_enabled"]["self_loop"]
911
- updated = True
912
-
913
- # < 2.0.170 - add audio input language
914
- if old < parse_version("2.0.170"):
915
- print("Migrating config from < 2.0.170...")
916
- if 'audio_input' in data["plugins"]:
917
- # add language to google_args if not present
918
- is_lang = False
919
- if "google_args" in data["plugins"]["audio_input"] \
920
- and isinstance(data["plugins"]["audio_input"]["google_args"], list):
921
- for option in data["plugins"]["audio_input"]["google_args"]:
922
- if option["name"] == "language":
923
- is_lang = True
924
- break
925
- if not is_lang:
926
- if "google_args" not in data["plugins"]["audio_input"] or \
927
- not isinstance(data["plugins"]["audio_input"]["google_args"], list):
928
- data["plugins"]["audio_input"]["google_args"] = []
929
- data["plugins"]["audio_input"]["google_args"].append({
930
- "name": "language",
931
- "value": "en-US",
932
- "type": "str",
933
- })
934
-
935
- # add language to google_cloud_args if not present
936
- is_lang = False
937
- if "google_cloud_args" in data["plugins"]["audio_input"] \
938
- and isinstance(data["plugins"]["audio_input"]["google_cloud_args"], list):
939
- for option in data["plugins"]["audio_input"]["google_cloud_args"]:
940
- if option["name"] == "language":
941
- is_lang = True
942
- break
943
- if not is_lang:
944
- if "google_cloud_args" not in data["plugins"]["audio_input"] or \
945
- not isinstance(data["plugins"]["audio_input"]["google_cloud_args"], list):
946
- data["plugins"]["audio_input"]["google_cloud_args"] = []
947
- data["plugins"]["audio_input"]["google_cloud_args"].append({
948
- "name": "language",
949
- "value": "en-US",
950
- "type": "str",
951
- })
952
-
953
- # add language to bing_args if not present
954
- is_lang = False
955
- if "bing_args" in data["plugins"]["audio_input"] \
956
- and isinstance(data["plugins"]["audio_input"]["bing_args"], list):
957
- for option in data["plugins"]["audio_input"]["bing_args"]:
958
- if option["name"] == "language":
959
- is_lang = True
960
- break
961
- if not is_lang:
962
- if "bing_args" not in data["plugins"]["audio_input"] or \
963
- not isinstance(data["plugins"]["audio_input"]["bing_args"], list):
964
- data["plugins"]["audio_input"]["bing_args"] = []
965
- data["plugins"]["audio_input"]["bing_args"].append({
966
- "name": "language",
967
- "value": "en-US",
968
- "type": "str",
969
- })
970
- updated = True
971
-
972
- # < 2.0.172 - fix cmd syntax
973
- if old < parse_version("2.0.172"):
974
- print("Migrating config from < 2.0.172...")
975
- if 'cmd_files' in data["plugins"] and 'syntax_file_index' in data["plugins"]["cmd_files"]:
976
- syntax = '"file_index": use it to index (embed in Vector Store) a file or directory for ' \
977
- 'future use, params: "path"'
978
- data["plugins"]["cmd_files"]["syntax_file_index"] = syntax
979
- if 'cmd_web' in data["plugins"] and 'syntax_web_url_open' in data["plugins"]["cmd_web"]:
980
- syntax = '"web_url_open": use it to get contents from a specific Web page. ' \
981
- 'Use a custom summary prompt if necessary, otherwise a default summary will be used, ' \
982
- 'params: "url", "summarize_prompt"'
983
- data["plugins"]["cmd_web"]["syntax_web_url_open"] = syntax
984
- if 'cmd_web' in data["plugins"] and 'syntax_web_url_raw' in data["plugins"]["cmd_web"]:
985
- syntax = '"web_url_raw": use it to get RAW text/html content (not summarized) from ' \
986
- 'a specific Web page, params: "url"'
987
- data["plugins"]["cmd_web"]["syntax_web_url_raw"] = syntax
988
- if 'cmd_web' in data["plugins"] and 'syntax_web_urls' in data["plugins"]["cmd_web"]:
989
- syntax = '"web_urls": use it to search the Web for URLs to use, prepare a search query itself, ' \
990
- 'a list of found links to websites will be returned, 10 links per page max. ' \
991
- 'You can change the page or the number of links per page using the provided parameters, ' \
992
- 'params: "query", "page", "num_links"'
993
- data["plugins"]["cmd_web"]["syntax_web_urls"] = syntax
994
- updated = True
995
-
996
- # < 2.1.1
997
- if old < parse_version("2.1.1"):
998
- print("Migrating config from < 2.1.1...")
999
- if 'llama.hub.loaders.args' not in data:
1000
- data['llama.hub.loaders.args'] = []
1001
- updated = True
1002
-
1003
- # < 2.1.2
1004
- if old < parse_version("2.1.2"):
1005
- print("Migrating config from < 2.1.2...")
1006
- if 'llama.hub.loaders.use_local' not in data:
1007
- data['llama.hub.loaders.use_local'] = False
1008
- updated = True
1009
-
1010
- # < 2.1.5 - syntax
1011
- if old < parse_version("2.1.5"):
1012
- print("Migrating config from < 2.1.5...")
1013
- if 'cmd_files' in data["plugins"] and 'syntax_file_index' in data["plugins"]["cmd_files"]:
1014
- syntax = '"file_index": use it to index (embed in Vector Store) a file or directory, params: "path"'
1015
- data["plugins"]["cmd_files"]["syntax_file_index"] = syntax
1016
- updated = True
1017
-
1018
- # < 2.1.8 - syntax
1019
- if old < parse_version("2.1.8"):
1020
- print("Migrating config from < 2.1.8...")
1021
- if 'idx_llama_index' in data["plugins"] and 'syntax_prepare_question' in data["plugins"]["idx_llama_index"]:
1022
- syntax = 'Simplify the question into a short query for retrieving information from a vector store.'
1023
- data["plugins"]["idx_llama_index"]["syntax_prepare_question"] = syntax
1024
- updated = True
1025
-
1026
- # < 2.1.9 - syntax
1027
- if old < parse_version("2.1.9"):
1028
- print("Migrating config from < 2.1.9...")
1029
- if 'cmd_files' in data["plugins"] and 'syntax_read_file' in data["plugins"]["cmd_files"]:
1030
- syntax = '"read_file": read data from file, if multiple files then pass list of files, params: "filename"'
1031
- data["plugins"]["cmd_files"]["syntax_read_file"] = syntax
1032
- if 'log.events' not in data:
1033
- data["log.events"] = False
1034
- updated = True
1035
-
1036
- # < 2.1.10
1037
- if old < parse_version("2.1.10"):
1038
- print("Migrating config from < 2.1.10...")
1039
-
1040
- # fix missing updated before >>>
1041
- if 'cmd_files' in data["plugins"] and 'syntax_file_index' in data["plugins"]["cmd_files"]:
1042
- syntax = '"file_index": use it to index (embed in Vector Store) a file or directory, params: "path"'
1043
- data["plugins"]["cmd_files"]["syntax_file_index"] = syntax
1044
- if 'idx_llama_index' in data["plugins"] and 'syntax_prepare_question' in data["plugins"]["idx_llama_index"]:
1045
- syntax = 'Simplify the question into a short query for retrieving information from a vector store.'
1046
- data["plugins"]["idx_llama_index"]["syntax_prepare_question"] = syntax
1047
- if 'cmd_files' in data["plugins"] and 'syntax_read_file' in data["plugins"]["cmd_files"]:
1048
- syntax = '"read_file": read data from file, if multiple files then pass list of files, params: "filename"'
1049
- data["plugins"]["cmd_files"]["syntax_read_file"] = syntax
1050
- if 'log.events' not in data:
1051
- data["log.events"] = False
1052
- # <<< fix missing updated before
1053
-
1054
- # current
1055
- if 'ctx.records.filter.labels' not in data:
1056
- data["ctx.records.filter.labels"] = [0, 1, 2, 3, 4, 5, 6, 7]
1057
-
1058
- if 'preset.plugins' not in data:
1059
- data["preset.plugins"] = ""
1060
-
1061
- if 'ctx.records.filter' in data and str(data["ctx.records.filter"]).startswith("label"):
1062
- data["ctx.records.filter"] = "all"
1063
- updated = True
1064
-
1065
- if old < parse_version("2.1.12"):
1066
- print("Migrating config from < 2.1.12...")
1067
- if 'max_requests_limit' not in data:
1068
- data["max_requests_limit"] = 60
1069
- if 'ctx.allow_item_delete' not in data:
1070
- data["ctx.allow_item_delete"] = True
1071
- if 'ctx.counters.all' not in data:
1072
- data["ctx.counters.all"] = False
1073
- if 'agent.prompt.continue' not in data:
1074
- data["agent.prompt.continue"] = "continue..."
1075
- if 'api_endpoint' not in data:
1076
- data["api_endpoint"] = "https://api.openai.com/v1"
1077
- updated = True
1078
-
1079
- if old < parse_version("2.1.15"):
1080
- print("Migrating config from < 2.1.15...")
1081
- if 'ctx.edit_icons' not in data:
1082
- data["ctx.edit_icons"] = False
1083
- if 'llama.idx.auto.modes' not in data:
1084
- data["llama.idx.auto.modes"] = "chat,completion,vision,assistant,langchain,llama_index,agent"
1085
- if 'ctx.allow_item_delete' in data:
1086
- del data["ctx.allow_item_delete"]
1087
- updated = True
1088
-
1089
- if old < parse_version("2.1.16"):
1090
- print("Migrating config from < 2.1.16...")
1091
- if 'ctx.sources' not in data:
1092
- data["ctx.sources"] = True
1093
- updated = True
1094
-
1095
- if old < parse_version("2.1.18"):
1096
- print("Migrating config from < 2.1.18...")
1097
- if 'ctx.audio' not in data:
1098
- data["ctx.audio"] = True
1099
- updated = True
1100
-
1101
- if old < parse_version("2.1.19"):
1102
- print("Migrating config from < 2.1.19...")
1103
- if 'llama.idx.excluded_ext' in data:
1104
- data["llama.idx.excluded.ext"] = copy.deepcopy(data["llama.idx.excluded_ext"])
1105
- del data["llama.idx.excluded_ext"]
1106
- if 'llama.idx.excluded.force' not in data:
1107
- data["llama.idx.excluded.force"] = False
1108
- if 'llama.idx.custom_meta' not in data:
1109
- data["llama.idx.custom_meta"] = [
1110
- {
1111
- "extensions": "*",
1112
- "key": "file_name",
1113
- "value": "{relative_path}"
1114
- }
1115
- ]
1116
- updated = True
1117
-
1118
- # < 2.1.20
1119
- if old < parse_version("2.1.20"):
1120
- print("Migrating config from < 2.1.20...")
1121
- data['cmd.prompt'] = cfg_get_base('cmd.prompt') # moved to json schema
1122
- updated = True
1123
-
1124
- # < 2.1.22
1125
- if old < parse_version("2.1.22"):
1126
- print("Migrating config from < 2.1.22...")
1127
- if 'llama.idx.custom_meta.web' not in data:
1128
- data["llama.idx.custom_meta.web"] = []
1129
- updated = True
1130
-
1131
- # < 2.1.23
1132
- if old < parse_version("2.1.23"):
1133
- print("Migrating config from < 2.1.23...")
1134
- if 'llama.idx.embeddings.provider' not in data:
1135
- data["llama.idx.embeddings.provider"] = "openai"
1136
- if 'llama.idx.embeddings.args' not in data:
1137
- data["llama.idx.embeddings.args"] = [
1138
- {
1139
- "name": "model",
1140
- "value": "text-embedding-3-small",
1141
- "type": "str"
1142
- }
1143
- ]
1144
- if 'llama.idx.embeddings.env' not in data:
1145
- data["llama.idx.embeddings.env"] = [
1146
- {
1147
- "name": "OPENAI_API_KEY",
1148
- "value": "{api_key}",
1149
- },
1150
- {
1151
- "name": "OPENAI_API_BASE",
1152
- "value": "{api_endpoint}",
1153
- }
1154
- ]
1155
- self.window.core.plugins.reset_options("cmd_web", [
1156
- "cmd.web_url_open",
1157
- "cmd.web_url_raw",
1158
- ])
1159
- updated = True
1160
-
1161
- # < 2.1.26
1162
- if old < parse_version("2.1.26"):
1163
- print("Migrating config from < 2.1.26...")
1164
- if 'agent.prompt.continue' in data and data['agent.prompt.continue'] == 'continue...':
1165
- data["agent.prompt.continue"] = "continue if needed..."
1166
- self.window.core.plugins.reset_options("idx_llama_index", [
1167
- "prompt",
1168
- ])
1169
- updated = True
1170
-
1171
- # < 2.1.28
1172
- if old < parse_version("2.1.28"):
1173
- print("Migrating config from < 2.1.28...")
1174
- if 'log.ctx' not in data:
1175
- data["log.ctx"] = True
1176
- if 'llama.idx.embeddings.limit.rpm' not in data:
1177
- data["llama.idx.embeddings.limit.rpm"] = 100
1178
- updated = True
1179
-
1180
- # < 2.1.29
1181
- if old < parse_version("2.1.29"):
1182
- print("Migrating config from < 2.1.29...")
1183
- self.window.core.plugins.reset_options("cmd_code_interpreter", [
1184
- "cmd.code_execute",
1185
- ])
1186
- updated = True
1187
-
1188
- # < 2.1.31
1189
- if old < parse_version("2.1.31"):
1190
- print("Migrating config from < 2.1.31...")
1191
- self.window.core.plugins.reset_options("cmd_code_interpreter", [
1192
- "cmd.code_execute",
1193
- ])
1194
- files_to_move = [
1195
- {"_interpreter.current.py": ".interpreter.current.py"},
1196
- {"_interpreter.py": ".interpreter.output.py"},
1197
- {"_interpreter.input.py": ".interpreter.input.py"},
1198
- ]
1199
- files_to_remove = [
1200
- "_interpreter.tmp.py",
1201
- ]
1202
- dir = self.window.core.config.get_user_dir("data")
1203
- try:
1204
- for file in files_to_move:
1205
- for src, dst in file.items():
1206
- src = os.path.join(dir, src)
1207
- dst = os.path.join(dir, dst)
1208
- if os.path.exists(src):
1209
- os.rename(src, dst)
1210
- for file in files_to_remove:
1211
- file = os.path.join(dir, file)
1212
- if os.path.exists(file):
1213
- os.remove(file)
1214
- except Exception as e:
1215
- print("Error while migrating interpreter files:", e)
1216
-
1217
- updated = True
1218
-
1219
- # < 2.1.32
1220
- if old < parse_version("2.1.32"):
1221
- print("Migrating config from < 2.1.32...")
1222
- if 'ctx.use_extra' not in data:
1223
- data["ctx.use_extra"] = True
1224
-
1225
- self.window.core.plugins.reset_options("real_time", [
1226
- "tpl",
1227
- ])
1228
-
1229
- # old keys first
1230
- data['cmd.prompt'] = cfg_get_base('prompt.cmd') # new format
1231
- data['cmd.prompt.extra'] = cfg_get_base('prompt.cmd.extra') # new format
1232
- data['cmd.prompt.extra.assistants'] = cfg_get_base('prompt.cmd.extra.assistants') # new format
1233
-
1234
- # new keys
1235
- data['prompt.agent.goal'] = cfg_get_base('prompt.agent.goal') # new format
1236
-
1237
- # replace to new keys
1238
- self.window.core.config.replace_key(data, "img_prompt", "prompt.img")
1239
- self.window.core.config.replace_key(data, "ctx.auto_summary.prompt", "prompt.ctx.auto_summary.user")
1240
- self.window.core.config.replace_key(data, "ctx.auto_summary.system", "prompt.ctx.auto_summary.system")
1241
- self.window.core.config.replace_key(data, "cmd.prompt", "prompt.cmd")
1242
- self.window.core.config.replace_key(data, "cmd.prompt.extra", "prompt.cmd.extra")
1243
- self.window.core.config.replace_key(data, "cmd.prompt.extra.assistants", "prompt.cmd.extra.assistants")
1244
- self.window.core.config.replace_key(data, "agent.prompt.continue", "prompt.agent.continue")
1245
- self.window.core.config.replace_key(data, "default_prompt", "prompt.default")
1246
- updated = True
1247
-
1248
- # < 2.1.35
1249
- if old < parse_version("2.1.35"):
1250
- print("Migrating config from < 2.1.35...")
1251
- if 'interpreter.auto_clear' not in data:
1252
- data["interpreter.auto_clear"] = True
1253
- if 'interpreter.execute_all' not in data:
1254
- data["interpreter.execute_all"] = True
1255
- if 'interpreter.edit' not in data:
1256
- data["interpreter.edit"] = False
1257
- if 'interpreter.input' not in data:
1258
- data["interpreter.input"] = ""
1259
- if 'video.player.path' not in data:
1260
- data["video.player.path"] = ""
1261
- if 'video.player.volume' not in data:
1262
- data["video.player.volume"] = 100
1263
- if 'video.player.volume.mute' not in data:
1264
- data["video.player.volume.mute"] = False
1265
- updated = True
1266
-
1267
- # < 2.1.37
1268
- if old < parse_version("2.1.37"):
1269
- print("Migrating config from < 2.1.37...")
1270
- if 'audio.transcribe.convert_video' not in data:
1271
- data["audio.transcribe.convert_video"] = True
1272
- updated = True
1273
-
1274
- # < 2.1.38
1275
- if old < parse_version("2.1.38"):
1276
- print("Migrating config from < 2.1.38...")
1277
- if 'lang' in data and data['lang'] == 'ua':
1278
- data["lang"] = "uk"
1279
- updated = True
1280
-
1281
- # < 2.1.45
1282
- if old < parse_version("2.1.45"):
1283
- print("Migrating config from < 2.1.45...")
1284
- if 'ctx.copy_code' not in data:
1285
- data["ctx.copy_code"] = True
1286
- updated = True
1287
-
1288
- # < 2.1.52
1289
- if old < parse_version("2.1.52"):
1290
- print("Migrating config from < 2.1.52...")
1291
- if 'ctx.code_interpreter' not in data:
1292
- data["ctx.code_interpreter"] = True
1293
- updated = True
1294
-
1295
- # < 2.1.59
1296
- if old < parse_version("2.1.59"):
1297
- print("Migrating config from < 2.1.59...")
1298
- if 'render.code_syntax' not in data:
1299
- data["render.code_syntax"] = "github-dark"
1300
- if 'zoom' not in data:
1301
- data["zoom"] = 1.0
1302
- if 'ctx.convert_lists' not in data:
1303
- data["ctx.convert_lists"] = False
1304
- if 'render.engine' not in data:
1305
- data["render.engine"] = "web"
1306
- if 'render.open_gl' not in data:
1307
- data["render.open_gl"] = False
1308
-
1309
- # in snap, leave legacy render engine by default
1310
- # if self.window.core.platforms.is_snap():
1311
- # data["render.engine"] = "legacy"
1312
-
1313
- # css upgrade
1314
- patch_css('web.css', True) # NEW
1315
- patch_css('web.light.css', True) # NEW
1316
- patch_css('web.dark.css', True) # NEW
1317
- updated = True
1318
-
1319
- # < 2.1.60
1320
- if old < parse_version("2.1.60"):
1321
- print("Migrating config from < 2.1.60...")
1322
- # css upgrade
1323
- patch_css('web.css', True) # force update
1324
- updated = True
1325
-
1326
- # < 2.1.61
1327
- if old < parse_version("2.1.61"):
1328
- print("Migrating config from < 2.1.61...")
1329
- # css upgrade
1330
- patch_css('web.css', True) # force update
1331
- updated = True
1332
-
1333
- # < 2.1.63
1334
- if old < parse_version("2.1.63"):
1335
- print("Migrating config from < 2.1.63...")
1336
- # css upgrade
1337
- patch_css('web.css', True) # force update
1338
- patch_css('web.light.css', True) # force update
1339
- patch_css('web.dark.css', True) # force update
1340
- updated = True
1341
-
1342
- # < 2.1.70
1343
- if old < parse_version("2.1.70"):
1344
- print("Migrating config from < 2.1.70...")
1345
- # css upgrade
1346
- patch_css('web.css', True) # force update
1347
- updated = True
1348
-
1349
- # < 2.1.72
1350
- if old < parse_version("2.1.72"):
1351
- print("Migrating config from < 2.1.72...")
1352
- # css upgrade
1353
- patch_css('web.css', True) # force update
1354
- patch_css('web.light.css', True) # force update
1355
- patch_css('web.dark.css', True) # force update
1356
- updated = True
1357
-
1358
- # < 2.1.73
1359
- if old < parse_version("2.1.73"):
1360
- print("Migrating config from < 2.1.73...")
1361
- # fix: issue #50
1362
- if "llama.idx.embeddings.args" in data:
1363
- for arg in data["llama.idx.embeddings.args"]:
1364
- if "type" not in arg:
1365
- arg["type"] = "str"
1366
- updated = True
1367
-
1368
- # < 2.1.74
1369
- if old < parse_version("2.1.74"):
1370
- print("Migrating config from < 2.1.74...")
1371
- # css upgrade
1372
- patch_css('web.css', True) # force update
1373
- patch_css('web.light.css', True) # force update
1374
- patch_css('web.dark.css', True) # force update
1375
- updated = True
1376
-
1377
- # < 2.1.75
1378
- if old < parse_version("2.1.75"):
1379
- print("Migrating config from < 2.1.75...")
1380
- # css upgrade
1381
- patch_css('web.css', True) # force update
1382
- patch_css('web.light.css', True) # force update
1383
- patch_css('web.dark.css', True) # force update
1384
- updated = True
1385
-
1386
- # < 2.1.76
1387
- if old < parse_version("2.1.76"):
1388
- print("Migrating config from < 2.1.76...")
1389
- if 'render.blocks' not in data:
1390
- data["render.blocks"] = True
1391
- # css upgrade
1392
- patch_css('web.css', True) # force update
1393
- patch_css('web.light.css', True) # force update
1394
- patch_css('web.dark.css', True) # force update
1395
- updated = True
1396
-
1397
- # < 2.1.78
1398
- if old < parse_version("2.1.78"):
1399
- print("Migrating config from < 2.1.78...")
1400
- # css upgrade, scroll bg
1401
- patch_css('web.css', True) # force update
1402
- patch_css('web.light.css', True) # force update
1403
- patch_css('web.dark.css', True) # force update
1404
- updated = True
1405
-
1406
- # < 2.1.79
1407
- if old < parse_version("2.1.79"):
1408
- print("Migrating config from < 2.1.79...")
1409
- if 'assistant.store.hide_threads' not in data:
1410
- data["assistant.store.hide_threads"] = True
1411
- updated = True
1412
-
1413
- # < 2.2.2
1414
- if old < parse_version("2.2.2"):
1415
- print("Migrating config from < 2.2.2...")
1416
- if 'app.env' not in data:
1417
- data["app.env"] = []
1418
- updated = True
1419
-
1420
- # < 2.2.7
1421
- if old < parse_version("2.2.7"):
1422
- print("Migrating config from < 2.2.7...")
1423
- if 'prompt.agent.instruction' not in data:
1424
- data["prompt.agent.instruction"] = ""
1425
- if 'prompt.expert' not in data:
1426
- data["prompt.expert"] = ""
1427
- if 'experts.mode' not in data:
1428
- data["experts.mode"] = "chat"
1429
- # from base
1430
- data["prompt.agent.instruction"] = cfg_get_base('prompt.agent.instruction')
1431
- data["prompt.agent.continue"] = cfg_get_base('prompt.agent.continue')
1432
- data["prompt.agent.goal"] = cfg_get_base('prompt.agent.goal')
1433
- data["prompt.expert"] = cfg_get_base('prompt.expert')
1434
- data["prompt.img"] = cfg_get_base('prompt.img')
1435
- updated = True
1436
-
1437
- # < 2.2.8
1438
- if old < parse_version("2.2.8"):
1439
- print("Migrating config from < 2.2.8...")
1440
- if 'access.audio.event.speech' not in data:
1441
- data["access.audio.event.speech"] = False
1442
- if 'access.audio.notify.execute' not in data:
1443
- data["access.audio.notify.execute"] = True
1444
- if 'access.microphone.notify' not in data:
1445
- data["access.microphone.notify"] = True
1446
- if 'access.shortcuts' not in data:
1447
- data["access.shortcuts"] = [
1448
- {
1449
- "action": "voice_cmd.toggle",
1450
- "key": "Space",
1451
- "key_modifier": "Control"
1452
- },
1453
- {
1454
- "action": "tab.chat",
1455
- "key": "1",
1456
- "key_modifier": "Control"
1457
- },
1458
- {
1459
- "action": "tab.files",
1460
- "key": "2",
1461
- "key_modifier": "Control"
1462
- },
1463
- {
1464
- "action": "tab.calendar",
1465
- "key": "3",
1466
- "key_modifier": "Control"
1467
- },
1468
- {
1469
- "action": "tab.draw",
1470
- "key": "4",
1471
- "key_modifier": "Control"
1472
- },
1473
- {
1474
- "action": "tab.notepad",
1475
- "key": "5",
1476
- "key_modifier": "Control"
1477
- }
1478
- ]
1479
- if 'access.voice_control' not in data:
1480
- data["access.voice_control"] = False
1481
- if 'access.voice_control.model' not in data:
1482
- data["access.voice_control.model"] = "gpt-3.5-turbo"
1483
- updated = True
1484
-
1485
- # < 2.2.11
1486
- if old < parse_version("2.2.11"):
1487
- print("Migrating config from < 2.2.11...")
1488
- if 'access.audio.event.speech.disabled' not in data:
1489
- data["access.audio.event.speech.disabled"] = []
1490
- updated = True
1491
-
1492
- # < 2.2.14
1493
- if old < parse_version("2.2.14"):
1494
- print("Migrating config from < 2.2.14...")
1495
- if 'access.voice_control.blacklist' not in data:
1496
- data["access.voice_control.blacklist"] = []
1497
- updated = True
1498
-
1499
- # < 2.2.16
1500
- if old < parse_version("2.2.16"):
1501
- print("Migrating config from < 2.2.16...")
1502
- if 'access.audio.use_cache' not in data:
1503
- data["access.audio.use_cache"] = True
1504
- updated = True
1505
-
1506
- # < 2.2.20
1507
- if old < parse_version("2.2.20"):
1508
- print("Migrating config from < 2.2.20...")
1509
- if 'func_call.native' not in data:
1510
- data["func_call.native"] = True
1511
- patch_css('web.css', True) # force update
1512
- updated = True
1513
-
1514
- # < 2.2.22
1515
- if old < parse_version("2.2.22"):
1516
- print("Migrating config from < 2.2.22...")
1517
- if 'llama.idx.stop.error' not in data:
1518
- data["llama.idx.stop.error"] = True
1519
- updated = True
1520
-
1521
- # < 2.2.25
1522
- if old < parse_version("2.2.25"):
1523
- print("Migrating config from < 2.2.25...")
1524
- data["prompt.expert"] = cfg_get_base('prompt.expert')
1525
- updated = True
1526
-
1527
- # < 2.2.26
1528
- if old < parse_version("2.2.26"):
1529
- print("Migrating config from < 2.2.26...")
1530
- if 'ctx.records.folders.top' not in data:
1531
- data["ctx.records.folders.top"] = False
1532
- if 'ctx.records.separators' not in data:
1533
- data["ctx.records.separators"] = True
1534
- if 'ctx.records.groups.separators' not in data:
1535
- data["ctx.records.groups.separators"] = True
1536
- updated = True
1537
-
1538
- # < 2.2.27
1539
- if old < parse_version("2.2.27"):
1540
- print("Migrating config from < 2.2.27...")
1541
- if 'ctx.records.pinned.separators' not in data:
1542
- data["ctx.records.pinned.separators"] = False
1543
- updated = True
1544
-
1545
- # < 2.2.28
1546
- if old < parse_version("2.2.28"):
1547
- print("Migrating config from < 2.2.28...")
1548
- if 'llama.idx.chat.mode' not in data:
1549
- data["llama.idx.chat.mode"] = "context"
1550
- if 'llama.idx.mode' not in data:
1551
- data["llama.idx.mode"] = "chat"
1552
- updated = True
1553
-
1554
- # < 2.2.31
1555
- if old < parse_version("2.2.31"):
1556
- print("Migrating config from < 2.2.31...")
1557
- if 'agent.continue.always' not in data:
1558
- data["agent.continue.always"] = False
1559
- if 'prompt.agent.continue.always' not in data:
1560
- data["prompt.agent.continue.always"] = "Continue reasoning..."
1561
- updated = True
1562
-
1563
- # < 2.4.0
1564
- if old < parse_version("2.4.0"):
1565
- print("Migrating config from < 2.4.0...")
1566
- if 'tabs.data' not in data:
1567
- data["tabs.data"] = self.window.core.tabs.from_defaults()
1568
- updated = True
1569
-
1570
- # < 2.4.7
1571
- if old < parse_version("2.4.7"):
1572
- print("Migrating config from < 2.4.7...")
1573
- self.window.core.plugins.reset_options("cmd_mouse_control", [
1574
- "prompt",
1575
- ])
1576
- updated = True
1577
-
1578
- # < 2.4.10
1579
- if old < parse_version("2.4.10"):
1580
- print("Migrating config from < 2.4.10...")
1581
- if 'prompt.agent.continue.llama' not in data:
1582
- data["prompt.agent.continue.llama"] = cfg_get_base('prompt.agent.continue.llama')
1583
- if 'agent.llama.idx' not in data:
1584
- data["agent.llama.idx"] = cfg_get_base('agent.llama.idx')
1585
- if 'agent.llama.steps' not in data:
1586
- data["agent.llama.steps"] = cfg_get_base('agent.llama.steps')
1587
- if 'agent.llama.provider' not in data:
1588
- data["agent.llama.provider"] = cfg_get_base('agent.llama.provider')
1589
- if 'agent.llama.verbose' not in data:
1590
- data["agent.llama.verbose"] = cfg_get_base('agent.llama.verbose')
1591
- data["agent.goal.notify"] = False # disable by default
1592
- updated = True
1593
-
1594
- # < 2.4.11
1595
- if old < parse_version("2.4.11"):
1596
- print("Migrating config from < 2.4.11...")
1597
- if 'api_proxy' not in data:
1598
- data["api_proxy"] =""
1599
- updated = True
1600
-
1601
- # < 2.4.13
1602
- if old < parse_version("2.4.13"):
1603
- print("Migrating config from < 2.4.13...")
1604
- data["interpreter.auto_clear"] = False
1605
- if 'cmd_code_interpreter' in data['plugins'] \
1606
- and 'cmd.code_execute' in data['plugins']['cmd_code_interpreter']:
1607
- # remove
1608
- del data['plugins']['cmd_code_interpreter']['cmd.code_execute']
1609
- if 'cmd_code_interpreter' in data['plugins'] \
1610
- and 'cmd.code_execute_all' in data['plugins']['cmd_code_interpreter']:
1611
- # remove
1612
- del data['plugins']['cmd_code_interpreter']['cmd.code_execute_all']
1613
- if 'cmd_code_interpreter' in data['plugins'] \
1614
- and 'cmd.code_execute_file' in data['plugins']['cmd_code_interpreter']:
1615
- # remove
1616
- del data['plugins']['cmd_code_interpreter']['cmd.code_execute_file']
1617
- updated = True
1618
-
1619
- # < 2.4.14
1620
- if old < parse_version("2.4.14"):
1621
- print("Migrating config from < 2.4.14...")
1622
- if 'prompt.agent.llama.max_eval' not in data:
1623
- data["prompt.agent.llama.max_eval"] = cfg_get_base('prompt.agent.llama.max_eval')
1624
- if 'prompt.agent.llama.append_eval' not in data:
1625
- data["prompt.agent.llama.append_eval"] = cfg_get_base('prompt.agent.llama.append_eval')
1626
- if 'agent.llama.loop.enabled' not in data:
1627
- data["agent.llama.loop.enabled"] = cfg_get_base('agent.llama.loop.enabled')
1628
- if 'agent.llama.loop.score' not in data:
1629
- data["agent.llama.loop.score"] = cfg_get_base('agent.llama.loop.score')
1630
- updated = True
1631
-
1632
- # < 2.4.15
1633
- if old < parse_version("2.4.15"):
1634
- print("Migrating config from < 2.4.15...")
1635
- data["interpreter.auto_clear"] = False
1636
- if 'cmd_code_interpreter' in data['plugins'] \
1637
- and 'cmd.ipython_execute_new' in data['plugins']['cmd_code_interpreter']:
1638
- # remove
1639
- del data['plugins']['cmd_code_interpreter']['cmd.ipython_execute_new']
1640
- if 'cmd_code_interpreter' in data['plugins'] \
1641
- and 'cmd.ipython_execute' in data['plugins']['cmd_code_interpreter']:
1642
- # remove
1643
- del data['plugins']['cmd_code_interpreter']['cmd.ipython_execute']
1644
- if 'cmd_code_interpreter' in data['plugins'] \
1645
- and 'cmd.sys_exec' in data['plugins']['cmd_code_interpreter']:
1646
- # remove
1647
- del data['plugins']['cmd_code_interpreter']['cmd.sys_exec']
1648
- if 'cmd_mouse_control' in data['plugins']:
1649
- del data['plugins']['cmd_mouse_control']
1650
- updated = True
1651
-
1652
- # < 2.4.16
1653
- if old < parse_version("2.4.16"):
1654
- print("Migrating config from < 2.4.16...")
1655
- data["interpreter.auto_clear"] = False
1656
- if 'cmd_code_interpreter' in data['plugins'] \
1657
- and 'cmd.ipython_execute_new' in data['plugins']['cmd_code_interpreter']:
1658
- # remove
1659
- del data['plugins']['cmd_code_interpreter']['cmd.ipython_execute_new']
1660
- if 'cmd_code_interpreter' in data['plugins'] \
1661
- and 'cmd.ipython_execute' in data['plugins']['cmd_code_interpreter']:
1662
- # remove
1663
- del data['plugins']['cmd_code_interpreter']['cmd.ipython_execute']
1664
- updated = True
1665
-
1666
- # < 2.4.19
1667
- if old < parse_version("2.4.19"):
1668
- print("Migrating config from < 2.4.19...")
1669
- if 'layout.animation.disable' not in data:
1670
- data["layout.animation.disable"] = cfg_get_base('layout.animation.disable')
1671
- if 'cmd_code_interpreter' in data['plugins'] \
1672
- and 'cmd.ipython_execute' in data['plugins']['cmd_code_interpreter']:
1673
- # remove
1674
- del data['plugins']['cmd_code_interpreter']['cmd.ipython_execute']
1675
- updated = True
1676
-
1677
- # < 2.4.21
1678
- if old < parse_version("2.4.21"):
1679
- print("Migrating config from < 2.4.21...")
1680
- if 'ctx.attachment.mode' not in data:
1681
- data["ctx.attachment.mode"] = cfg_get_base('ctx.attachment.mode')
1682
- if 'ctx.attachment.summary.model' not in data:
1683
- data["ctx.attachment.summary.model"] = cfg_get_base('ctx.attachment.summary.model')
1684
- if 'ctx.attachment.verbose' not in data:
1685
- data["ctx.attachment.verbose"] = cfg_get_base('ctx.attachment.verbose')
1686
- updated = True
1687
-
1688
- # < 2.4.22
1689
- if old < parse_version("2.4.22"):
1690
- print("Migrating config from < 2.4.22...")
1691
- data["ctx.attachment.mode"] = cfg_get_base('ctx.attachment.mode')
1692
- if 'ctx.attachment.img' not in data:
1693
- data["ctx.attachment.img"] = cfg_get_base(
1694
- 'ctx.attachment.img')
1695
- updated = True
1696
-
1697
- # < 2.4.29
1698
- if old < parse_version("2.4.29"):
1699
- print("Migrating config from < 2.4.29...")
1700
- if 'cmd_code_interpreter' in data['plugins'] \
1701
- and 'ipython_dockerfile' in data['plugins']['cmd_code_interpreter']:
1702
- # remove
1703
- del data['plugins']['cmd_code_interpreter']['ipython_dockerfile']
1704
- updated = True
1705
-
1706
- # < 2.4.31
1707
- if old < parse_version("2.4.31"):
1708
- print("Migrating config from < 2.4.31...")
1709
- if 'attachments_auto_index' not in data:
1710
- data["attachments_auto_index"] = cfg_get_base(
1711
- 'attachments_auto_index')
1712
- updated = True
1713
-
1714
- # < 2.4.34
1715
- if old < parse_version("2.4.34"):
1716
- print("Migrating config from < 2.4.34...")
1717
- if 'ctx.attachment.query.model' not in data:
1718
- data["ctx.attachment.query.model"] = cfg_get_base(
1719
- 'ctx.attachment.query.model')
1720
- updated = True
1721
-
1722
- # < 2.4.35
1723
- if old < parse_version("2.4.35"):
1724
- print("Migrating config from < 2.4.35...")
1725
- data["ctx.edit_icons"] = True
1726
- updated = True
1727
-
1728
- # < 2.4.37
1729
- if old < parse_version("2.4.37"):
1730
- print("Migrating config from < 2.4.37...")
1731
- if 'ctx.attachment.rag.history' not in data:
1732
- data["ctx.attachment.rag.history"] = cfg_get_base(
1733
- 'ctx.attachment.rag.history')
1734
- if 'ctx.attachment.rag.history.max_items' not in data:
1735
- data["ctx.attachment.rag.history.max_items"] = cfg_get_base(
1736
- 'ctx.attachment.rag.history.max_items')
1737
- updated = True
1738
-
1739
- # < 2.4.38
1740
- if old < parse_version("2.4.38"):
1741
- print("Migrating config from < 2.4.38...")
1742
- if 'theme.style' not in data:
1743
- data["theme.style"] = "blocks"
1744
- if 'audio.input.device' not in data:
1745
- data["audio.input.device"] = "0"
1746
- if 'audio.input.channels' not in data:
1747
- data["audio.input.channels"] = 1
1748
- if 'audio.input.rate' not in data:
1749
- data["audio.input.rate"] = 44100
1750
- patch_css('style.light.css', True) # force update
1751
- updated = True
1752
-
1753
- # < 2.4.39
1754
- if old < parse_version("2.4.39"):
1755
- print("Migrating config from < 2.4.39...")
1756
- if 'layout.split' not in data:
1757
- data["layout.split"] = False
1758
- updated = True
1759
-
1760
- # < 2.4.40
1761
- if old < parse_version("2.4.40"):
1762
- print("Migrating config from < 2.4.40...")
1763
- if 'cmd_web' in data['plugins'] \
1764
- and 'max_result_length' in data['plugins']['cmd_web']:
1765
- del data['plugins']['cmd_web']['max_result_length']
1766
- if 'cmd_web' in data['plugins'] \
1767
- and 'cmd.web_search' in data['plugins']['cmd_web']:
1768
- del data['plugins']['cmd_web']['cmd.web_search']
1769
- if 'cmd_web' in data['plugins'] \
1770
- and 'cmd.web_url_open' in data['plugins']['cmd_web']:
1771
- del data['plugins']['cmd_web']['cmd.web_url_open']
1772
- if 'cmd_web' in data['plugins'] \
1773
- and 'cmd.web_url_raw' in data['plugins']['cmd_web']:
1774
- del data['plugins']['cmd_web']['cmd.web_url_raw']
1775
- patch_css('web-blocks.css', True) # force update
1776
- patch_css('web-blocks.light.css', True) # force update
1777
- patch_css('web-chatgpt.css', True) # force update
1778
- patch_css('web-chatgpt_wide.css', True) # force update
1779
- updated = True
1780
-
1781
- # < 2.4.44
1782
- if old < parse_version("2.4.44"):
1783
- print("Migrating config from < 2.4.44...")
1784
- data["ctx.records.folders.top"] = True
1785
- updated = True
1786
-
1787
- # < 2.4.45
1788
- if old < parse_version("2.4.45"):
1789
- print("Migrating config from < 2.4.45...")
1790
- patch_css('style.css', True) # force update
1791
- updated = True
1792
-
1793
- # < 2.4.46
1794
- if old < parse_version("2.4.46"):
1795
- print("Migrating config from < 2.4.46...")
1796
- if 'api_azure_version' not in data:
1797
- data["api_azure_version"] = "2023-07-01-preview"
1798
- if 'api_azure_endpoint' not in data:
1799
- data["api_azure_endpoint"] = "https://<your-resource-name>.openai.azure.com/"
1800
- if 'api_key_google' not in data:
1801
- data["api_key_google"] = ""
1802
- if 'api_key_anthropic' not in data:
1803
- data["api_key_anthropic"] = ""
1804
- if 'api_key_hugging_face' not in data:
1805
- data["api_key_hugging_face"] = ""
1806
- updated = True
1807
-
1808
- # < 2.4.51
1809
- if old < parse_version("2.4.51"):
1810
- print("Migrating config from < 2.4.51...")
1811
- if 'audio.input.stop_interval' not in data:
1812
- data["audio.input.stop_interval"] = 10
1813
- if 'audio.input.continuous' not in data:
1814
- data["audio.input.continuous"] = False
1815
-
1816
- # < 2.4.55
1817
- if old < parse_version("2.4.55"):
1818
- print("Migrating config from < 2.4.55...")
1819
- if 'audio.input.timeout' not in data:
1820
- data["audio.input.timeout"] = 120
1821
- if 'audio.input.timeout.continuous' not in data:
1822
- data["audio.input.timeout.continuous"] = False
1823
-
1824
- # < 2.4.56
1825
- if old < parse_version("2.4.56"):
1826
- print("Migrating config from < 2.4.56...")
1827
- remove_modifiers = ["Meta", "Keypad", "GroupSwitch"]
1828
- if 'access.shortcuts' in data:
1829
- for item in data['access.shortcuts']:
1830
- if 'key_modifier' in item and item['key_modifier'] == 'Control':
1831
- item['key_modifier'] = 'Ctrl'
1832
- elif 'key_modifier' in item and item['key_modifier'] in remove_modifiers:
1833
- item['key_modifier'] = ''
1834
- updated = True
1835
-
1836
- # < 2.5.0
1837
- if old < parse_version("2.5.0"):
1838
- print("Migrating config from < 2.5.0...")
1839
- if 'api_key_deepseek' not in data:
1840
- data["api_key_deepseek"] = ""
1841
- updated = True
1842
-
1843
- # < 2.5.7
1844
- if old < parse_version("2.5.7"):
1845
- print("Migrating config from < 2.5.7...")
1846
- patch_css('web-blocks.css', True) # force update
1847
- patch_css('web-chatgpt.css', True) # force update
1848
- patch_css('web-chatgpt_wide.css', True) # force update
1849
- updated = True
1850
-
1851
- # < 2.5.8
1852
- if old < parse_version("2.5.8"):
1853
- print("Migrating config from < 2.5.8...")
1854
- if 'api_key_perplexity' not in data:
1855
- data["api_key_perplexity"] = ""
1856
- if 'api_endpoint_perplexity' not in data:
1857
- data["api_endpoint_perplexity"] = "https://api.perplexity.ai"
1858
- updated = True
1859
-
1860
- # < 2.5.17
1861
- if old < parse_version("2.5.17"):
1862
- print("Migrating config from < 2.5.17...")
1863
- if 'remote_tools.web_search' not in data:
1864
- data["remote_tools.web_search"] = True
1865
- updated = True
1866
-
1867
- # < 2.5.18
1868
- if old < parse_version("2.5.18"):
1869
- print("Migrating config from < 2.5.18...")
1870
- if 'remote_tools.image' not in data:
1871
- data["remote_tools.image"] = False
1872
- updated = True
1873
-
1874
- # < 2.5.19
1875
- if old < parse_version("2.5.19"):
1876
- print("Migrating config from < 2.5.19...")
1877
- if 'api_use_responses' not in data:
1878
- data["api_use_responses"] = True
1879
- if 'api_key_xai' not in data:
1880
- data["api_key_xai"] = ""
1881
- if 'api_endpoint_xai' not in data:
1882
- data["api_endpoint_xai"] = "https://api.x.ai/v1"
1883
- updated = True
1884
-
1885
- # < 2.5.20
1886
- if old < parse_version("2.5.20"):
1887
- print("Migrating config from < 2.5.20...")
1888
- if 'api_endpoint_deepseek' not in data:
1889
- data["api_endpoint_deepseek"] = "https://api.deepseek.com/v1"
1890
- if 'api_endpoint_google' not in data:
1891
- data["api_endpoint_google"] = "https://generativelanguage.googleapis.com/v1beta/openai"
1892
- if "mode" in data and "mode" == "langchain": # deprecated mode
1893
- data["mode"] = "chat"
1894
- updated = True
1895
-
1896
- # < 2.5.21
1897
- if old < parse_version("2.5.21"):
1898
- print("Migrating config from < 2.5.21...")
1899
- patch_css('web-chatgpt.css', True) # force replace file
1900
- updated = True
1901
-
1902
- # < 2.5.24
1903
- if old < parse_version("2.5.24"):
1904
- print("Migrating config from < 2.5.24...")
1905
- patch_css('web-chatgpt.css', True) # force replace file
1906
- updated = True
1907
-
1908
- # < 2.5.25
1909
- if old < parse_version("2.5.25"):
1910
- print("Migrating config from < 2.5.25...")
1911
- if 'api_use_responses_llama' not in data:
1912
- data["api_use_responses_llama"] = False
1913
- updated = True
1914
-
1915
- # < 2.5.27
1916
- if old < parse_version("2.5.27"):
1917
- print("Migrating config from < 2.5.27...")
1918
- if 'remote_tools.code_interpreter' not in data:
1919
- data["remote_tools.code_interpreter"] = False
1920
- if 'llama.idx.react' not in data:
1921
- data["llama.idx.react"] = True
1922
- updated = True
1923
-
1924
- # < 2.5.29
1925
- if old < parse_version("2.5.29"):
1926
- print("Migrating config from < 2.5.29...")
1927
- if 'api_endpoint_anthropic' not in data:
1928
- data["api_endpoint_anthropic"] = "https://api.anthropic.com/v1"
1929
- updated = True
1930
-
1931
- # < 2.5.31
1932
- if old < parse_version("2.5.31"):
1933
- print("Migrating config from < 2.5.31...")
1934
- if 'llama.idx.chat.auto_retrieve' not in data:
1935
- data["llama.idx.chat.auto_retrieve"] = True
1936
- if 'api_key_mistral' not in data:
1937
- data["api_key_mistral"] = ""
1938
- if 'api_endpoint_mistral' not in data:
1939
- data["api_endpoint_mistral"] = "https://api.mistral.ai/v1"
1940
- updated = True
1941
-
1942
- # < 2.5.35
1943
- if old < parse_version("2.5.35"):
1944
- print("Migrating config from < 2.5.35...")
1945
- data["img_dialog_open"] = False
1946
- updated = True
1947
-
1948
- # < 2.5.36
1949
- if old < parse_version("2.5.36"):
1950
- print("Migrating config from < 2.5.36...")
1951
- patch_css('style.css', True) # force replace file
1952
- patch_css('style.dark.css', True) # force replace file
1953
- patch_css('style.light.css', True) # force replace file
1954
- patch_css('web-chatgpt.css', True) # force replace file
1955
- patch_css('web-chatgpt.light.css', True) # force replace file
1956
- patch_css('web-chatgpt.dark.css', True) # force replace file
1957
- patch_css('web-chatgpt_wide.css', True) # force replace file
1958
- patch_css('web-chatgpt_wide.light.css', True) # force replace file
1959
- patch_css('web-chatgpt_wide.dark.css', True) # force replace file
1960
- updated = True
1961
-
1962
- # < 2.5.37
1963
- if old < parse_version("2.5.37"):
1964
- print("Migrating config from < 2.5.37...")
1965
- patch_css('style.css', True) # force replace file
1966
- patch_css('style.dark.css', True) # force replace file
1967
- patch_css('style.light.css', True) # force replace file
1968
- patch_css('web-chatgpt.css', True) # force replace file
1969
- patch_css('web-chatgpt.light.css', True) # force replace file
1970
- patch_css('web-chatgpt.dark.css', True) # force replace file
1971
- patch_css('web-chatgpt_wide.css', True) # force replace file
1972
- patch_css('web-chatgpt_wide.light.css', True) # force replace file
1973
- patch_css('web-chatgpt_wide.dark.css', True) # force replace file
1974
- updated = True
1975
-
1976
- # < 2.5.40 - update tool prompts
1977
- if old < parse_version("2.5.40"):
1978
- print("Migrating config from < 2.5.40...")
1979
-
1980
- # config
1981
- data['prompt.agent.goal'] = cfg_get_base('prompt.agent.goal')
1982
- data['prompt.agent.instruction'] = cfg_get_base('prompt.agent.instruction')
1983
- data['prompt.ctx.auto_summary.user'] = cfg_get_base('prompt.ctx.auto_summary.user')
1984
- data['prompt.cmd'] = cfg_get_base('prompt.cmd')
1985
- data['prompt.cmd.extra'] = cfg_get_base('prompt.cmd.extra')
1986
- data['prompt.cmd.extra.assistants'] = cfg_get_base('prompt.cmd.extra.assistants')
1987
- data['prompt.expert'] = cfg_get_base('prompt.expert')
1988
-
1989
- # plugins
1990
- if 'openai_dalle' in data['plugins'] \
1991
- and 'prompt' in data['plugins']['openai_dalle']:
1992
- del data['plugins']['openai_dalle']['prompt']
1993
- if 'idx_llama_index' in data['plugins'] \
1994
- and 'prompt' in data['plugins']['idx_llama_index']:
1995
- del data['plugins']['idx_llama_index']['prompt']
1996
-
1997
- # < 2.5.41
1998
- if old < parse_version("2.5.41"):
1999
- print("Migrating config from < 2.5.41...")
2000
- if "max_output_tokens" in data and "max_output_tokens" == 1024:
2001
- data["max_output_tokens"] = 0 # update default value
2002
- updated = True
2003
-
2004
- # < 2.5.42 - action img padding
2005
- if old < parse_version("2.5.42"):
2006
- print("Migrating config from < 2.5.42...")
2007
- patch_css('web-chatgpt.css', True) # force replace file
2008
- patch_css('web-chatgpt_wide.css', True) # force replace file
2009
- updated = True
2010
-
2011
- # < 2.5.43 - remove cmd_code_interpreter fresh_kernel option
2012
- if old < parse_version("2.5.43"):
2013
- print("Migrating config from < 2.5.43...")
2014
- # plugins
2015
- if 'cmd_code_interpreter' in data['plugins'] \
2016
- and 'fresh_kernel' in data['plugins']['cmd_code_interpreter']:
2017
- del data['plugins']['cmd_code_interpreter']['fresh_kernel']
2018
-
2019
- # < 2.5.51
2020
- if old < parse_version("2.5.51"):
2021
- print("Migrating config from < 2.5.51...")
2022
- patch_css('style.css', True) # force replace file
2023
- patch_css('style.dark.css', True) # force replace file
2024
- patch_css('style.light.css', True) # force replace file
2025
- updated = True
2026
-
2027
- # < 2.5.54
2028
- if old < parse_version("2.5.54"):
2029
- print("Migrating config from < 2.5.54...")
2030
- patch_css('web-chatgpt.css', True) # force replace file
2031
- updated = True
2032
-
2033
- # < 2.5.55
2034
- if old < parse_version("2.5.55"):
2035
- print("Migrating config from < 2.5.55...")
2036
- patch_css('web-chatgpt.css', True) # force replace file
2037
- updated = True
2038
-
2039
- # < 2.5.60
2040
- if old < parse_version("2.5.60"):
2041
- print("Migrating config from < 2.5.60...")
2042
- patch_css('style.css', True) # force replace file
2043
- patch_css('style.dark.css', True) # force replace file
2044
- patch_css('style.light.css', True) # force replace file
2045
- patch_css('web-chatgpt.css', True) # force replace file
2046
- patch_css('web-chatgpt.light.css', True) # force replace file
2047
- patch_css('web-chatgpt.dark.css', True) # force replace file
2048
- patch_css('web-chatgpt_wide.css', True) # force replace file
2049
- patch_css('web-chatgpt_wide.light.css', True) # force replace file
2050
- patch_css('web-chatgpt_wide.dark.css', True) # force replace file
2051
- updated = True
2052
-
2053
- # < 2.5.61
2054
- if old < parse_version("2.5.61"):
2055
- print("Migrating config from < 2.5.61..")
2056
- if "agent.output.render.all" not in data:
2057
- data["agent.output.render.all"] = False
2058
- data["prompt.expert"] = cfg_get_base(
2059
- 'prompt.expert')
2060
- if "experts.use_agent" not in data:
2061
- data["experts.use_agent"] = True
2062
- updated = True
2063
-
2064
- # < 2.5.63 - disable cmd.get_time in real_time plugin by default
2065
- if old < parse_version("2.5.63"):
2066
- print("Migrating config from < 2.5.63...")
2067
- if 'real_time' in data['plugins'] \
2068
- and 'cmd.get_time' in data['plugins']['real_time']:
2069
- del data['plugins']['real_time']['cmd.get_time']
2070
- updated = True
2071
-
2072
- # < 2.5.64
2073
- if old < parse_version("2.5.64"):
2074
- print("Migrating config from < 2.5.64..")
2075
- data["prompt.cmd"] = cfg_get_base(
2076
- 'prompt.cmd')
2077
- data["prompt.cmd.extra"] = cfg_get_base(
2078
- 'prompt.cmd.extra')
2079
- data["prompt.expert"] = cfg_get_base(
2080
- 'prompt.expert')
2081
- data["experts.use_agent"] = False
2082
- updated = True
2083
-
2084
- # < 2.5.65
2085
- if old < parse_version("2.5.65"):
2086
- print("Migrating config from < 2.5.65..")
2087
- data["prompt.expert"] = cfg_get_base(
2088
- 'prompt.expert')
2089
- updated = True
2090
-
2091
- # < 2.5.68
2092
- if old < parse_version("2.5.68"):
2093
- print("Migrating config from < 2.5.68..")
2094
- if "agent.func_call.native" not in data:
2095
- data["agent.func_call.native"] = False
2096
- if "experts.func_call.native" not in data:
2097
- data["experts.func_call.native"] = False
2098
- updated = True
2099
-
2100
- # < 2.5.69
2101
- if old < parse_version("2.5.69"):
2102
- print("Migrating config from < 2.5.69.")
2103
- data["prompt.agent.continue"] = cfg_get_base(
2104
- 'prompt.agent.continue')
2105
- data["prompt.agent.goal"] = cfg_get_base(
2106
- 'prompt.agent.goal')
2107
- data["prompt.expert"] = cfg_get_base(
2108
- 'prompt.expert')
2109
- if "agent.api_use_responses" not in data:
2110
- data["agent.api_use_responses"] = False
2111
- if "experts.api_use_responses" not in data:
2112
- data["experts.api_use_responses"] = False
2113
- if "experts.internal.api_use_responses" not in data:
2114
- data["experts.internal.api_use_responses"] = False
2115
- if 'cmd_web' in data['plugins'] \
2116
- and 'cmd.web_search' in data['plugins']['cmd_web']:
2117
- del data['plugins']['cmd_web']['cmd.web_search']
2118
- updated = True
2119
-
2120
- # < 2.5.71
2121
- if old < parse_version("2.5.71"):
2122
- print("Migrating config from < 2.5.71.")
2123
- if "remote_tools.computer_use.env" not in data:
2124
- data["remote_tools.computer_use.env"] = ""
2125
- if "remote_tools.mcp" not in data:
2126
- data["remote_tools.mcp"] = False
2127
- if "remote_tools.mcp.args" not in data:
2128
- data["remote_tools.mcp.args"] = cfg_get_base(
2129
- 'remote_tools.mcp.args')
2130
- if "remote_tools.file_search" not in data:
2131
- data["remote_tools.file_search"] = False
2132
- if "remote_tools.file_search.args" not in data:
2133
- data["remote_tools.file_search.args"] = ""
2134
- if 'cmd_mouse_control' in data['plugins'] \
2135
- and 'cmd.mouse_move' in data['plugins']['cmd_mouse_control']:
2136
- del data['plugins']['cmd_mouse_control']['cmd.mouse_move']
2137
- if 'cmd_mouse_control' in data['plugins'] \
2138
- and 'cmd.mouse_scroll' in data['plugins']['cmd_mouse_control']:
2139
- del data['plugins']['cmd_mouse_control']['cmd.mouse_scroll']
2140
- if 'cmd_mouse_control' in data['plugins'] \
2141
- and 'cmd.keyboard_type' in data['plugins']['cmd_mouse_control']:
2142
- del data['plugins']['cmd_mouse_control']['cmd.keyboard_type']
2143
- updated = True
2144
-
2145
- # < 2.5.73
2146
- if old < parse_version("2.5.73"):
2147
- print("Migrating config from < 2.5.73...")
2148
- patch_css('web-chatgpt.css', True) # force replace file
2149
- patch_css('web-chatgpt.light.css', True) # force replace file
2150
- patch_css('web-chatgpt_wide.css', True) # force replace file
2151
- patch_css('web-chatgpt_wide.light.css', True) # force replace file
2152
- patch_css('web-chatgpt_wide.dark.css', True) # force replace file
2153
- updated = True
2154
-
2155
- # < 2.5.76
2156
- if old < parse_version("2.5.76"):
2157
- print("Migrating config from < 2.5.76.")
2158
- if "agent.llama.loop.mode" not in data:
2159
- data["agent.llama.loop.mode"] = cfg_get_base(
2160
- 'agent.llama.loop.mode')
2161
- if "prompt.agent.llama.eval.complete" not in data:
2162
- data["prompt.agent.llama.eval.complete"] = cfg_get_base(
2163
- 'prompt.agent.llama.eval.complete')
2164
- data["prompt.agent.llama.eval"] = cfg_get_base(
2165
- 'prompt.agent.llama.eval')
2166
-
2167
- # < 2.5.89
2168
- if old < parse_version("2.5.89"):
2169
- print("Migrating config from < 2.5.89.")
2170
- if "audio.input.backend" not in data:
2171
- data["audio.input.backend"] = "native"
2172
- if "audio.output.backend" not in data:
2173
- data["audio.output.backend"] = "native"
2174
- if "audio.input.device" not in data:
2175
- data["audio.input.device"] = "0"
2176
- if "audio.output.device" not in data:
2177
- data["audio.output.device"] = "0"
2178
-
2179
- # < 2.5.90
2180
- if old < parse_version("2.5.90"):
2181
- print("Migrating config from < 2.5.90...")
2182
- patch_css('style.dark.css', True) # force replace file
2183
- patch_css('style.light.css', True) # force replace file
2184
- patch_css('web-blocks.css', True) # force replace file
2185
- patch_css('web-blocks.dark.css', True) # force replace file
2186
- patch_css('web-blocks.light.css', True) # force replace file
2187
- updated = True
2188
-
2189
- # < 2.5.91
2190
- if old < parse_version("2.5.91"):
2191
- print("Migrating config from < 2.5.91...")
2192
- if "audio.cache.enabled" not in data:
2193
- data["audio.cache.enabled"] = True
2194
- updated = True
2195
-
2196
- # < 2.5.92
2197
- if old < parse_version("2.5.92"):
2198
- print("Migrating config from < 2.5.92...")
2199
- if "audio.cache.max_files" not in data:
2200
- data["audio.cache.max_files"] = 1000
2201
- updated = True
2202
-
2203
- # < 2.5.94
2204
- if old < parse_version("2.5.94"):
2205
- print("Migrating config from < 2.5.94...")
2206
- if "api_endpoint_hugging_face" not in data:
2207
- data["api_endpoint_hugging_face"] = "https://router.huggingface.co/v1"
2208
-
2209
- # tips
2210
- patch_css('web-chatgpt.css', True) # force replace file
2211
- patch_css('web-chatgpt.light.css', True) # force replace file
2212
- patch_css('web-chatgpt.dark.css', True) # force replace file
2213
- patch_css('web-chatgpt_wide.css', True) # force replace file
2214
- patch_css('web-chatgpt_wide.light.css', True) # force replace file
2215
- patch_css('web-chatgpt_wide.dark.css', True) # force replace file
2216
- patch_css('web-blocks.css', True) # force replace file
2217
- patch_css('web-blocks.light.css', True) # force replace file
2218
- patch_css('web-blocks.dark.css', True) # force replace file
2219
- updated = True
2220
-
2221
- # < 2.5.95
2222
- if old < parse_version("2.5.95"):
2223
- print("Migrating config from < 2.5.95...")
2224
- if "personalize.about" not in data:
2225
- data["personalize.about"] = ""
2226
- if "personalize.modes" not in data:
2227
- data["personalize.modes"] = "chat"
2228
-
2229
- # avatars css
2230
- patch_css('web-chatgpt.css', True) # force replace file
2231
- patch_css('web-chatgpt.light.css', True) # force replace file
2232
- patch_css('web-chatgpt.dark.css', True) # force replace file
2233
- patch_css('web-chatgpt_wide.css', True) # force replace file
2234
- patch_css('web-chatgpt_wide.light.css', True) # force replace file
2235
- patch_css('web-chatgpt_wide.dark.css', True) # force replace file
2236
- patch_css('web-blocks.css', True) # force replace file
2237
- patch_css('web-blocks.light.css', True) # force replace file
2238
- patch_css('web-blocks.dark.css', True) # force replace file
2239
- updated = True
2240
-
2241
- # < 2.5.98
2242
- if old < parse_version("2.5.98"):
2243
- print("Migrating config from < 2.5.98...")
2244
- if "agent.openai.response.split" not in data:
2245
- data["agent.openai.response.split"] = True
2246
- updated = True
2247
-
2248
- # < 2.6.0
2249
- if old < parse_version("2.6.0"):
2250
- print("Migrating config from < 2.6.0...")
2251
- patch_css('style.light.css', True) # scrollbar, calendar fix
2252
- patch_css('style.dark.css', True) # calendar fix
2253
- updated = True
2254
-
2255
- # < 2.6.8
2256
- if old < parse_version("2.6.8"):
2257
- print("Migrating config from < 2.6.8...")
2258
- patch_css('web-chatgpt.light.css', True) # p color
2259
- patch_css('web-chatgpt.dark.css', True) # p color
2260
- patch_css('web-chatgpt_wide.light.css', True) # p color
2261
- patch_css('web-chatgpt_wide.dark.css', True) # p color
2262
- patch_css('style.light.css', True) # tree
2263
- patch_css('style.dark.css', True) # tree
2264
- updated = True
2265
-
2266
- # < 2.6.10
2267
- if old < parse_version("2.6.10"):
2268
- print("Migrating config from < 2.6.10...")
2269
- if "agent.idx.auto_retrieve" not in data:
2270
- data["agent.idx.auto_retrieve"] = True
2271
- if 'google' in data['plugins'] \
2272
- and 'oauth_scopes' in data['plugins']['google']:
2273
- # add documents scope
2274
- if "https://www.googleapis.com/auth/documents" not in data['plugins']['google']['oauth_scopes']:
2275
- data['plugins']['google']['oauth_scopes'] += " https://www.googleapis.com/auth/documents"
2276
- updated = True
2277
-
2278
- # < 2.6.21
2279
- if old < parse_version("2.6.21"):
2280
- print("Migrating config from < 2.6.21...")
2281
- if "agent.output.render.all" not in data:
2282
- data["agent.output.render.all"] = True
2283
- updated = True
2284
-
2285
- # < 2.6.23 -- fix: restore <p> color
2286
- if old < parse_version("2.6.23"):
2287
- print("Migrating config from < 2.6.23...")
2288
- patch_css('web-chatgpt.dark.css', True)
2289
- patch_css('web-chatgpt_wide.dark.css', True)
2290
- patch_css('web-chatgpt.light.css', True)
2291
- patch_css('web-chatgpt_wide.light.css', True)
2292
- patch_css('web-blocks.dark.css', True)
2293
- patch_css('web-blocks.light.css', True)
2294
- updated = True
2295
-
2296
- # < 2.6.24
2297
- if old < parse_version("2.6.24"):
2298
- print("Migrating config from < 2.6.24...")
2299
- if "llama.idx.embeddings.default" not in data:
2300
- data["llama.idx.embeddings.default"] = cfg_get_base(
2301
- 'llama.idx.embeddings.default')
2302
- updated = True
2303
-
2304
- # < 2.6.25
2305
- if old < parse_version("2.6.25"):
2306
- print("Migrating config from < 2.6.25...")
2307
- if "api_key_voyage" not in data:
2308
- data["api_key_voyage"] = ""
2309
- if "agent.llama.eval_model" not in data:
2310
- data["agent.llama.eval_model"] = "_"
2311
- if "llama.idx.embeddings.default" in data:
2312
- providers = []
2313
- for item in data["llama.idx.embeddings.default"]:
2314
- p = item.get('provider', '')
2315
- if p and p not in providers:
2316
- providers.append(p)
2317
-
2318
- if "anthropic" not in providers:
2319
- data["llama.idx.embeddings.default"].append({
2320
- "provider": "anthropic",
2321
- "model": "voyage-3.5",
2322
- })
2323
- if "deepseek_api" not in providers:
2324
- data["llama.idx.embeddings.default"].append({
2325
- "provider": "deepseek_api",
2326
- "model": "voyage-3.5",
2327
- })
2328
- if "mistral_ai" not in providers:
2329
- data["llama.idx.embeddings.default"].append({
2330
- "provider": "mistral_ai",
2331
- "model": "mistral-embed",
2332
- })
2333
- if "x_ai" not in providers:
2334
- data["llama.idx.embeddings.default"].append({
2335
- "provider": "x_ai",
2336
- "model": "",
2337
- })
2338
- updated = True
2339
-
2340
- # < 2.6.26
2341
- if old < parse_version("2.6.26"):
2342
- print("Migrating config from < 2.6.26...")
2343
- if "api_key_open_router" not in data:
2344
- data["api_key_open_router"] = ""
2345
- if "api_endpoint_open_router" not in data:
2346
- data["api_endpoint_open_router"] = "https://openrouter.ai/api/v1"
2347
- updated = True
2348
-
2349
- # < 2.6.28 -- fix: cmd color
2350
- if old < parse_version("2.6.28"):
2351
- print("Migrating config from < 2.6.28...")
2352
- patch_css('web-chatgpt.css', True)
2353
- patch_css('web-chatgpt_wide.css', True)
2354
- patch_css('web-chatgpt.dark.css', True)
2355
- patch_css('web-chatgpt_wide.dark.css', True)
2356
- patch_css('web-chatgpt.light.css', True)
2357
- patch_css('web-chatgpt_wide.light.css', True)
2358
- updated = True
2359
-
2360
- # < 2.6.30
2361
- if old < parse_version("2.6.30"):
2362
- print("Migrating config from < 2.6.30...")
2363
- if "api_native_google" not in data:
2364
- data["api_native_google"] = True
2365
- if "remote_tools.google.web_search" not in data:
2366
- data["remote_tools.google.web_search"] = True
2367
- if "remote_tools.google.code_interpreter" not in data:
2368
- data["remote_tools.google.code_interpreter"] = False
2369
- updated = True
2370
-
2371
- # < 2.6.31
2372
- if old < parse_version("2.6.31"):
2373
- print("Migrating config from < 2.6.31...")
2374
- if "log.realtime" not in data:
2375
- data["log.realtime"] = False
2376
- if "remote_tools.google.url_ctx" not in data:
2377
- data["remote_tools.google.url_ctx"] = False
2378
- if "audio.input.auto_turn" not in data:
2379
- data["audio.input.auto_turn"] = False
2380
- if "audio.input.vad.prefix" not in data:
2381
- data["audio.input.vad.prefix"] = 300
2382
- if "audio.input.vad.silence" not in data:
2383
- data["audio.input.vad.silence"] = 2000
2384
- updated = True
2385
-
2386
- # < 2.6.32
2387
- if old < parse_version("2.6.32"):
2388
- print("Migrating config from < 2.6.32...")
2389
-
2390
- data["prompt.img"] = cfg_get_base(
2391
- 'prompt.img')
2392
-
2393
- if "prompt.video" not in data:
2394
- data["prompt.video"] = cfg_get_base('prompt.video')
2395
- if "video.prompt_model" not in data:
2396
- data["video.prompt_model"] = cfg_get_base( 'video.prompt_model')
2397
- if "video.aspect_ratio" not in data:
2398
- data["video.aspect_ratio"] = cfg_get_base( 'video.aspect_ratio')
2399
- if "video.duration" not in data:
2400
- data["video.duration"] = cfg_get_base('video.duration')
2401
- if "video.fps" not in data:
2402
- data["video.fps"] = cfg_get_base('video.fps')
2403
- if "video.seed" not in data:
2404
- data["video.seed"] = cfg_get_base('video.seed')
2405
- if "video.negative_prompt" not in data:
2406
- data["video.negative_prompt"] = cfg_get_base('video.negative_prompt')
2407
- if "video.generate_audio" not in data:
2408
- data["video.generate_audio"] = cfg_get_base('video.generate_audio')
2409
- if "video.resolution" not in data:
2410
- data["video.resolution"] = cfg_get_base('video.resolution')
2411
-
2412
- # google vertex
2413
- if "api_native_google.use_vertex" not in data:
2414
- data["api_native_google.use_vertex"] = cfg_get_base('api_native_google.use_vertex')
2415
- if "api_native_google.cloud_project" not in data:
2416
- data["api_native_google.cloud_project"] = cfg_get_base('api_native_google.cloud_project')
2417
- if "api_native_google.cloud_location" not in data:
2418
- data["api_native_google.cloud_location"] = cfg_get_base('api_native_google.cloud_location')
2419
- if "api_native_google.app_credentials" not in data:
2420
- data["api_native_google.app_credentials"] = cfg_get_base('api_native_google.app_credentials')
2421
-
2422
- # audio loop
2423
- if "audio.input.loop" not in data:
2424
- data["audio.input.loop"] = False
2425
-
2426
- # add video player CSS
2427
- patch_css('web-chatgpt.css', True)
2428
- patch_css('web-chatgpt_wide.css', True)
2429
- patch_css('web-blocks.css', True)
2430
- updated = True
2431
-
2432
- # < 2.6.35
2433
- if old < parse_version("2.6.35"):
2434
- print("Migrating config from < 2.6.35...")
2435
- # remove will-change
2436
- patch_css('web-chatgpt.css', True)
2437
- patch_css('web-chatgpt_wide.css', True)
2438
- patch_css('web-blocks.css', True)
2439
- updated = True
2440
-
2441
- # < 2.6.36
2442
- if old < parse_version("2.6.36"):
2443
- print("Migrating config from < 2.6.36...")
2444
- # perf css
2445
- patch_css('web-chatgpt.css', True)
2446
- patch_css('web-chatgpt_wide.css', True)
2447
- patch_css('web-blocks.css', True)
2448
- updated = True
2449
-
2450
- # < 2.6.37
2451
- if old < parse_version("2.6.37"):
2452
- print("Migrating config from < 2.6.37...")
2453
-
2454
- # add: label-desc CSS
2455
- patch_css('style.dark.css', True)
2456
- patch_css('style.light.css', True)
2457
-
2458
- # add: Anthropic SDK
2459
- if "api_native_anthropic" not in data:
2460
- data["api_native_anthropic"] = True
2461
- if "remote_tools.anthropic.web_search" not in data:
2462
- data["remote_tools.anthropic.web_search"] = True
2463
-
2464
- # add: xAI SDK
2465
- if "api_native_xai" not in data:
2466
- data["api_native_xai"] = True
2467
- if "remote_tools.xai.mode" not in data:
2468
- data["remote_tools.xai.mode"] = "auto"
2469
- if "remote_tools.xai.sources.web" not in data:
2470
- data["remote_tools.xai.sources.web"] = True
2471
- if "remote_tools.xai.sources.x" not in data:
2472
- data["remote_tools.xai.sources.x"] = True
2473
- if "remote_tools.xai.sources.news" not in data:
2474
- data["remote_tools.xai.sources.news"] = False
2475
-
2476
- updated = True
2477
-
2478
- # < 2.6.40
2479
- if old < parse_version("2.6.40"):
2480
- print("Migrating config from < 2.6.40...")
2481
- # perf css
2482
- patch_css('web-chatgpt.css', True)
2483
- patch_css('web-chatgpt_wide.css', True)
2484
- patch_css('web-blocks.css', True)
2485
- updated = True
2486
-
2487
- # < 2.6.41
2488
- if old < parse_version("2.6.41"):
2489
- print("Migrating config from < 2.6.41...")
2490
- if "render.memory.limit" not in data:
2491
- data["render.memory.limit"] = "2.5GB"
2492
- # ul p
49
+ # --------------------------------------------
50
+ # previous patches for versions before 2.6.42
51
+ if old < parse_version("2.6.42"):
52
+ patcher = PatchBefore2_6_42(self.window)
53
+ data, updated, _ = patcher.execute(version)
54
+ # --------------------------------------------
55
+
56
+ # < 2.6.43
57
+ if old < parse_version("2.6.43"):
58
+ print("Migrating config from < 2.6.43...")
59
+ # li div margin
2493
60
  patch_css('web-chatgpt.css', True)
2494
61
  patch_css('web-chatgpt_wide.css', True)
2495
62
  patch_css('web-blocks.css', True)
2496
63
  updated = True
2497
64
 
2498
- # < 2.6.42
2499
- if old < parse_version("2.6.42"):
2500
- print("Migrating config from < 2.6.42...")
2501
- if "render.code_syntax.stream_max_lines" not in data:
2502
- data["render.code_syntax.stream_max_lines"] = 1000
2503
- if "render.code_syntax.final_max_lines" not in data:
2504
- data["render.code_syntax.final_max_lines"] = 1500
2505
- if "render.code_syntax.final_max_chars" not in data:
2506
- data["render.code_syntax.final_max_chars"] = 350000
2507
- updated = True
2508
-
2509
65
  # update file
2510
66
  migrated = False
2511
67
  if updated: