pygpt-net 2.7.7__py3-none-any.whl → 2.7.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pygpt_net/CHANGELOG.txt +12 -0
- pygpt_net/__init__.py +3 -3
- pygpt_net/app.py +5 -1
- pygpt_net/controller/assistant/batch.py +2 -2
- pygpt_net/controller/assistant/files.py +7 -6
- pygpt_net/controller/assistant/threads.py +0 -0
- pygpt_net/controller/chat/command.py +0 -0
- pygpt_net/controller/dialogs/confirm.py +35 -58
- pygpt_net/controller/lang/mapping.py +9 -9
- pygpt_net/controller/realtime/realtime.py +13 -1
- pygpt_net/controller/remote_store/{google/batch.py → batch.py} +209 -252
- pygpt_net/controller/remote_store/remote_store.py +982 -13
- pygpt_net/core/command/command.py +0 -0
- pygpt_net/core/db/viewer.py +1 -1
- pygpt_net/core/realtime/worker.py +3 -1
- pygpt_net/{controller/remote_store/google → core/remote_store/anthropic}/__init__.py +0 -1
- pygpt_net/core/remote_store/anthropic/files.py +211 -0
- pygpt_net/core/remote_store/anthropic/store.py +208 -0
- pygpt_net/core/remote_store/openai/store.py +5 -4
- pygpt_net/core/remote_store/remote_store.py +5 -1
- pygpt_net/{controller/remote_store/openai → core/remote_store/xai}/__init__.py +0 -1
- pygpt_net/core/remote_store/xai/files.py +225 -0
- pygpt_net/core/remote_store/xai/store.py +219 -0
- pygpt_net/data/config/config.json +10 -6
- pygpt_net/data/config/models.json +38 -22
- pygpt_net/data/config/settings.json +54 -1
- pygpt_net/data/icons/folder_eye.svg +1 -0
- pygpt_net/data/icons/folder_eye_filled.svg +1 -0
- pygpt_net/data/icons/folder_open.svg +1 -0
- pygpt_net/data/icons/folder_open_filled.svg +1 -0
- pygpt_net/data/locale/locale.de.ini +4 -3
- pygpt_net/data/locale/locale.en.ini +14 -4
- pygpt_net/data/locale/locale.es.ini +4 -3
- pygpt_net/data/locale/locale.fr.ini +4 -3
- pygpt_net/data/locale/locale.it.ini +4 -3
- pygpt_net/data/locale/locale.pl.ini +5 -4
- pygpt_net/data/locale/locale.uk.ini +4 -3
- pygpt_net/data/locale/locale.zh.ini +4 -3
- pygpt_net/icons.qrc +4 -0
- pygpt_net/icons_rc.py +282 -138
- pygpt_net/provider/api/anthropic/__init__.py +2 -0
- pygpt_net/provider/api/anthropic/chat.py +84 -1
- pygpt_net/provider/api/anthropic/store.py +307 -0
- pygpt_net/provider/api/anthropic/stream.py +75 -0
- pygpt_net/provider/api/anthropic/worker/__init__.py +0 -0
- pygpt_net/provider/api/anthropic/worker/importer.py +278 -0
- pygpt_net/provider/api/google/chat.py +59 -2
- pygpt_net/provider/api/google/realtime/client.py +70 -24
- pygpt_net/provider/api/google/realtime/realtime.py +48 -12
- pygpt_net/provider/api/google/store.py +124 -3
- pygpt_net/provider/api/google/stream.py +91 -24
- pygpt_net/provider/api/google/worker/importer.py +16 -28
- pygpt_net/provider/api/openai/assistants.py +2 -2
- pygpt_net/provider/api/openai/realtime/realtime.py +26 -6
- pygpt_net/provider/api/openai/store.py +4 -1
- pygpt_net/provider/api/openai/worker/importer.py +19 -61
- pygpt_net/provider/api/openai/worker/importer_assistants.py +230 -0
- pygpt_net/provider/api/x_ai/__init__.py +27 -6
- pygpt_net/provider/api/x_ai/audio.py +43 -11
- pygpt_net/provider/api/x_ai/chat.py +92 -4
- pygpt_net/provider/api/x_ai/realtime/__init__.py +12 -0
- pygpt_net/provider/api/x_ai/realtime/client.py +1864 -0
- pygpt_net/provider/api/x_ai/realtime/realtime.py +213 -0
- pygpt_net/provider/api/x_ai/remote_tools.py +102 -1
- pygpt_net/provider/api/x_ai/store.py +610 -0
- pygpt_net/provider/api/x_ai/stream.py +30 -9
- pygpt_net/provider/api/x_ai/tools.py +51 -0
- pygpt_net/provider/api/x_ai/worker/importer.py +308 -0
- pygpt_net/provider/audio_input/xai_grok_voice.py +390 -0
- pygpt_net/provider/audio_output/xai_tts.py +325 -0
- pygpt_net/provider/core/config/patch.py +29 -3
- pygpt_net/provider/core/config/patches/patch_before_2_6_42.py +2 -2
- pygpt_net/provider/core/model/patch.py +49 -1
- pygpt_net/tools/image_viewer/tool.py +334 -34
- pygpt_net/tools/image_viewer/ui/dialogs.py +317 -21
- pygpt_net/ui/dialog/assistant.py +1 -1
- pygpt_net/ui/dialog/plugins.py +13 -5
- pygpt_net/ui/dialog/remote_store.py +552 -0
- pygpt_net/ui/dialogs.py +3 -5
- pygpt_net/ui/layout/ctx/ctx_list.py +58 -7
- pygpt_net/ui/menu/tools.py +6 -13
- pygpt_net/ui/widget/dialog/{remote_store_google.py → remote_store.py} +10 -10
- pygpt_net/ui/widget/element/button.py +4 -4
- pygpt_net/ui/widget/image/display.py +2 -2
- pygpt_net/ui/widget/lists/context.py +2 -2
- {pygpt_net-2.7.7.dist-info → pygpt_net-2.7.9.dist-info}/METADATA +14 -2
- {pygpt_net-2.7.7.dist-info → pygpt_net-2.7.9.dist-info}/RECORD +87 -75
- pygpt_net/controller/remote_store/google/store.py +0 -615
- pygpt_net/controller/remote_store/openai/batch.py +0 -524
- pygpt_net/controller/remote_store/openai/store.py +0 -699
- pygpt_net/ui/dialog/remote_store_google.py +0 -539
- pygpt_net/ui/dialog/remote_store_openai.py +0 -539
- pygpt_net/ui/widget/dialog/remote_store_openai.py +0 -56
- pygpt_net/ui/widget/lists/remote_store_google.py +0 -248
- pygpt_net/ui/widget/lists/remote_store_openai.py +0 -317
- {pygpt_net-2.7.7.dist-info → pygpt_net-2.7.9.dist-info}/LICENSE +0 -0
- {pygpt_net-2.7.7.dist-info → pygpt_net-2.7.9.dist-info}/WHEEL +0 -0
- {pygpt_net-2.7.7.dist-info → pygpt_net-2.7.9.dist-info}/entry_points.txt +0 -0
pygpt_net/icons_rc.py
CHANGED
|
@@ -533,6 +533,43 @@ T640-160H160Zm0-\
|
|
|
533
533
|
80h480v-480H160v\
|
|
534
534
|
480Zm0 0v-480 48\
|
|
535
535
|
0Z\x22/></svg>\
|
|
536
|
+
\x00\x00\x02$\
|
|
537
|
+
<\
|
|
538
|
+
svg xmlns=\x22http:\
|
|
539
|
+
//www.w3.org/200\
|
|
540
|
+
0/svg\x22 height=\x222\
|
|
541
|
+
4px\x22 viewBox=\x220 \
|
|
542
|
+
-960 960 960\x22 wi\
|
|
543
|
+
dth=\x2224px\x22 fill=\
|
|
544
|
+
\x22#686868\x22><path \
|
|
545
|
+
d=\x22M160-160q-33 \
|
|
546
|
+
0-56.5-23.5T80-2\
|
|
547
|
+
40v-480q0-33 23.\
|
|
548
|
+
5-56.5T160-800h2\
|
|
549
|
+
40l80 80h320q33 \
|
|
550
|
+
0 56.5 23.5T880-\
|
|
551
|
+
640v249q-51-42-1\
|
|
552
|
+
12.5-65.5T640-48\
|
|
553
|
+
0q-143 0-247.5 9\
|
|
554
|
+
4T252-160h-92ZM6\
|
|
555
|
+
40-40q-91 0-168-\
|
|
556
|
+
48T360-220q35-84\
|
|
557
|
+
112-132t168-48q\
|
|
558
|
+
91 0 168 48t112 \
|
|
559
|
+
132q-35 84-112 1\
|
|
560
|
+
32T640-40Zm0-80q\
|
|
561
|
+
42 0 71-29t29-71\
|
|
562
|
+
q0-42-29-71t-71-\
|
|
563
|
+
29q-42 0-71 29t-\
|
|
564
|
+
29 71q0 42 29 71\
|
|
565
|
+
t71 29Zm0-40q-25\
|
|
566
|
+
0-42.5-17.5T580\
|
|
567
|
+
-220q0-25 17.5-4\
|
|
568
|
+
2.5T640-280q25 0\
|
|
569
|
+
42.5 17.5T700-2\
|
|
570
|
+
20q0 25-17.5 42.\
|
|
571
|
+
5T640-160Z\x22/></s\
|
|
572
|
+
vg>\
|
|
536
573
|
\x00\x00\x01P\
|
|
537
574
|
<\
|
|
538
575
|
svg xmlns=\x22http:\
|
|
@@ -606,6 +643,46 @@ T820-720l20 80q-\
|
|
|
606
643
|
2 15v520h-80v-24\
|
|
607
644
|
0h-80v240h-80Z\x22/\
|
|
608
645
|
></svg>\
|
|
646
|
+
\x00\x00\x02Q\
|
|
647
|
+
<\
|
|
648
|
+
svg xmlns=\x22http:\
|
|
649
|
+
//www.w3.org/200\
|
|
650
|
+
0/svg\x22 height=\x222\
|
|
651
|
+
4px\x22 viewBox=\x220 \
|
|
652
|
+
-960 960 960\x22 wi\
|
|
653
|
+
dth=\x2224px\x22 fill=\
|
|
654
|
+
\x22#686868\x22><path \
|
|
655
|
+
d=\x22M160-160q-33 \
|
|
656
|
+
0-56.5-23.5T80-2\
|
|
657
|
+
40v-480q0-33 23.\
|
|
658
|
+
5-56.5T160-800h2\
|
|
659
|
+
40l80 80h320q33 \
|
|
660
|
+
0 56.5 23.5T880-\
|
|
661
|
+
640v242q-18-14-3\
|
|
662
|
+
8-23t-42-19v-200\
|
|
663
|
+
H447l-80-80H160v\
|
|
664
|
+
480h120v80H160ZM\
|
|
665
|
+
640-40q-91 0-168\
|
|
666
|
+
-48T360-220q35-8\
|
|
667
|
+
4 112-132t168-48\
|
|
668
|
+
q91 0 168 48t112\
|
|
669
|
+
132q-35 84-112 \
|
|
670
|
+
132T640-40Zm0-80\
|
|
671
|
+
q57 0 107.5-26t8\
|
|
672
|
+
2.5-74q-32-48-82\
|
|
673
|
+
.5-74T640-320q-5\
|
|
674
|
+
7 0-107.5 26T450\
|
|
675
|
+
-220q32 48 82.5 \
|
|
676
|
+
74T640-120Zm0-40\
|
|
677
|
+
q-25 0-42.5-17.5\
|
|
678
|
+
T580-220q0-25 17\
|
|
679
|
+
.5-42.5T640-280q\
|
|
680
|
+
25 0 42.5 17.5T7\
|
|
681
|
+
00-220q0 25-17.5\
|
|
682
|
+
42.5T640-160Zm-\
|
|
683
|
+
480-80v-480 277-\
|
|
684
|
+
37 240Z\x22/></svg>\
|
|
685
|
+
\
|
|
609
686
|
\x00\x00\x01\xee\
|
|
610
687
|
<\
|
|
611
688
|
svg xmlns=\x22http:\
|
|
@@ -1351,6 +1428,26 @@ v320H160Zm240 0v\
|
|
|
1351
1428
|
Zm240 0v-440h160\
|
|
1352
1429
|
v440H640Z\x22/></sv\
|
|
1353
1430
|
g>\
|
|
1431
|
+
\x00\x00\x01\x15\
|
|
1432
|
+
<\
|
|
1433
|
+
svg xmlns=\x22http:\
|
|
1434
|
+
//www.w3.org/200\
|
|
1435
|
+
0/svg\x22 height=\x222\
|
|
1436
|
+
4px\x22 viewBox=\x220 \
|
|
1437
|
+
-960 960 960\x22 wi\
|
|
1438
|
+
dth=\x2224px\x22 fill=\
|
|
1439
|
+
\x22#686868\x22><path \
|
|
1440
|
+
d=\x22M160-160q-33 \
|
|
1441
|
+
0-56.5-23.5T80-2\
|
|
1442
|
+
40v-480q0-33 23.\
|
|
1443
|
+
5-56.5T160-800h2\
|
|
1444
|
+
40l80 80h320q33 \
|
|
1445
|
+
0 56.5 23.5T880-\
|
|
1446
|
+
640H160v400l96-3\
|
|
1447
|
+
20h684L837-217q-\
|
|
1448
|
+
8 26-29.5 41.5T7\
|
|
1449
|
+
60-160H160Z\x22/></\
|
|
1450
|
+
svg>\
|
|
1354
1451
|
\x00\x00\x01E\
|
|
1355
1452
|
<\
|
|
1356
1453
|
svg xmlns=\x22http:\
|
|
@@ -1844,6 +1941,31 @@ l=\x22#686868\x22 d=\x22M\
|
|
|
1844
1941
|
q0 134 93 227t22\
|
|
1845
1942
|
7 93Zm0-320Z\x22/><\
|
|
1846
1943
|
/svg>\
|
|
1944
|
+
\x00\x00\x01a\
|
|
1945
|
+
<\
|
|
1946
|
+
svg xmlns=\x22http:\
|
|
1947
|
+
//www.w3.org/200\
|
|
1948
|
+
0/svg\x22 height=\x222\
|
|
1949
|
+
4px\x22 viewBox=\x220 \
|
|
1950
|
+
-960 960 960\x22 wi\
|
|
1951
|
+
dth=\x2224px\x22 fill=\
|
|
1952
|
+
\x22#686868\x22><path \
|
|
1953
|
+
d=\x22M160-160q-33 \
|
|
1954
|
+
0-56.5-23.5T80-2\
|
|
1955
|
+
40v-480q0-33 23.\
|
|
1956
|
+
5-56.5T160-800h2\
|
|
1957
|
+
40l80 80h320q33 \
|
|
1958
|
+
0 56.5 23.5T880-\
|
|
1959
|
+
640H447l-80-80H1\
|
|
1960
|
+
60v480l96-320h68\
|
|
1961
|
+
4L837-217q-8 26-\
|
|
1962
|
+
29.5 41.5T760-16\
|
|
1963
|
+
0H160Zm84-80h516\
|
|
1964
|
+
l72-240H316l-72 \
|
|
1965
|
+
240Zm0 0 72-240-\
|
|
1966
|
+
72 240Zm-84-400v\
|
|
1967
|
+
-80 80Z\x22/></svg>\
|
|
1968
|
+
\
|
|
1847
1969
|
\x00\x00\x02g\
|
|
1848
1970
|
<\
|
|
1849
1971
|
svg xmlns=\x22http:\
|
|
@@ -4368,6 +4490,11 @@ qt_resource_name = b"\
|
|
|
4368
4490
|
\x09s\xed\xc7\
|
|
4369
4491
|
\x00w\
|
|
4370
4492
|
\x00e\x00b\x00c\x00a\x00m\x00.\x00s\x00v\x00g\
|
|
4493
|
+
\x00\x15\
|
|
4494
|
+
\x07o\xbe\x87\
|
|
4495
|
+
\x00f\
|
|
4496
|
+
\x00o\x00l\x00d\x00e\x00r\x00_\x00e\x00y\x00e\x00_\x00f\x00i\x00l\x00l\x00e\x00d\
|
|
4497
|
+
\x00.\x00s\x00v\x00g\
|
|
4371
4498
|
\x00\x08\
|
|
4372
4499
|
\x06|W\x87\
|
|
4373
4500
|
\x00c\
|
|
@@ -4381,6 +4508,10 @@ qt_resource_name = b"\
|
|
|
4381
4508
|
\x00a\
|
|
4382
4509
|
\x00c\x00c\x00e\x00s\x00s\x00i\x00b\x00i\x00l\x00i\x00t\x00y\x00.\x00s\x00v\x00g\
|
|
4383
4510
|
\
|
|
4511
|
+
\x00\x0e\
|
|
4512
|
+
\x00\xa5\xc1'\
|
|
4513
|
+
\x00f\
|
|
4514
|
+
\x00o\x00l\x00d\x00e\x00r\x00_\x00e\x00y\x00e\x00.\x00s\x00v\x00g\
|
|
4384
4515
|
\x00\x07\
|
|
4385
4516
|
\x0a\xb7Z'\
|
|
4386
4517
|
\x00s\
|
|
@@ -4490,6 +4621,11 @@ qt_resource_name = b"\
|
|
|
4490
4621
|
\x09\xd2]G\
|
|
4491
4622
|
\x00e\
|
|
4492
4623
|
\x00q\x00u\x00a\x00l\x00i\x00z\x00e\x00r\x00.\x00s\x00v\x00g\
|
|
4624
|
+
\x00\x16\
|
|
4625
|
+
\x01\x04\xe3\xa7\
|
|
4626
|
+
\x00f\
|
|
4627
|
+
\x00o\x00l\x00d\x00e\x00r\x00_\x00o\x00p\x00e\x00n\x00_\x00f\x00i\x00l\x00l\x00e\
|
|
4628
|
+
\x00d\x00.\x00s\x00v\x00g\
|
|
4493
4629
|
\x00\x09\
|
|
4494
4630
|
\x0b\xab\xa1'\
|
|
4495
4631
|
\x00w\
|
|
@@ -4566,6 +4702,10 @@ qt_resource_name = b"\
|
|
|
4566
4702
|
\x0a-\x1b\xc7\
|
|
4567
4703
|
\x00c\
|
|
4568
4704
|
\x00i\x00r\x00c\x00l\x00e\x00.\x00s\x00v\x00g\
|
|
4705
|
+
\x00\x0f\
|
|
4706
|
+
\x04\x18\x9b\x87\
|
|
4707
|
+
\x00f\
|
|
4708
|
+
\x00o\x00l\x00d\x00e\x00r\x00_\x00o\x00p\x00e\x00n\x00.\x00s\x00v\x00g\
|
|
4569
4709
|
\x00\x09\
|
|
4570
4710
|
\x09g\xa8g\
|
|
4571
4711
|
\x00r\
|
|
@@ -4925,165 +5065,169 @@ qt_resource_name = b"\
|
|
|
4925
5065
|
|
|
4926
5066
|
qt_resource_struct = b"\
|
|
4927
5067
|
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
|
|
4928
|
-
\x00\x00\x00\x00\x00\x02\x00\x00\x00\
|
|
4929
|
-
\x00\x00\
|
|
4930
|
-
\x00\x00\
|
|
4931
|
-
\x00\x00\
|
|
4932
|
-
\x00\x00\
|
|
5068
|
+
\x00\x00\x00\x00\x00\x02\x00\x00\x00\xa2\x00\x00\x00\x02\
|
|
5069
|
+
\x00\x00\x06\xb6\x00\x00\x00\x00\x00\x01\x00\x00\x5c\xa2\
|
|
5070
|
+
\x00\x00\x0e\x9a\x00\x00\x00\x00\x00\x01\x00\x00\xd8\x9e\
|
|
5071
|
+
\x00\x00\x0e\xf2\x00\x00\x00\x00\x00\x01\x00\x00\xdc\xbe\
|
|
5072
|
+
\x00\x00\x11\x1c\x00\x00\x00\x00\x00\x01\x00\x00\xfb\x14\
|
|
4933
5073
|
\x00\x00\x01\xf6\x00\x00\x00\x00\x00\x01\x00\x00\x1a\xc1\
|
|
4934
|
-
\x00\x00\
|
|
4935
|
-
\x00\x00\
|
|
4936
|
-
\x00\x00\
|
|
4937
|
-
\x00\x00\
|
|
4938
|
-
\x00\x00\x03\
|
|
5074
|
+
\x00\x00\x0d\x08\x00\x00\x00\x00\x00\x01\x00\x00\xbf8\
|
|
5075
|
+
\x00\x00\x0dh\x00\x00\x00\x00\x00\x01\x00\x00\xc6\x0a\
|
|
5076
|
+
\x00\x00\x08p\x00\x00\x00\x00\x00\x01\x00\x00u\xae\
|
|
5077
|
+
\x00\x00\x02\xd2\x00\x00\x00\x00\x00\x01\x00\x00$;\
|
|
5078
|
+
\x00\x00\x03\xc4\x00\x00\x00\x00\x00\x01\x00\x005#\
|
|
5079
|
+
\x00\x00\x03\xda\x00\x00\x00\x00\x00\x01\x00\x007\x12\
|
|
5080
|
+
\x00\x00\x05\xb6\x00\x00\x00\x00\x00\x01\x00\x00Qz\
|
|
4939
5081
|
\x00\x00\x00V\x00\x00\x00\x00\x00\x01\x00\x00\x04\xc3\
|
|
4940
|
-
\x00\x00\
|
|
4941
|
-
\x00\x00\
|
|
4942
|
-
\x00\x00\
|
|
4943
|
-
\x00\x00\
|
|
4944
|
-
\x00\x00\x0a
|
|
4945
|
-
\x00\x00\
|
|
4946
|
-
\x00\x00\
|
|
4947
|
-
\x00\x00\
|
|
4948
|
-
\x00\x00\
|
|
4949
|
-
\x00\x00\
|
|
4950
|
-
\x00\x00\
|
|
4951
|
-
\x00\x00\
|
|
5082
|
+
\x00\x00\x0bz\x00\x00\x00\x00\x00\x01\x00\x00\xa6\xd7\
|
|
5083
|
+
\x00\x00\x0a\xa0\x00\x00\x00\x00\x00\x01\x00\x00\x9a\x94\
|
|
5084
|
+
\x00\x00\x0a\x86\x00\x00\x00\x00\x00\x01\x00\x00\x99\x00\
|
|
5085
|
+
\x00\x00\x09\xea\x00\x00\x00\x00\x00\x01\x00\x00\x8d\xd9\
|
|
5086
|
+
\x00\x00\x0a\xce\x00\x00\x00\x00\x00\x01\x00\x00\x9e\xfd\
|
|
5087
|
+
\x00\x00\x08P\x00\x00\x00\x00\x00\x01\x00\x00t\xa1\
|
|
5088
|
+
\x00\x00\x0a:\x00\x00\x00\x00\x00\x01\x00\x00\x91\x88\
|
|
5089
|
+
\x00\x00\x08\xea\x00\x00\x00\x00\x00\x01\x00\x00~\xda\
|
|
5090
|
+
\x00\x00\x03<\x00\x00\x00\x00\x00\x01\x00\x00-6\
|
|
5091
|
+
\x00\x00\x0fX\x00\x00\x00\x00\x00\x01\x00\x00\xe3\xe8\
|
|
5092
|
+
\x00\x00\x0c\xdc\x00\x00\x00\x00\x00\x01\x00\x00\xbc(\
|
|
5093
|
+
\x00\x00\x07\xd0\x00\x00\x00\x00\x00\x01\x00\x00n\xc1\
|
|
5094
|
+
\x00\x00\x02\xaa\x00\x00\x00\x00\x00\x01\x00\x00\x22\xcf\
|
|
4952
5095
|
\x00\x00\x00@\x00\x00\x00\x00\x00\x01\x00\x00\x03\xa5\
|
|
4953
|
-
\x00\x00\
|
|
5096
|
+
\x00\x00\x05Z\x00\x00\x00\x00\x00\x01\x00\x00L\x84\
|
|
4954
5097
|
\x00\x00\x01z\x00\x00\x00\x00\x00\x01\x00\x00\x12\x82\
|
|
4955
|
-
\x00\x00\
|
|
4956
|
-
\x00\x00\x07\
|
|
5098
|
+
\x00\x00\x09\x14\x00\x00\x00\x00\x00\x01\x00\x00\x82U\
|
|
5099
|
+
\x00\x00\x07\x9a\x00\x00\x00\x00\x00\x01\x00\x00k>\
|
|
4957
5100
|
\x00\x00\x00\xac\x00\x00\x00\x00\x00\x01\x00\x00\x08\xf3\
|
|
4958
|
-
\x00\x00\
|
|
4959
|
-
\x00\x00\
|
|
4960
|
-
\x00\x00\
|
|
4961
|
-
\x00\x00\x03\
|
|
5101
|
+
\x00\x00\x07\x0c\x00\x00\x00\x00\x00\x01\x00\x00b\xab\
|
|
5102
|
+
\x00\x00\x09F\x00\x00\x00\x00\x00\x01\x00\x00\x85\x83\
|
|
5103
|
+
\x00\x00\x0a\x00\x00\x00\x00\x00\x00\x01\x00\x00\x8e\x97\
|
|
5104
|
+
\x00\x00\x03\xf6\x00\x00\x00\x00\x00\x01\x00\x008L\
|
|
4962
5105
|
\x00\x00\x01\xde\x00\x00\x00\x00\x00\x01\x00\x00\x19\x22\
|
|
4963
|
-
\x00\x00\
|
|
4964
|
-
\x00\x00\
|
|
5106
|
+
\x00\x00\x0d \x00\x00\x00\x00\x00\x01\x00\x00\xc1\x1a\
|
|
5107
|
+
\x00\x00\x03\x08\x00\x00\x00\x00\x00\x01\x00\x00(\x82\
|
|
4965
5108
|
\x00\x00\x02\x0e\x00\x00\x00\x00\x00\x01\x00\x00\x1c\x07\
|
|
4966
|
-
\x00\x00\
|
|
5109
|
+
\x00\x00\x0ct\x00\x00\x00\x00\x00\x01\x00\x00\xb8\x02\
|
|
4967
5110
|
\x00\x00\x00\x10\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
|
|
4968
|
-
\x00\x00\
|
|
4969
|
-
\x00\x00\
|
|
4970
|
-
\x00\x00\x0a\
|
|
4971
|
-
\x00\x00\
|
|
4972
|
-
\x00\x00\x0d\
|
|
4973
|
-
\x00\x00\
|
|
4974
|
-
\x00\x00\
|
|
4975
|
-
\x00\x00\
|
|
4976
|
-
\x00\x00\
|
|
4977
|
-
\x00\x00\
|
|
4978
|
-
\x00\x00\x10\
|
|
4979
|
-
\x00\x00\
|
|
4980
|
-
\x00\x00\
|
|
4981
|
-
\x00\x00\x0e\
|
|
4982
|
-
\x00\x00\
|
|
4983
|
-
\x00\x00\x08
|
|
5111
|
+
\x00\x00\x0e\x84\x00\x00\x00\x00\x00\x01\x00\x00j\x8c\
|
|
5112
|
+
\x00\x00\x0e(\x00\x00\x00\x00\x00\x01\x00\x00\xd3K\
|
|
5113
|
+
\x00\x00\x0a\xb4\x00\x00\x00\x00\x00\x01\x00\x00\x9c\xb5\
|
|
5114
|
+
\x00\x00\x02|\x00\x00\x00\x00\x00\x01\x00\x00 \x13\
|
|
5115
|
+
\x00\x00\x0d\xca\x00\x00\x00\x00\x00\x01\x00\x00\xcc\xa1\
|
|
5116
|
+
\x00\x00\x03\xaa\x00\x00\x00\x00\x00\x01\x00\x003p\
|
|
5117
|
+
\x00\x00\x0fz\x00\x00\x00\x00\x00\x01\x00\x00\xe4\xe5\
|
|
5118
|
+
\x00\x00\x06L\x00\x00\x00\x00\x00\x01\x00\x00W\xcc\
|
|
5119
|
+
\x00\x00\x0aX\x00\x00\x00\x00\x00\x01\x00\x00\x92\xd5\
|
|
5120
|
+
\x00\x00\x0d\x98\x00\x00\x00\x00\x00\x01\x00\x00\xc9W\
|
|
5121
|
+
\x00\x00\x10\xae\x00\x00\x00\x00\x00\x01\x00\x00\xf6\x1e\
|
|
5122
|
+
\x00\x00\x10\xe0\x00\x00\x00\x00\x00\x01\x00\x00\xf8u\
|
|
5123
|
+
\x00\x00\x0f\x90\x00\x00\x00\x00\x00\x01\x00\x00\xe5\xa6\
|
|
5124
|
+
\x00\x00\x0e\xc6\x00\x00\x00\x00\x00\x01\x00\x00\xdb\x13\
|
|
5125
|
+
\x00\x00\x06\x82\x00\x00\x00\x00\x00\x01\x00\x00Yf\
|
|
5126
|
+
\x00\x00\x08\xcc\x00\x00\x00\x00\x00\x01\x00\x00}\x01\
|
|
4984
5127
|
\x00\x00\x01Z\x00\x00\x00\x00\x00\x01\x00\x00\x10\xf3\
|
|
4985
|
-
\x00\x00\
|
|
4986
|
-
\x00\x00\
|
|
4987
|
-
\x00\x00\
|
|
4988
|
-
\x00\x00\
|
|
4989
|
-
\x00\x00\
|
|
4990
|
-
\x00\x00\
|
|
4991
|
-
\x00\x00\
|
|
4992
|
-
\x00\x00\
|
|
4993
|
-
\x00\x00\
|
|
4994
|
-
\x00\x00\x06\
|
|
4995
|
-
\x00\x00\
|
|
4996
|
-
\x00\x00\
|
|
4997
|
-
\x00\x00\
|
|
4998
|
-
\x00\x00\
|
|
4999
|
-
\x00\x00\
|
|
5000
|
-
\x00\x00\
|
|
5001
|
-
\x00\x00\
|
|
5002
|
-
\x00\x00\
|
|
5128
|
+
\x00\x00\x02L\x00\x00\x00\x00\x00\x01\x00\x00\x1d\xeb\
|
|
5129
|
+
\x00\x00\x0b\xe0\x00\x00\x00\x00\x00\x01\x00\x00\xab:\
|
|
5130
|
+
\x00\x00\x0dT\x00\x00\x00\x00\x00\x01\x00\x00\xc3\xec\
|
|
5131
|
+
\x00\x00\x0b\xc2\x00\x00\x00\x00\x00\x01\x00\x00\xaa\x0c\
|
|
5132
|
+
\x00\x00\x0e\xb0\x00\x00\x00\x00\x00\x01\x00\x00\xdaV\
|
|
5133
|
+
\x00\x00\x04:\x00\x00\x00\x00\x00\x01\x00\x00;\xf4\
|
|
5134
|
+
\x00\x00\x07&\x00\x00\x00\x00\x00\x01\x00\x00c\xf8\
|
|
5135
|
+
\x00\x00\x06\xee\x00\x00\x00\x00\x00\x01\x00\x00_\x08\
|
|
5136
|
+
\x00\x00\x0e\x10\x00\x00\x00\x00\x00\x01\x00\x00\xd1\xf6\
|
|
5137
|
+
\x00\x00\x06\x00\x00\x00\x00\x00\x00\x01\x00\x00S\xdc\
|
|
5138
|
+
\x00\x00\x07j\x00\x00\x00\x00\x00\x01\x00\x00iE\
|
|
5139
|
+
\x00\x00\x08\x0c\x00\x00\x00\x00\x00\x01\x00\x00r\x91\
|
|
5140
|
+
\x00\x00\x082\x00\x00\x00\x00\x00\x01\x00\x00s\x8b\
|
|
5141
|
+
\x00\x00\x0c\xa0\x00\x00\x00\x00\x00\x01\x00\x00\xb9\xc5\
|
|
5142
|
+
\x00\x00\x0c$\x00\x00\x00\x00\x00\x01\x00\x00\xb4\x87\
|
|
5143
|
+
\x00\x00\x0b\x0a\x00\x00\x00\x00\x00\x01\x00\x00\xa1\x8b\
|
|
5144
|
+
\x00\x00\x02\x92\x00\x00\x00\x00\x00\x01\x00\x00!g\
|
|
5145
|
+
\x00\x00\x0c\xf0\x00\x00\x00\x00\x00\x01\x00\x00\xbd\xeb\
|
|
5146
|
+
\x00\x00\x10\x96\x00\x00\x00\x00\x00\x01\x00\x00\xf4\xef\
|
|
5003
5147
|
\x00\x00\x00\x96\x00\x00\x00\x00\x00\x01\x00\x00\x07\xac\
|
|
5004
|
-
\x00\x00\
|
|
5005
|
-
\x00\x00\x0f
|
|
5006
|
-
\x00\x00\
|
|
5007
|
-
\x00\x00\
|
|
5008
|
-
\x00\x00\
|
|
5009
|
-
\x00\x00\
|
|
5010
|
-
\x00\x00\
|
|
5011
|
-
\x00\x00\
|
|
5012
|
-
\x00\x00\
|
|
5013
|
-
\x00\x00\
|
|
5014
|
-
\x00\x00\x09\
|
|
5015
|
-
\x00\x00\
|
|
5148
|
+
\x00\x00\x0b\xf6\x00\x00\x00\x00\x00\x01\x00\x00\xafA\
|
|
5149
|
+
\x00\x00\x0f\xe4\x00\x00\x00\x00\x00\x01\x00\x00\xeau\
|
|
5150
|
+
\x00\x00\x0f\xfc\x00\x00\x00\x00\x00\x01\x00\x00\xec\xa7\
|
|
5151
|
+
\x00\x00\x05.\x00\x00\x00\x00\x00\x01\x00\x00I5\
|
|
5152
|
+
\x00\x00\x03T\x00\x00\x00\x00\x00\x01\x00\x00/\x19\
|
|
5153
|
+
\x00\x00\x0eD\x00\x00\x00\x00\x00\x01\x00\x00\xd5\xe3\
|
|
5154
|
+
\x00\x00\x05\x02\x00\x00\x00\x00\x00\x01\x00\x00GV\
|
|
5155
|
+
\x00\x00\x090\x00\x00\x00\x00\x00\x01\x00\x00\x83\xff\
|
|
5156
|
+
\x00\x00\x0d>\x00\x00\x00\x00\x00\x01\x00\x00\xc2\x1d\
|
|
5157
|
+
\x00\x00\x04$\x00\x00\x00\x00\x00\x01\x00\x00:\xe8\
|
|
5158
|
+
\x00\x00\x09\xbe\x00\x00\x00\x00\x00\x01\x00\x00\x8a@\
|
|
5159
|
+
\x00\x00\x07\xf4\x00\x00\x00\x00\x00\x01\x00\x00p&\
|
|
5016
5160
|
\x00\x00\x022\x00\x00\x00\x00\x00\x01\x00\x00\x1c\xbb\
|
|
5017
|
-
\x00\x00\
|
|
5018
|
-
\x00\x00\
|
|
5019
|
-
\x00\x00\
|
|
5020
|
-
\x00\x00\x03
|
|
5021
|
-
\x00\x00\
|
|
5022
|
-
\x00\x00\
|
|
5023
|
-
\x00\x00\
|
|
5024
|
-
\x00\x00\x0d\
|
|
5025
|
-
\x00\x00\
|
|
5026
|
-
\x00\x00\x0f\
|
|
5161
|
+
\x00\x00\x03\x1e\x00\x00\x00\x00\x00\x01\x00\x00)f\
|
|
5162
|
+
\x00\x00\x04\xc6\x00\x00\x00\x00\x00\x01\x00\x00E\x10\
|
|
5163
|
+
\x00\x00\x05\x96\x00\x00\x00\x00\x00\x01\x00\x00P\xb3\
|
|
5164
|
+
\x00\x00\x03\x90\x00\x00\x00\x00\x00\x01\x00\x002:\
|
|
5165
|
+
\x00\x00\x07\xb6\x00\x00\x00\x00\x00\x01\x00\x00m'\
|
|
5166
|
+
\x00\x00\x06\x18\x00\x00\x00\x00\x00\x01\x00\x00T\xfb\
|
|
5167
|
+
\x00\x00\x10t\x00\x00\x00\x00\x00\x01\x00\x00\xf3_\
|
|
5168
|
+
\x00\x00\x0d\xb6\x00\x00\x00\x00\x00\x01\x00\x00\xcb`\
|
|
5169
|
+
\x00\x00\x10\x5c\x00\x00\x00\x00\x00\x01\x00\x00\xf1\xcd\
|
|
5170
|
+
\x00\x00\x0f\xb4\x00\x00\x00\x00\x00\x01\x00\x00\xe7Z\
|
|
5027
5171
|
\x00\x00\x01\xb0\x00\x00\x00\x00\x00\x01\x00\x00\x16\x8e\
|
|
5028
|
-
\x00\x00\
|
|
5029
|
-
\x00\x00\
|
|
5030
|
-
\x00\x00\
|
|
5031
|
-
\x00\x00\x02\
|
|
5032
|
-
\x00\x00\
|
|
5033
|
-
\x00\x00\x04
|
|
5034
|
-
\x00\x00\
|
|
5035
|
-
\x00\x00\
|
|
5036
|
-
\x00\x00\
|
|
5172
|
+
\x00\x00\x04R\x00\x00\x00\x00\x00\x01\x00\x00=z\
|
|
5173
|
+
\x00\x00\x064\x00\x00\x00\x00\x00\x01\x00\x00V\x87\
|
|
5174
|
+
\x00\x00\x07R\x00\x00\x00\x00\x00\x01\x00\x00g\x92\
|
|
5175
|
+
\x00\x00\x02\xf4\x00\x00\x00\x00\x00\x01\x00\x00&\x90\
|
|
5176
|
+
\x00\x00\x04\x9a\x00\x00\x00\x00\x00\x01\x00\x00A\x1b\
|
|
5177
|
+
\x00\x00\x04\xb2\x00\x00\x00\x00\x00\x01\x00\x00Br\
|
|
5178
|
+
\x00\x00\x0d\xf6\x00\x00\x00\x00\x00\x01\x00\x00\xd0\xc9\
|
|
5179
|
+
\x00\x00\x08\x8c\x00\x00\x00\x00\x00\x01\x00\x00x\x0c\
|
|
5180
|
+
\x00\x00\x06d\x00\x00\x00\x00\x00\x01\x00\x00X\xaa\
|
|
5037
5181
|
\x00\x00\x00\xe0\x00\x00\x00\x00\x00\x01\x00\x00\x0c\x14\
|
|
5038
|
-
\x00\x00\
|
|
5182
|
+
\x00\x00\x09`\x00\x00\x00\x00\x00\x01\x00\x00\x86\x9b\
|
|
5039
5183
|
\x00\x00\x00p\x00\x00\x00\x00\x00\x01\x00\x00\x06X\
|
|
5040
|
-
\x00\x00\
|
|
5041
|
-
\x00\x00\
|
|
5042
|
-
\x00\x00\
|
|
5043
|
-
\x00\x00\x04
|
|
5044
|
-
\x00\x00\x04\
|
|
5045
|
-
\x00\x00\
|
|
5184
|
+
\x00\x00\x10\x16\x00\x00\x00\x00\x00\x01\x00\x00\xee\x1f\
|
|
5185
|
+
\x00\x00\x0aj\x00\x00\x00\x00\x00\x01\x00\x00\x95\xae\
|
|
5186
|
+
\x00\x00\x04\x0e\x00\x00\x00\x00\x00\x01\x00\x00:(\
|
|
5187
|
+
\x00\x00\x04\x80\x00\x00\x00\x00\x00\x01\x00\x00?\xc7\
|
|
5188
|
+
\x00\x00\x04\xe8\x00\x00\x00\x00\x00\x01\x00\x00E\xd9\
|
|
5189
|
+
\x00\x00\x0b\x22\x00\x00\x00\x00\x00\x01\x00\x00\xa2\x9f\
|
|
5046
5190
|
\x00\x00\x00\xf6\x00\x00\x00\x00\x00\x01\x00\x00\x0d]\
|
|
5047
5191
|
\x00\x00\x01\x10\x00\x00\x00\x00\x00\x01\x00\x00\x0ee\
|
|
5048
|
-
\x00\x00\
|
|
5049
|
-
\x00\x00\
|
|
5050
|
-
\x00\x00\
|
|
5192
|
+
\x00\x00\x07\x82\x00\x00\x00\x00\x00\x01\x00\x00j\x8c\
|
|
5193
|
+
\x00\x00\x05\xe8\x00\x00\x00\x00\x00\x01\x00\x00R\x93\
|
|
5194
|
+
\x00\x00\x0d\x82\x00\x00\x00\x00\x00\x01\x00\x00\xc88\
|
|
5051
5195
|
\x00\x00\x00,\x00\x00\x00\x00\x00\x01\x00\x00\x01\xbc\
|
|
5052
|
-
\x00\x00\
|
|
5053
|
-
\x00\x00\
|
|
5054
|
-
\x00\x00\
|
|
5055
|
-
\x00\x00\
|
|
5056
|
-
\x00\x00\
|
|
5057
|
-
\x00\x00\
|
|
5196
|
+
\x00\x00\x05x\x00\x00\x00\x00\x00\x01\x00\x00M\xb0\
|
|
5197
|
+
\x00\x00\x0e^\x00\x00\x00\x00\x00\x01\x00\x00\xd7\xa3\
|
|
5198
|
+
\x00\x00\x04j\x00\x00\x00\x00\x00\x01\x00\x00?\x01\
|
|
5199
|
+
\x00\x00\x0d\xe0\x00\x00\x00\x00\x00\x01\x00\x00\xce\x12\
|
|
5200
|
+
\x00\x00\x0b:\x00\x00\x00\x00\x00\x01\x00\x00\xa3b\
|
|
5201
|
+
\x00\x00\x104\x00\x00\x00\x00\x00\x01\x00\x00\xefs\
|
|
5058
5202
|
\x00\x00\x01\xc8\x00\x00\x00\x00\x00\x01\x00\x00\x17\xea\
|
|
5059
|
-
\x00\x00\
|
|
5060
|
-
\x00\x00\
|
|
5061
|
-
\x00\x00\x09
|
|
5062
|
-
\x00\x00\x0f\
|
|
5203
|
+
\x00\x00\x0c^\x00\x00\x00\x00\x00\x01\x00\x00\xb7A\
|
|
5204
|
+
\x00\x00\x0b\x9e\x00\x00\x00\x00\x00\x01\x00\x00\xa8\x81\
|
|
5205
|
+
\x00\x00\x09\xd6\x00\x00\x00\x00\x00\x01\x00\x00\x8cY\
|
|
5206
|
+
\x00\x00\x0f\xca\x00\x00\x00\x00\x00\x01\x00\x00\xe8\x81\
|
|
5063
5207
|
\x00\x00\x00\xc8\x00\x00\x00\x00\x00\x01\x00\x00\x0b\x16\
|
|
5064
|
-
\x00\x00\
|
|
5065
|
-
\x00\x00\
|
|
5066
|
-
\x00\x00\
|
|
5208
|
+
\x00\x00\x0f,\x00\x00\x00\x00\x00\x01\x00\x00\xe0\xa0\
|
|
5209
|
+
\x00\x00\x08\xfe\x00\x00\x00\x00\x00\x01\x00\x00\x80f\
|
|
5210
|
+
\x00\x00\x0a\xf0\x00\x00\x00\x00\x00\x01\x00\x00\xa0x\
|
|
5067
5211
|
\x00\x00\x01\x90\x00\x00\x00\x00\x00\x01\x00\x00\x14\x99\
|
|
5068
|
-
\x00\x00\
|
|
5069
|
-
\x00\x00\
|
|
5070
|
-
\x00\x00\
|
|
5071
|
-
\x00\x00\
|
|
5072
|
-
\x00\x00\
|
|
5073
|
-
\x00\x00\
|
|
5074
|
-
\x00\x00\
|
|
5075
|
-
\x00\x00\
|
|
5076
|
-
\x00\x00\x10
|
|
5077
|
-
\x00\x00\
|
|
5078
|
-
\x00\x00\
|
|
5079
|
-
\x00\x00\
|
|
5080
|
-
\x00\x00\x0c\
|
|
5081
|
-
\x00\x00\
|
|
5082
|
-
\x00\x00\
|
|
5212
|
+
\x00\x00\x09\xa2\x00\x00\x00\x00\x00\x01\x00\x00}\x01\
|
|
5213
|
+
\x00\x00\x0c\x8a\x00\x00\x00\x00\x00\x01\x00\x00\xb8\xf5\
|
|
5214
|
+
\x00\x00\x0fD\x00\x00\x00\x00\x00\x01\x00\x00\xe2K\
|
|
5215
|
+
\x00\x00\x0a\x16\x00\x00\x00\x00\x00\x01\x00\x00\x90\x8a\
|
|
5216
|
+
\x00\x00\x0c@\x00\x00\x00\x00\x00\x01\x00\x00\xb5E\
|
|
5217
|
+
\x00\x00\x08\xa6\x00\x00\x00\x00\x00\x01\x00\x00{7\
|
|
5218
|
+
\x00\x00\x0bT\x00\x00\x00\x00\x00\x01\x00\x00\xa4\xdc\
|
|
5219
|
+
\x00\x00\x10\xfe\x00\x00\x00\x00\x00\x01\x00\x00\xfa\x05\
|
|
5220
|
+
\x00\x00\x10\xc8\x00\x00\x00\x00\x00\x01\x00\x00\xf73\
|
|
5221
|
+
\x00\x00\x09\x88\x00\x00\x00\x00\x00\x01\x00\x00\x87\x98\
|
|
5222
|
+
\x00\x00\x03j\x00\x00\x00\x00\x00\x01\x00\x000k\
|
|
5223
|
+
\x00\x00\x05D\x00\x00\x00\x00\x00\x01\x00\x00K0\
|
|
5224
|
+
\x00\x00\x0c\xba\x00\x00\x00\x00\x00\x01\x00\x00\xbaw\
|
|
5225
|
+
\x00\x00\x0f\x0a\x00\x00\x00\x00\x00\x01\x00\x00\xde\xcd\
|
|
5226
|
+
\x00\x00\x06\xcc\x00\x00\x00\x00\x00\x01\x00\x00]\xa8\
|
|
5083
5227
|
\x00\x00\x01<\x00\x00\x00\x00\x00\x01\x00\x00\x0f\xdd\
|
|
5084
|
-
\x00\x00\
|
|
5085
|
-
\x00\x00\x06\
|
|
5086
|
-
\x00\x00\
|
|
5228
|
+
\x00\x00\x07:\x00\x00\x00\x00\x00\x01\x00\x00d\xae\
|
|
5229
|
+
\x00\x00\x06\x96\x00\x00\x00\x00\x00\x01\x00\x00[#\
|
|
5230
|
+
\x00\x00\x0c\x0e\x00\x00\x00\x00\x00\x01\x00\x00\xb2]\
|
|
5087
5231
|
"
|
|
5088
5232
|
|
|
5089
5233
|
def qInitResources():
|
|
@@ -31,6 +31,7 @@ from .audio import Audio
|
|
|
31
31
|
from .image import Image
|
|
32
32
|
from .remote_tools import RemoteTools
|
|
33
33
|
from .computer import Computer
|
|
34
|
+
from .store import Store
|
|
34
35
|
|
|
35
36
|
|
|
36
37
|
class ApiAnthropic:
|
|
@@ -48,6 +49,7 @@ class ApiAnthropic:
|
|
|
48
49
|
self.image = Image(window) # stub: no image generation in Anthropic
|
|
49
50
|
self.remote_tools = RemoteTools(window)
|
|
50
51
|
self.computer = Computer(window)
|
|
52
|
+
self.store = Store(window)
|
|
51
53
|
self.client: Optional[anthropic.Anthropic] = None
|
|
52
54
|
self.locked = False
|
|
53
55
|
self.last_client_args: Optional[Dict[str, Any]] = None
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
import json
|
|
13
|
+
import os
|
|
13
14
|
from typing import Optional, Dict, Any, List, Set
|
|
14
15
|
|
|
15
16
|
from pygpt_net.core.types import MODE_CHAT, MODE_AUDIO, MODE_COMPUTER
|
|
@@ -178,6 +179,12 @@ class Chat:
|
|
|
178
179
|
except Exception:
|
|
179
180
|
pass
|
|
180
181
|
|
|
182
|
+
# Download files referenced by code execution results (Files API)
|
|
183
|
+
try:
|
|
184
|
+
self._maybe_download_files_from_response(response, ctx)
|
|
185
|
+
except Exception:
|
|
186
|
+
pass
|
|
187
|
+
|
|
181
188
|
def extract_text(self, response: Message) -> str:
|
|
182
189
|
"""
|
|
183
190
|
Extract text from response content blocks.
|
|
@@ -586,4 +593,80 @@ class Chat:
|
|
|
586
593
|
return json.dumps(last, ensure_ascii=False)
|
|
587
594
|
return str(last)
|
|
588
595
|
except Exception:
|
|
589
|
-
return "ok"
|
|
596
|
+
return "ok"
|
|
597
|
+
|
|
598
|
+
# -------------------------- Files download helpers -------------------------- #
|
|
599
|
+
|
|
600
|
+
def _maybe_download_files_from_response(self, response: Message, ctx: CtxItem) -> None:
|
|
601
|
+
"""
|
|
602
|
+
Scan response content blocks for Files API file_ids and download them.
|
|
603
|
+
Works for code execution tool results that output files.
|
|
604
|
+
"""
|
|
605
|
+
file_ids: List[str] = []
|
|
606
|
+
|
|
607
|
+
def _to_plain(obj):
|
|
608
|
+
try:
|
|
609
|
+
if hasattr(obj, "model_dump"):
|
|
610
|
+
return obj.model_dump()
|
|
611
|
+
if hasattr(obj, "to_dict"):
|
|
612
|
+
return obj.to_dict()
|
|
613
|
+
except Exception:
|
|
614
|
+
pass
|
|
615
|
+
if isinstance(obj, dict):
|
|
616
|
+
return {k: _to_plain(v) for k, v in obj.items()}
|
|
617
|
+
if isinstance(obj, (list, tuple)):
|
|
618
|
+
return [_to_plain(x) for x in obj]
|
|
619
|
+
return obj
|
|
620
|
+
|
|
621
|
+
def _walk(o):
|
|
622
|
+
if o is None:
|
|
623
|
+
return
|
|
624
|
+
if isinstance(o, dict):
|
|
625
|
+
for k, v in o.items():
|
|
626
|
+
if k == "file_id" and isinstance(v, str) and v.startswith("file_"):
|
|
627
|
+
if v not in file_ids:
|
|
628
|
+
file_ids.append(v)
|
|
629
|
+
else:
|
|
630
|
+
_walk(v)
|
|
631
|
+
elif isinstance(o, (list, tuple)):
|
|
632
|
+
for it in o:
|
|
633
|
+
_walk(it)
|
|
634
|
+
|
|
635
|
+
try:
|
|
636
|
+
for blk in getattr(response, "content", []) or []:
|
|
637
|
+
btype = getattr(blk, "type", "") or ""
|
|
638
|
+
# code_execution results appear as *_tool_result with nested 'content'
|
|
639
|
+
if btype.endswith("_tool_result"):
|
|
640
|
+
content = getattr(blk, "content", None)
|
|
641
|
+
_walk(_to_plain(content))
|
|
642
|
+
except Exception:
|
|
643
|
+
pass
|
|
644
|
+
|
|
645
|
+
if not file_ids:
|
|
646
|
+
return
|
|
647
|
+
|
|
648
|
+
saved: List[str] = []
|
|
649
|
+
for fid in file_ids:
|
|
650
|
+
try:
|
|
651
|
+
path = self.window.core.api.anthropic.store.download_to_dir(fid)
|
|
652
|
+
if path:
|
|
653
|
+
saved.append(path)
|
|
654
|
+
except Exception:
|
|
655
|
+
continue
|
|
656
|
+
|
|
657
|
+
if saved:
|
|
658
|
+
saved = self.window.core.filesystem.make_local_list(saved)
|
|
659
|
+
if not isinstance(ctx.files, list):
|
|
660
|
+
ctx.files = []
|
|
661
|
+
for p in saved:
|
|
662
|
+
if p not in ctx.files:
|
|
663
|
+
ctx.files.append(p)
|
|
664
|
+
images = []
|
|
665
|
+
for path in saved:
|
|
666
|
+
ext = os.path.splitext(path)[1].lower().lstrip(".")
|
|
667
|
+
if ext in ["png", "jpg", "jpeg", "gif", "bmp", "tiff", "webp"]:
|
|
668
|
+
images.append(path)
|
|
669
|
+
if images:
|
|
670
|
+
if not isinstance(ctx.images, list):
|
|
671
|
+
ctx.images = []
|
|
672
|
+
ctx.images += images
|