v4.6.2-alpah (#511)
1
projects/app/public/imgs/modal/badAnswer.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1700745147176" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="25531" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M551.706122 909.061224c-25.6 0-49.632653-8.359184-65.306122-24.555102-25.6-26.122449-36.571429-70.530612-47.542857-117.028571-6.269388-26.122449-13.583673-55.902041-21.420408-68.963265-20.897959-35.526531-65.828571-54.334694-78.367347-59.036735H266.971429c-25.6 0-47.020408-20.897959-47.020409-47.020408V215.771429c0-25.6 20.897959-47.020408 47.020409-47.020409h67.918367C364.146939 153.6 447.738776 114.938776 543.346939 114.938776h181.812245c29.779592 0 92.473469 10.971429 117.55102 53.289795 23.510204 39.183673 63.216327 344.293878 63.216327 370.416327 0 56.946939-53.812245 101.355102-100.310204 101.355102h-119.640817c-4.179592 0-6.791837 2.089796-7.836734 3.657143-1.044898 1.567347-2.612245 4.179592-2.089796 8.359184 4.179592 20.37551 13.583673 73.665306 6.791836 130.612244-7.314286 57.991837-41.795918 102.922449-92.473469 120.163266-12.016327 4.179592-25.6 6.269388-38.661225 6.269387z" fill="#16C4AF" p-id="25532"></path><path d="M132.179592 623.281633c-10.971429 0-19.853061-8.881633-19.853061-19.853062V196.440816c0-10.971429 8.881633-19.853061 19.853061-19.853061s19.853061 8.881633 19.853061 19.853061v406.987755c0 10.971429-8.881633 19.853061-19.853061 19.853062z" fill="#16C4AF" p-id="25533"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
1
projects/app/public/imgs/modal/bill.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1700746245397" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="43680" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M0 0m178.086957 0l667.826086 0q178.086957 0 178.086957 178.086957l0 667.826086q0 178.086957-178.086957 178.086957l-667.826086 0q-178.086957 0-178.086957-178.086957l0-667.826086q0-178.086957 178.086957-178.086957Z" fill="#8973E6" p-id="43681"></path><path d="M570.813217 258.782609a77.534609 77.534609 0 0 1 77.534609 77.534608v350.987131a77.913043 77.913043 0 0 0 74.017391 77.824l3.895653 0.089043H316.838957a77.534609 77.534609 0 0 1-77.534609-77.534608V336.317217a77.534609 77.534609 0 0 1 77.534609-77.534608h253.996521zM456.43687 589.913043h-122.61287a16.606609 16.606609 0 0 0-16.606609 16.606609v5.743305c0 9.171478 7.43513 16.606609 16.606609 16.606608h122.61287a16.606609 16.606609 0 0 0 16.606608-16.606608v-5.743305a16.606609 16.606609 0 0 0-16.606608-16.606609z m77.913043-116.869565h-200.525913a16.606609 16.606609 0 0 0-16.606609 16.606609v5.743304c0 9.171478 7.43513 16.606609 16.606609 16.606609h200.525913a16.606609 16.606609 0 0 0 16.606609-16.606609v-5.743304a16.606609 16.606609 0 0 0-16.606609-16.606609z m0-116.869565h-200.525913a16.606609 16.606609 0 0 0-16.606609 16.606609v5.743304c0 9.171478 7.43513 16.606609 16.606609 16.606609h200.525913a16.606609 16.606609 0 0 0 16.606609-16.606609v-5.743304a16.606609 16.606609 0 0 0-16.606609-16.606609z" fill="#FFFFFF" p-id="43682"></path><path d="M628.869565 570.434783h155.826087v116.869565a77.913043 77.913043 0 0 1-155.826087 0v-116.869565z" fill="#FFFFFF" opacity=".6" p-id="43683"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
1
projects/app/public/imgs/modal/chatHistory.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1700627014976" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9004" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M749.57747 338.71354a28.03513 28.03513 0 0 1-1.921508-56.00726l167.832777-11.875555-5.355025-146.507178a28.03513 28.03513 0 0 1 56.038759-2.047509l5.607026 153.43721a48.730726 48.730726 0 0 1-45.45471 50.589234l-174.762809 12.348057c-0.630003 0.063-1.291506 0.063-1.98451 0.063001z m166.16327-60.952783z" fill="#2E3138" p-id="9005"></path><path d="M585.461711 1004.878624a484.125741 484.125741 0 0 0-190.544383-929.254302H285.13932l-94.815439 74.466344-152.775707 469.761675L395.35833 996.153084s131.607609 33.799656 190.103381 8.72554z" fill="#56E5BE" p-id="9006"></path><path d="M769.202061 559.781563a484.220242 484.220242 0 0 1-290.179343 443.648054c-59.346275 25.98762-339.06757-61.173283-369.559711-198.450919-63.630295-286.651327-5.071523-729.133876 175.644813-729.133875a484.031241 484.031241 0 0 1 484.094241 483.93674z" fill="#50DDB8" p-id="9007"></path><path d="M279.658295 87.342376a484.220242 484.220242 0 0 1 103.950481 908.810708l-233.101079-144.900671-112.802022-242.551123 8.851541-229.258062 107.100495-210.389474z" fill="#42D3AD" p-id="9008"></path><path d="M512.727874 1023.999212a512.003371 512.003371 0 0 1-426.921477-227.998055C-70.780828 561.041569-6.993032 242.480594 227.998056 85.798869S781.424118-6.87456 938.105843 228.085028a28.06663 28.06663 0 0 1-46.683216 31.122144 455.964611 455.964611 0 0 0-632.333927-126.630587C49.864731 271.996231-6.961532 555.655044 132.521114 764.910513s423.046959 266.050232 632.333927 126.599086a458.925625 458.925625 0 0 0 198.954921-441.821045 28.04458 28.04458 0 1 1 55.566258-7.623036 515.342386 515.342386 0 0 1-223.462035 496.127297 509.451859 509.451859 0 0 1-283.186311 85.806397z" fill="#2E3138" p-id="9009"></path><path d="M729.543378 657.558016h-2.236511l-186.354862-14.553067a47.029718 47.029718 0 0 1-43.0292-46.746217v-211.77548a28.03513 28.03513 0 0 1 56.07026 0v203.17594l177.818323 13.891565a28.03513 28.03513 0 0 1-2.14201 56.007259z" fill="#2E3138" p-id="9010"></path></svg>
|
||||
|
After Width: | Height: | Size: 2.2 KiB |
1
projects/app/public/imgs/modal/concat.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1700745458924" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="30191" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M0 512a512 512 0 1 0 1024 0 512 512 0 1 0-1024 0Z" fill="#EFF2FF" p-id="30192"></path><path d="M682.666667 682.666667c9.898667 9.841778-9.841778-9.841778 0 0zM338.488889 685.511111l5.688889-5.688889c-1.080889 0.682667-2.161778 2.104889-2.844445 2.844445a10.752 10.752 0 0 0-2.844444 2.844444z" fill="#000000" p-id="30193"></path><path d="M784.896 740.693333c23.324444-40.504889 10.410667-71.68-30.947556-102.798222-48.696889-36.579556-96.199111-61.212444-130.389333-21.788444 0 0-36.295111 43.064889-143.075555-57.685334C356.352 440.490667 408.462222 398.677333 408.462222 398.677333c43.178667-43.235556 15.701333-75.548444-20.48-124.416-36.238222-48.924444-72.817778-64.341333-125.326222-22.300444-101.262222 81.009778 41.528889 271.189333 113.607111 345.144889 0 0 109.738667 113.095111 178.801778 150.755555l36.920889 20.593778c52.906667 27.079111 112.469333 39.480889 154.339555 14.336 0 0 20.195556-10.353778 38.570667-42.097778z" fill="#4D4DEE" p-id="30194"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
1
projects/app/public/imgs/modal/edit.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1700634007483" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="19559" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M65.361 856H967v160H65.361zM65.531 805.062l2.295-188.972L676.402 7.515 863.078 194.19 254.503 802.766 65.53 805.062z m50.726-169.52l-1.46 120.254 120.254-1.46L116.257 635.54z m507.147-507.147L742.198 247.19l52.163-52.163L675.567 76.232l-52.163 52.163z" fill="#1AA5FF" p-id="19560"></path></svg>
|
||||
|
After Width: | Height: | Size: 628 B |
1
projects/app/public/imgs/modal/folder.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1700746526624" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="53489" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M300.053794 0h423.892412c200.032053 0 300.053794 100.021741 300.053794 300.053794v423.892412c0 200.032053-100.021741 300.053794-300.053794 300.053794H300.053794C100.021741 1023.988572 0 923.966831 0 723.934778v-423.880984C0 100.021741 100.021741 0 300.053794 0z" fill="#598BFC" opacity=".15" p-id="53490"></path><path d="M709.900648 336.864812h-191.883572c-7.017065 0-13.542706-3.645674-17.211237-9.62275l-43.725226-41.828105a34.641899 34.641899 0 0 0-29.508242-16.479816h-110.695908c-43.725226 0-79.164831 35.416748-79.16483 79.09626v310.876531c0 42.136673 34.182476 76.296291 76.364862 76.30772h395.835582c42.170958 0 76.364862-34.171047 76.364862-76.30772V413.172532c0-42.136673-34.193904-76.30772-76.376291-76.30772z" fill="#598BFC" p-id="53491"></path><path d="M335.436256 437.800828h353.116059c13.336994 0 20.011205 6.857066 20.011205 20.571199s-6.674211 20.571199-20.011205 20.571199H335.436256c-13.336994 0-20.011205-6.857066-20.011205-20.571199s6.674211-20.571199 20.011205-20.571199z" fill="#FFFFFF" p-id="53492"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
1
projects/app/public/imgs/modal/import.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1700746705101" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="61761" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M906.5472 756.8384H632.9344c-23.04 0-43.2128-20.1728-43.2128-43.2128s20.1728-43.2128 43.2128-43.2128h273.6128c23.04 0 43.2128 20.1728 43.2128 43.2128s-20.1728 43.2128-43.2128 43.2128z" fill="#409EFF" p-id="61762"></path><path d="M631.296 756.8384c-11.5712 0-23.04-2.8672-28.7744-11.5712-17.3056-17.3056-17.3056-43.2128 0-60.5184L732.16 555.2128c17.3056-17.3056 43.2128-17.3056 60.5184 0s17.3056 43.2128 0 60.5184L663.04 745.3696c-11.5712 8.6016-23.04 11.4688-31.744 11.4688z" fill="#409EFF" p-id="61763"></path><path d="M761.4464 886.3744c-11.5712 0-23.04-2.8672-28.7744-11.5712L603.0336 745.3696c-17.3056-17.3056-17.3056-43.2128 0-60.5184s43.2128-17.3056 60.5184 0l129.6384 129.536c17.3056 17.3056 17.3056 43.2128 0 60.5184-8.704 5.7344-20.2752 11.4688-31.744 11.4688z" fill="#409EFF" p-id="61764"></path><path d="M851.8656 932.4544a126.65856 126.65856 0 0 1-89.2928 37.4784c-34.6112 0-63.3856-11.5712-89.2928-37.4784L546.5088 802.9184c-17.3056-17.3056-28.7744-40.3456-34.6112-63.3856-2.8672-8.6016-2.8672-17.3056-2.8672-25.9072s0-17.3056 2.8672-25.9072c5.7344-23.04 17.3056-46.08 34.6112-63.3856L676.0448 494.592c48.4352-49.3568 127.6928-49.9712 177.0496-1.536l1.536 1.536c17.6128 17.6128 52.0192 62.1568 67.2768 82.1248 1.4336 1.8432 4.096 2.2528 5.9392 0.8192 1.024-0.8192 1.6384-2.048 1.6384-3.3792V280.064c0-65.6384-53.76-119.3984-119.3984-119.3984H314.5728c-65.6384 0-119.3984 53.76-119.3984 119.3984v573.3376c0 65.6384 53.76 119.3984 119.3984 119.3984h492.6464c65.6384 0 119.3984-53.76 119.3984-119.3984 0-2.3552-1.8432-4.1984-4.1984-4.1984a3.9936 3.9936 0 0 0-3.3792 1.7408c-14.7456 20.1728-47.616 64.1024-67.1744 81.5104z" fill="#409EFF" p-id="61765"></path><path d="M131.7888 823.0912V212.48c0-66.2528 54.6816-120.9344 120.9344-120.9344h524.1856C756.8384 68.5056 725.0944 51.2 690.5856 51.2H189.44C126.0544 51.2 74.24 103.0144 74.24 166.4v584.6016c0 43.2128 23.04 80.5888 60.5184 100.7616-2.9696-11.4688-2.9696-20.0704-2.9696-28.672z" fill="#409EFF" p-id="61766"></path></svg>
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
1
projects/app/public/imgs/modal/key.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1700745751866" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="36975" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M220.150923 700.501366l167.543301-167.5433a73.062148 73.062148 0 0 1 103.327242 103.327242l-365.310741 365.310741a73.062148 73.062148 0 1 1-103.327242-103.286288l94.481152-94.481152-64.257012-64.257013a73.062148 73.062148 0 1 1 103.327242-103.286288l64.216058 64.216058z" fill="#CCDAFF" p-id="36976"></path><path d="M475.909397 49.003242a365.310741 365.310741 0 1 1 365.310741 632.782092 365.310741 365.310741 0 0 1-365.310741-632.741138z m118.685036 205.589677a127.981622 127.981622 0 1 0 127.981622 221.643692 127.981622 127.981622 0 0 0-127.981622-221.684646z" fill="#244DD5" p-id="36977"></path></svg>
|
||||
|
After Width: | Height: | Size: 939 B |
1
projects/app/public/imgs/modal/move.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1700746780241" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="67557" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M768 320v128H576V256h128L512 64 320 256h128v192H256V320L64 512l64 64 128 128V576h192v192H320l192 192 64-64 128-128H576V576h192v128l192-192-192-192z" p-id="67558" fill="#13227a"></path></svg>
|
||||
|
After Width: | Height: | Size: 524 B |
1
projects/app/public/imgs/modal/network.svg
Normal file
|
After Width: | Height: | Size: 7.9 KiB |
1
projects/app/public/imgs/modal/openai.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1700746289796" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="44851" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M939.795692 421.415385a248.832 248.832 0 0 0-21.385846-204.386462 251.667692 251.667692 0 0 0-271.064615-120.753231 248.832 248.832 0 0 0-187.687385-83.672615 251.687385 251.687385 0 0 0-240.088615 174.257231 248.910769 248.910769 0 0 0-166.4 120.713846 251.707077 251.707077 0 0 0 30.956307 295.108923 248.832 248.832 0 0 0 21.385847 204.386461 251.687385 251.687385 0 0 0 271.064615 120.753231 248.832 248.832 0 0 0 187.687385 83.672616 251.687385 251.687385 0 0 0 240.167384-174.355693 248.910769 248.910769 0 0 0 166.4-120.713846A251.707077 251.707077 0 0 0 939.795692 421.415385zM564.342154 946.195692a186.663385 186.663385 0 0 1-119.827692-43.323077c1.516308-0.827077 4.174769-2.284308 5.907692-3.347692l198.892308-114.884923a32.334769 32.334769 0 0 0 16.344615-28.297846V475.943385l84.066461 48.541538a2.993231 2.993231 0 0 1 1.634462 2.304v232.211692a187.431385 187.431385 0 0 1-187.017846 187.195077z m-402.195692-171.776a186.564923 186.564923 0 0 1-22.331077-125.44c1.476923 0.886154 4.056615 2.461538 5.907692 3.524923l198.892308 114.884923a32.374154 32.374154 0 0 0 32.669538 0l242.825846-140.20923v97.083077a3.012923 3.012923 0 0 1-1.201231 2.579692l-201.058461 116.086154a187.392 187.392 0 0 1-255.704615-68.509539z m-52.322462-434.195692a186.505846 186.505846 0 0 1 97.437538-82.077538c0 1.713231-0.098462 4.745846-0.098461 6.852923v229.769846a32.315077 32.315077 0 0 0 16.324923 28.278154L466.313846 663.236923l-84.066461 48.541539a3.012923 3.012923 0 0 1-2.835693 0.256l-201.078154-116.184616a187.392 187.392 0 0 1-68.509538-255.625846z m690.688 160.728615l-242.825846-140.20923 84.066461-48.521847a3.012923 3.012923 0 0 1 2.835693-0.256l201.078154 116.086154a187.234462 187.234462 0 0 1-28.928 337.821539V529.230769a32.295385 32.295385 0 0 0-16.226462-28.278154zM884.184615 375.020308c-1.476923-0.905846-4.056615-2.461538-5.907692-3.524923l-198.892308-114.884923a32.413538 32.413538 0 0 0-32.669538 0l-242.825846 140.20923v-97.083077a3.012923 3.012923 0 0 1 1.201231-2.579692l201.058461-115.987692A187.214769 187.214769 0 0 1 884.184615 375.020308z m-526.00123 173.036307l-84.086154-48.541538a2.993231 2.993231 0 0 1-1.634462-2.304V264.999385a187.214769 187.214769 0 0 1 307.003077-143.753847c-1.516308 0.827077-4.155077 2.284308-5.907692 3.347693l-198.892308 114.884923a32.315077 32.315077 0 0 0-16.344615 28.278154z m45.666461-98.461538L512 387.131077l108.150154 62.424615v124.888616L512 636.868923l-108.150154-62.424615z" fill="#202123" p-id="44852"></path></svg>
|
||||
|
After Width: | Height: | Size: 2.8 KiB |
1
projects/app/public/imgs/modal/params.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1700626300526" class="icon" viewBox="0 0 1050 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5944" xmlns:xlink="http://www.w3.org/1999/xlink" width="131.25" height="128"><path d="M877.714286 29.404164H173.484566c-72.53027 0-131.338598 58.808327-131.338598 131.338597V864.972481c0 72.53027 58.808327 131.338598 131.338598 131.338598h704.22972c72.53027 0 131.338598-58.808327 131.338597-131.338598V160.742761C1008.807849 88.212491 949.999521 29.404164 877.714286 29.404164zM857.621441 760.832735h-113.941135c-19.112706 39.695621-59.543431 67.384542-106.590093 67.384542s-87.477387-27.443886-106.590093-67.384542h-318.545107c-27.933955 0-50.722182-22.788227-50.722182-50.722182 0-27.933955 22.788227-50.722182 50.722182-50.722183h318.790141c19.112706-39.695621 59.543431-67.384542 106.590094-67.384541s87.477387 27.443886 106.590093 67.384541H857.621441c27.933955 0 50.722182 22.788227 50.722182 50.722183 0.245035 28.17899-22.543192 50.722182-50.722182 50.722182z m0-394.750897H523.149079c-19.112706 39.695621-59.543431 67.384542-106.590094 67.384542s-87.477387-27.443886-106.590093-67.384542h-98.013879c-27.933955 0-50.722182-22.788227-50.722182-50.722183 0-27.933955 22.788227-50.722182 50.722182-50.722182h98.258914c19.112706-39.695621 59.543431-67.384542 106.590093-67.384542s87.477387 27.443886 106.590093 67.384542H857.621441c27.933955 0 50.722182 22.788227 50.722182 50.722182 0.245035 27.933955-22.543192 50.722182-50.722182 50.722183z" p-id="5945" fill="#1296db"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
1
projects/app/public/imgs/modal/password.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1700746389208" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="49701" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M128 0h768C981.357714 0 1024 42.642286 1024 128v768c0 85.357714-42.642286 128-128 128H128C42.642286 1024 0 981.357714 0 896V128C0 42.642286 42.642286 0 128 0z" fill="#4C84FF" p-id="49702"></path><path d="M704 398.189714h-31.963429v-64.950857c0-89.746286-71.68-162.596571-160.036571-162.596571-88.283429 0-159.963429 72.850286-159.963429 162.596571v64.950857h-32.036571c-35.181714 0-64 29.257143-64 65.097143v282.331429c0 35.766857 28.818286 65.097143 64 65.097143h384c35.181714 0 64-29.257143 64-65.097143v-282.331429a64.731429 64.731429 0 0 0-64-65.097143zM512 682.715429a85.577143 85.577143 0 0 1-85.357714-85.357715A85.577143 85.577143 0 0 1 512 512a85.577143 85.577143 0 0 1 85.357714 85.357714A85.577143 85.577143 0 0 1 512 682.642286z m-95.963429-284.525715v-64.950857c0-53.979429 42.861714-97.572571 95.963429-97.572571 53.101714 0 96.036571 43.52 96.036571 97.572571v64.950857H416.036571z" fill="#FFFFFF" p-id="49703"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
1
projects/app/public/imgs/modal/pay.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1700746345419" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="47618" width="128" height="128" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M885 409.2c-28.2 1.4-53.9-18.2-59.4-46.8l-29-150.5-585 112.6c-8.4 1.6-15.8 6.5-20.7 13.8-4.9 7.3-6.7 15.9-5.1 24.3 6 31.3-14.5 61.6-45.8 67.6-31.3 6.1-61.6-14.5-67.6-45.8-7.4-38.7 0.7-78.1 22.9-110.9 22.2-32.8 55.8-54.9 94.5-62.4L781.4 97.4c28.5-5.5 57.5 0.5 81.6 16.8 24.1 16.3 40.4 41 45.9 69.5l30.2 157c6 31.3-14.5 61.6-45.8 67.6-2.8 0.5-5.5 0.8-8.3 0.9z" fill="#00EFEF" p-id="47619"></path><path d="M861.6 281.7H162.1c-54.6 0-99 44.4-99 99V817c0 54.6 44.4 99.1 99 99.1h699.5c54.5 0 99-44.4 99-99.1V380.7c0-54.6-44.5-99-99-99zM178.5 397.1h666.6v60.1H178.5v-60.1z m666.6 403.5H178.5V570h666.6v230.6z" fill="#52A9FF" p-id="47620"></path><path d="M446.7 682.8H251.1c-20.7 0-37.6-16.9-37.6-37.6 0-20.7 16.9-37.6 37.6-37.6h195.5c20.7 0 37.6 16.9 37.6 37.6 0.1 20.7-16.9 37.6-37.5 37.6z" fill="#00EFEF" p-id="47621"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
1
projects/app/public/imgs/modal/preview.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1700747053101" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="69471" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M512 853.333333c-263.9872 0-477.866667-284.672-477.866667-341.230933C34.133333 471.3472 248.0128 170.666667 512 170.666667c263.918933 0 477.866667 303.445333 477.866667 341.435733C989.7984 568.900267 775.850667 853.333333 512 853.333333z m-6.144-521.1136c-127.658667 0-276.5824 60.279467-276.5824 187.938134s148.8896 174.318933 276.548267 174.318933 279.005867-46.660267 279.005866-174.318933-151.3472-187.938133-279.005866-187.938134z m2.594133 93.7984a79.325867 79.325867 0 0 0 79.223467 79.291734c10.376533 0 19.968-2.1504 29.013333-5.563734 0.341333 3.6864 1.297067 7.202133 1.297067 11.0592a113.220267 113.220267 0 1 1-226.542933 0 113.322667 113.322667 0 0 1 113.220266-113.3568c3.1744 0 6.178133 0.7168 9.216 0.989867-3.345067 8.6016-5.4272 17.749333-5.4272 27.579733z" fill="#85C2FF" p-id="69472"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
1
projects/app/public/imgs/modal/prompt.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1700745656774" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="34698" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M683.776 164.352a55.808 55.808 0 1 0-105.984-34.9184L336.9984 859.648a55.808 55.808 0 1 0 105.984 34.9184L683.8272 164.352zM179.712 327.168l-66.9184-36.5568a33.4848 33.4848 0 0 1 0-58.88L179.712 195.072a9.472 9.472 0 0 0 3.7888-3.7888l36.608-66.9184a33.4848 33.4848 0 0 1 58.88 0l37.9392 69.3248 69.376 37.9392a33.4848 33.4848 0 0 1 0 58.88l-66.9184 36.6592a9.472 9.472 0 0 0-3.7888 3.7376l-36.608 66.9184a33.4848 33.4848 0 0 1-58.88 0l-36.608-66.9184a9.472 9.472 0 0 0-3.7888-3.7376z m591.4624 302.8992l-57.5488-31.488a28.8256 28.8256 0 0 1 0-50.688l57.5488-31.488a8.192 8.192 0 0 0 3.2768-3.2256l31.488-57.6a28.8256 28.8256 0 0 1 50.688 0l32.6144 59.6992 59.648 32.6144a28.7744 28.7744 0 0 1 0 50.688l-57.5488 31.488a8.192 8.192 0 0 0-3.2768 3.2256l-31.488 57.6a28.8256 28.8256 0 0 1-50.688 0l-31.4368-57.6a8.192 8.192 0 0 0-3.2768-3.2256z" p-id="34699" fill="#13227a"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
1
projects/app/public/imgs/modal/quote.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1700627067306" class="icon" viewBox="0 0 1025 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10812" xmlns:xlink="http://www.w3.org/1999/xlink" width="128.125" height="128"><path d="M448 838.4c0 67.2-52.8 121.6-118.4 121.6H118.4C52.8 960 0 905.6 0 838.4v-448C0 209.6 140.8 64 315.2 64h40c20.8 0 40 19.2 40 40v81.6c0 22.4-17.6 40-40 40h-40c-86.4 0-156.8 73.6-156.8 163.2v20.8c0 33.6 27.2 60.8 59.2 60.8h113.6c65.6 0 118.4 54.4 118.4 121.6v246.4z m576 0c0 67.2-52.8 121.6-118.4 121.6H694.4c-65.6 0-118.4-54.4-118.4-121.6v-448C576 209.6 716.8 64 891.2 64h40c20.8 0 40 19.2 40 40v81.6c0 22.4-17.6 40-40 40h-40c-86.4 0-156.8 73.6-156.8 163.2v20.8c0 33.6 27.2 60.8 59.2 60.8h113.6c65.6 0 118.4 54.4 118.4 121.6v246.4z" p-id="10813" fill="#E67E22"></path></svg>
|
||||
|
After Width: | Height: | Size: 910 B |
1
projects/app/public/imgs/modal/readFeedback.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1700745264665" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="27472" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M826 957H342.1c-74.3 0-135-60.8-135-135V338.1c0-74.3 60.8-135 135-135H826c74.3 0 135 60.8 135 135V822c0 74.3-60.8 135-135 135z" fill="#BAD4FF" p-id="27473"></path><path d="M901 452.9c-16.4 0-25.3 13.5-25.3 30v300.4c0 49.7-40.5 94.6-84.6 94.6H230.4c-44.2 0-84.6-46-84.6-95.7V242.7c0-49.7 40.5-94.6 84.6-94.6h313.3c16.5 0 29.8-9 29.8-25.5S560.2 97 543.7 97H230.4c-77.1 0-135.2 62.9-135.2 145.7v540.6c0 82.8 58.2 145.7 135.2 145.7h560.7c77 0 136.3-62.8 136.3-145.7V483c0-16.6-9.9-30.1-26.4-30.1z" fill="#0081FF" p-id="27474"></path><path d="M426.4 441.9l3.1 125.6c0.6 15.5 13 28 28.5 28.8l125.2 2.4h1.3c7.9 0 15.5-3.2 21-8.8L919 275.1c11.6-11.7 10.8-30-0.8-41.7L791.6 105.5c-11.1-11.3-30.9-11.3-42.1 0l-314.3 314c-5.9 5.9-9.1 14-8.8 22.4z m344.2-291.8l105.3 104.5-296.8 296.2-100.7-3.9-4.5-100.6c-0.1 0 296.7-296.2 296.7-296.2z" fill="#0081FF" p-id="27475"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
1
projects/app/public/imgs/modal/shareLight.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1690507057466" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2581" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64"><path d="M816 416a174.816 174.816 0 0 1-133.6-62.624l-219.616 104.672a222.944 222.944 0 0 1-1.216 174.656l173.696 89.984A179.84 179.84 0 1 1 611.2 784l-185.056-96a224 224 0 1 1 2.912-284.8l221.44-105.6A175.552 175.552 0 1 1 816 416z" fill="#3399FF" p-id="2582"></path></svg>
|
||||
|
After Width: | Height: | Size: 596 B |
1
projects/app/public/imgs/modal/team.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1700746143520" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="41570" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M593.9 619.6l-45-45c-17.7 7.1-33.7 15-48.2 23.6v233.4h54.6l38.6-212z" fill="#FFDB69" p-id="41571"></path><path d="M629.3 352.9m-147.8 0a147.8 147.8 0 1 0 295.6 0 147.8 147.8 0 1 0-295.6 0Z" fill="#FFECB6" p-id="41572"></path><path d="M709.6 574.7l-45 45 38.6 212.1H896c0-0.1 6.4-180-186.4-257.1z" fill="#FFDB69" p-id="41573"></path><path d="M629.3 619.6l-32.9-32.9h65.8zM629.3 619.6l-32.2 154.3 32.2 57.8 32.1-57.8zM603.6 510.4c-88.6 0-160.7-72.1-160.7-160.7 0-44.5 14.3-66.4 21.9-78.1l1.6-2.5c2.8-4.5 8.8-5.8 13.3-3s5.8 8.8 3 13.3l-1.7 2.7c-7 10.8-18.8 28.8-18.8 67.6 0 78 63.4 141.4 141.4 141.4S745 427.7 745 349.7s-63.4-141.4-141.4-141.4c-44.8 0-68.5 13.8-90.2 34.4-3.9 3.7-10 3.5-13.6-0.4-3.7-3.9-3.5-10 0.4-13.6 21.7-20.6 49.3-39.7 103.5-39.7 88.6 0 160.7 72.1 160.7 160.7s-72.2 160.7-160.8 160.7z" fill="#F7931E" p-id="41574"></path><path d="M870.3 834.9c-5.3 0-9.6-4.3-9.6-9.6 0-141.7-115.3-257.1-257.1-257.1-39.1 0-72.3 5.7-101.7 17.6-5 2-10.6-0.4-12.5-5.3-2-4.9 0.4-10.6 5.3-12.5 31.7-12.8 67.3-19 108.9-19 152.4 0 276.3 124 276.3 276.3 0 5.3-4.3 9.6-9.6 9.6z" fill="#F7931E" p-id="41575"></path><path d="M430 352.9m-147.8 0a147.8 147.8 0 1 0 295.6 0 147.8 147.8 0 1 0-295.6 0Z" fill="#FFECB6" p-id="41576"></path><path d="M349.7 574.7l45 45-38.6 212.1H163.3c0-0.1-6.4-180 186.4-257.1zM510.4 574.7l-45 45 38.6 212h192.8s6.4-179.9-186.4-257z" fill="#F4BA64" p-id="41577"></path><path d="M430 619.6l-32.9-32.9H463zM430 619.6l-32.1 154.3 32.1 57.8 32.2-57.8z" fill="#F7931E" p-id="41578"></path><path d="M404.3 510.4c-88.6 0-160.7-72.1-160.7-160.7 0-44.5 14.3-66.4 21.9-78.1l1.6-2.5c2.9-4.5 8.8-5.8 13.3-3s5.8 8.8 3 13.3l-1.7 2.7c-7 10.8-18.8 28.8-18.8 67.6 0 78 63.4 141.4 141.4 141.4s141.4-63.4 141.4-141.4-63.4-141.4-141.4-141.4c-44.8 0-68.5 13.8-90.2 34.4-3.9 3.7-10 3.5-13.6-0.4-3.7-3.9-3.5-10 0.4-13.6 21.7-20.6 49.3-39.7 103.5-39.7 88.6 0 160.7 72.1 160.7 160.7s-72.2 160.7-160.8 160.7zM671 834.9c-5.3 0-9.6-4.3-9.6-9.6 0-141.7-115.3-257.1-257.1-257.1-68.4 0-121.2 18.1-161.5 55.3-3.9 3.6-10 3.4-13.6-0.5-3.6-3.9-3.4-10 0.5-13.6 44-40.7 101.1-60.4 174.6-60.4 152.4 0 276.3 124 276.3 276.3 0.1 5.3-4.2 9.6-9.6 9.6z" fill="" p-id="41579"></path><path d="M137.6 834.9c-5.3 0-9.6-4.3-9.6-9.6 0-74.6 19.3-129.1 62.6-176.7 3.6-3.9 9.7-4.2 13.6-0.7 3.9 3.6 4.2 9.7 0.7 13.6-40.4 44.5-57.6 93.4-57.6 163.8 0 5.3-4.3 9.6-9.7 9.6z" fill="" p-id="41580"></path></svg>
|
||||
|
After Width: | Height: | Size: 2.6 KiB |
1
projects/app/public/imgs/modal/txt.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1700746633907" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="59866" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M384.8192 785.6128c20.7872-25.8048 45.2608-49.4592 68.5056-73.1136 63.2832-64.4096 126.6688-128.9216 189.952-193.3312 59.0848-60.1088 118.1696-120.2176 177.152-180.3264 13.2096-13.4144 25.8048-29.7984 40.5504-41.472 15.36-12.0832 25.6-4.5056 37.5808 7.7824 10.5472 10.8544 20.7872 22.016 31.1296 32.9728 2.3552 2.56 15.9744 13.2096 15.9744 16.896 0 0-0.3072-258.4576-0.3072-258.4576 0-38.6048-31.4368-70.0416-70.0416-70.0416L135.7824 26.5216c-38.6048 0-70.0416 31.4368-70.0416 70.0416l0 812.6464c0 38.6048 31.4368 70.0416 70.0416 70.0416l183.7056 0.9216 36.4544-136.704C356.0448 843.4688 364.544 810.8032 384.8192 785.6128zM461.2096 432.2304 207.36 432.2304c-11.9808 0-21.7088-9.728-21.7088-21.7088 0-11.9808 9.728-21.7088 21.7088-21.7088l253.8496 0c11.9808 0 21.7088 9.728 21.7088 21.7088C483.0208 422.5024 473.1904 432.2304 461.2096 432.2304zM637.952 317.6448 207.36 317.6448c-11.9808 0-21.7088-9.728-21.7088-21.7088 0-11.9808 9.728-21.7088 21.7088-21.7088L637.952 274.2272c11.9808 0 21.7088 9.728 21.7088 21.7088C659.6608 307.9168 649.9328 317.6448 637.952 317.6448zM758.1696 202.9568 207.36 202.9568c-11.9808 0-21.7088-9.728-21.7088-21.7088 0-11.9808 9.728-21.7088 21.7088-21.7088l550.8096 0c11.9808 0 21.7088 9.728 21.7088 21.7088C779.8784 193.2288 770.1504 202.9568 758.1696 202.9568z" fill="#FF9000" p-id="59867"></path><path d="M992.5632 501.4528 891.4944 400.384c-10.752-10.752-29.5936-10.752-40.3456 0L428.2368 823.0912c-1.7408 1.7408-3.072 3.9936-3.6864 6.3488l-42.2912 151.6544c-1.3312 4.8128-0.1024 10.0352 3.2768 13.7216 2.7648 2.9696 6.656 4.7104 10.6496 4.7104 0.9216 0 1.7408-0.1024 2.6624-0.2048L562.176 968.704c2.8672-0.512 5.5296-1.9456 7.5776-3.9936l422.912-422.8096C1003.7248 530.7392 1003.7248 512.6144 992.5632 501.4528zM927.1296 585.3184c-5.4272 5.4272-13.9264 5.7344-19.0464 0.6144l-100.864-100.864c-5.12-5.12-4.8128-13.6192 0.6144-19.0464 5.4272-5.4272 14.0288-5.7344 19.0464-0.6144l100.864 100.864C932.864 571.2896 932.5568 579.8912 927.1296 585.3184z" fill="#FF9000" p-id="59868"></path></svg>
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
1
projects/app/public/imgs/modal/wholeRecord.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1700705708636" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="23671" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M179.5 890.1C116.4 890.1 65 838.7 65 775.6V371.4c0-63.1 51.4-114.5 114.5-114.5h561.6c63.1 0 114.5 51.4 114.5 114.5v404.2c0 63.1-51.4 114.5-114.5 114.5H179.5z m0-584.6c-36.4 0-65.9 29.6-65.9 65.9v404.2c0 36.4 29.6 65.9 65.9 65.9h561.6c36.4 0 66-29.6 66-65.9V371.4c0-36.4-29.6-65.9-66-65.9H179.5z" fill="#6B400D" p-id="23672"></path><path d="M521.3 511H195.2c-1.6 0-2.8-1.3-2.8-2.8v-44.1c0-1.6 1.3-2.8 2.8-2.8h326.1c1.6 0 2.8 1.3 2.8 2.8v44.1c0 1.6-1.2 2.8-2.8 2.8zM521.3 685.7H195.2c-1.6 0-2.8-1.3-2.8-2.8v-44.1c0-1.6 1.3-2.8 2.8-2.8h326.1c1.6 0 2.8 1.3 2.8 2.8v44.1c0 1.5-1.2 2.8-2.8 2.8zM625 547.1c-4.9 0-9.4-1.9-12.9-5.4l-48.6-48.8c-7.1-7.1-7.1-18.7 0-25.8 3.4-3.4 8-5.3 12.9-5.3s9.4 1.9 12.9 5.3l35.8 35.9 72.2-72.5c3.4-3.5 8-5.3 12.9-5.3s9.4 1.9 12.9 5.3c7.1 7.1 7.1 18.7 0 25.8L638 541.7c-3.6 3.5-8.2 5.4-13 5.4zM625 721.8c-4.9 0-9.4-1.9-12.9-5.4l-48.6-48.8c-7.1-7.1-7.1-18.7 0-25.8 3.4-3.4 8-5.3 12.9-5.3s9.4 1.9 12.9 5.3l35.8 35.9 72.2-72.5c3.4-3.5 8-5.3 12.9-5.3s9.4 1.9 12.9 5.3c7.1 7.1 7.1 18.7 0 25.8L638 716.4c-3.6 3.5-8.2 5.4-13 5.4z" fill="#6B400D" p-id="23673"></path><path d="M853.5 371.4c0-62-50.4-112.4-112.4-112.4H179.5c-2.7 0-5.4 0.2-8.1 0.4l-1.1 0.1-0.3-1.1v-4.9c0-63.1 51.4-114.5 114.5-114.5h561.6c63.1 0 114.5 51.4 114.5 114.5v404.2c0 59.5-46.5 109.6-105.9 114.1l-1.1 0.1V371.4z" fill="#6B400D" p-id="23674"></path><path d="M846.1 186.5H284.5c-36.9 0-67 30-67 67v4.5H741c62.6 0 113.5 50.9 113.5 113.5v352.3c32.9-4.2 58.5-32.1 58.5-66.1V253.5c0-37-30-67-66.9-67z" fill="#FFD524" p-id="23675"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
BIN
projects/app/public/imgs/module/templates.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
@@ -31,9 +31,8 @@
|
||||
"Export Config Successful": "The configuration has been copied. Please check for important data",
|
||||
"Export Configs": "Export Configs",
|
||||
"Feedback Count": "User Feedback",
|
||||
"Import Config": "Import Config",
|
||||
"Import Config Failed": "Failed to import the configuration, please ensure that the configuration is normal!",
|
||||
"Import Configs": "Import Configs",
|
||||
"Import Configs Failed": "Failed to import the configuration, please ensure that the configuration is normal!",
|
||||
"Input Field Settings": "Input Field Settings",
|
||||
"Logs Empty": "Logs is empty",
|
||||
"Logs Message Total": "Message Count",
|
||||
@@ -54,15 +53,7 @@
|
||||
"My Modules": "My Custom Modules",
|
||||
"No Modules": "No module",
|
||||
"System Module": "System Module",
|
||||
"type": "{{type}}\n{{example}}",
|
||||
"valueType": {
|
||||
"any": "any",
|
||||
"boolean": "boolean",
|
||||
"chatHistory": "Chat History",
|
||||
"datasetQuote": "Dataset Quote",
|
||||
"number": "number",
|
||||
"string": "string"
|
||||
}
|
||||
"type": "{{type}}\n{{example}}"
|
||||
},
|
||||
"modules": {
|
||||
"Title is required": "Title is required"
|
||||
@@ -115,9 +106,11 @@
|
||||
"module model": "Model",
|
||||
"module name": "Name",
|
||||
"module price": "Price",
|
||||
"module query": "Question/Query",
|
||||
"module question": "Question",
|
||||
"module quoteList": "Quotes",
|
||||
"module runningTime": "Time",
|
||||
"module search query": "Query",
|
||||
"module search response": "Search Result",
|
||||
"module similarity": "Similarity",
|
||||
"module temperature": "Temperature",
|
||||
@@ -129,12 +122,14 @@
|
||||
},
|
||||
"common": {
|
||||
"Add": "Add",
|
||||
"Add New": "Add",
|
||||
"Back": "Back",
|
||||
"Beta": "Beta",
|
||||
"Business edition features": "This is the commercial version function ~",
|
||||
"Choose": "Choose",
|
||||
"Close": "Close",
|
||||
"Collect": "Collect",
|
||||
"Confirm": "Confirm",
|
||||
"Confirm Create": "Create",
|
||||
"Confirm Move": "Move here",
|
||||
"Confirm Update": "Update",
|
||||
@@ -174,6 +169,7 @@
|
||||
"Rename Failed": "Rename Failed",
|
||||
"Rename Success": "Rename Success",
|
||||
"Request Error": "Request Error",
|
||||
"Require Input": "Required",
|
||||
"Save Failed": "Save Failed",
|
||||
"Save Success": "Save Success",
|
||||
"Search": "Search",
|
||||
@@ -222,6 +218,11 @@
|
||||
"Select TTS": "Select TTS",
|
||||
"TTS": "Audio Speech",
|
||||
"TTS Tip": "After this function is enabled, the voice playback function can be used after each conversation. Use of this feature may incur additional charges.",
|
||||
"create app": "Create App",
|
||||
"setting": "App Setting",
|
||||
"simple": {
|
||||
"mode template select": "Template"
|
||||
},
|
||||
"tts": {
|
||||
"Close": "NoUse",
|
||||
"Model alloy": "Female - Alloy",
|
||||
@@ -249,6 +250,7 @@
|
||||
},
|
||||
"dataset": {
|
||||
"Choose Dataset": "Choose Dataset",
|
||||
"Create dataset": "Create Dataset",
|
||||
"Dataset": "Dataset",
|
||||
"Go Dataset": "To Dataset",
|
||||
"Quote Length": "Quote Length",
|
||||
@@ -260,6 +262,65 @@
|
||||
"Edit": "Edit Data",
|
||||
"id": "Data ID"
|
||||
}
|
||||
},
|
||||
"module": {
|
||||
"Data Type": "Data Type",
|
||||
"Field Description": "Description",
|
||||
"Field Name": "Name",
|
||||
"Field Type": "Type",
|
||||
"Field key": "Key",
|
||||
"Input Type": "Input Type",
|
||||
"Plugin output must connect": "Custom outputs must all be connected",
|
||||
"Variable": "Variable",
|
||||
"Variable Setting": "Variable Setting",
|
||||
"input": {
|
||||
"label": {
|
||||
"chat history": "",
|
||||
"switch": "",
|
||||
"user question": ""
|
||||
}
|
||||
},
|
||||
"inputType": {
|
||||
"input": "Input",
|
||||
"selectApp": "App Selector",
|
||||
"selectChatModel": "Select Chat Model",
|
||||
"selectDataset": "Dataset Selector",
|
||||
"switch": "Switch",
|
||||
"target": "Target Data",
|
||||
"textarea": "Textarea"
|
||||
},
|
||||
"output": {
|
||||
"description": {
|
||||
"running done": "running done"
|
||||
},
|
||||
"label": {
|
||||
"running done": "running done"
|
||||
}
|
||||
},
|
||||
"valueType": {
|
||||
"any": "Any",
|
||||
"boolean": "Boolean",
|
||||
"chatHistory": "History",
|
||||
"datasetQuote": "Dataset Quote",
|
||||
"number": "Number",
|
||||
"selectApp": "Select App",
|
||||
"selectDataset": "Select Dataset",
|
||||
"string": "String"
|
||||
},
|
||||
"variable": {
|
||||
"add option": "Add Option",
|
||||
"key": "Key",
|
||||
"key is required": "variable key is required",
|
||||
"select type": "Select",
|
||||
"text max length": "Max Length",
|
||||
"text type": "Text",
|
||||
"variable key is required": "",
|
||||
"variable name": "Name",
|
||||
"variable name is required": "variable name is required",
|
||||
"variable option is required": "Variable option is required",
|
||||
"variable option is value is required": "Variable option is value is required",
|
||||
"variable options": "Options"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dataset": {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"app": {
|
||||
"AI Advanced Settings": "AI 高级配置",
|
||||
"AI Settings": "AI 配置",
|
||||
"Advance App TestTip": "当前应用为高级编排模式\n如需切换为【简易模式】请点击左侧保存按键",
|
||||
"Advance App TestTip": "当前应用可能为高级编排模式\n如需切换为【简易模式】请点击左侧保存按键",
|
||||
"App Detail": "应用详情",
|
||||
"Basic Settings": "基本信息",
|
||||
"Chat Debug": "调试预览",
|
||||
@@ -31,9 +31,8 @@
|
||||
"Export Config Successful": "已复制配置,请注意检查是否有重要数据",
|
||||
"Export Configs": "导出配置",
|
||||
"Feedback Count": "用户反馈",
|
||||
"Import Config": "导入配置",
|
||||
"Import Config Failed": "导入配置失败,请确保配置正常!",
|
||||
"Import Configs": "导入配置",
|
||||
"Import Configs Failed": "导入配置失败,请确保配置正常!",
|
||||
"Input Field Settings": "输入字段编辑",
|
||||
"Logs Empty": "还没有日志噢~",
|
||||
"Logs Message Total": "消息总数",
|
||||
@@ -54,15 +53,7 @@
|
||||
"My Modules": "",
|
||||
"No Modules": "还没有模块~",
|
||||
"System Module": "系统模块",
|
||||
"type": "\"{{type}}\"类型\n{{example}}",
|
||||
"valueType": {
|
||||
"any": "任意",
|
||||
"boolean": "布尔",
|
||||
"chatHistory": "聊天记录",
|
||||
"datasetQuote": "引用内容",
|
||||
"number": "数字",
|
||||
"string": "字符串"
|
||||
}
|
||||
"type": "\"{{type}}\"类型\n{{example}}"
|
||||
},
|
||||
"modules": {
|
||||
"Title is required": "模块名不能为空"
|
||||
@@ -115,9 +106,11 @@
|
||||
"module model": "模型",
|
||||
"module name": "模型名",
|
||||
"module price": "计费",
|
||||
"module query": "问题/检索词",
|
||||
"module question": "问题",
|
||||
"module quoteList": "引用内容",
|
||||
"module runningTime": "运行时长",
|
||||
"module search query": "检索词",
|
||||
"module search response": "搜索结果",
|
||||
"module similarity": "相似度",
|
||||
"module temperature": "温度",
|
||||
@@ -129,12 +122,14 @@
|
||||
},
|
||||
"common": {
|
||||
"Add": "添加",
|
||||
"Add New": "新增",
|
||||
"Back": "返回",
|
||||
"Beta": "实验版",
|
||||
"Business edition features": "这是商业版功能~",
|
||||
"Choose": "选择",
|
||||
"Close": "关闭",
|
||||
"Collect": "收藏",
|
||||
"Confirm": "确认",
|
||||
"Confirm Create": "确认创建",
|
||||
"Confirm Move": "移动到这",
|
||||
"Confirm Update": "确认更新",
|
||||
@@ -174,6 +169,7 @@
|
||||
"Rename Failed": "重命名失败",
|
||||
"Rename Success": "重命名成功",
|
||||
"Request Error": "请求异常",
|
||||
"Require Input": "必填",
|
||||
"Save Failed": "保存失败",
|
||||
"Save Success": "保存成功",
|
||||
"Search": "搜索",
|
||||
@@ -222,6 +218,11 @@
|
||||
"Select TTS": "选择语音播放模式",
|
||||
"TTS": "语音播报",
|
||||
"TTS Tip": "开启后,每次对话后可使用语音播放功能。使用该功能可能产生额外费用。",
|
||||
"create app": "创建属于你的 AI 应用",
|
||||
"setting": "应用信息设置",
|
||||
"simple": {
|
||||
"mode template select": "简易模板"
|
||||
},
|
||||
"tts": {
|
||||
"Close": "不使用",
|
||||
"Model alloy": "女声 - Alloy",
|
||||
@@ -249,6 +250,7 @@
|
||||
},
|
||||
"dataset": {
|
||||
"Choose Dataset": "关联知识库",
|
||||
"Create dataset": "创建一个知识库",
|
||||
"Dataset": "知识库",
|
||||
"Go Dataset": "前往知识库",
|
||||
"Quote Length": "引用内容长度",
|
||||
@@ -260,6 +262,65 @@
|
||||
"Edit": "编辑数据",
|
||||
"id": "数据ID"
|
||||
}
|
||||
},
|
||||
"module": {
|
||||
"Data Type": "数据类型",
|
||||
"Field Description": "字段描述",
|
||||
"Field Name": "字段名",
|
||||
"Field Type": "字段类型",
|
||||
"Field key": "字段 Key",
|
||||
"Input Type": "输入类型",
|
||||
"Plugin output must connect": "自定义输出必须全部连接",
|
||||
"Variable": "参数变量",
|
||||
"Variable Setting": "变量设置",
|
||||
"input": {
|
||||
"label": {
|
||||
"chat history": "聊天记录",
|
||||
"switch": "触发器",
|
||||
"user question": "用户问题"
|
||||
}
|
||||
},
|
||||
"inputType": {
|
||||
"input": "输入框",
|
||||
"selectApp": "应用选择",
|
||||
"selectChatModel": "对话模型选择",
|
||||
"selectDataset": "知识库选择",
|
||||
"switch": "开关",
|
||||
"target": "外部数据",
|
||||
"textarea": "段落输入"
|
||||
},
|
||||
"output": {
|
||||
"description": {
|
||||
"running done": "模块调用结束时触发"
|
||||
},
|
||||
"label": {
|
||||
"running done": "模块调用结束"
|
||||
}
|
||||
},
|
||||
"valueType": {
|
||||
"any": "任意",
|
||||
"boolean": "布尔",
|
||||
"chatHistory": "聊天记录",
|
||||
"datasetQuote": "引用内容",
|
||||
"number": "数字",
|
||||
"selectApp": "应用选择",
|
||||
"selectDataset": "知识库选择",
|
||||
"string": "字符串"
|
||||
},
|
||||
"variable": {
|
||||
"add option": "添加选项",
|
||||
"key": "变量 key",
|
||||
"key is required": "",
|
||||
"select type": "下拉单选",
|
||||
"text max length": "最大长度",
|
||||
"text type": "文本",
|
||||
"variable key is required": "变量 key 不能为空",
|
||||
"variable name": "变量名",
|
||||
"variable name is required": "变量名不能为空",
|
||||
"variable option is required": "选项不能全空",
|
||||
"variable option is value is required": "选项内容不能为空",
|
||||
"variable options": "选项"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dataset": {
|
||||
|
||||
27
projects/app/public/simpleTemplates/fastgpt-simple.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "极简模板",
|
||||
"desc": "极简模板\n已内置参数细节",
|
||||
"systemForm": {
|
||||
"aiSettings": {
|
||||
"model": true,
|
||||
"systemPrompt": true,
|
||||
"temperature": false,
|
||||
"maxToken": false,
|
||||
"quoteTemplate": false,
|
||||
"quotePrompt": false
|
||||
},
|
||||
"dataset": {
|
||||
"datasets": true,
|
||||
"similarity": false,
|
||||
"limit": false,
|
||||
"rerank": false,
|
||||
"searchEmptyText": false
|
||||
},
|
||||
"userGuide": {
|
||||
"welcomeText": true,
|
||||
"variables": false,
|
||||
"questionGuide": false,
|
||||
"tts": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import { Image } from '@chakra-ui/react';
|
||||
import type { ImageProps } from '@chakra-ui/react';
|
||||
import { LOGO_ICON } from '@fastgpt/global/core/chat/constants';
|
||||
|
||||
const Avatar = ({ w = '30px', ...props }: ImageProps) => {
|
||||
const Avatar = ({ w = '30px', src, ...props }: ImageProps) => {
|
||||
return (
|
||||
<Image
|
||||
fallbackSrc={LOGO_ICON}
|
||||
@@ -14,6 +14,7 @@ const Avatar = ({ w = '30px', ...props }: ImageProps) => {
|
||||
w={w}
|
||||
h={w}
|
||||
p={'1px'}
|
||||
src={src || LOGO_ICON}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { ModalBody, Box, useTheme } from '@chakra-ui/react';
|
||||
import { ModalBody, Box, useTheme, Flex, Image } from '@chakra-ui/react';
|
||||
import { ChatItemType } from '@fastgpt/global/core/chat/type';
|
||||
import MyModal from '../MyModal';
|
||||
|
||||
@@ -16,13 +16,13 @@ const ContextModal = ({
|
||||
<MyModal
|
||||
isOpen={true}
|
||||
onClose={onClose}
|
||||
iconSrc="/imgs/modal/chatHistory.svg"
|
||||
title={`完整对话记录(${context.length}条)`}
|
||||
h={['90vh', '80vh']}
|
||||
minW={['90vw', '600px']}
|
||||
isCentered
|
||||
>
|
||||
<ModalBody
|
||||
pt={0}
|
||||
whiteSpace={'pre-wrap'}
|
||||
textAlign={'justify'}
|
||||
wordBreak={'break-all'}
|
||||
|
||||
@@ -33,7 +33,12 @@ const FeedbackModal = ({
|
||||
});
|
||||
|
||||
return (
|
||||
<MyModal isOpen={true} onClose={onClose} title={t('chat.Feedback Modal')}>
|
||||
<MyModal
|
||||
isOpen={true}
|
||||
onClose={onClose}
|
||||
iconSrc="/imgs/modal/badAnswer.svg"
|
||||
title={t('chat.Feedback Modal')}
|
||||
>
|
||||
<ModalBody>
|
||||
<Textarea
|
||||
ref={ref}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useCallback, useMemo, useState } from 'react';
|
||||
import { ModalBody, Box, useTheme, Flex, Progress, Link } from '@chakra-ui/react';
|
||||
import { ModalBody, Box, useTheme, Flex, Progress, Link, Image } from '@chakra-ui/react';
|
||||
import { getDatasetDataItemById } from '@/web/core/dataset/api';
|
||||
import { useLoading } from '@/web/common/hooks/useLoading';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
@@ -68,6 +68,7 @@ const QuoteModal = ({
|
||||
h={['90vh', '80vh']}
|
||||
isCentered
|
||||
minW={['90vw', '600px']}
|
||||
iconSrc="/imgs/modal/quote.svg"
|
||||
title={
|
||||
<Box>
|
||||
知识库引用({rawSearch.length}条)
|
||||
@@ -77,7 +78,7 @@ const QuoteModal = ({
|
||||
</Box>
|
||||
}
|
||||
>
|
||||
<ModalBody pt={0} whiteSpace={'pre-wrap'} textAlign={'justify'} wordBreak={'break-all'}>
|
||||
<ModalBody whiteSpace={'pre-wrap'} textAlign={'justify'} wordBreak={'break-all'}>
|
||||
{rawSearch.map((item, i) => (
|
||||
<Box
|
||||
key={i}
|
||||
|
||||
@@ -36,7 +36,12 @@ const ReadFeedbackModal = ({
|
||||
});
|
||||
|
||||
return (
|
||||
<MyModal isOpen={true} onClose={onClose} title={t('chat.Feedback Modal')}>
|
||||
<MyModal
|
||||
isOpen={true}
|
||||
onClose={onClose}
|
||||
iconSrc="/imgs/modal/readFeedback.svg"
|
||||
title={t('chat.Feedback Modal')}
|
||||
>
|
||||
<ModalBody>{content}</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button mr={2} isLoading={isLoading} variant={'base'} onClick={mutate}>
|
||||
|
||||
@@ -35,7 +35,7 @@ const SelectMarkCollection = ({
|
||||
const theme = useTheme();
|
||||
const [selectedDatasetId, setSelectedDatasetId] = useState<string>();
|
||||
const [selectedDatasetCollectionIds, setSelectedDatasetCollectionIds] = useState<string[]>([]);
|
||||
const { paths, parentId, setParentId, datasets, isLoading } = useDatasetSelect();
|
||||
const { paths, parentId, setParentId, datasets, isFetching } = useDatasetSelect();
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -107,7 +107,7 @@ const SelectMarkCollection = ({
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button
|
||||
isLoading={isLoading}
|
||||
isLoading={isFetching}
|
||||
isDisabled={!selectedDatasetId}
|
||||
onClick={() => {
|
||||
setAdminMarkData({ ...adminMarkData, datasetId: selectedDatasetId });
|
||||
|
||||
@@ -2,31 +2,33 @@ import React, { useMemo, useState } from 'react';
|
||||
import { Box, useTheme, Flex, Image } from '@chakra-ui/react';
|
||||
import type { ChatHistoryItemResType } from '@fastgpt/global/core/chat/api.d';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { ModuleTemplatesFlat } from '@/constants/flow/ModuleTemplate';
|
||||
import { moduleTemplatesFlat } from '@/web/core/modules/template/system';
|
||||
import Tabs from '../Tabs';
|
||||
|
||||
import MyModal from '../MyModal';
|
||||
import MyTooltip from '../MyTooltip';
|
||||
import { QuestionOutlineIcon } from '@chakra-ui/icons';
|
||||
import { formatPrice } from '@fastgpt/global/support/wallet/bill/tools';
|
||||
import Markdown from '../Markdown';
|
||||
|
||||
function Row({ label, value }: { label: string; value?: string | number | React.ReactNode }) {
|
||||
function Row({ label, value }: { label: string; value?: string | number }) {
|
||||
const theme = useTheme();
|
||||
const strValue = `${value}`;
|
||||
const isCodeBlock = strValue.startsWith('~~~json');
|
||||
|
||||
return value !== undefined && value !== '' && value !== 'undefined' ? (
|
||||
<Box mb={2}>
|
||||
<Box fontSize={['sm', 'md']} mb={1} flex={'0 0 90px'}>
|
||||
<Box mb={3}>
|
||||
<Box fontSize={['sm', 'md']} mb={isCodeBlock ? 0 : 1} flex={'0 0 90px'}>
|
||||
{label}:
|
||||
</Box>
|
||||
<Box
|
||||
borderRadius={'lg'}
|
||||
border={theme.borders.base}
|
||||
px={3}
|
||||
py={1}
|
||||
position={'relative'}
|
||||
whiteSpace={'pre-wrap'}
|
||||
borderRadius={'md'}
|
||||
fontSize={'sm'}
|
||||
{...(isCodeBlock
|
||||
? { transform: 'translateY(-3px)' }
|
||||
: { px: 3, py: 1, border: theme.borders.base })}
|
||||
>
|
||||
{value}
|
||||
<Markdown source={strValue} />
|
||||
</Box>
|
||||
</Box>
|
||||
) : null;
|
||||
@@ -39,7 +41,6 @@ const WholeResponseModal = ({
|
||||
response: ChatHistoryItemResType[];
|
||||
onClose: () => void;
|
||||
}) => {
|
||||
const theme = useTheme();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const list = useMemo(
|
||||
@@ -51,7 +52,8 @@ const WholeResponseModal = ({
|
||||
mr={2}
|
||||
src={
|
||||
item.moduleLogo ||
|
||||
ModuleTemplatesFlat.find((template) => item.moduleType === template.flowType)?.logo
|
||||
moduleTemplatesFlat.find((template) => item.moduleType === template.flowType)
|
||||
?.avatar
|
||||
}
|
||||
alt={''}
|
||||
w={['14px', '16px']}
|
||||
@@ -75,6 +77,7 @@ const WholeResponseModal = ({
|
||||
onClose={onClose}
|
||||
h={['90vh', '80vh']}
|
||||
w={['90vw', '500px']}
|
||||
iconSrc="/imgs/modal/wholeRecord.svg"
|
||||
title={
|
||||
<Flex alignItems={'center'}>
|
||||
{t('chat.Complete Response')}
|
||||
@@ -102,37 +105,26 @@ const WholeResponseModal = ({
|
||||
/>
|
||||
<Row label={t('chat.response.module tokens')} value={`${activeModule?.tokens}`} />
|
||||
<Row label={t('chat.response.module model')} value={activeModule?.model} />
|
||||
<Row label={t('chat.response.module query')} value={activeModule?.query} />
|
||||
|
||||
{/* ai chat */}
|
||||
<Row label={t('chat.response.module question')} value={activeModule?.question} />
|
||||
<Row label={t('chat.response.module temperature')} value={activeModule?.temperature} />
|
||||
<Row label={t('chat.response.module maxToken')} value={activeModule?.maxToken} />
|
||||
<Row
|
||||
label={t('chat.response.module quoteList')}
|
||||
value={(() => {
|
||||
try {
|
||||
JSON.stringify(activeModule.quoteList, null, 2);
|
||||
} catch (error) {
|
||||
return '';
|
||||
}
|
||||
})()}
|
||||
/>
|
||||
<Row
|
||||
label={t('chat.response.module historyPreview')}
|
||||
value={(() => {
|
||||
if (!activeModule?.historyPreview) return '';
|
||||
return (
|
||||
<>
|
||||
{activeModule.historyPreview.map((item, i) => (
|
||||
<Box key={i} _notLast={{ mb: 3, borderBottom: theme.borders.base }} pb={3}>
|
||||
<Box fontWeight={'bold'}>{item.obj}</Box>
|
||||
<Box>{item.value}</Box>
|
||||
</Box>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
return activeModule.historyPreview
|
||||
.map((item, i) => `**${item.obj}**\n${item.value}`)
|
||||
.join('\n---\n');
|
||||
})()}
|
||||
/>
|
||||
{activeModule.quoteList && activeModule.quoteList.length > 0 && (
|
||||
<Row
|
||||
label={t('chat.response.module quoteList')}
|
||||
value={`~~~json\n${JSON.stringify(activeModule.quoteList, null, 2)}`}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* dataset search */}
|
||||
<Row label={t('chat.response.module similarity')} value={activeModule?.similarity} />
|
||||
@@ -143,15 +135,7 @@ const WholeResponseModal = ({
|
||||
label={t('chat.response.module cq')}
|
||||
value={(() => {
|
||||
if (!activeModule?.cqList) return '';
|
||||
return (
|
||||
<Box as={'ol'} px={3}>
|
||||
{activeModule.cqList.map((item) => (
|
||||
<Box key={item.key} as={'li'}>
|
||||
{item.value}
|
||||
</Box>
|
||||
))}
|
||||
</Box>
|
||||
);
|
||||
return activeModule.cqList.map((item) => `* ${item.value}`).join('\n');
|
||||
})()}
|
||||
/>
|
||||
<Row label={t('chat.response.module cq result')} value={activeModule?.cqResult} />
|
||||
@@ -161,50 +145,34 @@ const WholeResponseModal = ({
|
||||
label={t('chat.response.module extract description')}
|
||||
value={activeModule?.extractDescription}
|
||||
/>
|
||||
<Row
|
||||
label={t('chat.response.module extract result')}
|
||||
value={(() => {
|
||||
try {
|
||||
return JSON.stringify(activeModule?.extractResult, null, 2);
|
||||
} catch (error) {
|
||||
return '';
|
||||
}
|
||||
})()}
|
||||
/>
|
||||
{activeModule?.extractResult && (
|
||||
<Row
|
||||
label={t('chat.response.module extract result')}
|
||||
value={`~~~json\n${JSON.stringify(activeModule?.extractResult, null, 2)}`}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* http */}
|
||||
<Row
|
||||
label={t('chat.response.module http body')}
|
||||
value={(() => {
|
||||
try {
|
||||
return JSON.stringify(activeModule?.body, null, 2);
|
||||
} catch (error) {
|
||||
return '';
|
||||
}
|
||||
})()}
|
||||
/>
|
||||
<Row
|
||||
label={t('chat.response.module http result')}
|
||||
value={(() => {
|
||||
try {
|
||||
return JSON.stringify(activeModule?.httpResult, null, 2);
|
||||
} catch (error) {
|
||||
return '';
|
||||
}
|
||||
})()}
|
||||
/>
|
||||
{activeModule?.body && (
|
||||
<Row
|
||||
label={t('chat.response.module http body')}
|
||||
value={`~~~json\n${JSON.stringify(activeModule?.body, null, 2)}`}
|
||||
/>
|
||||
)}
|
||||
{activeModule?.httpResult && (
|
||||
<Row
|
||||
label={t('chat.response.module http result')}
|
||||
value={`~~~json\n${JSON.stringify(activeModule?.httpResult, null, 2)}`}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* plugin */}
|
||||
<Row
|
||||
label={t('chat.response.plugin output')}
|
||||
value={(() => {
|
||||
try {
|
||||
return JSON.stringify(activeModule?.pluginOutput, null, 2);
|
||||
} catch (error) {
|
||||
return '';
|
||||
}
|
||||
})()}
|
||||
/>
|
||||
{activeModule?.pluginOutput && (
|
||||
<Row
|
||||
label={t('chat.response.plugin output')}
|
||||
value={`~~~json\n${JSON.stringify(activeModule?.pluginOutput, null, 2)}`}
|
||||
/>
|
||||
)}
|
||||
</Box>
|
||||
</Flex>
|
||||
</MyModal>
|
||||
|
||||
@@ -33,14 +33,13 @@ import { eventBus } from '@/web/common/utils/eventbus';
|
||||
import { adaptChat2GptMessages } from '@fastgpt/global/core/chat/adapt';
|
||||
import { useMarkdown } from '@/web/common/hooks/useMarkdown';
|
||||
import { ModuleItemType } from '@fastgpt/global/core/module/type.d';
|
||||
import { VariableInputEnum } from '@/constants/app';
|
||||
import { VariableInputEnum } from '@fastgpt/global/core/module/constants';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import type { ChatMessageItemType } from '@fastgpt/global/core/ai/type.d';
|
||||
import { fileDownload } from '@/web/common/file/utils';
|
||||
import { htmlTemplate } from '@/constants/common';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { TaskResponseKeyEnum } from '@fastgpt/global/core/chat/constants';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { customAlphabet } from 'nanoid';
|
||||
import { adminUpdateChatFeedback, userUpdateChatFeedback } from '@/web/core/chat/api';
|
||||
@@ -60,9 +59,10 @@ const SelectMarkCollection = dynamic(() => import('./SelectMarkCollection'));
|
||||
|
||||
import styles from './index.module.scss';
|
||||
import { postQuestionGuide } from '@/web/core/ai/api';
|
||||
import { splitGuideModule } from '@/global/core/app/modules/utils';
|
||||
import { AppTTSConfigType } from '@/types/app';
|
||||
import { splitGuideModule } from '@fastgpt/global/core/module/utils';
|
||||
import type { AppTTSConfigType } from '@fastgpt/global/core/module/type.d';
|
||||
import MessageInput from './MessageInput';
|
||||
import { ModuleOutputKeyEnum } from '@fastgpt/global/core/module/constants';
|
||||
|
||||
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 24);
|
||||
|
||||
@@ -105,7 +105,7 @@ type Props = {
|
||||
onUpdateVariable?: (e: Record<string, any>) => void;
|
||||
onStartChat?: (e: StartChatFnProps) => Promise<{
|
||||
responseText: string;
|
||||
[TaskResponseKeyEnum.responseData]: ChatHistoryItemResType[];
|
||||
[ModuleOutputKeyEnum.responseData]: ChatHistoryItemResType[];
|
||||
isNewChat?: boolean;
|
||||
}>;
|
||||
onDelMessage?: (e: { contentId?: string; index: number }) => void;
|
||||
@@ -760,6 +760,9 @@ const ChatBox = (
|
||||
variant={'outline'}
|
||||
colorScheme={'gray'}
|
||||
size={'xs'}
|
||||
whiteSpace={'pre-wrap'}
|
||||
h={'auto'}
|
||||
py={1}
|
||||
onClick={() => {
|
||||
resetInputVal(item);
|
||||
}}
|
||||
|
||||
@@ -13,7 +13,12 @@ const md = `
|
||||
const CommunityModal = ({ onClose }: { onClose: () => void }) => {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<MyModal isOpen={true} onClose={onClose} title={t('home.Community')}>
|
||||
<MyModal
|
||||
isOpen={true}
|
||||
onClose={onClose}
|
||||
iconSrc="/imgs/modal/concat.svg"
|
||||
title={t('home.Community')}
|
||||
>
|
||||
<ModalBody textAlign={'center'}>
|
||||
<Markdown source={md} />
|
||||
</ModalBody>
|
||||
|
||||
@@ -8,6 +8,7 @@ const unAuthPage: { [key: string]: boolean } = {
|
||||
'/': true,
|
||||
'/login': true,
|
||||
'/login/provider': true,
|
||||
'/login/fastlogin': true,
|
||||
'/appStore': true,
|
||||
'/chat/share': true
|
||||
};
|
||||
|
||||
@@ -22,6 +22,7 @@ const pcUnShowLayoutRoute: Record<string, boolean> = {
|
||||
'/': true,
|
||||
'/login': true,
|
||||
'/login/provider': true,
|
||||
'/login/fastlogin': true,
|
||||
'/chat/share': true,
|
||||
'/app/edit': true,
|
||||
'/chat': true
|
||||
@@ -30,6 +31,7 @@ const phoneUnShowLayoutRoute: Record<string, boolean> = {
|
||||
'/': true,
|
||||
'/login': true,
|
||||
'/login/provider': true,
|
||||
'/login/fastlogin': true,
|
||||
'/chat/share': true
|
||||
};
|
||||
|
||||
|
||||
@@ -6,10 +6,12 @@ import {
|
||||
ModalHeader,
|
||||
ModalCloseButton,
|
||||
ModalContentProps,
|
||||
Box
|
||||
Box,
|
||||
Image
|
||||
} from '@chakra-ui/react';
|
||||
|
||||
interface Props extends ModalContentProps {
|
||||
iconSrc?: string;
|
||||
title?: any;
|
||||
isCentered?: boolean;
|
||||
isOpen: boolean;
|
||||
@@ -19,6 +21,7 @@ interface Props extends ModalContentProps {
|
||||
const MyModal = ({
|
||||
isOpen,
|
||||
onClose,
|
||||
iconSrc,
|
||||
title,
|
||||
children,
|
||||
isCentered,
|
||||
@@ -51,8 +54,9 @@ const MyModal = ({
|
||||
background={'#FBFBFC'}
|
||||
borderBottom={'1px solid #F4F6F8'}
|
||||
roundedTop={'lg'}
|
||||
py={3}
|
||||
py={'10px'}
|
||||
>
|
||||
{iconSrc && <Image mr={3} objectFit={'contain'} alt="" src={iconSrc} w={'20px'} />}
|
||||
{title}
|
||||
<Box flex={1} />
|
||||
{onClose && <ModalCloseButton position={'relative'} top={0} right={0} />}
|
||||
|
||||
@@ -19,7 +19,7 @@ const PromptTemplate = ({
|
||||
const [selectTemplateTitle, setSelectTemplateTitle] = useState<PromptTemplateItem>();
|
||||
|
||||
return (
|
||||
<MyModal isOpen title={title} onClose={onClose} isCentered>
|
||||
<MyModal isOpen title={title} onClose={onClose} iconSrc="/imgs/modal/prompt.svg">
|
||||
<ModalBody h="100%" w={'600px'} maxW={'90vw'} overflowY={'auto'}>
|
||||
<Grid gridTemplateColumns={['1fr', '1fr 1fr']} gridGap={4}>
|
||||
{templates.map((item) => (
|
||||
|
||||
@@ -4,8 +4,7 @@ import { useQuery } from '@tanstack/react-query';
|
||||
import React, { Dispatch, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { Box, Flex, ModalHeader } from '@chakra-ui/react';
|
||||
import MyIcon from '@/components/Icon';
|
||||
import { Box, Flex } from '@chakra-ui/react';
|
||||
import ParentPaths from '@/components/common/ParentPaths';
|
||||
|
||||
type PathItemType = {
|
||||
@@ -29,12 +28,12 @@ const DatasetSelectContainer = ({
|
||||
children: React.ReactNode;
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const { isPc } = useSystemStore();
|
||||
|
||||
return (
|
||||
<MyModal isOpen={isOpen} onClose={onClose} w={'100%'} maxW={['90vw', '900px']} isCentered>
|
||||
<Flex flexDirection={'column'} h={'90vh'}>
|
||||
<ModalHeader fontWeight={'normal'}>
|
||||
<MyModal
|
||||
iconSrc="/imgs/module/db.png"
|
||||
title={
|
||||
<Box fontWeight={'normal'}>
|
||||
<ParentPaths
|
||||
paths={paths.map((path, i) => ({
|
||||
parentId: path.parentId,
|
||||
@@ -50,7 +49,15 @@ const DatasetSelectContainer = ({
|
||||
{tips}
|
||||
</Box>
|
||||
)}
|
||||
</ModalHeader>
|
||||
</Box>
|
||||
}
|
||||
isOpen={isOpen}
|
||||
onClose={onClose}
|
||||
w={'100%'}
|
||||
maxW={['90vw', '900px']}
|
||||
isCentered
|
||||
>
|
||||
<Flex flexDirection={'column'} h={'90vh'}>
|
||||
<Box flex={'1 0 0'}>{children}</Box>
|
||||
</Flex>
|
||||
</MyModal>
|
||||
@@ -58,10 +65,9 @@ const DatasetSelectContainer = ({
|
||||
};
|
||||
|
||||
export function useDatasetSelect() {
|
||||
const { t } = useTranslation();
|
||||
const [parentId, setParentId] = useState<string>();
|
||||
const [parentId, setParentId] = useState<string>('');
|
||||
|
||||
const { data, isLoading } = useQuery(['loadDatasetData', parentId], () =>
|
||||
const { data, isFetching } = useQuery(['loadDatasetData', parentId], () =>
|
||||
Promise.all([getDatasets({ parentId }), getDatasetPaths(parentId)])
|
||||
);
|
||||
|
||||
@@ -72,7 +78,7 @@ export function useDatasetSelect() {
|
||||
setParentId,
|
||||
datasets: data?.[0] || [],
|
||||
paths,
|
||||
isLoading
|
||||
isFetching
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import MyModal from '@/components/MyModal';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { EditFormType } from '@/web/core/app/basicSettings';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import {
|
||||
Box,
|
||||
BoxProps,
|
||||
Button,
|
||||
Flex,
|
||||
Image,
|
||||
Link,
|
||||
ModalBody,
|
||||
ModalFooter,
|
||||
@@ -19,9 +19,12 @@ import { QuestionOutlineIcon } from '@chakra-ui/icons';
|
||||
import { Prompt_QuotePromptList, Prompt_QuoteTemplateList } from '@/global/core/prompt/AIChat';
|
||||
import { chatModelList, feConfigs } from '@/web/common/system/staticData';
|
||||
import MySlider from '@/components/Slider';
|
||||
import { SystemInputEnum } from '@/constants/app';
|
||||
import { ModuleInputKeyEnum } from '@fastgpt/global/core/module/constants';
|
||||
import dynamic from 'next/dynamic';
|
||||
import { PromptTemplateItem } from '@fastgpt/global/core/ai/type.d';
|
||||
import type { AIChatModuleProps } from '@fastgpt/global/core/module/node/type.d';
|
||||
import type { AppSimpleEditConfigTemplateType } from '@fastgpt/global/core/app/type.d';
|
||||
import { SimpleModeTemplate_FastGPT_Universal } from '@/global/core/app/constants';
|
||||
|
||||
const PromptTemplate = dynamic(() => import('@/components/PromptTemplate'));
|
||||
|
||||
@@ -29,12 +32,14 @@ const AIChatSettingsModal = ({
|
||||
isAdEdit,
|
||||
onClose,
|
||||
onSuccess,
|
||||
defaultData
|
||||
defaultData,
|
||||
simpleModeTemplate = SimpleModeTemplate_FastGPT_Universal
|
||||
}: {
|
||||
isAdEdit?: boolean;
|
||||
onClose: () => void;
|
||||
onSuccess: (e: EditFormType['chatModel']) => void;
|
||||
defaultData: EditFormType['chatModel'];
|
||||
onSuccess: (e: AIChatModuleProps) => void;
|
||||
defaultData: AIChatModuleProps;
|
||||
simpleModeTemplate?: AppSimpleEditConfigTemplateType;
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const [refresh, setRefresh] = useState(false);
|
||||
@@ -49,7 +54,10 @@ const AIChatSettingsModal = ({
|
||||
}>();
|
||||
|
||||
const tokenLimit = useMemo(() => {
|
||||
return chatModelList.find((item) => item.model === getValues('model'))?.maxResponse || 4000;
|
||||
return (
|
||||
chatModelList.find((item) => item.model === getValues(ModuleInputKeyEnum.aiModel))
|
||||
?.maxResponse || 4000
|
||||
);
|
||||
}, [getValues, refresh]);
|
||||
|
||||
const LabelStyles: BoxProps = {
|
||||
@@ -63,8 +71,9 @@ const AIChatSettingsModal = ({
|
||||
return (
|
||||
<MyModal
|
||||
isOpen
|
||||
iconSrc="/imgs/module/AI.png"
|
||||
title={
|
||||
<Flex alignItems={'flex-end'}>
|
||||
<>
|
||||
{t('app.AI Advanced Settings')}
|
||||
{feConfigs?.docUrl && (
|
||||
<Link
|
||||
@@ -78,13 +87,13 @@ const AIChatSettingsModal = ({
|
||||
查看说明
|
||||
</Link>
|
||||
)}
|
||||
</Flex>
|
||||
</>
|
||||
}
|
||||
isCentered
|
||||
w={'700px'}
|
||||
h={['90vh', 'auto']}
|
||||
>
|
||||
<ModalBody flex={['1 0 0', 'auto']} overflowY={'auto'}>
|
||||
<ModalBody flex={['1 0 0', 'auto']} overflowY={'auto'} minH={'40vh'}>
|
||||
{isAdEdit && (
|
||||
<Flex alignItems={'center'}>
|
||||
<Box {...LabelStyles} w={'80px'}>
|
||||
@@ -92,112 +101,123 @@ const AIChatSettingsModal = ({
|
||||
</Box>
|
||||
<Box flex={1} ml={'10px'}>
|
||||
<Switch
|
||||
isChecked={getValues(SystemInputEnum.isResponseAnswerText)}
|
||||
isChecked={getValues(ModuleInputKeyEnum.aiChatIsResponseText)}
|
||||
size={'lg'}
|
||||
onChange={(e) => {
|
||||
const value = e.target.checked;
|
||||
setValue(SystemInputEnum.isResponseAnswerText, value);
|
||||
setValue(ModuleInputKeyEnum.aiChatIsResponseText, value);
|
||||
setRefresh((state) => !state);
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
</Flex>
|
||||
)}
|
||||
<Flex alignItems={'center'} mb={10} mt={isAdEdit ? 8 : 5}>
|
||||
<Box {...LabelStyles} mr={2} w={'80px'}>
|
||||
温度
|
||||
</Box>
|
||||
<Box flex={1} ml={'10px'}>
|
||||
<MySlider
|
||||
markList={[
|
||||
{ label: '严谨', value: 0 },
|
||||
{ label: '发散', value: 10 }
|
||||
]}
|
||||
width={'95%'}
|
||||
min={0}
|
||||
max={10}
|
||||
value={getValues('temperature')}
|
||||
onChange={(e) => {
|
||||
setValue('temperature', e);
|
||||
setRefresh(!refresh);
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
</Flex>
|
||||
<Flex alignItems={'center'} mt={12} mb={10}>
|
||||
<Box {...LabelStyles} mr={2} w={'80px'}>
|
||||
回复上限
|
||||
</Box>
|
||||
<Box flex={1} ml={'10px'}>
|
||||
<MySlider
|
||||
markList={[
|
||||
{ label: '100', value: 100 },
|
||||
{ label: `${tokenLimit}`, value: tokenLimit }
|
||||
]}
|
||||
width={'95%'}
|
||||
min={100}
|
||||
max={tokenLimit}
|
||||
step={50}
|
||||
value={getValues('maxToken')}
|
||||
onChange={(val) => {
|
||||
setValue('maxToken', val);
|
||||
setRefresh(!refresh);
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
</Flex>
|
||||
<Box>
|
||||
<Flex {...LabelStyles} mb={1}>
|
||||
引用内容模板
|
||||
<MyTooltip
|
||||
label={t('template.Quote Content Tip', {
|
||||
default: Prompt_QuoteTemplateList[0].value
|
||||
})}
|
||||
forceShow
|
||||
>
|
||||
<QuestionOutlineIcon display={['none', 'inline']} ml={1} />
|
||||
</MyTooltip>
|
||||
<Box flex={1} />
|
||||
<Box
|
||||
{...selectTemplateBtn}
|
||||
onClick={() =>
|
||||
setSelectTemplateData({
|
||||
title: '选择知识库提示词模板',
|
||||
templates: Prompt_QuoteTemplateList
|
||||
})
|
||||
}
|
||||
>
|
||||
选择模板
|
||||
{simpleModeTemplate?.systemForm?.aiSettings?.temperature && (
|
||||
<Flex alignItems={'center'} mb={10} mt={isAdEdit ? 8 : 5}>
|
||||
<Box {...LabelStyles} mr={2} w={'80px'}>
|
||||
温度
|
||||
</Box>
|
||||
<Box flex={1} ml={'10px'}>
|
||||
<MySlider
|
||||
markList={[
|
||||
{ label: '严谨', value: 0 },
|
||||
{ label: '发散', value: 10 }
|
||||
]}
|
||||
width={'95%'}
|
||||
min={0}
|
||||
max={10}
|
||||
value={getValues(ModuleInputKeyEnum.aiChatTemperature)}
|
||||
onChange={(e) => {
|
||||
setValue(ModuleInputKeyEnum.aiChatTemperature, e);
|
||||
setRefresh(!refresh);
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
</Flex>
|
||||
<Textarea
|
||||
rows={6}
|
||||
placeholder={
|
||||
t('template.Quote Content Tip', { default: Prompt_QuoteTemplateList[0].value }) || ''
|
||||
}
|
||||
borderColor={'myGray.100'}
|
||||
{...register('quoteTemplate')}
|
||||
/>
|
||||
</Box>
|
||||
<Box mt={4}>
|
||||
<Flex {...LabelStyles} mb={1}>
|
||||
引用内容提示词
|
||||
<MyTooltip
|
||||
label={t('template.Quote Prompt Tip', { default: Prompt_QuotePromptList[0].value })}
|
||||
forceShow
|
||||
>
|
||||
<QuestionOutlineIcon display={['none', 'inline']} ml={1} />
|
||||
</MyTooltip>
|
||||
)}
|
||||
{simpleModeTemplate?.systemForm?.aiSettings?.maxToken && (
|
||||
<Flex alignItems={'center'} mt={12} mb={10}>
|
||||
<Box {...LabelStyles} mr={2} w={'80px'}>
|
||||
回复上限
|
||||
</Box>
|
||||
<Box flex={1} ml={'10px'}>
|
||||
<MySlider
|
||||
markList={[
|
||||
{ label: '100', value: 100 },
|
||||
{ label: `${tokenLimit}`, value: tokenLimit }
|
||||
]}
|
||||
width={'95%'}
|
||||
min={100}
|
||||
max={tokenLimit}
|
||||
step={50}
|
||||
value={getValues(ModuleInputKeyEnum.aiChatMaxToken)}
|
||||
onChange={(val) => {
|
||||
setValue(ModuleInputKeyEnum.aiChatMaxToken, val);
|
||||
setRefresh(!refresh);
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
</Flex>
|
||||
<Textarea
|
||||
rows={11}
|
||||
placeholder={
|
||||
t('template.Quote Prompt Tip', { default: Prompt_QuotePromptList[0].value }) || ''
|
||||
}
|
||||
borderColor={'myGray.100'}
|
||||
{...register('quotePrompt')}
|
||||
/>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
{simpleModeTemplate?.systemForm?.aiSettings?.quoteTemplate && (
|
||||
<Box>
|
||||
<Flex {...LabelStyles} mb={1}>
|
||||
引用内容模板
|
||||
<MyTooltip
|
||||
label={t('template.Quote Content Tip', {
|
||||
default: Prompt_QuoteTemplateList[0].value
|
||||
})}
|
||||
forceShow
|
||||
>
|
||||
<QuestionOutlineIcon display={['none', 'inline']} ml={1} />
|
||||
</MyTooltip>
|
||||
<Box flex={1} />
|
||||
<Box
|
||||
{...selectTemplateBtn}
|
||||
onClick={() =>
|
||||
setSelectTemplateData({
|
||||
title: '选择知识库提示词模板',
|
||||
templates: Prompt_QuoteTemplateList
|
||||
})
|
||||
}
|
||||
>
|
||||
选择模板
|
||||
</Box>
|
||||
</Flex>
|
||||
|
||||
<Textarea
|
||||
rows={6}
|
||||
placeholder={
|
||||
t('template.Quote Content Tip', { default: Prompt_QuoteTemplateList[0].value }) ||
|
||||
''
|
||||
}
|
||||
borderColor={'myGray.100'}
|
||||
{...register(ModuleInputKeyEnum.aiChatQuoteTemplate)}
|
||||
/>
|
||||
</Box>
|
||||
)}
|
||||
{simpleModeTemplate?.systemForm?.aiSettings?.quotePrompt && (
|
||||
<Box mt={4}>
|
||||
<Flex {...LabelStyles} mb={1}>
|
||||
引用内容提示词
|
||||
<MyTooltip
|
||||
label={t('template.Quote Prompt Tip', { default: Prompt_QuotePromptList[0].value })}
|
||||
forceShow
|
||||
>
|
||||
<QuestionOutlineIcon display={['none', 'inline']} ml={1} />
|
||||
</MyTooltip>
|
||||
</Flex>
|
||||
<Textarea
|
||||
rows={11}
|
||||
placeholder={
|
||||
t('template.Quote Prompt Tip', { default: Prompt_QuotePromptList[0].value }) || ''
|
||||
}
|
||||
borderColor={'myGray.100'}
|
||||
{...register(ModuleInputKeyEnum.aiChatQuotePrompt)}
|
||||
/>
|
||||
</Box>
|
||||
)}
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button variant={'base'} onClick={onClose}>
|
||||
@@ -215,8 +235,8 @@ const AIChatSettingsModal = ({
|
||||
onSuccess={(e) => {
|
||||
const quoteVal = e.value;
|
||||
const promptVal = Prompt_QuotePromptList.find((item) => item.title === e.title)?.value;
|
||||
setValue('quoteTemplate', quoteVal);
|
||||
setValue('quotePrompt', promptVal);
|
||||
setValue(ModuleInputKeyEnum.aiChatQuoteTemplate, quoteVal);
|
||||
setValue(ModuleInputKeyEnum.aiChatQuotePrompt, promptVal);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -10,7 +10,8 @@ import {
|
||||
Textarea,
|
||||
Grid,
|
||||
Divider,
|
||||
Switch
|
||||
Switch,
|
||||
Image
|
||||
} from '@chakra-ui/react';
|
||||
import Avatar from '@/components/Avatar';
|
||||
import { useForm } from 'react-hook-form';
|
||||
@@ -28,47 +29,44 @@ import { feConfigs } from '@/web/common/system/staticData';
|
||||
import DatasetSelectContainer, { useDatasetSelect } from '@/components/core/dataset/SelectModal';
|
||||
import { useLoading } from '@/web/common/hooks/useLoading';
|
||||
import EmptyTip from '@/components/EmptyTip';
|
||||
import { AppSimpleEditFormType } from '@fastgpt/global/core/app/type';
|
||||
import { ModuleInputKeyEnum } from '@fastgpt/global/core/module/constants';
|
||||
|
||||
export type KbParamsType = {
|
||||
searchSimilarity: number;
|
||||
searchLimit: number;
|
||||
searchEmptyText: string;
|
||||
rerank: boolean;
|
||||
};
|
||||
type DatasetParamsProps = AppSimpleEditFormType['dataset'];
|
||||
|
||||
export const DatasetSelectModal = ({
|
||||
isOpen,
|
||||
activeDatasets = [],
|
||||
defaultSelectedDatasets = [],
|
||||
onChange,
|
||||
onClose
|
||||
}: {
|
||||
isOpen: boolean;
|
||||
activeDatasets: SelectedDatasetType;
|
||||
defaultSelectedDatasets: SelectedDatasetType;
|
||||
onChange: (e: SelectedDatasetType) => void;
|
||||
onClose: () => void;
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const theme = useTheme();
|
||||
const { allDatasets } = useDatasetStore();
|
||||
const [selectedKbList, setSelectedKbList] = useState<SelectedDatasetType>(
|
||||
activeDatasets.filter((dataset) => {
|
||||
const [selectedDatasets, setSelectedDatasets] = useState<SelectedDatasetType>(
|
||||
defaultSelectedDatasets.filter((dataset) => {
|
||||
return allDatasets.find((item) => item._id === dataset.datasetId);
|
||||
})
|
||||
);
|
||||
const { toast } = useToast();
|
||||
const { paths, setParentId, datasets, isLoading } = useDatasetSelect();
|
||||
const { paths, setParentId, datasets, isFetching } = useDatasetSelect();
|
||||
const { Loading } = useLoading();
|
||||
|
||||
const filterKbList = useMemo(() => {
|
||||
const filterDatasets = useMemo(() => {
|
||||
return {
|
||||
selected: allDatasets.filter((item) =>
|
||||
selectedKbList.find((dataset) => dataset.datasetId === item._id)
|
||||
selectedDatasets.find((dataset) => dataset.datasetId === item._id)
|
||||
),
|
||||
unSelected: datasets.filter(
|
||||
(item) => !selectedKbList.find((dataset) => dataset.datasetId === item._id)
|
||||
(item) => !selectedDatasets.find((dataset) => dataset.datasetId === item._id)
|
||||
)
|
||||
};
|
||||
}, [datasets, allDatasets, selectedKbList]);
|
||||
}, [datasets, allDatasets, selectedDatasets]);
|
||||
|
||||
return (
|
||||
<DatasetSelectContainer
|
||||
@@ -88,7 +86,7 @@ export const DatasetSelectModal = ({
|
||||
]}
|
||||
gridGap={3}
|
||||
>
|
||||
{filterKbList.selected.map((item) =>
|
||||
{filterDatasets.selected.map((item) =>
|
||||
(() => {
|
||||
return (
|
||||
<Card
|
||||
@@ -109,7 +107,7 @@ export const DatasetSelectModal = ({
|
||||
cursor={'pointer'}
|
||||
_hover={{ color: 'red.500' }}
|
||||
onClick={() => {
|
||||
setSelectedKbList((state) =>
|
||||
setSelectedDatasets((state) =>
|
||||
state.filter((kb) => kb.datasetId !== item._id)
|
||||
);
|
||||
}}
|
||||
@@ -121,7 +119,7 @@ export const DatasetSelectModal = ({
|
||||
)}
|
||||
</Grid>
|
||||
|
||||
{filterKbList.selected.length > 0 && <Divider my={3} />}
|
||||
{filterDatasets.selected.length > 0 && <Divider my={3} />}
|
||||
|
||||
<Grid
|
||||
gridTemplateColumns={[
|
||||
@@ -131,7 +129,7 @@ export const DatasetSelectModal = ({
|
||||
]}
|
||||
gridGap={3}
|
||||
>
|
||||
{filterKbList.unSelected.map((item) =>
|
||||
{filterDatasets.unSelected.map((item) =>
|
||||
(() => {
|
||||
return (
|
||||
<MyTooltip
|
||||
@@ -155,7 +153,7 @@ export const DatasetSelectModal = ({
|
||||
if (item.type === DatasetTypeEnum.folder) {
|
||||
setParentId(item._id);
|
||||
} else if (item.type === DatasetTypeEnum.dataset) {
|
||||
const vectorModel = selectedKbList[0]?.vectorModel?.model;
|
||||
const vectorModel = selectedDatasets[0]?.vectorModel?.model;
|
||||
|
||||
if (vectorModel && vectorModel !== item.vectorModel.model) {
|
||||
return toast({
|
||||
@@ -163,7 +161,7 @@ export const DatasetSelectModal = ({
|
||||
title: t('dataset.Select Dataset Tips')
|
||||
});
|
||||
}
|
||||
setSelectedKbList((state) => [
|
||||
setSelectedDatasets((state) => [
|
||||
...state,
|
||||
{ datasetId: item._id, vectorModel: item.vectorModel }
|
||||
]);
|
||||
@@ -199,26 +197,26 @@ export const DatasetSelectModal = ({
|
||||
})()
|
||||
)}
|
||||
</Grid>
|
||||
{filterKbList.unSelected.length === 0 && <EmptyTip text={t('common.folder.empty')} />}
|
||||
{filterDatasets.unSelected.length === 0 && <EmptyTip text={t('common.folder.empty')} />}
|
||||
</ModalBody>
|
||||
|
||||
<ModalFooter>
|
||||
<Button
|
||||
onClick={() => {
|
||||
// filter out the dataset that is not in the kList
|
||||
const filterKbList = selectedKbList.filter((dataset) => {
|
||||
const filterDatasets = selectedDatasets.filter((dataset) => {
|
||||
return allDatasets.find((item) => item._id === dataset.datasetId);
|
||||
});
|
||||
|
||||
onClose();
|
||||
onChange(filterKbList);
|
||||
onChange(filterDatasets);
|
||||
}}
|
||||
>
|
||||
{t('common.Done')}
|
||||
</Button>
|
||||
</ModalFooter>
|
||||
|
||||
<Loading fixed={false} loading={isLoading} />
|
||||
<Loading fixed={false} loading={isFetching} />
|
||||
</Flex>
|
||||
</DatasetSelectContainer>
|
||||
);
|
||||
@@ -226,24 +224,30 @@ export const DatasetSelectModal = ({
|
||||
|
||||
export const DatasetParamsModal = ({
|
||||
searchEmptyText,
|
||||
searchLimit,
|
||||
searchSimilarity,
|
||||
limit,
|
||||
similarity,
|
||||
rerank,
|
||||
onClose,
|
||||
onChange
|
||||
}: KbParamsType & { onClose: () => void; onChange: (e: KbParamsType) => void }) => {
|
||||
}: DatasetParamsProps & { onClose: () => void; onChange: (e: DatasetParamsProps) => void }) => {
|
||||
const [refresh, setRefresh] = useState(false);
|
||||
const { register, setValue, getValues, handleSubmit } = useForm<KbParamsType>({
|
||||
const { register, setValue, getValues, handleSubmit } = useForm<DatasetParamsProps>({
|
||||
defaultValues: {
|
||||
searchEmptyText,
|
||||
searchLimit,
|
||||
searchSimilarity,
|
||||
limit,
|
||||
similarity,
|
||||
rerank
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<MyModal isOpen={true} onClose={onClose} title={'搜索参数调整'} minW={['90vw', '600px']}>
|
||||
<MyModal
|
||||
isOpen={true}
|
||||
onClose={onClose}
|
||||
iconSrc="/imgs/modal/params.svg"
|
||||
title={'搜索参数调整'}
|
||||
minW={['90vw', '600px']}
|
||||
>
|
||||
<Flex flexDirection={'column'}>
|
||||
<ModalBody>
|
||||
{feConfigs?.isPlus && (
|
||||
@@ -256,9 +260,9 @@ export const DatasetParamsModal = ({
|
||||
</Box>
|
||||
<Switch
|
||||
size={'lg'}
|
||||
isChecked={getValues('rerank')}
|
||||
isChecked={getValues(ModuleInputKeyEnum.datasetStartReRank)}
|
||||
onChange={(e) => {
|
||||
setValue('rerank', e.target.checked);
|
||||
setValue(ModuleInputKeyEnum.datasetStartReRank, e.target.checked);
|
||||
setRefresh(!refresh);
|
||||
}}
|
||||
/>
|
||||
@@ -282,9 +286,9 @@ export const DatasetParamsModal = ({
|
||||
min={0}
|
||||
max={1}
|
||||
step={0.01}
|
||||
value={getValues('searchSimilarity')}
|
||||
value={getValues(ModuleInputKeyEnum.datasetSimilarity)}
|
||||
onChange={(val) => {
|
||||
setValue('searchSimilarity', val);
|
||||
setValue(ModuleInputKeyEnum.datasetSimilarity, val);
|
||||
setRefresh(!refresh);
|
||||
}}
|
||||
/>
|
||||
@@ -301,9 +305,9 @@ export const DatasetParamsModal = ({
|
||||
]}
|
||||
min={1}
|
||||
max={20}
|
||||
value={getValues('searchLimit')}
|
||||
value={getValues(ModuleInputKeyEnum.datasetLimit)}
|
||||
onChange={(val) => {
|
||||
setValue('searchLimit', val);
|
||||
setValue(ModuleInputKeyEnum.datasetLimit, val);
|
||||
setRefresh(!refresh);
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -15,7 +15,7 @@ import { streamFetch } from '@/web/common/api/fetch';
|
||||
import MyTooltip from '@/components/MyTooltip';
|
||||
import { useUserStore } from '@/web/support/user/useUserStore';
|
||||
import ChatBox, { type ComponentRef, type StartChatFnProps } from '@/components/ChatBox';
|
||||
import { getGuideModule } from '@/global/core/app/modules/utils';
|
||||
import { getGuideModule } from '@fastgpt/global/core/module/utils';
|
||||
import { checkChatSupportSelectFileByModules } from '@/web/core/chat/utils';
|
||||
|
||||
export type ChatTestComponentRef = {
|
||||
|
||||
@@ -28,11 +28,8 @@ import React, {
|
||||
import { customAlphabet } from 'nanoid';
|
||||
import { appModule2FlowEdge, appModule2FlowNode } from '@/utils/adapt';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import {
|
||||
FlowNodeInputTypeEnum,
|
||||
FlowNodeTypeEnum,
|
||||
FlowNodeValTypeEnum
|
||||
} from '@fastgpt/global/core/module/node/constant';
|
||||
import { FlowNodeInputTypeEnum, FlowNodeTypeEnum } from '@fastgpt/global/core/module/node/constant';
|
||||
import { ModuleDataTypeEnum } from '@fastgpt/global/core/module/constants';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { ModuleItemType } from '@fastgpt/global/core/module/type.d';
|
||||
import { EventNameEnum, eventBus } from '@/web/common/utils/eventbus';
|
||||
@@ -42,6 +39,7 @@ const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 6);
|
||||
type OnChange<ChangesType> = (changes: ChangesType[]) => void;
|
||||
export type useFlowProviderStoreType = {
|
||||
reactFlowWrapper: null | React.RefObject<HTMLDivElement>;
|
||||
mode: 'app' | 'plugin';
|
||||
filterAppIds: string[];
|
||||
nodes: Node<FlowModuleItemType, string | undefined>[];
|
||||
setNodes: Dispatch<SetStateAction<Node<FlowModuleItemType, string | undefined>[]>>;
|
||||
@@ -66,6 +64,7 @@ export type useFlowProviderStoreType = {
|
||||
|
||||
const StateContext = createContext<useFlowProviderStoreType>({
|
||||
reactFlowWrapper: null,
|
||||
mode: 'app',
|
||||
filterAppIds: [],
|
||||
nodes: [],
|
||||
setNodes: function (
|
||||
@@ -118,9 +117,11 @@ const StateContext = createContext<useFlowProviderStoreType>({
|
||||
export const useFlowProviderStore = () => useContext(StateContext);
|
||||
|
||||
export const FlowProvider = ({
|
||||
mode,
|
||||
filterAppIds = [],
|
||||
children
|
||||
}: {
|
||||
mode: useFlowProviderStoreType['mode'];
|
||||
filterAppIds?: string[];
|
||||
children: React.ReactNode;
|
||||
}) => {
|
||||
@@ -173,7 +174,7 @@ export const FlowProvider = ({
|
||||
const source = nodes.find((node) => node.id === connect.source)?.data;
|
||||
const sourceType = (() => {
|
||||
if (source?.flowType === FlowNodeTypeEnum.classifyQuestion) {
|
||||
return FlowNodeValTypeEnum.boolean;
|
||||
return ModuleDataTypeEnum.boolean;
|
||||
}
|
||||
if (source?.flowType === FlowNodeTypeEnum.pluginInput) {
|
||||
return source?.inputs.find((input) => input.key === connect.sourceHandle)?.valueType;
|
||||
@@ -192,8 +193,8 @@ export const FlowProvider = ({
|
||||
});
|
||||
}
|
||||
if (
|
||||
sourceType !== FlowNodeValTypeEnum.any &&
|
||||
targetType !== FlowNodeValTypeEnum.any &&
|
||||
sourceType !== ModuleDataTypeEnum.any &&
|
||||
targetType !== ModuleDataTypeEnum.any &&
|
||||
sourceType !== targetType
|
||||
) {
|
||||
return toast({
|
||||
@@ -328,10 +329,9 @@ export const FlowProvider = ({
|
||||
const node = nodes.find((node) => node.id === nodeId);
|
||||
if (!node) return nodes;
|
||||
const template = {
|
||||
logo: node.data.logo,
|
||||
avatar: node.data.avatar,
|
||||
name: node.data.name,
|
||||
intro: node.data.intro,
|
||||
description: node.data.description,
|
||||
flowType: node.data.flowType,
|
||||
inputs: node.data.inputs,
|
||||
outputs: node.data.outputs,
|
||||
@@ -407,6 +407,7 @@ export const FlowProvider = ({
|
||||
|
||||
const value = {
|
||||
reactFlowWrapper,
|
||||
mode,
|
||||
filterAppIds,
|
||||
nodes,
|
||||
setNodes,
|
||||
@@ -444,13 +445,13 @@ export function flowNode2Modules({
|
||||
const modules: ModuleItemType[] = nodes.map((item) => ({
|
||||
moduleId: item.data.moduleId,
|
||||
name: item.data.name,
|
||||
logo: item.data.logo,
|
||||
avatar: item.data.avatar,
|
||||
flowType: item.data.flowType,
|
||||
showStatus: item.data.showStatus,
|
||||
position: item.position,
|
||||
inputs: item.data.inputs.map((item) => ({
|
||||
...item,
|
||||
connected: item.connected ?? item.type !== FlowNodeInputTypeEnum.target
|
||||
connected: Boolean(item.value ?? item.connected ?? item.type !== FlowNodeInputTypeEnum.target)
|
||||
})),
|
||||
outputs: item.data.outputs.map((item) => ({
|
||||
...item,
|
||||
|
||||
@@ -12,7 +12,13 @@ const ImportSettings = ({ onClose }: { onClose: () => void }) => {
|
||||
const { setNodes, setEdges, initData } = useFlowProviderStore();
|
||||
|
||||
return (
|
||||
<MyModal isOpen w={'600px'} onClose={onClose} title={t('app.Import Config')}>
|
||||
<MyModal
|
||||
isOpen
|
||||
w={'600px'}
|
||||
onClose={onClose}
|
||||
iconSrc="/imgs/modal/params.svg"
|
||||
title={t('app.Import Configs')}
|
||||
>
|
||||
<ModalBody>
|
||||
<Textarea
|
||||
placeholder={t('app.Paste Config') || 'app.Paste Config'}
|
||||
@@ -38,7 +44,7 @@ const ImportSettings = ({ onClose }: { onClose: () => void }) => {
|
||||
onClose();
|
||||
} catch (error) {
|
||||
toast({
|
||||
title: t('app.Import Config Failed')
|
||||
title: t('app.Import Configs Failed')
|
||||
});
|
||||
}
|
||||
}}
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
import React, { useCallback, useMemo } from 'react';
|
||||
import { Box, Flex } from '@chakra-ui/react';
|
||||
import {
|
||||
Box,
|
||||
Flex,
|
||||
Accordion,
|
||||
AccordionItem,
|
||||
AccordionButton,
|
||||
AccordionPanel,
|
||||
AccordionIcon,
|
||||
useTheme
|
||||
} from '@chakra-ui/react';
|
||||
import type {
|
||||
FlowModuleTemplateType,
|
||||
SystemModuleTemplateType
|
||||
moduleTemplateListType
|
||||
} from '@fastgpt/global/core/module/type.d';
|
||||
import { useViewport, XYPosition } from 'reactflow';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
@@ -16,32 +25,31 @@ const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 6);
|
||||
import MyIcon from '@/components/Icon';
|
||||
import EmptyTip from '@/components/EmptyTip';
|
||||
import { FlowNodeTypeEnum } from '@fastgpt/global/core/module/node/constant';
|
||||
import { getPluginModuleDetail } from '@/web/core/plugin/api';
|
||||
import { getPreviewPluginModule } from '@/web/core/plugin/api';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import { getErrText } from '@fastgpt/global/common/error/utils';
|
||||
import { moduleTemplatesList } from '@/web/core/modules/template/system';
|
||||
import { ModuleTemplateTypeEnum } from '@fastgpt/global/core/module/constants';
|
||||
|
||||
enum TemplateTypeEnum {
|
||||
system = 'system',
|
||||
combine = 'combine'
|
||||
plugin = 'plugin'
|
||||
}
|
||||
|
||||
export type ModuleTemplateProps = {
|
||||
systemTemplates: SystemModuleTemplateType;
|
||||
pluginTemplates: SystemModuleTemplateType;
|
||||
show2Plugin?: boolean;
|
||||
systemTemplates: FlowModuleTemplateType[];
|
||||
pluginTemplates: FlowModuleTemplateType[];
|
||||
};
|
||||
|
||||
const ModuleTemplateList = ({
|
||||
systemTemplates,
|
||||
pluginTemplates,
|
||||
show2Plugin = false,
|
||||
isOpen,
|
||||
onClose
|
||||
}: ModuleTemplateProps & {
|
||||
isOpen: boolean;
|
||||
onClose: () => void;
|
||||
}) => {
|
||||
const router = useRouter();
|
||||
const { t } = useTranslation();
|
||||
const [templateType, setTemplateType] = React.useState(TemplateTypeEnum.system);
|
||||
|
||||
@@ -53,9 +61,9 @@ const ModuleTemplateList = ({
|
||||
child: <RenderList templates={systemTemplates} onClose={onClose} />
|
||||
},
|
||||
{
|
||||
type: TemplateTypeEnum.combine,
|
||||
type: TemplateTypeEnum.plugin,
|
||||
label: t('plugin.Plugin Module'),
|
||||
child: <RenderList templates={pluginTemplates} onClose={onClose} />
|
||||
child: <RenderList templates={pluginTemplates} onClose={onClose} isPlugin />
|
||||
}
|
||||
],
|
||||
[pluginTemplates, onClose, systemTemplates, t]
|
||||
@@ -112,20 +120,6 @@ const ModuleTemplateList = ({
|
||||
{item.label}
|
||||
</Box>
|
||||
))}
|
||||
<Box flex={1} />
|
||||
{show2Plugin && templateType === TemplateTypeEnum.combine && (
|
||||
<Flex
|
||||
alignItems={'center'}
|
||||
_hover={{ textDecoration: 'underline' }}
|
||||
cursor={'pointer'}
|
||||
onClick={() => router.push('/plugin/list')}
|
||||
>
|
||||
<Box fontSize={'sm'} transform={'translateY(-1px)'}>
|
||||
{t('plugin.To Edit Plugin')}
|
||||
</Box>
|
||||
<MyIcon name={'common/rightArrowLight'} w={'12px'} />
|
||||
</Flex>
|
||||
)}
|
||||
</Flex>
|
||||
{TemplateItem}
|
||||
</Flex>
|
||||
@@ -135,47 +129,56 @@ const ModuleTemplateList = ({
|
||||
|
||||
export default React.memo(ModuleTemplateList);
|
||||
|
||||
var RenderList = React.memo(function RenderList({
|
||||
const RenderList = React.memo(function RenderList({
|
||||
templates,
|
||||
isPlugin = false,
|
||||
onClose
|
||||
}: {
|
||||
templates: {
|
||||
label: string;
|
||||
list: FlowModuleTemplateType[];
|
||||
}[];
|
||||
templates: FlowModuleTemplateType[];
|
||||
isPlugin?: boolean;
|
||||
onClose: () => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const router = useRouter();
|
||||
const { isPc } = useSystemStore();
|
||||
const { setNodes, reactFlowWrapper } = useFlowProviderStore();
|
||||
const { x, y, zoom } = useViewport();
|
||||
const { setLoading } = useSystemStore();
|
||||
const { toast } = useToast();
|
||||
|
||||
const formatTemplates = useMemo<moduleTemplateListType>(() => {
|
||||
const copy: moduleTemplateListType = JSON.parse(JSON.stringify(moduleTemplatesList));
|
||||
templates.forEach((item) => {
|
||||
const index = copy.findIndex((template) => template.type === item.templateType);
|
||||
if (index === -1) return;
|
||||
copy[index].list.push(item);
|
||||
});
|
||||
return copy.filter((item) => item.list.length > 0);
|
||||
}, [templates]);
|
||||
|
||||
const onAddNode = useCallback(
|
||||
async ({ template, position }: { template: FlowModuleTemplateType; position: XYPosition }) => {
|
||||
if (!reactFlowWrapper?.current) return;
|
||||
|
||||
let templateModule = { ...template };
|
||||
|
||||
// get plugin module
|
||||
try {
|
||||
if (templateModule.flowType === FlowNodeTypeEnum.pluginModule) {
|
||||
setLoading(true);
|
||||
const pluginModule = await getPluginModuleDetail(templateModule.id);
|
||||
templateModule = {
|
||||
...templateModule,
|
||||
...pluginModule
|
||||
};
|
||||
const templateModule = await (async () => {
|
||||
try {
|
||||
// get plugin preview module
|
||||
if (template.flowType === FlowNodeTypeEnum.pluginModule) {
|
||||
setLoading(true);
|
||||
const res = await getPreviewPluginModule(template.id);
|
||||
setLoading(false);
|
||||
return res;
|
||||
}
|
||||
return { ...template };
|
||||
} catch (e) {
|
||||
toast({
|
||||
status: 'error',
|
||||
title: getErrText(e, t('plugin.Get Plugin Module Detail Failed'))
|
||||
});
|
||||
setLoading(false);
|
||||
return Promise.reject(e);
|
||||
}
|
||||
} catch (e) {
|
||||
return toast({
|
||||
status: 'error',
|
||||
title: getErrText(e, t('plugin.Get Plugin Module Detail Failed'))
|
||||
});
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
})();
|
||||
|
||||
const reactFlowBounds = reactFlowWrapper.current.getBoundingClientRect();
|
||||
const mouseX = (position.x - reactFlowBounds.left - x) / zoom - 100;
|
||||
@@ -196,46 +199,73 @@ var RenderList = React.memo(function RenderList({
|
||||
[reactFlowWrapper, setLoading, setNodes, t, toast, x, y, zoom]
|
||||
);
|
||||
|
||||
const list = useMemo(() => templates.map((item) => item.list).flat(), [templates]);
|
||||
|
||||
return list.length === 0 ? (
|
||||
return templates.length === 0 ? (
|
||||
<EmptyTip text={t('app.module.No Modules')} />
|
||||
) : (
|
||||
<Box flex={'1 0 0'} overflow={'overlay'}>
|
||||
<Box w={['100%', '330px']} mx={'auto'}>
|
||||
{list.map((item) => (
|
||||
<Flex
|
||||
key={item.id}
|
||||
alignItems={'center'}
|
||||
p={5}
|
||||
cursor={'pointer'}
|
||||
_hover={{ bg: 'myWhite.600' }}
|
||||
borderRadius={'md'}
|
||||
draggable
|
||||
onDragEnd={(e) => {
|
||||
if (e.clientX < 360) return;
|
||||
onAddNode({
|
||||
template: item,
|
||||
position: { x: e.clientX, y: e.clientY }
|
||||
});
|
||||
}}
|
||||
onClick={(e) => {
|
||||
if (isPc) return;
|
||||
onClose();
|
||||
onAddNode({
|
||||
template: item,
|
||||
position: { x: e.clientX, y: e.clientY }
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Avatar src={item.logo} w={'34px'} objectFit={'contain'} borderRadius={'0'} />
|
||||
<Box ml={5} flex={'1 0 0'}>
|
||||
<Box color={'black'}>{item.name}</Box>
|
||||
<Box className="textEllipsis3" color={'myGray.500'} fontSize={'sm'}>
|
||||
{item.intro}
|
||||
{formatTemplates.map((item, i) => (
|
||||
<Box key={item.type}>
|
||||
<Flex>
|
||||
<Box fontWeight={'bold'} flex={1}>
|
||||
{item.label}
|
||||
</Box>
|
||||
</Box>
|
||||
</Flex>
|
||||
{isPlugin && item.type === ModuleTemplateTypeEnum.personalPlugin && (
|
||||
<Flex
|
||||
alignItems={'center'}
|
||||
_hover={{ textDecoration: 'underline' }}
|
||||
cursor={'pointer'}
|
||||
onClick={() => router.push('/plugin/list')}
|
||||
>
|
||||
<Box fontSize={'sm'} transform={'translateY(-1px)'}>
|
||||
{t('plugin.To Edit Plugin')}
|
||||
</Box>
|
||||
<MyIcon name={'common/rightArrowLight'} w={'12px'} />
|
||||
</Flex>
|
||||
)}
|
||||
</Flex>
|
||||
<>
|
||||
{item.list.map((template) => (
|
||||
<Flex
|
||||
key={template.id}
|
||||
alignItems={'center'}
|
||||
p={5}
|
||||
cursor={'pointer'}
|
||||
_hover={{ bg: 'myWhite.600' }}
|
||||
borderRadius={'sm'}
|
||||
draggable
|
||||
onDragEnd={(e) => {
|
||||
if (e.clientX < 360) return;
|
||||
onAddNode({
|
||||
template: template,
|
||||
position: { x: e.clientX, y: e.clientY }
|
||||
});
|
||||
}}
|
||||
onClick={(e) => {
|
||||
if (isPc) return;
|
||||
onClose();
|
||||
onAddNode({
|
||||
template: template,
|
||||
position: { x: e.clientX, y: e.clientY }
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Avatar
|
||||
src={template.avatar}
|
||||
w={'34px'}
|
||||
objectFit={'contain'}
|
||||
borderRadius={'0'}
|
||||
/>
|
||||
<Box ml={5} flex={'1 0 0'}>
|
||||
<Box color={'black'}>{template.name}</Box>
|
||||
<Box className="textEllipsis3" color={'myGray.500'} fontSize={'sm'}>
|
||||
{template.intro}
|
||||
</Box>
|
||||
</Box>
|
||||
</Flex>
|
||||
))}
|
||||
</>
|
||||
</Box>
|
||||
))}
|
||||
</Box>
|
||||
</Box>
|
||||
@@ -39,6 +39,7 @@ const SelectAppModal = ({
|
||||
<MyModal
|
||||
isOpen
|
||||
title={`选择应用${max > 1 ? `(${selectedApps.length}/${max})` : ''}`}
|
||||
iconSrc="/imgs/module/ai.svg"
|
||||
onClose={onClose}
|
||||
minW={'700px'}
|
||||
position={'relative'}
|
||||
|
||||
@@ -35,11 +35,12 @@ const ExtractFieldModal = ({
|
||||
});
|
||||
|
||||
return (
|
||||
<MyModal isOpen={true} onClose={onClose}>
|
||||
<ModalHeader display={'flex'} alignItems={'center'}>
|
||||
<Avatar src={'/imgs/module/extract.png'} mr={2} w={'20px'} objectFit={'cover'} />
|
||||
提取字段配置
|
||||
</ModalHeader>
|
||||
<MyModal
|
||||
isOpen={true}
|
||||
iconSrc="/imgs/module/extract.png"
|
||||
title={'提取字段配置'}
|
||||
onClose={onClose}
|
||||
>
|
||||
<ModalBody>
|
||||
<Flex alignItems={'center'}>
|
||||
<Box flex={'0 0 70px'}>必填</Box>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState } from 'react';
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
@@ -11,65 +11,69 @@ import {
|
||||
} from '@chakra-ui/react';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import MyModal from '@/components/MyModal';
|
||||
import Avatar from '@/components/Avatar';
|
||||
import { FlowNodeValTypeEnum } from '@fastgpt/global/core/module/node/constant';
|
||||
import { ModuleDataTypeEnum } from '@fastgpt/global/core/module/constants';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import MySelect from '@/components/Select';
|
||||
|
||||
const typeSelectList = [
|
||||
{
|
||||
label: '字符串',
|
||||
value: FlowNodeValTypeEnum.string
|
||||
},
|
||||
{
|
||||
label: '数字',
|
||||
value: FlowNodeValTypeEnum.number
|
||||
},
|
||||
{
|
||||
label: '布尔',
|
||||
value: FlowNodeValTypeEnum.boolean
|
||||
},
|
||||
{
|
||||
label: '历史记录',
|
||||
value: FlowNodeValTypeEnum.chatHistory
|
||||
},
|
||||
{
|
||||
label: '引用内容',
|
||||
value: FlowNodeValTypeEnum.datasetQuote
|
||||
},
|
||||
{
|
||||
label: '任意',
|
||||
value: FlowNodeValTypeEnum.any
|
||||
}
|
||||
];
|
||||
import { FlowValueTypeMap } from '@/web/core/modules/constants/dataType';
|
||||
import { FlowNodeInputTypeEnum } from '@fastgpt/global/core/module/node/constant';
|
||||
|
||||
export type EditFieldModeType = 'input' | 'output' | 'pluginInput';
|
||||
export type EditFieldType = {
|
||||
type?: `${FlowNodeInputTypeEnum}`; // input type
|
||||
key: string;
|
||||
label?: string;
|
||||
valueType?: `${FlowNodeValTypeEnum}`;
|
||||
valueType?: `${ModuleDataTypeEnum}`;
|
||||
description?: string;
|
||||
required?: boolean;
|
||||
createSign?: boolean;
|
||||
};
|
||||
|
||||
const FieldEditModal = ({
|
||||
mode,
|
||||
defaultField = {
|
||||
label: '',
|
||||
key: '',
|
||||
description: '',
|
||||
valueType: FlowNodeValTypeEnum.string,
|
||||
required: false
|
||||
},
|
||||
defaultField,
|
||||
onClose,
|
||||
onSubmit
|
||||
}: {
|
||||
mode: EditFieldModeType;
|
||||
defaultField?: EditFieldType;
|
||||
defaultField: EditFieldType;
|
||||
onClose: () => void;
|
||||
onSubmit: (data: EditFieldType) => void;
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const inputTypeList = [
|
||||
{
|
||||
label: t('core.module.inputType.target'),
|
||||
value: FlowNodeInputTypeEnum.target,
|
||||
valueType: ModuleDataTypeEnum.string
|
||||
},
|
||||
{
|
||||
label: t('core.module.inputType.input'),
|
||||
value: FlowNodeInputTypeEnum.input,
|
||||
valueType: ModuleDataTypeEnum.string
|
||||
},
|
||||
{
|
||||
label: t('core.module.inputType.textarea'),
|
||||
value: FlowNodeInputTypeEnum.textarea,
|
||||
valueType: ModuleDataTypeEnum.string
|
||||
},
|
||||
{
|
||||
label: t('core.module.inputType.switch'),
|
||||
value: FlowNodeInputTypeEnum.switch,
|
||||
valueType: ModuleDataTypeEnum.boolean
|
||||
},
|
||||
{
|
||||
label: t('core.module.inputType.selectDataset'),
|
||||
value: FlowNodeInputTypeEnum.selectDataset,
|
||||
valueType: ModuleDataTypeEnum.selectDataset
|
||||
}
|
||||
];
|
||||
const dataTypeSelectList = Object.values(FlowValueTypeMap)
|
||||
.slice(0, -2)
|
||||
.map((item) => ({
|
||||
label: t(item.label),
|
||||
value: item.value
|
||||
}));
|
||||
|
||||
const { register, getValues, setValue, handleSubmit } = useForm<EditFieldType>({
|
||||
defaultValues: defaultField
|
||||
});
|
||||
@@ -79,75 +83,113 @@ const FieldEditModal = ({
|
||||
? t('app.Input Field Settings')
|
||||
: t('app.Output Field Settings');
|
||||
|
||||
const showValueTypeSelect = useMemo(() => {
|
||||
return getValues('type') === FlowNodeInputTypeEnum.target || mode === 'output';
|
||||
}, [getValues, mode, refresh]);
|
||||
|
||||
return (
|
||||
<MyModal
|
||||
isOpen={true}
|
||||
title={
|
||||
<Flex alignItems={'center'}>
|
||||
<Avatar src={'/imgs/module/extract.png'} mr={2} w={'20px'} objectFit={'cover'} />
|
||||
{title}
|
||||
</Flex>
|
||||
}
|
||||
onClose={onClose}
|
||||
>
|
||||
<MyModal isOpen={true} iconSrc="/imgs/module/extract.png" title={title} onClose={onClose}>
|
||||
<ModalBody minH={'260px'} overflow={'visible'}>
|
||||
{mode === 'input' && (
|
||||
{/* input type select: target, input, textarea.... */}
|
||||
{mode === 'pluginInput' && (
|
||||
<Flex alignItems={'center'} mb={5}>
|
||||
<Box flex={'0 0 70px'}>必填</Box>
|
||||
<Box flex={'0 0 70px'}>{t('core.module.Input Type')}</Box>
|
||||
<MySelect
|
||||
w={'288px'}
|
||||
list={inputTypeList}
|
||||
value={getValues('type')}
|
||||
onchange={(e: string) => {
|
||||
const type = e as `${FlowNodeInputTypeEnum}`;
|
||||
const selectedItem = inputTypeList.find((item) => item.value === type);
|
||||
setValue('type', type);
|
||||
setValue('valueType', selectedItem?.valueType);
|
||||
|
||||
if (type === FlowNodeInputTypeEnum.selectDataset) {
|
||||
setValue('label', selectedItem?.label);
|
||||
}
|
||||
|
||||
setRefresh(!refresh);
|
||||
}}
|
||||
/>
|
||||
</Flex>
|
||||
)}
|
||||
{['input', 'pluginInput'].includes(mode) && (
|
||||
<Flex alignItems={'center'} mb={5}>
|
||||
<Box flex={'0 0 70px'}>{t('common.Require Input')}</Box>
|
||||
<Switch {...register('required')} />
|
||||
</Flex>
|
||||
)}
|
||||
<Flex mb={5} alignItems={'center'}>
|
||||
<Box flex={'0 0 70px'}>字段类型</Box>
|
||||
<MySelect
|
||||
w={'288px'}
|
||||
list={typeSelectList}
|
||||
value={getValues('valueType')}
|
||||
onchange={(e: string) => {
|
||||
const type = e as `${FlowNodeValTypeEnum}`;
|
||||
setValue('valueType', type);
|
||||
{showValueTypeSelect && (
|
||||
<Flex mb={5} alignItems={'center'}>
|
||||
<Box flex={'0 0 70px'}>{t('core.module.Data Type')}</Box>
|
||||
<MySelect
|
||||
w={'288px'}
|
||||
list={dataTypeSelectList}
|
||||
value={getValues('valueType')}
|
||||
onchange={(e: string) => {
|
||||
const type = e as `${ModuleDataTypeEnum}`;
|
||||
setValue('valueType', type);
|
||||
|
||||
if (
|
||||
type === FlowNodeValTypeEnum.chatHistory ||
|
||||
type === FlowNodeValTypeEnum.datasetQuote
|
||||
) {
|
||||
const label = typeSelectList.find((item) => item.value === type)?.label;
|
||||
setValue('label', label);
|
||||
}
|
||||
if (
|
||||
type === ModuleDataTypeEnum.chatHistory ||
|
||||
type === ModuleDataTypeEnum.datasetQuote
|
||||
) {
|
||||
const label = dataTypeSelectList.find((item) => item.value === type)?.label;
|
||||
setValue('label', label);
|
||||
}
|
||||
|
||||
setRefresh(!refresh);
|
||||
}}
|
||||
/>
|
||||
</Flex>
|
||||
)}
|
||||
|
||||
setRefresh(!refresh);
|
||||
}}
|
||||
/>
|
||||
</Flex>
|
||||
<Flex mb={5} alignItems={'center'}>
|
||||
<Box flex={'0 0 70px'}>字段名</Box>
|
||||
<Box flex={'0 0 70px'}>{t('core.module.Field Name')}</Box>
|
||||
<Input
|
||||
placeholder="预约字段/sql语句……"
|
||||
{...register('label', { required: '字段名不能为空' })}
|
||||
/>
|
||||
</Flex>
|
||||
|
||||
<Flex mb={5} alignItems={'center'}>
|
||||
<Box flex={'0 0 70px'}>字段 key</Box>
|
||||
<Box flex={'0 0 70px'}>{t('core.module.Field key')}</Box>
|
||||
<Input
|
||||
placeholder="appointment/sql"
|
||||
{...register('key', { required: '字段 key 不能为空' })}
|
||||
/>
|
||||
</Flex>
|
||||
<Flex mb={5} alignItems={'flex-start'}>
|
||||
<Box flex={'0 0 70px'}>字段描述</Box>
|
||||
<Box flex={'0 0 70px'}>{t('core.module.Field Description')}</Box>
|
||||
<Textarea placeholder="可选" rows={3} {...register('description')} />
|
||||
</Flex>
|
||||
</ModalBody>
|
||||
|
||||
<ModalFooter>
|
||||
<Button variant={'base'} mr={3} onClick={onClose}>
|
||||
取消
|
||||
{t('common.Close')}
|
||||
</Button>
|
||||
<Button onClick={handleSubmit(onSubmit)}>确认</Button>
|
||||
<Button onClick={handleSubmit(onSubmit)}>{t('common.Confirm')}</Button>
|
||||
</ModalFooter>
|
||||
</MyModal>
|
||||
);
|
||||
};
|
||||
|
||||
export default React.memo(FieldEditModal);
|
||||
|
||||
export const defaultInputField: EditFieldType = {
|
||||
label: '',
|
||||
key: '',
|
||||
description: '',
|
||||
type: FlowNodeInputTypeEnum.target,
|
||||
valueType: ModuleDataTypeEnum.string,
|
||||
required: true,
|
||||
createSign: true
|
||||
};
|
||||
export const defaultOutputField: EditFieldType = {
|
||||
label: '',
|
||||
key: '',
|
||||
description: '',
|
||||
valueType: ModuleDataTypeEnum.string,
|
||||
required: true,
|
||||
createSign: true
|
||||
};
|
||||
|
||||
@@ -9,14 +9,13 @@ import { useTranslation } from 'next-i18next';
|
||||
import { useEditTitle } from '@/web/common/hooks/useEditTitle';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
import { useFlowProviderStore, onChangeNode } from '../../FlowProvider';
|
||||
import {
|
||||
FlowNodeSpecialInputKeyEnum,
|
||||
FlowNodeTypeEnum
|
||||
} from '@fastgpt/global/core/module/node/constant';
|
||||
import { FlowNodeTypeEnum } from '@fastgpt/global/core/module/node/constant';
|
||||
import { ModuleInputKeyEnum } from '@fastgpt/global/core/module/constants';
|
||||
import { useSystemStore } from '@/web/common/system/useSystemStore';
|
||||
import { getPluginModuleDetail } from '@/web/core/plugin/api';
|
||||
import { getPreviewPluginModule } from '@/web/core/plugin/api';
|
||||
import { getErrText } from '@fastgpt/global/common/error/utils';
|
||||
import { useConfirm } from '@/web/common/hooks/useConfirm';
|
||||
import { LOGO_ICON } from '@fastgpt/global/core/chat/constants';
|
||||
|
||||
type Props = FlowModuleItemType & {
|
||||
children?: React.ReactNode | React.ReactNode[] | string;
|
||||
@@ -27,9 +26,9 @@ type Props = FlowModuleItemType & {
|
||||
const NodeCard = (props: Props) => {
|
||||
const {
|
||||
children,
|
||||
logo = '/icon/logo.svg',
|
||||
avatar = LOGO_ICON,
|
||||
name = '未知模块',
|
||||
description,
|
||||
intro,
|
||||
minW = '300px',
|
||||
moduleId,
|
||||
flowType,
|
||||
@@ -59,14 +58,13 @@ const NodeCard = (props: Props) => {
|
||||
icon: 'common/refreshLight',
|
||||
label: t('plugin.Synchronous version'),
|
||||
onClick: () => {
|
||||
const pluginId = inputs.find(
|
||||
(item) => item.key === FlowNodeSpecialInputKeyEnum.pluginId
|
||||
)?.value;
|
||||
const pluginId = inputs.find((item) => item.key === ModuleInputKeyEnum.pluginId)
|
||||
?.value;
|
||||
if (!pluginId) return;
|
||||
openConfirm(async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const pluginModule = await getPluginModuleDetail(pluginId);
|
||||
const pluginModule = await getPreviewPluginModule(pluginId);
|
||||
onResetNode(moduleId, pluginModule);
|
||||
} catch (e) {
|
||||
return toast({
|
||||
@@ -147,18 +145,13 @@ const NodeCard = (props: Props) => {
|
||||
className={isPreview ? 'nodrag' : ''}
|
||||
>
|
||||
<Flex className="custom-drag-handle" px={4} py={3} alignItems={'center'}>
|
||||
<Avatar src={logo} borderRadius={'md'} objectFit={'contain'} w={'30px'} h={'30px'} />
|
||||
<Avatar src={avatar} borderRadius={'md'} objectFit={'contain'} w={'30px'} h={'30px'} />
|
||||
<Box ml={3} fontSize={'lg'} color={'myGray.600'}>
|
||||
{name}
|
||||
</Box>
|
||||
{description && (
|
||||
<MyTooltip label={description} forceShow>
|
||||
<QuestionOutlineIcon
|
||||
display={['none', 'inline']}
|
||||
transform={'translateY(1px)'}
|
||||
mb={'1px'}
|
||||
ml={1}
|
||||
/>
|
||||
{intro && (
|
||||
<MyTooltip label={intro} forceShow>
|
||||
<QuestionOutlineIcon display={['none', 'inline']} mb={'1px'} ml={1} />
|
||||
</MyTooltip>
|
||||
)}
|
||||
<Box flex={1} />
|
||||
|
||||
@@ -6,7 +6,7 @@ import React, { useCallback, useMemo } from 'react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import MySelect from '@/components/Select';
|
||||
import { TTSTypeEnum } from '@/constants/app';
|
||||
import { AppTTSConfigType } from '@/types/app';
|
||||
import type { AppTTSConfigType } from '@fastgpt/global/core/module/type.d';
|
||||
import { useAudioPlay } from '@/web/common/utils/voice';
|
||||
import { audioSpeechModels } from '@/web/common/system/staticData';
|
||||
import MyModal from '@/components/MyModal';
|
||||
@@ -0,0 +1,342 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
ModalFooter,
|
||||
ModalBody,
|
||||
NumberInput,
|
||||
NumberInputField,
|
||||
NumberInputStepper,
|
||||
NumberIncrementStepper,
|
||||
NumberDecrementStepper,
|
||||
Flex,
|
||||
Switch,
|
||||
Input,
|
||||
Grid,
|
||||
FormControl,
|
||||
useTheme,
|
||||
Image,
|
||||
Table,
|
||||
Thead,
|
||||
Tbody,
|
||||
Tr,
|
||||
Th,
|
||||
Td,
|
||||
TableContainer,
|
||||
BoxProps,
|
||||
useDisclosure
|
||||
} from '@chakra-ui/react';
|
||||
import { QuestionOutlineIcon, SmallAddIcon } from '@chakra-ui/icons';
|
||||
import { VariableInputEnum } from '@fastgpt/global/core/module/constants';
|
||||
import type { VariableItemType } from '@fastgpt/global/core/module/type.d';
|
||||
import MyIcon from '@/components/Icon';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { useFieldArray } from 'react-hook-form';
|
||||
import { customAlphabet } from 'nanoid';
|
||||
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 6);
|
||||
import MyModal from '@/components/MyModal';
|
||||
import MyTooltip from '@/components/MyTooltip';
|
||||
import { variableTip } from '@fastgpt/global/core/module/template/tip';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
|
||||
const VariableEdit = ({
|
||||
variables,
|
||||
onChange
|
||||
}: {
|
||||
variables: VariableItemType[];
|
||||
onChange: (data: VariableItemType[]) => void;
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const { toast } = useToast();
|
||||
const theme = useTheme();
|
||||
const [refresh, setRefresh] = useState(false);
|
||||
|
||||
const VariableTypeList = [
|
||||
{
|
||||
label: t('core.module.variable.text type'),
|
||||
icon: 'settingLight',
|
||||
key: VariableInputEnum.input
|
||||
},
|
||||
{
|
||||
label: t('core.module.variable.select type'),
|
||||
icon: 'settingLight',
|
||||
key: VariableInputEnum.select
|
||||
}
|
||||
];
|
||||
|
||||
const { isOpen: isOpenEdit, onOpen: onOpenEdit, onClose: onCloseEdit } = useDisclosure();
|
||||
const {
|
||||
reset: resetEdit,
|
||||
register: registerEdit,
|
||||
getValues: getValuesEdit,
|
||||
setValue: setValuesEdit,
|
||||
control: editVariableController,
|
||||
handleSubmit: handleSubmitEdit
|
||||
} = useForm<{ variable: VariableItemType }>();
|
||||
|
||||
const {
|
||||
fields: selectEnums,
|
||||
append: appendEnums,
|
||||
remove: removeEnums
|
||||
} = useFieldArray({
|
||||
control: editVariableController,
|
||||
name: 'variable.enums'
|
||||
});
|
||||
|
||||
const BoxBtnStyles: BoxProps = {
|
||||
cursor: 'pointer',
|
||||
px: 3,
|
||||
py: '2px',
|
||||
borderRadius: 'md',
|
||||
_hover: {
|
||||
bg: 'myGray.200'
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<Flex alignItems={'center'}>
|
||||
<Image alt={''} src={'/imgs/module/variable.png'} objectFit={'contain'} w={'18px'} />
|
||||
<Box ml={2} flex={1}>
|
||||
{t('core.module.Variable')}
|
||||
<MyTooltip label={variableTip} forceShow>
|
||||
<QuestionOutlineIcon display={['none', 'inline']} ml={1} />
|
||||
</MyTooltip>
|
||||
</Box>
|
||||
<Flex
|
||||
{...BoxBtnStyles}
|
||||
onClick={() => {
|
||||
resetEdit({ variable: addVariable() });
|
||||
onOpenEdit();
|
||||
}}
|
||||
>
|
||||
+ {t('common.Add New')}
|
||||
</Flex>
|
||||
</Flex>
|
||||
{variables.length > 0 && (
|
||||
<Box mt={2} borderRadius={'lg'} overflow={'hidden'} borderWidth={'1px'} borderBottom="none">
|
||||
<TableContainer>
|
||||
<Table bg={'white'}>
|
||||
<Thead>
|
||||
<Tr>
|
||||
<Th>{t('core.module.variable.variable name')}</Th>
|
||||
<Th>{t('core.module.variable.key')}</Th>
|
||||
<Th>{t('common.Require Input')}</Th>
|
||||
<Th></Th>
|
||||
</Tr>
|
||||
</Thead>
|
||||
<Tbody>
|
||||
{variables.map((item, index) => (
|
||||
<Tr key={item.id}>
|
||||
<Td>{item.label} </Td>
|
||||
<Td>{item.key}</Td>
|
||||
<Td>{item.required ? '✔' : ''}</Td>
|
||||
<Td>
|
||||
<MyIcon
|
||||
mr={3}
|
||||
name={'settingLight'}
|
||||
w={'16px'}
|
||||
cursor={'pointer'}
|
||||
onClick={() => {
|
||||
resetEdit({ variable: item });
|
||||
onOpenEdit();
|
||||
}}
|
||||
/>
|
||||
<MyIcon
|
||||
name={'delete'}
|
||||
w={'16px'}
|
||||
cursor={'pointer'}
|
||||
onClick={() =>
|
||||
onChange(variables.filter((variable) => variable.id !== item.id))
|
||||
}
|
||||
/>
|
||||
</Td>
|
||||
</Tr>
|
||||
))}
|
||||
</Tbody>
|
||||
</Table>
|
||||
</TableContainer>
|
||||
</Box>
|
||||
)}
|
||||
<MyModal
|
||||
iconSrc="/imgs/module/variable.png"
|
||||
title={t('core.module.Variable Setting')}
|
||||
isOpen={isOpenEdit}
|
||||
onClose={onCloseEdit}
|
||||
>
|
||||
<ModalBody>
|
||||
<Flex alignItems={'center'}>
|
||||
<Box w={'70px'}>{t('common.Require Input')}</Box>
|
||||
<Switch {...registerEdit('variable.required')} />
|
||||
</Flex>
|
||||
<Flex mt={5} alignItems={'center'}>
|
||||
<Box w={'80px'}>{t('core.module.variable.variable name')}</Box>
|
||||
<Input
|
||||
{...registerEdit('variable.label', {
|
||||
required: t('core.module.variable.variable name is required')
|
||||
})}
|
||||
/>
|
||||
</Flex>
|
||||
<Flex mt={5} alignItems={'center'}>
|
||||
<Box w={'80px'}>{t('core.module.variable.key')}</Box>
|
||||
<Input
|
||||
{...registerEdit('variable.key', {
|
||||
required: t('core.module.variable.key is required')
|
||||
})}
|
||||
/>
|
||||
</Flex>
|
||||
|
||||
<Box mt={5} mb={2}>
|
||||
{t('core.module.Field Type')}
|
||||
</Box>
|
||||
<Grid gridTemplateColumns={'repeat(2,130px)'} gridGap={4}>
|
||||
{VariableTypeList.map((item) => (
|
||||
<Flex
|
||||
key={item.key}
|
||||
px={4}
|
||||
py={1}
|
||||
border={theme.borders.base}
|
||||
borderRadius={'md'}
|
||||
cursor={'pointer'}
|
||||
{...(item.key === getValuesEdit('variable.type')
|
||||
? {
|
||||
bg: 'myWhite.600'
|
||||
}
|
||||
: {
|
||||
_hover: {
|
||||
boxShadow: 'md'
|
||||
},
|
||||
onClick: () => {
|
||||
setValuesEdit('variable.type', item.key);
|
||||
setRefresh(!refresh);
|
||||
}
|
||||
})}
|
||||
>
|
||||
<MyIcon name={item.icon as any} w={'16px'} />
|
||||
<Box ml={3}>{item.label}</Box>
|
||||
</Flex>
|
||||
))}
|
||||
</Grid>
|
||||
|
||||
{getValuesEdit('variable.type') === VariableInputEnum.input && (
|
||||
<>
|
||||
<Box mt={5} mb={2}>
|
||||
{t('core.module.variable.text max length')}
|
||||
</Box>
|
||||
<Box>
|
||||
<NumberInput max={100} min={1} step={1} position={'relative'}>
|
||||
<NumberInputField
|
||||
{...registerEdit('variable.maxLen', {
|
||||
min: 1,
|
||||
max: 100,
|
||||
valueAsNumber: true
|
||||
})}
|
||||
max={100}
|
||||
/>
|
||||
<NumberInputStepper>
|
||||
<NumberIncrementStepper />
|
||||
<NumberDecrementStepper />
|
||||
</NumberInputStepper>
|
||||
</NumberInput>
|
||||
</Box>
|
||||
</>
|
||||
)}
|
||||
|
||||
{getValuesEdit('variable.type') === VariableInputEnum.select && (
|
||||
<>
|
||||
<Box mt={5} mb={2}>
|
||||
{t('core.module.variable.variable options')}
|
||||
</Box>
|
||||
<Box>
|
||||
{selectEnums.map((item, i) => (
|
||||
<Flex key={item.id} mb={2} alignItems={'center'}>
|
||||
<FormControl>
|
||||
<Input
|
||||
{...registerEdit(`variable.enums.${i}.value`, {
|
||||
required: t('core.module.variable.variable option is value is required')
|
||||
})}
|
||||
/>
|
||||
</FormControl>
|
||||
<MyIcon
|
||||
ml={3}
|
||||
name={'delete'}
|
||||
w={'16px'}
|
||||
cursor={'pointer'}
|
||||
p={2}
|
||||
borderRadius={'lg'}
|
||||
_hover={{ bg: 'red.100' }}
|
||||
onClick={() => removeEnums(i)}
|
||||
/>
|
||||
</Flex>
|
||||
))}
|
||||
</Box>
|
||||
<Button
|
||||
variant={'solid'}
|
||||
w={'100%'}
|
||||
textAlign={'left'}
|
||||
leftIcon={<SmallAddIcon />}
|
||||
bg={'myGray.100 !important'}
|
||||
onClick={() => appendEnums({ value: '' })}
|
||||
>
|
||||
{t('core.module.variable add option')}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</ModalBody>
|
||||
|
||||
<ModalFooter>
|
||||
<Button variant={'base'} mr={3} onClick={onCloseEdit}>
|
||||
{t('common.Close')}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleSubmitEdit(({ variable }) => {
|
||||
// check select
|
||||
if (variable.type === VariableInputEnum.select) {
|
||||
const enums = variable.enums.filter((item) => item.value);
|
||||
if (enums.length === 0) {
|
||||
toast({
|
||||
status: 'warning',
|
||||
title: t('core.module.variable.variable option is required')
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
const onChangeVariable = [...variables];
|
||||
// update
|
||||
if (variable.id) {
|
||||
const index = variables.findIndex((item) => item.id === variable.id);
|
||||
onChangeVariable[index] = variable;
|
||||
} else {
|
||||
onChangeVariable.push({
|
||||
...variable,
|
||||
id: nanoid()
|
||||
});
|
||||
}
|
||||
onChange(onChangeVariable);
|
||||
onCloseEdit();
|
||||
})}
|
||||
>
|
||||
{getValuesEdit('variable.id') ? t('common.Confirm Update') : t('common.Add New')}
|
||||
</Button>
|
||||
</ModalFooter>
|
||||
</MyModal>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default React.memo(VariableEdit);
|
||||
|
||||
export const defaultVariable: VariableItemType = {
|
||||
id: nanoid(),
|
||||
key: 'key',
|
||||
label: 'label',
|
||||
type: VariableInputEnum.input,
|
||||
required: true,
|
||||
maxLen: 50,
|
||||
enums: [{ value: '' }]
|
||||
};
|
||||
export const addVariable = () => {
|
||||
const newVariable = { ...defaultVariable, key: nanoid(), id: '' };
|
||||
return newVariable;
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { NodeProps } from 'reactflow';
|
||||
import { Box, Input, Button, Flex, Textarea } from '@chakra-ui/react';
|
||||
import { Box, Button, Flex, Textarea } from '@chakra-ui/react';
|
||||
import NodeCard from '../modules/NodeCard';
|
||||
import { FlowModuleItemType } from '@fastgpt/global/core/module/type.d';
|
||||
import Divider from '../modules/Divider';
|
||||
@@ -10,11 +10,8 @@ import type { ClassifyQuestionAgentItemType } from '@fastgpt/global/core/module/
|
||||
import { customAlphabet } from 'nanoid';
|
||||
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 4);
|
||||
import MyIcon from '@/components/Icon';
|
||||
import {
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeValTypeEnum,
|
||||
FlowNodeSpecialInputKeyEnum
|
||||
} from '@fastgpt/global/core/module/node/constant';
|
||||
import { FlowNodeOutputTypeEnum } from '@fastgpt/global/core/module/node/constant';
|
||||
import { ModuleDataTypeEnum, ModuleInputKeyEnum } from '@fastgpt/global/core/module/constants';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import SourceHandle from '../render/SourceHandle';
|
||||
import MyTooltip from '@/components/MyTooltip';
|
||||
@@ -32,7 +29,7 @@ const NodeCQNode = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
moduleId={moduleId}
|
||||
flowInputList={inputs}
|
||||
CustomComponent={{
|
||||
[FlowNodeSpecialInputKeyEnum.agents]: ({
|
||||
[ModuleInputKeyEnum.agents]: ({
|
||||
key: agentKey,
|
||||
value: agents = [],
|
||||
...props
|
||||
@@ -100,7 +97,7 @@ const NodeCQNode = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<SourceHandle handleKey={item.key} valueType={FlowNodeValTypeEnum.boolean} />
|
||||
<SourceHandle handleKey={item.key} valueType={ModuleDataTypeEnum.boolean} />
|
||||
</Box>
|
||||
</Box>
|
||||
))}
|
||||
|
||||
@@ -12,11 +12,9 @@ import type { ContextExtractAgentItemType } from '@fastgpt/global/core/module/ty
|
||||
import RenderOutput from '../render/RenderOutput';
|
||||
import MyIcon from '@/components/Icon';
|
||||
import ExtractFieldModal from '../modules/ExtractFieldModal';
|
||||
import { ContextExtractEnum } from '@/constants/flow/flowField';
|
||||
import {
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeValTypeEnum
|
||||
} from '@fastgpt/global/core/module/node/constant';
|
||||
import { ModuleInputKeyEnum } from '@fastgpt/global/core/module/constants';
|
||||
import { FlowNodeOutputTypeEnum } from '@fastgpt/global/core/module/node/constant';
|
||||
import { ModuleDataTypeEnum } from '@fastgpt/global/core/module/constants';
|
||||
import { useFlowProviderStore, onChangeNode } from '../../FlowProvider';
|
||||
|
||||
const NodeExtract = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
@@ -33,7 +31,7 @@ const NodeExtract = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
moduleId={moduleId}
|
||||
flowInputList={inputs}
|
||||
CustomComponent={{
|
||||
[ContextExtractEnum.extractKeys]: ({
|
||||
[ModuleInputKeyEnum.extractKeys]: ({
|
||||
value: extractKeys = [],
|
||||
...props
|
||||
}: {
|
||||
@@ -94,7 +92,7 @@ const NodeExtract = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
onChangeNode({
|
||||
moduleId,
|
||||
type: 'updateInput',
|
||||
key: ContextExtractEnum.extractKeys,
|
||||
key: ModuleInputKeyEnum.extractKeys,
|
||||
value: {
|
||||
...props,
|
||||
value: extractKeys.filter((extract) => item.key !== extract.key)
|
||||
@@ -130,7 +128,7 @@ const NodeExtract = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
onClose={() => setEditExtractField(undefined)}
|
||||
onSubmit={(data) => {
|
||||
const extracts: ContextExtractAgentItemType[] =
|
||||
inputs.find((item) => item.key === ContextExtractEnum.extractKeys)?.value || [];
|
||||
inputs.find((item) => item.key === ModuleInputKeyEnum.extractKeys)?.value || [];
|
||||
|
||||
const exists = extracts.find((item) => item.key === editExtractFiled.key);
|
||||
|
||||
@@ -141,9 +139,9 @@ const NodeExtract = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
onChangeNode({
|
||||
moduleId,
|
||||
type: 'updateInput',
|
||||
key: ContextExtractEnum.extractKeys,
|
||||
key: ModuleInputKeyEnum.extractKeys,
|
||||
value: {
|
||||
...inputs.find((input) => input.key === ContextExtractEnum.extractKeys),
|
||||
...inputs.find((input) => input.key === ModuleInputKeyEnum.extractKeys),
|
||||
value: newInputs
|
||||
}
|
||||
});
|
||||
@@ -152,7 +150,7 @@ const NodeExtract = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
key: data.key,
|
||||
label: `提取结果-${data.desc}`,
|
||||
description: '无法提取时不会返回',
|
||||
valueType: FlowNodeValTypeEnum.string,
|
||||
valueType: ModuleDataTypeEnum.string,
|
||||
type: FlowNodeOutputTypeEnum.source,
|
||||
targets: []
|
||||
};
|
||||
|
||||
@@ -11,9 +11,9 @@ import RenderOutput from '../render/RenderOutput';
|
||||
|
||||
import {
|
||||
FlowNodeInputTypeEnum,
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeValTypeEnum
|
||||
FlowNodeOutputTypeEnum
|
||||
} from '@fastgpt/global/core/module/node/constant';
|
||||
import { ModuleDataTypeEnum } from '@fastgpt/global/core/module/constants';
|
||||
import { customAlphabet } from 'nanoid';
|
||||
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 6);
|
||||
import { onChangeNode } from '../../FlowProvider';
|
||||
@@ -37,7 +37,7 @@ const NodeHttp = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
key,
|
||||
value: {
|
||||
key,
|
||||
valueType: FlowNodeValTypeEnum.string,
|
||||
valueType: ModuleDataTypeEnum.string,
|
||||
type: FlowNodeInputTypeEnum.target,
|
||||
label: `入参${inputs.length - 1}`,
|
||||
edit: true
|
||||
@@ -62,7 +62,7 @@ const NodeHttp = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
value: {
|
||||
key: nanoid(),
|
||||
label: `出参${outputs.length}`,
|
||||
valueType: FlowNodeValTypeEnum.string,
|
||||
valueType: ModuleDataTypeEnum.string,
|
||||
type: FlowNodeOutputTypeEnum.source,
|
||||
edit: true,
|
||||
targets: []
|
||||
|
||||
@@ -3,27 +3,22 @@ import { NodeProps } from 'reactflow';
|
||||
import NodeCard from '../modules/NodeCard';
|
||||
import { FlowModuleItemType } from '@fastgpt/global/core/module/type.d';
|
||||
import { onChangeNode } from '../../FlowProvider';
|
||||
|
||||
import dynamic from 'next/dynamic';
|
||||
import { Box, Button, Flex } from '@chakra-ui/react';
|
||||
import { QuestionOutlineIcon, SmallAddIcon } from '@chakra-ui/icons';
|
||||
import { customAlphabet } from 'nanoid';
|
||||
import {
|
||||
FlowNodeInputTypeEnum,
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeValTypeEnum
|
||||
} from '@fastgpt/global/core/module/node/constant';
|
||||
import { FlowNodeOutputTypeEnum } from '@fastgpt/global/core/module/node/constant';
|
||||
import Container from '../modules/Container';
|
||||
import MyIcon from '@/components/Icon';
|
||||
import MyTooltip from '@/components/MyTooltip';
|
||||
import SourceHandle from '../render/SourceHandle';
|
||||
import { EditFieldType } from '../modules/FieldEditModal';
|
||||
import { defaultInputField, type EditFieldType } from '../modules/FieldEditModal';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
|
||||
const FieldEditModal = dynamic(() => import('../modules/FieldEditModal'));
|
||||
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 6);
|
||||
|
||||
const NodeInput = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
const NodePluginInput = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
const { moduleId, inputs, outputs } = data;
|
||||
const { toast } = useToast();
|
||||
const [editField, setEditField] = useState<EditFieldType>();
|
||||
|
||||
return (
|
||||
@@ -37,7 +32,7 @@ const NodeInput = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
justifyContent={'right'}
|
||||
alignItems={'center'}
|
||||
position={'relative'}
|
||||
mb={4}
|
||||
mb={7}
|
||||
>
|
||||
<MyIcon
|
||||
name={'settingLight'}
|
||||
@@ -47,6 +42,7 @@ const NodeInput = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
_hover={{ color: 'myBlue.600' }}
|
||||
onClick={() =>
|
||||
setEditField({
|
||||
type: item.type,
|
||||
key: item.key,
|
||||
label: item.label,
|
||||
valueType: item.valueType,
|
||||
@@ -103,31 +99,7 @@ const NodeInput = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
variant={'base'}
|
||||
leftIcon={<SmallAddIcon />}
|
||||
onClick={() => {
|
||||
const key = nanoid();
|
||||
onChangeNode({
|
||||
moduleId,
|
||||
type: 'addInput',
|
||||
value: {
|
||||
key,
|
||||
valueType: FlowNodeValTypeEnum.string,
|
||||
type: FlowNodeInputTypeEnum.target,
|
||||
label: `入参${inputs.length + 1}`,
|
||||
edit: true,
|
||||
required: true
|
||||
}
|
||||
});
|
||||
onChangeNode({
|
||||
moduleId,
|
||||
type: 'addOutput',
|
||||
value: {
|
||||
key,
|
||||
label: `入参${inputs.length + 1}`,
|
||||
valueType: FlowNodeValTypeEnum.string,
|
||||
type: FlowNodeOutputTypeEnum.source,
|
||||
edit: true,
|
||||
targets: []
|
||||
}
|
||||
});
|
||||
setEditField(defaultInputField);
|
||||
}}
|
||||
>
|
||||
添加入参
|
||||
@@ -140,6 +112,44 @@ const NodeInput = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
defaultField={editField}
|
||||
onClose={() => setEditField(undefined)}
|
||||
onSubmit={(e) => {
|
||||
// create field
|
||||
if (e.createSign) {
|
||||
// check key repeat
|
||||
const memInput = inputs.find((item) => item.key === e.key);
|
||||
if (memInput) {
|
||||
return toast({
|
||||
status: 'warning',
|
||||
title: '字段key已存在'
|
||||
});
|
||||
}
|
||||
|
||||
onChangeNode({
|
||||
moduleId,
|
||||
type: 'addInput',
|
||||
value: {
|
||||
key: e.key,
|
||||
valueType: e.valueType,
|
||||
type: e.type,
|
||||
label: e.label,
|
||||
required: e.required,
|
||||
edit: true
|
||||
}
|
||||
});
|
||||
onChangeNode({
|
||||
moduleId,
|
||||
type: 'addOutput',
|
||||
value: {
|
||||
key: e.key,
|
||||
valueType: e.valueType,
|
||||
label: e.label,
|
||||
type: FlowNodeOutputTypeEnum.source,
|
||||
edit: true,
|
||||
targets: []
|
||||
}
|
||||
});
|
||||
return setEditField(undefined);
|
||||
}
|
||||
// check key valid
|
||||
const memInput = inputs.find((item) => item.key === editField.key);
|
||||
const memOutput = outputs.find((item) => item.key === editField.key);
|
||||
|
||||
@@ -188,4 +198,4 @@ const NodeInput = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
</NodeCard>
|
||||
);
|
||||
};
|
||||
export default React.memo(NodeInput);
|
||||
export default React.memo(NodePluginInput);
|
||||
@@ -3,27 +3,22 @@ import { NodeProps } from 'reactflow';
|
||||
import NodeCard from '../modules/NodeCard';
|
||||
import { FlowModuleItemType } from '@fastgpt/global/core/module/type.d';
|
||||
import { onChangeNode } from '../../FlowProvider';
|
||||
|
||||
import dynamic from 'next/dynamic';
|
||||
import { Box, Button, Flex } from '@chakra-ui/react';
|
||||
import { QuestionOutlineIcon, SmallAddIcon } from '@chakra-ui/icons';
|
||||
import { customAlphabet } from 'nanoid';
|
||||
import {
|
||||
FlowNodeInputTypeEnum,
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeValTypeEnum
|
||||
} from '@fastgpt/global/core/module/node/constant';
|
||||
import { FlowNodeOutputTypeEnum } from '@fastgpt/global/core/module/node/constant';
|
||||
import Container from '../modules/Container';
|
||||
import MyIcon from '@/components/Icon';
|
||||
import MyTooltip from '@/components/MyTooltip';
|
||||
import { EditFieldType } from '../modules/FieldEditModal';
|
||||
import { EditFieldType, defaultOutputField } from '../modules/FieldEditModal';
|
||||
import TargetHandle from '../render/TargetHandle';
|
||||
import { useToast } from '@/web/common/hooks/useToast';
|
||||
|
||||
const FieldEditModal = dynamic(() => import('../modules/FieldEditModal'));
|
||||
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 6);
|
||||
|
||||
const NodeOutput = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
const NodePluginOutput = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
const { moduleId, inputs, outputs } = data;
|
||||
const { toast } = useToast();
|
||||
const [editField, setEditField] = useState<EditFieldType>();
|
||||
|
||||
return (
|
||||
@@ -37,22 +32,20 @@ const NodeOutput = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
justifyContent={'left'}
|
||||
alignItems={'center'}
|
||||
position={'relative'}
|
||||
mb={4}
|
||||
mb={7}
|
||||
>
|
||||
<TargetHandle handleKey={item.key} valueType={item.valueType} />
|
||||
<Box position={'relative'}>
|
||||
{item.label}
|
||||
{item.required && (
|
||||
<Box
|
||||
position={'absolute'}
|
||||
right={'-6px'}
|
||||
top={'-3px'}
|
||||
color={'red.500'}
|
||||
fontWeight={'bold'}
|
||||
>
|
||||
*
|
||||
</Box>
|
||||
)}
|
||||
<Box
|
||||
position={'absolute'}
|
||||
right={'-6px'}
|
||||
top={'-3px'}
|
||||
color={'red.500'}
|
||||
fontWeight={'bold'}
|
||||
>
|
||||
*
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
<MyIcon
|
||||
@@ -104,34 +97,10 @@ const NodeOutput = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
variant={'base'}
|
||||
leftIcon={<SmallAddIcon />}
|
||||
onClick={() => {
|
||||
const key = nanoid();
|
||||
onChangeNode({
|
||||
moduleId,
|
||||
type: 'addInput',
|
||||
value: {
|
||||
key,
|
||||
valueType: FlowNodeValTypeEnum.string,
|
||||
type: FlowNodeInputTypeEnum.target,
|
||||
label: `入参${inputs.length + 1}`,
|
||||
edit: true,
|
||||
required: true
|
||||
}
|
||||
});
|
||||
onChangeNode({
|
||||
moduleId,
|
||||
type: 'addOutput',
|
||||
value: {
|
||||
key,
|
||||
label: `入参${inputs.length + 1}`,
|
||||
valueType: FlowNodeValTypeEnum.string,
|
||||
type: FlowNodeOutputTypeEnum.source,
|
||||
edit: true,
|
||||
targets: []
|
||||
}
|
||||
});
|
||||
setEditField(defaultOutputField);
|
||||
}}
|
||||
>
|
||||
添加入参
|
||||
添加出参
|
||||
</Button>
|
||||
</Box>
|
||||
</Container>
|
||||
@@ -141,6 +110,42 @@ const NodeOutput = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
defaultField={editField}
|
||||
onClose={() => setEditField(undefined)}
|
||||
onSubmit={(e) => {
|
||||
if (e.createSign) {
|
||||
// check key repeat
|
||||
const memInput = inputs.find((item) => item.key === e.key);
|
||||
if (memInput) {
|
||||
return toast({
|
||||
status: 'warning',
|
||||
title: '字段key已存在'
|
||||
});
|
||||
}
|
||||
|
||||
onChangeNode({
|
||||
moduleId,
|
||||
type: 'addInput',
|
||||
value: {
|
||||
key: e.key,
|
||||
valueType: e.valueType,
|
||||
type: e.type,
|
||||
label: e.label,
|
||||
required: e.required,
|
||||
edit: true
|
||||
}
|
||||
});
|
||||
onChangeNode({
|
||||
moduleId,
|
||||
type: 'addOutput',
|
||||
value: {
|
||||
key: e.key,
|
||||
valueType: e.valueType,
|
||||
label: e.label,
|
||||
type: FlowNodeOutputTypeEnum.source,
|
||||
edit: true,
|
||||
targets: []
|
||||
}
|
||||
});
|
||||
return setEditField(undefined);
|
||||
}
|
||||
const memInput = inputs.find((item) => item.key === editField.key);
|
||||
const memOutput = outputs.find((item) => item.key === editField.key);
|
||||
if (!memInput || !memOutput) return;
|
||||
@@ -188,4 +193,4 @@ const NodeOutput = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
</NodeCard>
|
||||
);
|
||||
};
|
||||
export default React.memo(NodeOutput);
|
||||
export default React.memo(NodePluginOutput);
|
||||
@@ -1,26 +0,0 @@
|
||||
import React from 'react';
|
||||
import { NodeProps } from 'reactflow';
|
||||
import NodeCard from '../modules/NodeCard';
|
||||
import { FlowModuleItemType } from '@fastgpt/global/core/module/type.d';
|
||||
import Divider from '../modules/Divider';
|
||||
import Container from '../modules/Container';
|
||||
import RenderInput from '../render/RenderInput';
|
||||
import RenderOutput from '../render/RenderOutput';
|
||||
|
||||
const NodeSimple = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
const { moduleId, inputs, outputs } = data;
|
||||
|
||||
return (
|
||||
<NodeCard minW={'300px'} isPreview {...data}>
|
||||
<Divider text="Input" />
|
||||
<Container>
|
||||
<RenderInput moduleId={moduleId} flowInputList={inputs} />
|
||||
</Container>
|
||||
<Divider text="Output" />
|
||||
<Container>
|
||||
<RenderOutput moduleId={moduleId} flowOutputList={outputs} />
|
||||
</Container>
|
||||
</NodeCard>
|
||||
);
|
||||
};
|
||||
export default React.memo(NodeSimple);
|
||||
@@ -11,15 +11,23 @@ const NodeSimple = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
const { moduleId, inputs, outputs } = data;
|
||||
|
||||
return (
|
||||
<NodeCard minW={'300px'} {...data}>
|
||||
<Divider text="Input" />
|
||||
<Container>
|
||||
<RenderInput moduleId={moduleId} flowInputList={inputs} />
|
||||
</Container>
|
||||
<Divider text="Output" />
|
||||
<Container>
|
||||
<RenderOutput moduleId={moduleId} flowOutputList={outputs} />
|
||||
</Container>
|
||||
<NodeCard minW={'350px'} {...data}>
|
||||
{inputs.length > 0 && (
|
||||
<>
|
||||
<Divider text="Input" />
|
||||
<Container>
|
||||
<RenderInput moduleId={moduleId} flowInputList={inputs} />
|
||||
</Container>
|
||||
</>
|
||||
)}
|
||||
{outputs.length > 0 && (
|
||||
<>
|
||||
<Divider text="Output" />
|
||||
<Container>
|
||||
<RenderOutput moduleId={moduleId} flowOutputList={outputs} />
|
||||
</Container>
|
||||
</>
|
||||
)}
|
||||
</NodeCard>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -16,19 +16,19 @@ import {
|
||||
} from '@chakra-ui/react';
|
||||
import { QuestionOutlineIcon } from '@chakra-ui/icons';
|
||||
import { FlowModuleItemType, ModuleItemType } from '@fastgpt/global/core/module/type.d';
|
||||
import { SystemInputEnum } from '@/constants/app';
|
||||
import { welcomeTextTip, variableTip } from '@/constants/flow/ModuleTemplate';
|
||||
import { ModuleInputKeyEnum } from '@fastgpt/global/core/module/constants';
|
||||
import { welcomeTextTip, variableTip } from '@fastgpt/global/core/module/template/tip';
|
||||
import { onChangeNode } from '../../FlowProvider';
|
||||
|
||||
import VariableEditModal, { addVariable } from '../../../VariableEditModal';
|
||||
import VariableEdit from '../modules/VariableEdit';
|
||||
import MyIcon from '@/components/Icon';
|
||||
import MyTooltip from '@/components/MyTooltip';
|
||||
import Container from '../modules/Container';
|
||||
import NodeCard from '../modules/NodeCard';
|
||||
import { VariableItemType } from '@/types/app';
|
||||
import QGSwitch from '@/pages/app/detail/components/QGSwitch';
|
||||
import TTSSelect from '@/pages/app/detail/components/TTSSelect';
|
||||
import { splitGuideModule } from '@/global/core/app/modules/utils';
|
||||
import type { VariableItemType } from '@fastgpt/global/core/module/type.d';
|
||||
import QGSwitch from '@/components/core/module/Flow/components/modules/QGSwitch';
|
||||
import TTSSelect from '@/components/core/module/Flow/components/modules/TTSSelect';
|
||||
import { splitGuideModule } from '@fastgpt/global/core/module/utils';
|
||||
|
||||
const NodeUserGuide = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
const theme = useTheme();
|
||||
@@ -57,7 +57,7 @@ export function WelcomeText({ data }: { data: FlowModuleItemType }) {
|
||||
const { inputs, moduleId } = data;
|
||||
|
||||
const welcomeText = useMemo(
|
||||
() => inputs.find((item) => item.key === SystemInputEnum.welcomeText),
|
||||
() => inputs.find((item) => item.key === ModuleInputKeyEnum.welcomeText),
|
||||
[inputs]
|
||||
);
|
||||
|
||||
@@ -81,7 +81,7 @@ export function WelcomeText({ data }: { data: FlowModuleItemType }) {
|
||||
onChange={(e) => {
|
||||
onChangeNode({
|
||||
moduleId,
|
||||
key: SystemInputEnum.welcomeText,
|
||||
key: ModuleInputKeyEnum.welcomeText,
|
||||
type: 'updateInput',
|
||||
value: {
|
||||
...welcomeText,
|
||||
@@ -100,21 +100,19 @@ function ChatStartVariable({ data }: { data: FlowModuleItemType }) {
|
||||
|
||||
const variables = useMemo(
|
||||
() =>
|
||||
(inputs.find((item) => item.key === SystemInputEnum.variables)
|
||||
(inputs.find((item) => item.key === ModuleInputKeyEnum.variables)
|
||||
?.value as VariableItemType[]) || [],
|
||||
[inputs]
|
||||
);
|
||||
|
||||
const [editVariable, setEditVariable] = useState<VariableItemType>();
|
||||
|
||||
const updateVariables = useCallback(
|
||||
(value: VariableItemType[]) => {
|
||||
onChangeNode({
|
||||
moduleId,
|
||||
key: SystemInputEnum.variables,
|
||||
key: ModuleInputKeyEnum.variables,
|
||||
type: 'updateInput',
|
||||
value: {
|
||||
...inputs.find((item) => item.key === SystemInputEnum.variables),
|
||||
...inputs.find((item) => item.key === ModuleInputKeyEnum.variables),
|
||||
value
|
||||
}
|
||||
});
|
||||
@@ -122,92 +120,7 @@ function ChatStartVariable({ data }: { data: FlowModuleItemType }) {
|
||||
[inputs, moduleId]
|
||||
);
|
||||
|
||||
const onclickSubmit = useCallback(
|
||||
({ variable }: { variable: VariableItemType }) => {
|
||||
updateVariables(variables.map((item) => (item.id === variable.id ? variable : item)));
|
||||
setEditVariable(undefined);
|
||||
},
|
||||
[updateVariables, variables]
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Flex mb={1} alignItems={'center'}>
|
||||
<MyIcon name={'variable'} mr={2} w={'16px'} color={'#fb7c3d'} />
|
||||
<Box>对话框变量</Box>
|
||||
<MyTooltip label={variableTip} forceShow>
|
||||
<QuestionOutlineIcon display={['none', 'inline']} ml={1} />
|
||||
</MyTooltip>
|
||||
<Box flex={1} />
|
||||
<Flex
|
||||
ml={2}
|
||||
textAlign={'right'}
|
||||
cursor={'pointer'}
|
||||
px={3}
|
||||
py={'2px'}
|
||||
borderRadius={'md'}
|
||||
_hover={{ bg: 'myGray.200' }}
|
||||
onClick={() => {
|
||||
const newVariable = addVariable();
|
||||
updateVariables(variables.concat(newVariable));
|
||||
setEditVariable(newVariable);
|
||||
}}
|
||||
>
|
||||
+ 新增
|
||||
</Flex>
|
||||
</Flex>
|
||||
{variables.length > 0 && (
|
||||
<TableContainer borderWidth={'1px'} borderBottom="none" borderRadius={'lg'}>
|
||||
<Table>
|
||||
<Thead>
|
||||
<Tr>
|
||||
<Th>变量名</Th>
|
||||
<Th>变量 key</Th>
|
||||
<Th>必填</Th>
|
||||
<Th></Th>
|
||||
</Tr>
|
||||
</Thead>
|
||||
<Tbody>
|
||||
{variables.map((item, index) => (
|
||||
<Tr key={index}>
|
||||
<Td>{item.label} </Td>
|
||||
<Td>{item.key}</Td>
|
||||
<Td>{item.required ? '✔' : ''}</Td>
|
||||
<Td>
|
||||
<MyIcon
|
||||
mr={3}
|
||||
name={'settingLight'}
|
||||
w={'16px'}
|
||||
cursor={'pointer'}
|
||||
onClick={() => {
|
||||
setEditVariable(item);
|
||||
}}
|
||||
/>
|
||||
<MyIcon
|
||||
name={'delete'}
|
||||
w={'16px'}
|
||||
cursor={'pointer'}
|
||||
onClick={() =>
|
||||
updateVariables(variables.filter((variable) => variable.id !== item.id))
|
||||
}
|
||||
/>
|
||||
</Td>
|
||||
</Tr>
|
||||
))}
|
||||
</Tbody>
|
||||
</Table>
|
||||
</TableContainer>
|
||||
)}
|
||||
|
||||
{!!editVariable && (
|
||||
<VariableEditModal
|
||||
defaultVariable={editVariable}
|
||||
onClose={() => setEditVariable(undefined)}
|
||||
onSubmit={onclickSubmit}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
return <VariableEdit variables={variables} onChange={(e) => updateVariables(e)} />;
|
||||
}
|
||||
|
||||
function QuestionGuide({ data }: { data: FlowModuleItemType }) {
|
||||
@@ -215,7 +128,7 @@ function QuestionGuide({ data }: { data: FlowModuleItemType }) {
|
||||
|
||||
const questionGuide = useMemo(
|
||||
() =>
|
||||
(inputs.find((item) => item.key === SystemInputEnum.questionGuide)?.value as boolean) ||
|
||||
(inputs.find((item) => item.key === ModuleInputKeyEnum.questionGuide)?.value as boolean) ||
|
||||
false,
|
||||
[inputs]
|
||||
);
|
||||
@@ -228,10 +141,10 @@ function QuestionGuide({ data }: { data: FlowModuleItemType }) {
|
||||
const value = e.target.checked;
|
||||
onChangeNode({
|
||||
moduleId,
|
||||
key: SystemInputEnum.questionGuide,
|
||||
key: ModuleInputKeyEnum.questionGuide,
|
||||
type: 'updateInput',
|
||||
value: {
|
||||
...inputs.find((item) => item.key === SystemInputEnum.questionGuide),
|
||||
...inputs.find((item) => item.key === ModuleInputKeyEnum.questionGuide),
|
||||
value
|
||||
}
|
||||
});
|
||||
@@ -250,10 +163,10 @@ function TTSGuide({ data }: { data: FlowModuleItemType }) {
|
||||
onChange={(e) => {
|
||||
onChangeNode({
|
||||
moduleId,
|
||||
key: SystemInputEnum.tts,
|
||||
key: ModuleInputKeyEnum.tts,
|
||||
type: 'updateInput',
|
||||
value: {
|
||||
...inputs.find((item) => item.key === SystemInputEnum.tts),
|
||||
...inputs.find((item) => item.key === ModuleInputKeyEnum.tts),
|
||||
value: e
|
||||
}
|
||||
});
|
||||
|
||||
@@ -6,12 +6,12 @@ import { AddIcon } from '@chakra-ui/icons';
|
||||
import NodeCard from '../../modules/NodeCard';
|
||||
import { FlowModuleItemType } from '@fastgpt/global/core/module/type.d';
|
||||
import Container from '../../modules/Container';
|
||||
import { SystemInputEnum, VariableInputEnum } from '@/constants/app';
|
||||
import type { VariableItemType } from '@/types/app';
|
||||
import { VariableInputEnum, ModuleInputKeyEnum } from '@fastgpt/global/core/module/constants';
|
||||
import type { VariableItemType } from '@fastgpt/global/core/module/type.d';
|
||||
import MyIcon from '@/components/Icon';
|
||||
import { customAlphabet } from 'nanoid';
|
||||
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 6);
|
||||
import VariableEditModal, { addVariable } from '../../../../VariableEditModal';
|
||||
import VariableEditModal, { addVariable } from '../../modules/VariableEdit';
|
||||
import { onChangeNode } from '../../../FlowProvider';
|
||||
|
||||
export const defaultVariable: VariableItemType = {
|
||||
@@ -29,102 +29,31 @@ const NodeUserGuide = ({ data }: NodeProps<FlowModuleItemType>) => {
|
||||
|
||||
const variables = useMemo(
|
||||
() =>
|
||||
(inputs.find((item) => item.key === SystemInputEnum.variables)
|
||||
(inputs.find((item) => item.key === ModuleInputKeyEnum.variables)
|
||||
?.value as VariableItemType[]) || [],
|
||||
[inputs]
|
||||
);
|
||||
|
||||
const [editVariable, setEditVariable] = useState<VariableItemType>();
|
||||
|
||||
const updateVariables = useCallback(
|
||||
(value: VariableItemType[]) => {
|
||||
onChangeNode({
|
||||
moduleId,
|
||||
key: SystemInputEnum.variables,
|
||||
type: 'updateInput',
|
||||
value: {
|
||||
...inputs.find((item) => item.key === SystemInputEnum.variables),
|
||||
value
|
||||
}
|
||||
});
|
||||
},
|
||||
[inputs, moduleId]
|
||||
);
|
||||
|
||||
const onclickSubmit = useCallback(
|
||||
({ variable }: { variable: VariableItemType }) => {
|
||||
updateVariables(variables.map((item) => (item.id === variable.id ? variable : item)));
|
||||
setEditVariable(undefined);
|
||||
},
|
||||
[updateVariables, variables]
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<NodeCard minW={'300px'} {...data}>
|
||||
<Container borderTop={'2px solid'} borderTopColor={'myGray.200'}>
|
||||
<TableContainer>
|
||||
<Table>
|
||||
<Thead>
|
||||
<Tr>
|
||||
<Th>变量名</Th>
|
||||
<Th>变量 key</Th>
|
||||
<Th>必填</Th>
|
||||
<Th></Th>
|
||||
</Tr>
|
||||
</Thead>
|
||||
<Tbody>
|
||||
{variables.map((item, index) => (
|
||||
<Tr key={index}>
|
||||
<Td>{item.label} </Td>
|
||||
<Td>{item.key}</Td>
|
||||
<Td>{item.required ? '✔' : ''}</Td>
|
||||
<Td>
|
||||
<MyIcon
|
||||
mr={3}
|
||||
name={'settingLight'}
|
||||
w={'16px'}
|
||||
cursor={'pointer'}
|
||||
onClick={() => {
|
||||
setEditVariable(item);
|
||||
}}
|
||||
/>
|
||||
<MyIcon
|
||||
name={'delete'}
|
||||
w={'16px'}
|
||||
cursor={'pointer'}
|
||||
onClick={() =>
|
||||
updateVariables(variables.filter((variable) => variable.id !== item.id))
|
||||
}
|
||||
/>
|
||||
</Td>
|
||||
</Tr>
|
||||
))}
|
||||
</Tbody>
|
||||
</Table>
|
||||
</TableContainer>
|
||||
<Box mt={2} textAlign={'right'}>
|
||||
<Button
|
||||
variant={'base'}
|
||||
leftIcon={<AddIcon fontSize={'10px'} />}
|
||||
onClick={() => {
|
||||
const newVariable = addVariable();
|
||||
updateVariables(variables.concat(newVariable));
|
||||
setEditVariable(newVariable);
|
||||
}}
|
||||
>
|
||||
新增
|
||||
</Button>
|
||||
</Box>
|
||||
<VariableEditModal
|
||||
variables={variables}
|
||||
onChange={(e) =>
|
||||
onChangeNode({
|
||||
moduleId,
|
||||
key: ModuleInputKeyEnum.variables,
|
||||
type: 'updateInput',
|
||||
value: {
|
||||
...inputs.find((item) => item.key === ModuleInputKeyEnum.variables),
|
||||
value: e
|
||||
}
|
||||
})
|
||||
}
|
||||
/>
|
||||
</Container>
|
||||
</NodeCard>
|
||||
{!!editVariable && (
|
||||
<VariableEditModal
|
||||
defaultVariable={editVariable}
|
||||
onClose={() => setEditVariable(undefined)}
|
||||
onSubmit={onclickSubmit}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -28,13 +28,12 @@ import MyTooltip from '@/components/MyTooltip';
|
||||
import TargetHandle from './TargetHandle';
|
||||
import MyIcon from '@/components/Icon';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { AIChatProps } from '@/types/core/aiChat';
|
||||
import type { AIChatModuleProps } from '@fastgpt/global/core/module/node/type.d';
|
||||
import { chatModelList } from '@/web/common/system/staticData';
|
||||
import { formatPrice } from '@fastgpt/global/support/wallet/bill/tools';
|
||||
import { useDatasetStore } from '@/web/core/dataset/store/dataset';
|
||||
import type { SelectedDatasetType } from '@fastgpt/global/core/module/api.d';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import type { LLMModelItemType } from '@fastgpt/global/core/ai/model.d';
|
||||
import type { EditFieldModeType, EditFieldType } from '../modules/FieldEditModal';
|
||||
import { feConfigs } from '@/web/common/system/staticData';
|
||||
|
||||
@@ -53,13 +52,31 @@ export const Label = React.memo(function Label({
|
||||
inputKey: string;
|
||||
editFiledType?: EditFieldModeType;
|
||||
}) {
|
||||
const { required = false, description, edit, label, type, valueType } = item;
|
||||
const { t } = useTranslation();
|
||||
const { mode } = useFlowProviderStore();
|
||||
const {
|
||||
required = false,
|
||||
description,
|
||||
edit,
|
||||
label,
|
||||
type,
|
||||
valueType,
|
||||
showTargetInApp,
|
||||
showTargetInPlugin
|
||||
} = item;
|
||||
const [editField, setEditField] = useState<EditFieldType>();
|
||||
|
||||
const targetHandle = useMemo(() => {
|
||||
if (type === FlowNodeInputTypeEnum.target) return true;
|
||||
if (mode === 'app' && showTargetInApp) return true;
|
||||
if (mode === 'plugin' && showTargetInPlugin) return true;
|
||||
return false;
|
||||
}, [mode, showTargetInApp, showTargetInPlugin, type]);
|
||||
|
||||
return (
|
||||
<Flex className="nodrag" cursor={'default'} alignItems={'center'} position={'relative'}>
|
||||
<Box position={'relative'}>
|
||||
{label}
|
||||
{t(label)}
|
||||
{description && (
|
||||
<MyTooltip label={description} forceShow>
|
||||
<QuestionOutlineIcon display={['none', 'inline']} ml={1} />
|
||||
@@ -78,9 +95,7 @@ export const Label = React.memo(function Label({
|
||||
)}
|
||||
</Box>
|
||||
|
||||
{(type === FlowNodeInputTypeEnum.target || valueType) && (
|
||||
<TargetHandle handleKey={inputKey} valueType={valueType} />
|
||||
)}
|
||||
{targetHandle && <TargetHandle handleKey={inputKey} valueType={valueType} />}
|
||||
|
||||
{edit && (
|
||||
<>
|
||||
@@ -93,6 +108,7 @@ export const Label = React.memo(function Label({
|
||||
onClick={() =>
|
||||
setEditField({
|
||||
label: item.label,
|
||||
type: item.type,
|
||||
valueType: item.valueType,
|
||||
required: item.required,
|
||||
key: inputKey,
|
||||
@@ -210,9 +226,6 @@ const RenderInput = ({
|
||||
{item.type === FlowNodeInputTypeEnum.aiSettings && (
|
||||
<AISetting inputs={sortInputs} item={item} moduleId={moduleId} />
|
||||
)}
|
||||
{item.type === FlowNodeInputTypeEnum.maxToken && (
|
||||
<MaxTokenRender inputs={sortInputs} item={item} moduleId={moduleId} />
|
||||
)}
|
||||
{item.type === FlowNodeInputTypeEnum.selectChatModel && (
|
||||
<SelectChatModelRender inputs={sortInputs} item={item} moduleId={moduleId} />
|
||||
)}
|
||||
@@ -381,7 +394,7 @@ var AISetting = React.memo(function AISetting({ inputs = [], moduleId }: RenderP
|
||||
inputs.forEach((item) => {
|
||||
obj[item.key] = item.value;
|
||||
});
|
||||
return obj as AIChatProps;
|
||||
return obj as AIChatModuleProps;
|
||||
}, [inputs]);
|
||||
|
||||
const {
|
||||
@@ -427,50 +440,12 @@ var AISetting = React.memo(function AISetting({ inputs = [], moduleId }: RenderP
|
||||
);
|
||||
});
|
||||
|
||||
var MaxTokenRender = React.memo(function MaxTokenRender({
|
||||
inputs = [],
|
||||
item,
|
||||
moduleId
|
||||
}: RenderProps) {
|
||||
const model = inputs.find((item) => item.key === 'model')?.value;
|
||||
const modelData = chatModelList.find((item) => item.model === model);
|
||||
const maxToken = modelData ? modelData.maxResponse : 4000;
|
||||
const markList = [
|
||||
{ label: '100', value: 100 },
|
||||
{ label: `${maxToken}`, value: maxToken }
|
||||
];
|
||||
|
||||
return (
|
||||
<Box pt={5} pb={4} px={2}>
|
||||
<MySlider
|
||||
markList={markList}
|
||||
width={'100%'}
|
||||
min={item.min || 100}
|
||||
max={maxToken}
|
||||
step={item.step || 1}
|
||||
value={item.value}
|
||||
onChange={(e) => {
|
||||
onChangeNode({
|
||||
moduleId,
|
||||
type: 'updateInput',
|
||||
key: item.key,
|
||||
value: {
|
||||
...item,
|
||||
value: e
|
||||
}
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
});
|
||||
|
||||
var SelectChatModelRender = React.memo(function SelectChatModelRender({
|
||||
inputs = [],
|
||||
item,
|
||||
moduleId
|
||||
}: RenderProps) {
|
||||
const modelList = (item.customData?.() as LLMModelItemType[]) || chatModelList || [];
|
||||
const modelList = chatModelList || [];
|
||||
|
||||
function onChangeModel(e: string) {
|
||||
{
|
||||
@@ -531,6 +506,7 @@ var SelectChatModelRender = React.memo(function SelectChatModelRender({
|
||||
|
||||
var SelectDatasetRender = React.memo(function SelectDatasetRender({ item, moduleId }: RenderProps) {
|
||||
const theme = useTheme();
|
||||
const { mode } = useFlowProviderStore();
|
||||
const { allDatasets, loadAllDatasets } = useDatasetStore();
|
||||
const {
|
||||
isOpen: isOpenKbSelect,
|
||||
@@ -538,9 +514,9 @@ var SelectDatasetRender = React.memo(function SelectDatasetRender({ item, module
|
||||
onClose: onCloseKbSelect
|
||||
} = useDisclosure();
|
||||
|
||||
const showKbList = useMemo(() => {
|
||||
const selectedDatasets = useMemo(() => {
|
||||
const value = item.value as SelectedDatasetType;
|
||||
return allDatasets.filter((dataset) => value.find((kb) => kb.datasetId === dataset._id));
|
||||
return allDatasets.filter((dataset) => value?.find((item) => item.datasetId === dataset._id));
|
||||
}, [allDatasets, item.value]);
|
||||
|
||||
useQuery(['loadAllDatasets'], loadAllDatasets);
|
||||
@@ -551,7 +527,7 @@ var SelectDatasetRender = React.memo(function SelectDatasetRender({ item, module
|
||||
<Button h={'36px'} onClick={onOpenKbSelect}>
|
||||
选择知识库
|
||||
</Button>
|
||||
{showKbList.map((item) => (
|
||||
{selectedDatasets.map((item) => (
|
||||
<Flex
|
||||
key={item._id}
|
||||
alignItems={'center'}
|
||||
@@ -574,22 +550,24 @@ var SelectDatasetRender = React.memo(function SelectDatasetRender({ item, module
|
||||
</Flex>
|
||||
))}
|
||||
</Grid>
|
||||
<DatasetSelectModal
|
||||
isOpen={isOpenKbSelect}
|
||||
activeDatasets={item.value}
|
||||
onChange={(e) => {
|
||||
onChangeNode({
|
||||
moduleId,
|
||||
key: item.key,
|
||||
type: 'updateInput',
|
||||
value: {
|
||||
...item,
|
||||
value: e
|
||||
}
|
||||
});
|
||||
}}
|
||||
onClose={onCloseKbSelect}
|
||||
/>
|
||||
{isOpenKbSelect && (
|
||||
<DatasetSelectModal
|
||||
isOpen={isOpenKbSelect}
|
||||
defaultSelectedDatasets={item.value}
|
||||
onChange={(e) => {
|
||||
onChangeNode({
|
||||
moduleId,
|
||||
key: item.key,
|
||||
type: 'updateInput',
|
||||
value: {
|
||||
...item,
|
||||
value: e
|
||||
}
|
||||
});
|
||||
}}
|
||||
onClose={onCloseKbSelect}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -8,7 +8,8 @@ import SourceHandle from './SourceHandle';
|
||||
import MyIcon from '@/components/Icon';
|
||||
import dynamic from 'next/dynamic';
|
||||
import { onChangeNode } from '../../FlowProvider';
|
||||
import { SystemOutputEnum } from '@/constants/app';
|
||||
import { ModuleOutputKeyEnum } from '@fastgpt/global/core/module/constants';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
|
||||
import type { EditFieldType, EditFieldModeType } from '../modules/FieldEditModal';
|
||||
const FieldEditModal = dynamic(() => import('../modules/FieldEditModal'));
|
||||
@@ -25,7 +26,8 @@ export const Label = ({
|
||||
outputs: FlowNodeOutputItemType[];
|
||||
editFiledType?: EditFieldModeType;
|
||||
}) => {
|
||||
const { label, description, edit } = item;
|
||||
const { t } = useTranslation();
|
||||
const { label = '', description, edit } = item;
|
||||
const [editField, setEditField] = useState<EditFieldType>();
|
||||
|
||||
return (
|
||||
@@ -71,11 +73,11 @@ export const Label = ({
|
||||
</>
|
||||
)}
|
||||
{description && (
|
||||
<MyTooltip label={description} forceShow>
|
||||
<MyTooltip label={t(description)} forceShow>
|
||||
<QuestionOutlineIcon display={['none', 'inline']} mr={1} />
|
||||
</MyTooltip>
|
||||
)}
|
||||
<Box>{label}</Box>
|
||||
<Box>{t(label)}</Box>
|
||||
|
||||
{!!editField && (
|
||||
<FieldEditModal
|
||||
@@ -123,8 +125,8 @@ const RenderOutput = ({
|
||||
const sortOutput = useMemo(
|
||||
() =>
|
||||
[...flowOutputList].sort((a, b) => {
|
||||
if (a.key === SystemOutputEnum.finish) return -1;
|
||||
if (b.key === SystemOutputEnum.finish) return 1;
|
||||
if (a.key === ModuleOutputKeyEnum.finish) return -1;
|
||||
if (b.key === ModuleOutputKeyEnum.finish) return 1;
|
||||
return 0;
|
||||
}),
|
||||
[flowOutputList]
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
import React, { useMemo, useTransition } from 'react';
|
||||
import { Box, BoxProps } from '@chakra-ui/react';
|
||||
import { Handle, Position } from 'reactflow';
|
||||
import { FlowValueTypeStyle, FlowValueTypeTip } from '@/constants/flow';
|
||||
import { FlowValueTypeStyle, FlowValueTypeMap } from '@/web/core/modules/constants/dataType';
|
||||
import MyTooltip from '@/components/MyTooltip';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { FlowNodeValTypeEnum } from '@fastgpt/global/core/module/node/constant';
|
||||
import { ModuleDataTypeEnum } from '@fastgpt/global/core/module/constants';
|
||||
|
||||
interface Props extends BoxProps {
|
||||
handleKey: string;
|
||||
valueType?: `${FlowNodeValTypeEnum}`;
|
||||
valueType?: `${ModuleDataTypeEnum}`;
|
||||
}
|
||||
|
||||
const SourceHandle = ({ handleKey, valueType, ...props }: Props) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const valType = valueType ?? FlowNodeValTypeEnum.any;
|
||||
const valType = valueType ?? ModuleDataTypeEnum.any;
|
||||
|
||||
const valueStyle = useMemo(
|
||||
() =>
|
||||
valueType
|
||||
? FlowValueTypeStyle[valueType]
|
||||
: (FlowValueTypeStyle[FlowNodeValTypeEnum.any] as any),
|
||||
: (FlowValueTypeStyle[ModuleDataTypeEnum.any] as any),
|
||||
[valueType]
|
||||
);
|
||||
|
||||
@@ -34,8 +34,8 @@ const SourceHandle = ({ handleKey, valueType, ...props }: Props) => {
|
||||
>
|
||||
<MyTooltip
|
||||
label={t('app.module.type', {
|
||||
type: t(FlowValueTypeTip[valType].label),
|
||||
example: FlowValueTypeTip[valType].example
|
||||
type: t(FlowValueTypeMap[valType].label),
|
||||
example: FlowValueTypeMap[valType].example
|
||||
})}
|
||||
>
|
||||
<Handle
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import { Box, BoxProps } from '@chakra-ui/react';
|
||||
import { Handle, OnConnect, Position } from 'reactflow';
|
||||
import { FlowValueTypeStyle, FlowValueTypeTip } from '@/constants/flow';
|
||||
import { FlowValueTypeStyle, FlowValueTypeMap } from '@/web/core/modules/constants/dataType';
|
||||
import MyTooltip from '@/components/MyTooltip';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { FlowNodeValTypeEnum } from '@fastgpt/global/core/module/node/constant';
|
||||
import { ModuleDataTypeEnum } from '@fastgpt/global/core/module/constants';
|
||||
|
||||
interface Props extends BoxProps {
|
||||
handleKey: string;
|
||||
valueType?: `${FlowNodeValTypeEnum}`;
|
||||
valueType?: `${ModuleDataTypeEnum}`;
|
||||
onConnect?: OnConnect;
|
||||
}
|
||||
|
||||
const TargetHandle = ({ handleKey, valueType, onConnect, ...props }: Props) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const valType = valueType ?? FlowNodeValTypeEnum.any;
|
||||
const valType = valueType ?? ModuleDataTypeEnum.any;
|
||||
const valueStyle = useMemo(
|
||||
() =>
|
||||
valueType
|
||||
? FlowValueTypeStyle[valueType]
|
||||
: (FlowValueTypeStyle[FlowNodeValTypeEnum.any] as any),
|
||||
: (FlowValueTypeStyle[ModuleDataTypeEnum.any] as any),
|
||||
[valueType]
|
||||
);
|
||||
|
||||
@@ -35,8 +35,8 @@ const TargetHandle = ({ handleKey, valueType, onConnect, ...props }: Props) => {
|
||||
>
|
||||
<MyTooltip
|
||||
label={t('app.module.type', {
|
||||
type: t(FlowValueTypeTip[valType].label),
|
||||
example: FlowValueTypeTip[valType].example
|
||||
type: t(FlowValueTypeMap[valType].label),
|
||||
example: FlowValueTypeMap[valType].example
|
||||
})}
|
||||
>
|
||||
<Handle
|
||||
|
||||
@@ -2,13 +2,13 @@ import React, { useEffect } from 'react';
|
||||
import ReactFlow, { Background, Controls, ReactFlowProvider } from 'reactflow';
|
||||
import { Box, Flex, IconButton, useDisclosure } from '@chakra-ui/react';
|
||||
import { SmallCloseIcon } from '@chakra-ui/icons';
|
||||
import { edgeOptions, connectionLineStyle } from '@/constants/flow';
|
||||
import { edgeOptions, connectionLineStyle } from '@/web/core/modules/constants/flowUi';
|
||||
import { FlowNodeTypeEnum } from '@fastgpt/global/core/module/node/constant';
|
||||
|
||||
import dynamic from 'next/dynamic';
|
||||
|
||||
import ButtonEdge from './components/modules/ButtonEdge';
|
||||
import TemplateList, { type ModuleTemplateProps } from './TemplateList';
|
||||
import ModuleTemplateList, { type ModuleTemplateProps } from './ModuleTemplateList';
|
||||
import { useFlowProviderStore } from './FlowProvider';
|
||||
|
||||
import 'reactflow/dist/style.css';
|
||||
@@ -27,8 +27,8 @@ const nodeTypes = {
|
||||
[FlowNodeTypeEnum.contentExtract]: dynamic(() => import('./components/nodes/NodeExtract')),
|
||||
[FlowNodeTypeEnum.httpRequest]: dynamic(() => import('./components/nodes/NodeHttp')),
|
||||
[FlowNodeTypeEnum.runApp]: NodeSimple,
|
||||
[FlowNodeTypeEnum.pluginInput]: dynamic(() => import('./components/nodes/NodeInput')),
|
||||
[FlowNodeTypeEnum.pluginOutput]: dynamic(() => import('./components/nodes/NodeOutput')),
|
||||
[FlowNodeTypeEnum.pluginInput]: dynamic(() => import('./components/nodes/NodePluginInput')),
|
||||
[FlowNodeTypeEnum.pluginOutput]: dynamic(() => import('./components/nodes/NodePluginOutput')),
|
||||
[FlowNodeTypeEnum.pluginModule]: NodeSimple
|
||||
};
|
||||
const edgeTypes = {
|
||||
@@ -40,7 +40,7 @@ type Props = {
|
||||
} & ModuleTemplateProps;
|
||||
|
||||
const Container = React.memo(function Container(props: Props) {
|
||||
const { modules = [], Header, systemTemplates, pluginTemplates, show2Plugin } = props;
|
||||
const { modules = [], Header, systemTemplates, pluginTemplates } = props;
|
||||
|
||||
const {
|
||||
isOpen: isOpenTemplate,
|
||||
@@ -114,10 +114,9 @@ const Container = React.memo(function Container(props: Props) {
|
||||
<Controls position={'bottom-right'} style={{ display: 'flex' }} showInteractive={false} />
|
||||
</ReactFlow>
|
||||
|
||||
<TemplateList
|
||||
<ModuleTemplateList
|
||||
systemTemplates={systemTemplates}
|
||||
pluginTemplates={pluginTemplates}
|
||||
show2Plugin={show2Plugin}
|
||||
isOpen={isOpenTemplate}
|
||||
onClose={onCloseTemplate}
|
||||
/>
|
||||
|
||||
@@ -1,209 +0,0 @@
|
||||
import React, { useState } from 'react';
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
ModalHeader,
|
||||
ModalFooter,
|
||||
ModalBody,
|
||||
NumberInput,
|
||||
NumberInputField,
|
||||
NumberInputStepper,
|
||||
NumberIncrementStepper,
|
||||
NumberDecrementStepper,
|
||||
Flex,
|
||||
Switch,
|
||||
Input,
|
||||
Grid,
|
||||
FormControl,
|
||||
useTheme
|
||||
} from '@chakra-ui/react';
|
||||
import { SmallAddIcon } from '@chakra-ui/icons';
|
||||
import { VariableInputEnum } from '@/constants/app';
|
||||
import type { VariableItemType } from '@/types/app';
|
||||
import MyIcon from '@/components/Icon';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { useFieldArray } from 'react-hook-form';
|
||||
import { customAlphabet } from 'nanoid';
|
||||
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 6);
|
||||
import MyModal from '@/components/MyModal';
|
||||
|
||||
const VariableTypeList = [
|
||||
{ label: '文本', icon: 'settingLight', key: VariableInputEnum.input },
|
||||
{ label: '下拉单选', icon: 'settingLight', key: VariableInputEnum.select }
|
||||
];
|
||||
|
||||
export type VariableFormType = {
|
||||
variable: VariableItemType;
|
||||
};
|
||||
|
||||
const VariableEditModal = ({
|
||||
defaultVariable,
|
||||
onClose,
|
||||
onSubmit
|
||||
}: {
|
||||
defaultVariable: VariableItemType;
|
||||
onClose: () => void;
|
||||
onSubmit: (data: VariableFormType) => void;
|
||||
}) => {
|
||||
const theme = useTheme();
|
||||
const [refresh, setRefresh] = useState(false);
|
||||
|
||||
const { reset, getValues, setValue, register, control, handleSubmit } = useForm<VariableFormType>(
|
||||
{
|
||||
defaultValues: {
|
||||
variable: defaultVariable
|
||||
}
|
||||
}
|
||||
);
|
||||
const {
|
||||
fields: selectEnums,
|
||||
append: appendEnums,
|
||||
remove: removeEnums
|
||||
} = useFieldArray({
|
||||
control,
|
||||
name: 'variable.enums'
|
||||
});
|
||||
|
||||
return (
|
||||
<MyModal isOpen={true} onClose={onClose}>
|
||||
<ModalHeader display={'flex'}>
|
||||
<MyIcon name={'variable'} mr={2} w={'24px'} color={'#FF8A4C'} />
|
||||
变量设置
|
||||
</ModalHeader>
|
||||
<ModalBody>
|
||||
<Flex alignItems={'center'}>
|
||||
<Box w={'70px'}>必填</Box>
|
||||
<Switch {...register('variable.required')} />
|
||||
</Flex>
|
||||
<Flex mt={5} alignItems={'center'}>
|
||||
<Box w={'80px'}>变量名</Box>
|
||||
<Input {...register('variable.label', { required: '变量名不能为空' })} />
|
||||
</Flex>
|
||||
<Flex mt={5} alignItems={'center'}>
|
||||
<Box w={'80px'}>变量 key</Box>
|
||||
<Input {...register('variable.key', { required: '变量 key 不能为空' })} />
|
||||
</Flex>
|
||||
|
||||
<Box mt={5} mb={2}>
|
||||
字段类型
|
||||
</Box>
|
||||
<Grid gridTemplateColumns={'repeat(2,130px)'} gridGap={4}>
|
||||
{VariableTypeList.map((item) => (
|
||||
<Flex
|
||||
key={item.key}
|
||||
px={4}
|
||||
py={1}
|
||||
border={theme.borders.base}
|
||||
borderRadius={'md'}
|
||||
cursor={'pointer'}
|
||||
{...(item.key === getValues('variable.type')
|
||||
? {
|
||||
bg: 'myWhite.600'
|
||||
}
|
||||
: {
|
||||
_hover: {
|
||||
boxShadow: 'md'
|
||||
},
|
||||
onClick: () => {
|
||||
setValue('variable.type', item.key);
|
||||
setRefresh(!refresh);
|
||||
}
|
||||
})}
|
||||
>
|
||||
<MyIcon name={item.icon as any} w={'16px'} />
|
||||
<Box ml={3}>{item.label}</Box>
|
||||
</Flex>
|
||||
))}
|
||||
</Grid>
|
||||
|
||||
{getValues('variable.type') === VariableInputEnum.input && (
|
||||
<>
|
||||
<Box mt={5} mb={2}>
|
||||
最大长度
|
||||
</Box>
|
||||
<Box>
|
||||
<NumberInput max={100} min={1} step={1} position={'relative'}>
|
||||
<NumberInputField
|
||||
{...register('variable.maxLen', {
|
||||
min: 1,
|
||||
max: 100,
|
||||
valueAsNumber: true
|
||||
})}
|
||||
max={100}
|
||||
/>
|
||||
<NumberInputStepper>
|
||||
<NumberIncrementStepper />
|
||||
<NumberDecrementStepper />
|
||||
</NumberInputStepper>
|
||||
</NumberInput>
|
||||
</Box>
|
||||
</>
|
||||
)}
|
||||
|
||||
{getValues('variable.type') === VariableInputEnum.select && (
|
||||
<>
|
||||
<Box mt={5} mb={2}>
|
||||
选项
|
||||
</Box>
|
||||
<Box>
|
||||
{selectEnums.map((item, i) => (
|
||||
<Flex key={item.id} mb={2} alignItems={'center'}>
|
||||
<FormControl>
|
||||
<Input
|
||||
{...register(`variable.enums.${i}.value`, {
|
||||
required: '选项内容不能为空'
|
||||
})}
|
||||
/>
|
||||
</FormControl>
|
||||
<MyIcon
|
||||
ml={3}
|
||||
name={'delete'}
|
||||
w={'16px'}
|
||||
cursor={'pointer'}
|
||||
p={2}
|
||||
borderRadius={'lg'}
|
||||
_hover={{ bg: 'red.100' }}
|
||||
onClick={() => removeEnums(i)}
|
||||
/>
|
||||
</Flex>
|
||||
))}
|
||||
</Box>
|
||||
<Button
|
||||
variant={'solid'}
|
||||
w={'100%'}
|
||||
textAlign={'left'}
|
||||
leftIcon={<SmallAddIcon />}
|
||||
bg={'myGray.100 !important'}
|
||||
onClick={() => appendEnums({ value: '' })}
|
||||
>
|
||||
添加选项
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</ModalBody>
|
||||
|
||||
<ModalFooter>
|
||||
<Button variant={'base'} mr={3} onClick={onClose}>
|
||||
取消
|
||||
</Button>
|
||||
<Button onClick={handleSubmit(onSubmit)}>确认</Button>
|
||||
</ModalFooter>
|
||||
</MyModal>
|
||||
);
|
||||
};
|
||||
|
||||
export default React.memo(VariableEditModal);
|
||||
|
||||
export const defaultVariable: VariableItemType = {
|
||||
id: nanoid(),
|
||||
key: 'key',
|
||||
label: 'label',
|
||||
type: VariableInputEnum.input,
|
||||
required: true,
|
||||
maxLen: 50,
|
||||
enums: [{ value: '' }]
|
||||
};
|
||||
export const addVariable = () => {
|
||||
const newVariable = { ...defaultVariable, key: nanoid(), id: nanoid() };
|
||||
return newVariable;
|
||||
};
|
||||
@@ -219,16 +219,23 @@ const ApiKeyTable = ({ tips, appId }: { tips: string; appId?: string }) => {
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<MyModal isOpen={!!apiKey} w={['400px', '600px']} onClose={() => setApiKey('')}>
|
||||
<Box py={3} px={5}>
|
||||
<Box fontWeight={'bold'} fontSize={'2xl'}>
|
||||
新的 API 秘钥
|
||||
<MyModal
|
||||
isOpen={!!apiKey}
|
||||
w={['400px', '600px']}
|
||||
iconSrc="/imgs/modal/key.svg"
|
||||
title={
|
||||
<Box>
|
||||
<Box fontWeight={'bold'} fontSize={'xl'}>
|
||||
新的 API 秘钥
|
||||
</Box>
|
||||
<Box fontSize={'sm'} color={'myGray.600'}>
|
||||
请保管好你的秘钥,秘钥不会再次展示~
|
||||
</Box>
|
||||
</Box>
|
||||
<Box fontSize={'sm'} color={'myGray.600'}>
|
||||
请保管好你的秘钥,秘钥不会再次展示~
|
||||
</Box>
|
||||
</Box>
|
||||
<ModalBody>
|
||||
}
|
||||
onClose={() => setApiKey('')}
|
||||
>
|
||||
<ModalBody pt={5}>
|
||||
<Flex
|
||||
bg={'myGray.100'}
|
||||
px={3}
|
||||
@@ -236,6 +243,7 @@ const ApiKeyTable = ({ tips, appId }: { tips: string; appId?: string }) => {
|
||||
whiteSpace={'pre-wrap'}
|
||||
wordBreak={'break-all'}
|
||||
cursor={'pointer'}
|
||||
borderRadius={'md'}
|
||||
onClick={() => copyData(apiKey)}
|
||||
>
|
||||
<Box flex={1}>{apiKey}</Box>
|
||||
@@ -292,7 +300,11 @@ function EditKeyModal({
|
||||
});
|
||||
|
||||
return (
|
||||
<MyModal isOpen={true} title={isEdit ? t('outlink.Edit API Key') : t('outlink.Create API Key')}>
|
||||
<MyModal
|
||||
isOpen={true}
|
||||
iconSrc="/imgs/modal/key.svg"
|
||||
title={isEdit ? t('outlink.Edit API Key') : t('outlink.Create API Key')}
|
||||
>
|
||||
<ModalBody>
|
||||
<Flex alignItems={'center'}>
|
||||
<Box flex={'0 0 90px'}>{t('Name')}:</Box>
|
||||
|
||||
@@ -98,6 +98,7 @@ function EditModal({
|
||||
<MyModal
|
||||
isOpen
|
||||
onClose={onClose}
|
||||
iconSrc="/imgs/modal/team.svg"
|
||||
title={defaultData.id ? t('user.team.Update Team') : t('user.team.Create Team')}
|
||||
>
|
||||
<ModalBody>
|
||||
|
||||
@@ -68,13 +68,14 @@ const InviteModal = ({
|
||||
return (
|
||||
<MyModal
|
||||
isOpen
|
||||
iconSrc="/imgs/modal/team.svg"
|
||||
title={
|
||||
<>
|
||||
<Box>
|
||||
<Box>{t('user.team.Invite Member')}</Box>
|
||||
<Box color={'myGray.500'} fontSize={'xs'} fontWeight={'normal'}>
|
||||
{t('user.team.Invite Member Tips')}
|
||||
</Box>
|
||||
</>
|
||||
</Box>
|
||||
}
|
||||
maxW={['90vw', '400px']}
|
||||
overflow={'unset'}
|
||||
|
||||
@@ -64,7 +64,7 @@ const TeamManageModal = ({ onClose }: { onClose: () => void }) => {
|
||||
|
||||
const {
|
||||
data: myTeams = [],
|
||||
isLoading: isLoadingTeams,
|
||||
isFetching: isLoadingTeams,
|
||||
refetch: refetchTeam
|
||||
} = useQuery(['getTeams', userInfo?._id], () => getTeamList(TeamMemberStatusEnum.active));
|
||||
const defaultTeam = useMemo(
|
||||
|
||||
@@ -53,13 +53,14 @@ const UpdateInviteModal = () => {
|
||||
return (
|
||||
<MyModal
|
||||
isOpen={inviteList && inviteList.length > 0}
|
||||
iconSrc="/imgs/modal/team.svg"
|
||||
title={
|
||||
<>
|
||||
<Box>
|
||||
<Box>{t('user.team.Processing invitations')}</Box>
|
||||
<Box fontWeight={'normal'} fontSize={'sm'} color={'myGray.500'}>
|
||||
{t('user.team.Processing invitations Tips', { amount: inviteList?.length })}
|
||||
</Box>
|
||||
</>
|
||||
</Box>
|
||||
}
|
||||
maxW={['90vw', '500px']}
|
||||
>
|
||||
|
||||
@@ -5,7 +5,8 @@ export const defaultApp: AppDetailType = {
|
||||
_id: '',
|
||||
userId: 'userId',
|
||||
name: '模型加载中',
|
||||
type: 'basic',
|
||||
type: 'simple',
|
||||
simpleTemplateId: 'fastgpt-universal',
|
||||
avatar: '/icon/logo.svg',
|
||||
intro: '',
|
||||
updateTime: Date.now(),
|
||||
@@ -26,26 +27,6 @@ export const defaultOutLinkForm: OutLinkEditType = {
|
||||
}
|
||||
};
|
||||
|
||||
/* module special */
|
||||
export enum SystemInputEnum {
|
||||
'welcomeText' = 'welcomeText',
|
||||
'variables' = 'variables',
|
||||
'switch' = 'switch', // a trigger switch
|
||||
'history' = 'history',
|
||||
'userChatInput' = 'userChatInput',
|
||||
'questionGuide' = 'questionGuide',
|
||||
'tts' = 'tts',
|
||||
isResponseAnswerText = 'isResponseAnswerText'
|
||||
}
|
||||
export enum SystemOutputEnum {
|
||||
finish = 'finish'
|
||||
}
|
||||
|
||||
export enum VariableInputEnum {
|
||||
input = 'input',
|
||||
select = 'select'
|
||||
}
|
||||
|
||||
export enum TTSTypeEnum {
|
||||
none = 'none',
|
||||
web = 'web',
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
export enum ContextExtractEnum {
|
||||
extractKeys = 'extractKeys',
|
||||
content = 'content',
|
||||
description = 'description',
|
||||
success = 'success',
|
||||
failed = 'failed',
|
||||
fields = 'fields'
|
||||
}
|
||||
|
||||
export enum HttpPropsEnum {
|
||||
url = 'url',
|
||||
failed = 'failed'
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
import type { BoxProps } from '@chakra-ui/react';
|
||||
import { FlowNodeTypeEnum, FlowNodeValTypeEnum } from '@fastgpt/global/core/module/node/constant';
|
||||
|
||||
export const FlowValueTypeStyle: Record<`${FlowNodeValTypeEnum}`, BoxProps> = {
|
||||
[FlowNodeValTypeEnum.string]: {
|
||||
background: '#36ADEF'
|
||||
},
|
||||
[FlowNodeValTypeEnum.number]: {
|
||||
background: '#FB7C3C'
|
||||
},
|
||||
[FlowNodeValTypeEnum.boolean]: {
|
||||
background: '#E7D118'
|
||||
},
|
||||
[FlowNodeValTypeEnum.chatHistory]: {
|
||||
background: '#00A9A6'
|
||||
},
|
||||
[FlowNodeValTypeEnum.datasetQuote]: {
|
||||
background: '#A558C9'
|
||||
},
|
||||
[FlowNodeValTypeEnum.any]: {
|
||||
background: '#9CA2A8'
|
||||
}
|
||||
};
|
||||
export const FlowValueTypeTip = {
|
||||
[FlowNodeValTypeEnum.string]: {
|
||||
label: 'app.module.valueType.string',
|
||||
example: ''
|
||||
},
|
||||
[FlowNodeValTypeEnum.number]: {
|
||||
label: 'app.module.valueType.number',
|
||||
example: ''
|
||||
},
|
||||
[FlowNodeValTypeEnum.boolean]: {
|
||||
label: 'app.module.valueType.boolean',
|
||||
example: ''
|
||||
},
|
||||
[FlowNodeValTypeEnum.chatHistory]: {
|
||||
label: 'app.module.valueType.chatHistory',
|
||||
example: `{
|
||||
obj: System | Human | AI;
|
||||
value: string;
|
||||
}`
|
||||
},
|
||||
[FlowNodeValTypeEnum.datasetQuote]: {
|
||||
label: 'app.module.valueType.datasetQuote',
|
||||
example: `{
|
||||
id: string;
|
||||
datasetId: string;
|
||||
collectionId: string;
|
||||
sourceName: string;
|
||||
sourceId?: string;
|
||||
q: string;
|
||||
a: string
|
||||
}`
|
||||
},
|
||||
[FlowNodeValTypeEnum.any]: {
|
||||
label: 'app.module.valueType.any',
|
||||
example: ''
|
||||
}
|
||||
};
|
||||
|
||||
export const initModuleType: Record<string, boolean> = {
|
||||
[FlowNodeTypeEnum.historyNode]: true,
|
||||
[FlowNodeTypeEnum.questionInput]: true,
|
||||
[FlowNodeTypeEnum.pluginInput]: true
|
||||
};
|
||||
|
||||
export const edgeOptions = {
|
||||
style: {
|
||||
strokeWidth: 1.5,
|
||||
stroke: '#5A646Es'
|
||||
}
|
||||
};
|
||||
export const connectionLineStyle = { strokeWidth: 1.5, stroke: '#5A646Es' };
|
||||
@@ -1,28 +0,0 @@
|
||||
import type { FlowNodeInputItemType } from '@fastgpt/global/core/module/node/type.d';
|
||||
import { SystemInputEnum } from '../app';
|
||||
import {
|
||||
FlowNodeInputTypeEnum,
|
||||
FlowNodeValTypeEnum
|
||||
} from '@fastgpt/global/core/module/node/constant';
|
||||
|
||||
export const Input_Template_TFSwitch: FlowNodeInputItemType = {
|
||||
key: SystemInputEnum.switch,
|
||||
type: FlowNodeInputTypeEnum.target,
|
||||
label: '触发器',
|
||||
valueType: FlowNodeValTypeEnum.any
|
||||
};
|
||||
|
||||
export const Input_Template_History: FlowNodeInputItemType = {
|
||||
key: SystemInputEnum.history,
|
||||
type: FlowNodeInputTypeEnum.target,
|
||||
label: '聊天记录',
|
||||
valueType: FlowNodeValTypeEnum.chatHistory
|
||||
};
|
||||
|
||||
export const Input_Template_UserChatInput: FlowNodeInputItemType = {
|
||||
key: SystemInputEnum.userChatInput,
|
||||
type: FlowNodeInputTypeEnum.target,
|
||||
label: '用户问题',
|
||||
required: true,
|
||||
valueType: FlowNodeValTypeEnum.string
|
||||
};
|
||||
@@ -1,15 +0,0 @@
|
||||
import type { FlowNodeOutputItemType } from '@fastgpt/global/core/module/node/type';
|
||||
import { SystemOutputEnum } from '../app';
|
||||
import {
|
||||
FlowNodeOutputTypeEnum,
|
||||
FlowNodeValTypeEnum
|
||||
} from '@fastgpt/global/core/module/node/constant';
|
||||
|
||||
export const Output_Template_Finish: FlowNodeOutputItemType = {
|
||||
key: SystemOutputEnum.finish,
|
||||
label: '模块调用结束',
|
||||
description: '模块调用结束时触发',
|
||||
valueType: FlowNodeValTypeEnum.boolean,
|
||||
type: FlowNodeOutputTypeEnum.source,
|
||||
targets: []
|
||||
};
|
||||
@@ -8,6 +8,7 @@ import type {
|
||||
} from '@fastgpt/global/core/ai/model.d';
|
||||
|
||||
import type { FeConfigsType } from '@fastgpt/global/common/system/types/index.d';
|
||||
import { AppSimpleEditConfigTemplateType } from '@fastgpt/global/core/app/type';
|
||||
|
||||
export type ConfigFileType = {
|
||||
FeConfig: FeConfigsType;
|
||||
@@ -31,4 +32,5 @@ export type InitDateResponse = {
|
||||
feConfigs: FeConfigsType;
|
||||
priceMd: string;
|
||||
systemVersion: string;
|
||||
simpleModeTemplates: AppSimpleEditConfigTemplateType[];
|
||||
};
|
||||
|
||||
30
projects/app/src/global/core/app/constants.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { AppSimpleEditConfigTemplateType } from '@fastgpt/global/core/app/type.d';
|
||||
|
||||
export const SimpleModeTemplate_FastGPT_Universal: AppSimpleEditConfigTemplateType = {
|
||||
id: 'fastgpt-universal',
|
||||
name: '通用模板',
|
||||
desc: '通用模板\n可完全自行配置AI属性和知识库',
|
||||
systemForm: {
|
||||
aiSettings: {
|
||||
model: true,
|
||||
systemPrompt: true,
|
||||
temperature: true,
|
||||
maxToken: true,
|
||||
quoteTemplate: true,
|
||||
quotePrompt: true
|
||||
},
|
||||
dataset: {
|
||||
datasets: true,
|
||||
similarity: true,
|
||||
limit: true,
|
||||
rerank: true,
|
||||
searchEmptyText: true
|
||||
},
|
||||
userGuide: {
|
||||
welcomeText: true,
|
||||
variables: true,
|
||||
questionGuide: true,
|
||||
tts: true
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
import { SystemInputEnum } from '@/constants/app';
|
||||
import { FlowNodeTypeEnum } from '@fastgpt/global/core/module/node/constant';
|
||||
import { AppTTSConfigType, VariableItemType } from '@/types/app';
|
||||
import type { ModuleItemType } from '@fastgpt/global/core/module/type';
|
||||
|
||||
export const getGuideModule = (modules: ModuleItemType[]) =>
|
||||
modules.find((item) => item.flowType === FlowNodeTypeEnum.userGuide);
|
||||
|
||||
export const splitGuideModule = (guideModules?: ModuleItemType) => {
|
||||
const welcomeText: string =
|
||||
guideModules?.inputs?.find((item) => item.key === SystemInputEnum.welcomeText)?.value || '';
|
||||
|
||||
const variableModules: VariableItemType[] =
|
||||
guideModules?.inputs.find((item) => item.key === SystemInputEnum.variables)?.value || [];
|
||||
|
||||
const questionGuide: boolean =
|
||||
guideModules?.inputs?.find((item) => item.key === SystemInputEnum.questionGuide)?.value ||
|
||||
false;
|
||||
|
||||
const ttsConfig: AppTTSConfigType = guideModules?.inputs?.find(
|
||||
(item) => item.key === SystemInputEnum.tts
|
||||
)?.value || { type: 'web' };
|
||||
|
||||
return {
|
||||
welcomeText,
|
||||
variableModules,
|
||||
questionGuide,
|
||||
ttsConfig
|
||||
};
|
||||
};
|
||||
2
projects/app/src/global/core/chat/api.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
import type { AppTTSConfigType } from '@/types/app';
|
||||
import type { AppTTSConfigType } from '@fastgpt/global/core/module/type.d';
|
||||
|
||||
export type GetChatSpeechProps = {
|
||||
ttsConfig: AppTTSConfigType;
|
||||
|
||||
@@ -27,6 +27,7 @@ Router.events.on('routeChangeError', () => NProgress.done());
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
keepPreviousData: true,
|
||||
refetchOnWindowFocus: false,
|
||||
retry: false,
|
||||
cacheTime: 10
|
||||
|
||||
@@ -26,7 +26,12 @@ const BillDetail = ({ bill, onClose }: { bill: BillItemType; onClose: () => void
|
||||
);
|
||||
|
||||
return (
|
||||
<MyModal isOpen={true} onClose={onClose} title={t('user.Bill Detail')}>
|
||||
<MyModal
|
||||
isOpen={true}
|
||||
onClose={onClose}
|
||||
iconSrc="/imgs/modal/bill.svg"
|
||||
title={t('user.Bill Detail')}
|
||||
>
|
||||
<ModalBody>
|
||||
<Flex alignItems={'center'} pb={4}>
|
||||
<Box flex={'0 0 80px'}>用户:</Box>
|
||||
@@ -63,15 +68,15 @@ const BillDetail = ({ bill, onClose }: { bill: BillItemType; onClose: () => void
|
||||
<Th>模块名</Th>
|
||||
<Th>AI模型</Th>
|
||||
<Th>Token长度</Th>
|
||||
<Th>费用</Th>
|
||||
<Th>费用(¥)</Th>
|
||||
</Tr>
|
||||
</Thead>
|
||||
<Tbody>
|
||||
{filterBillList.map((item, i) => (
|
||||
<Tr key={i}>
|
||||
<Td>{t(item.moduleName)}</Td>
|
||||
<Td>{item.model}</Td>
|
||||
<Td>{item.tokenLen}</Td>
|
||||
<Td>{item.model || '-'}</Td>
|
||||
<Td>{item.tokenLen || '-'}</Td>
|
||||
<Td>{formatPrice(item.amount)}</Td>
|
||||
</Tr>
|
||||
))}
|
||||
|
||||
@@ -29,7 +29,12 @@ const OpenAIAccountModal = ({
|
||||
});
|
||||
|
||||
return (
|
||||
<MyModal isOpen onClose={onClose} title={t('user.OpenAI Account Setting')}>
|
||||
<MyModal
|
||||
isOpen
|
||||
onClose={onClose}
|
||||
iconSrc="/imgs/modal/openai.svg"
|
||||
title={t('user.OpenAI Account Setting')}
|
||||
>
|
||||
<ModalBody>
|
||||
<Box fontSize={'sm'} color={'myGray.500'}>
|
||||
可以填写 OpenAI/OneAPI 的相关秘钥。如果你填写了该内容,在线上平台使用 OpenAI Chat
|
||||
|
||||
@@ -67,9 +67,10 @@ const PayModal = ({ onClose }: { onClose: () => void }) => {
|
||||
isOpen={true}
|
||||
onClose={payId ? undefined : onClose}
|
||||
title={t('user.Pay')}
|
||||
iconSrc="/imgs/modal/pay.svg"
|
||||
isCentered={!payId}
|
||||
>
|
||||
<ModalBody p={0} minH={payId ? 'auto' : '70vh'} display={'flex'} flexDirection={'column'}>
|
||||
<ModalBody px={0} minH={payId ? 'auto' : '70vh'} display={'flex'} flexDirection={'column'}>
|
||||
{!payId && (
|
||||
<>
|
||||
<Grid gridTemplateColumns={'repeat(4,1fr)'} gridGap={5} mb={4} px={6}>
|
||||
|
||||
@@ -37,7 +37,12 @@ const UpdatePswModal = ({ onClose }: { onClose: () => void }) => {
|
||||
});
|
||||
|
||||
return (
|
||||
<MyModal isOpen onClose={onClose} title={t('user.Update Password')}>
|
||||
<MyModal
|
||||
isOpen
|
||||
onClose={onClose}
|
||||
iconSrc="/imgs/modal/password.svg"
|
||||
title={t('user.Update Password')}
|
||||
>
|
||||
<ModalBody>
|
||||
<Flex alignItems={'center'}>
|
||||
<Box flex={'0 0 70px'}>旧密码:</Box>
|
||||
|
||||
@@ -106,7 +106,6 @@ const Account = ({ currentTab }: { currentTab: `${TabEnum}` }) => {
|
||||
(tab: string) => {
|
||||
if (tab === TabEnum.loginout) {
|
||||
openConfirm(() => {
|
||||
clearToken();
|
||||
setUserInfo(null);
|
||||
router.replace('/login');
|
||||
})();
|
||||
|
||||
@@ -41,7 +41,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
]);
|
||||
} catch (error) {}
|
||||
|
||||
await initPgData();
|
||||
try {
|
||||
await initPgData();
|
||||
} catch (error) {}
|
||||
|
||||
await MongoDataset.updateMany(
|
||||
{},
|
||||
|
||||
40
projects/app/src/pages/api/admin/initv462.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { jsonRes } from '@fastgpt/service/common/response';
|
||||
import { connectToDatabase } from '@/service/mongo';
|
||||
import { delay } from '@/utils/tools';
|
||||
import { PgClient } from '@fastgpt/service/common/pg';
|
||||
import {
|
||||
DatasetDataIndexTypeEnum,
|
||||
PgDatasetTableName
|
||||
} from '@fastgpt/global/core/dataset/constant';
|
||||
|
||||
import { authCert } from '@fastgpt/service/support/permission/auth/common';
|
||||
import { MongoDatasetData } from '@fastgpt/service/core/dataset/data/schema';
|
||||
import { getUserDefaultTeam } from '@fastgpt/service/support/user/team/controller';
|
||||
import { MongoDataset } from '@fastgpt/service/core/dataset/schema';
|
||||
import { defaultQAModels } from '@fastgpt/global/core/ai/model';
|
||||
import { MongoApp } from '@fastgpt/service/core/app/schema';
|
||||
|
||||
let success = 0;
|
||||
/* pg 中的数据搬到 mongo dataset.datas 中,并做映射 */
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
try {
|
||||
const { limit = 50 } = req.body as { limit: number };
|
||||
await authCert({ req, authRoot: true });
|
||||
await connectToDatabase();
|
||||
|
||||
await initFullTextToken(limit);
|
||||
|
||||
jsonRes(res, {
|
||||
message: 'success'
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
||||
jsonRes(res, {
|
||||
code: 500,
|
||||
error
|
||||
});
|
||||
}
|
||||
}
|
||||
export async function initFullTextToken(limit = 50) {}
|
||||
@@ -0,0 +1,615 @@
|
||||
/*
|
||||
universal mode.
|
||||
@author: FastGpt Team
|
||||
*/
|
||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { jsonRes } from '@fastgpt/service/common/response';
|
||||
import type { AppSimpleEditFormType } from '@fastgpt/global/core/app/type.d';
|
||||
import type { ModuleItemType } from '@fastgpt/global/core/module/type';
|
||||
import { FlowNodeInputTypeEnum } from '@fastgpt/global/core/module/node/constant';
|
||||
import { FormatForm2ModulesProps } from '@fastgpt/global/core/app/api';
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
||||
try {
|
||||
const { formData, chatModelMaxToken, chatModelList } = req.body as FormatForm2ModulesProps;
|
||||
|
||||
const modules = [
|
||||
...(formData.dataset.datasets.length > 0
|
||||
? datasetTemplate({ formData, maxToken: chatModelMaxToken })
|
||||
: simpleChatTemplate({ formData, maxToken: chatModelMaxToken }))
|
||||
];
|
||||
|
||||
jsonRes<ModuleItemType[]>(res, {
|
||||
data: modules
|
||||
});
|
||||
} catch (err) {
|
||||
jsonRes(res, {
|
||||
code: 500,
|
||||
error: err
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function simpleChatTemplate({
|
||||
formData,
|
||||
maxToken
|
||||
}: {
|
||||
formData: AppSimpleEditFormType;
|
||||
maxToken: number;
|
||||
}): ModuleItemType[] {
|
||||
return [
|
||||
{
|
||||
moduleId: 'userChatInput',
|
||||
name: '用户问题(对话入口)',
|
||||
logo: '/imgs/module/userChatInput.png',
|
||||
flowType: 'questionInput',
|
||||
position: {
|
||||
x: 464.32198615344566,
|
||||
y: 1602.2698463081606
|
||||
},
|
||||
inputs: [
|
||||
{
|
||||
key: 'userChatInput',
|
||||
type: 'systemInput',
|
||||
label: '用户问题',
|
||||
connected: true
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
key: 'userChatInput',
|
||||
label: '用户问题',
|
||||
type: 'source',
|
||||
valueType: 'string',
|
||||
targets: [
|
||||
{
|
||||
moduleId: 'chatModule',
|
||||
key: 'userChatInput'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
moduleId: 'history',
|
||||
name: '聊天记录',
|
||||
logo: '/imgs/module/history.png',
|
||||
flowType: 'historyNode',
|
||||
position: {
|
||||
x: 452.5466249541586,
|
||||
y: 1276.3930310334215
|
||||
},
|
||||
inputs: [
|
||||
{
|
||||
key: 'maxContext',
|
||||
type: 'numberInput',
|
||||
label: '最长记录数',
|
||||
value: 10,
|
||||
min: 0,
|
||||
max: 50,
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'history',
|
||||
type: 'hidden',
|
||||
label: '聊天记录',
|
||||
connected: true
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
key: 'history',
|
||||
label: '聊天记录',
|
||||
valueType: 'chatHistory',
|
||||
type: 'source',
|
||||
targets: [
|
||||
{
|
||||
moduleId: 'chatModule',
|
||||
key: 'history'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
moduleId: 'chatModule',
|
||||
name: 'AI 对话',
|
||||
logo: '/imgs/module/AI.png',
|
||||
flowType: 'chatNode',
|
||||
showStatus: true,
|
||||
position: {
|
||||
x: 981.9682828103937,
|
||||
y: 890.014595014464
|
||||
},
|
||||
inputs: [
|
||||
{
|
||||
key: 'switch',
|
||||
type: 'target',
|
||||
label: 'core.module.input.label.switch',
|
||||
valueType: 'any',
|
||||
connected: false
|
||||
},
|
||||
{
|
||||
key: 'model',
|
||||
type: 'selectChatModel',
|
||||
label: '对话模型',
|
||||
required: true,
|
||||
value: formData.aiSettings.model,
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'temperature',
|
||||
type: 'hidden',
|
||||
label: '温度',
|
||||
value: 1,
|
||||
min: 0,
|
||||
max: 10,
|
||||
step: 1,
|
||||
markList: [
|
||||
{
|
||||
label: '严谨',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
label: '发散',
|
||||
value: 10
|
||||
}
|
||||
],
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'maxToken',
|
||||
type: 'hidden',
|
||||
label: '回复上限',
|
||||
value: maxToken,
|
||||
min: 100,
|
||||
max: 4000,
|
||||
step: 50,
|
||||
markList: [
|
||||
{
|
||||
label: '100',
|
||||
value: 100
|
||||
},
|
||||
{
|
||||
label: '4000',
|
||||
value: 4000
|
||||
}
|
||||
],
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'isResponseAnswerText',
|
||||
type: 'hidden',
|
||||
label: '返回AI内容',
|
||||
valueType: 'boolean',
|
||||
value: true,
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'quoteTemplate',
|
||||
type: 'hidden',
|
||||
label: '引用内容模板',
|
||||
valueType: 'string',
|
||||
value: '',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'quotePrompt',
|
||||
type: 'hidden',
|
||||
label: '引用内容提示词',
|
||||
valueType: 'string',
|
||||
value: '',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'aiSettings',
|
||||
type: 'aiSettings',
|
||||
label: '',
|
||||
connected: false
|
||||
},
|
||||
{
|
||||
key: 'systemPrompt',
|
||||
type: 'textarea',
|
||||
label: '系统提示词',
|
||||
max: 300,
|
||||
valueType: 'string',
|
||||
description:
|
||||
'模型固定的引导词,通过调整该内容,可以引导模型聊天方向。该内容会被固定在上下文的开头。可使用变量,例如 {{language}}',
|
||||
placeholder:
|
||||
'模型固定的引导词,通过调整该内容,可以引导模型聊天方向。该内容会被固定在上下文的开头。可使用变量,例如 {{language}}',
|
||||
value: formData.aiSettings.systemPrompt,
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'quoteQA',
|
||||
type: 'target',
|
||||
label: '引用内容',
|
||||
description: "对象数组格式,结构:\n [{q:'问题',a:'回答'}]",
|
||||
valueType: 'datasetQuote',
|
||||
connected: false
|
||||
},
|
||||
{
|
||||
key: 'history',
|
||||
type: 'target',
|
||||
label: 'core.module.input.label.chat history',
|
||||
valueType: 'chatHistory',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'userChatInput',
|
||||
type: 'target',
|
||||
label: 'core.module.input.label.user question',
|
||||
required: true,
|
||||
valueType: 'string',
|
||||
connected: true
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
key: 'answerText',
|
||||
label: 'AI回复',
|
||||
description: '将在 stream 回复完毕后触发',
|
||||
valueType: 'string',
|
||||
type: 'source',
|
||||
targets: []
|
||||
},
|
||||
{
|
||||
key: 'finish',
|
||||
label: 'core.module.output.label.running done',
|
||||
description: 'core.module.output.description.running done',
|
||||
valueType: 'boolean',
|
||||
type: 'source',
|
||||
targets: []
|
||||
},
|
||||
{
|
||||
key: 'history',
|
||||
label: '新的上下文',
|
||||
description: '将本次回复内容拼接上历史记录,作为新的上下文返回',
|
||||
valueType: 'chatHistory',
|
||||
type: 'source',
|
||||
targets: []
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
}
|
||||
function datasetTemplate({
|
||||
formData,
|
||||
maxToken
|
||||
}: {
|
||||
formData: AppSimpleEditFormType;
|
||||
maxToken: number;
|
||||
}): ModuleItemType[] {
|
||||
return [
|
||||
{
|
||||
moduleId: 'userChatInput',
|
||||
name: '用户问题(对话入口)',
|
||||
logo: '/imgs/module/userChatInput.png',
|
||||
flowType: 'questionInput',
|
||||
position: {
|
||||
x: 464.32198615344566,
|
||||
y: 1602.2698463081606
|
||||
},
|
||||
inputs: [
|
||||
{
|
||||
key: 'userChatInput',
|
||||
type: 'systemInput',
|
||||
label: '用户问题',
|
||||
connected: true
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
key: 'userChatInput',
|
||||
label: '用户问题',
|
||||
type: 'source',
|
||||
valueType: 'string',
|
||||
targets: [
|
||||
{
|
||||
moduleId: 'chatModule',
|
||||
key: 'userChatInput'
|
||||
},
|
||||
{
|
||||
moduleId: 'datasetSearch',
|
||||
key: 'userChatInput'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
moduleId: 'history',
|
||||
name: '聊天记录',
|
||||
logo: '/imgs/module/history.png',
|
||||
flowType: 'historyNode',
|
||||
position: {
|
||||
x: 452.5466249541586,
|
||||
y: 1276.3930310334215
|
||||
},
|
||||
inputs: [
|
||||
{
|
||||
key: 'maxContext',
|
||||
type: 'numberInput',
|
||||
label: '最长记录数',
|
||||
value: 6,
|
||||
min: 0,
|
||||
max: 50,
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'history',
|
||||
type: 'hidden',
|
||||
label: '聊天记录',
|
||||
connected: true
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
key: 'history',
|
||||
label: '聊天记录',
|
||||
valueType: 'chatHistory',
|
||||
type: 'source',
|
||||
targets: [
|
||||
{
|
||||
moduleId: 'chatModule',
|
||||
key: 'history'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
moduleId: 'datasetSearch',
|
||||
name: '知识库搜索',
|
||||
logo: '/imgs/module/db.png',
|
||||
flowType: 'datasetSearchNode',
|
||||
showStatus: true,
|
||||
position: {
|
||||
x: 956.0838440206068,
|
||||
y: 887.462827870246
|
||||
},
|
||||
inputs: [
|
||||
{
|
||||
key: 'datasets',
|
||||
value: formData.dataset.datasets,
|
||||
type: FlowNodeInputTypeEnum.custom,
|
||||
label: '关联的知识库',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'similarity',
|
||||
value: 0.5,
|
||||
type: FlowNodeInputTypeEnum.slider,
|
||||
label: '相似度',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'limit',
|
||||
value: 8,
|
||||
type: FlowNodeInputTypeEnum.slider,
|
||||
label: '单次搜索上限',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'switch',
|
||||
type: FlowNodeInputTypeEnum.target,
|
||||
label: '触发器',
|
||||
connected: false
|
||||
},
|
||||
{
|
||||
key: 'userChatInput',
|
||||
type: FlowNodeInputTypeEnum.target,
|
||||
label: '用户问题',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'rerank',
|
||||
type: FlowNodeInputTypeEnum.switch,
|
||||
label: '结果重排',
|
||||
description: '将召回的结果进行进一步重排,可增加召回率',
|
||||
plusField: true,
|
||||
connected: true,
|
||||
value: true
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
key: 'isEmpty',
|
||||
label: '搜索结果为空',
|
||||
type: 'source',
|
||||
valueType: 'boolean',
|
||||
targets: []
|
||||
},
|
||||
{
|
||||
key: 'unEmpty',
|
||||
label: '搜索结果不为空',
|
||||
type: 'source',
|
||||
valueType: 'boolean',
|
||||
targets: []
|
||||
},
|
||||
{
|
||||
key: 'quoteQA',
|
||||
label: '引用内容',
|
||||
description:
|
||||
'始终返回数组,如果希望搜索结果为空时执行额外操作,需要用到上面的两个输入以及目标模块的触发器',
|
||||
type: 'source',
|
||||
valueType: 'datasetQuote',
|
||||
targets: [
|
||||
{
|
||||
moduleId: 'chatModule',
|
||||
key: 'quoteQA'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
key: 'finish',
|
||||
label: 'core.module.output.label.running done',
|
||||
description: 'core.module.output.description.running done',
|
||||
valueType: 'boolean',
|
||||
type: 'source',
|
||||
targets: []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
moduleId: 'chatModule',
|
||||
name: 'AI 对话',
|
||||
logo: '/imgs/module/AI.png',
|
||||
flowType: 'chatNode',
|
||||
showStatus: true,
|
||||
position: {
|
||||
x: 1551.71405495818,
|
||||
y: 977.4911578918461
|
||||
},
|
||||
inputs: [
|
||||
{
|
||||
key: 'switch',
|
||||
type: 'target',
|
||||
label: 'core.module.input.label.switch',
|
||||
valueType: 'any',
|
||||
connected: false
|
||||
},
|
||||
{
|
||||
key: 'model',
|
||||
type: 'selectChatModel',
|
||||
label: '对话模型',
|
||||
required: true,
|
||||
value: formData.aiSettings.model,
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'temperature',
|
||||
type: 'hidden',
|
||||
label: '温度',
|
||||
value: 0,
|
||||
min: 0,
|
||||
max: 10,
|
||||
step: 1,
|
||||
markList: [
|
||||
{
|
||||
label: '严谨',
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
label: '发散',
|
||||
value: 10
|
||||
}
|
||||
],
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'maxToken',
|
||||
type: 'hidden',
|
||||
label: '回复上限',
|
||||
value: maxToken,
|
||||
min: 100,
|
||||
max: 4000,
|
||||
step: 50,
|
||||
markList: [
|
||||
{
|
||||
label: '100',
|
||||
value: 100
|
||||
},
|
||||
{
|
||||
label: '4000',
|
||||
value: 4000
|
||||
}
|
||||
],
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'isResponseAnswerText',
|
||||
type: 'hidden',
|
||||
label: '返回AI内容',
|
||||
valueType: 'boolean',
|
||||
value: true,
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'quoteTemplate',
|
||||
type: 'hidden',
|
||||
label: '引用内容模板',
|
||||
valueType: 'string',
|
||||
value: '',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'quotePrompt',
|
||||
type: 'hidden',
|
||||
label: '引用内容提示词',
|
||||
valueType: 'string',
|
||||
value: '',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'aiSettings',
|
||||
type: 'aiSettings',
|
||||
label: '',
|
||||
connected: false
|
||||
},
|
||||
{
|
||||
key: 'systemPrompt',
|
||||
type: 'textarea',
|
||||
label: '系统提示词',
|
||||
max: 300,
|
||||
valueType: 'string',
|
||||
description:
|
||||
'模型固定的引导词,通过调整该内容,可以引导模型聊天方向。该内容会被固定在上下文的开头。可使用变量,例如 {{language}}',
|
||||
placeholder:
|
||||
'模型固定的引导词,通过调整该内容,可以引导模型聊天方向。该内容会被固定在上下文的开头。可使用变量,例如 {{language}}',
|
||||
value: formData.aiSettings.systemPrompt,
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'quoteQA',
|
||||
type: 'target',
|
||||
label: '引用内容',
|
||||
description: "对象数组格式,结构:\n [{q:'问题',a:'回答'}]",
|
||||
valueType: 'datasetQuote',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'history',
|
||||
type: 'target',
|
||||
label: 'core.module.input.label.chat history',
|
||||
valueType: 'chatHistory',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'userChatInput',
|
||||
type: 'target',
|
||||
label: 'core.module.input.label.user question',
|
||||
required: true,
|
||||
valueType: 'string',
|
||||
connected: true
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
key: 'answerText',
|
||||
label: 'AI回复',
|
||||
description: '将在 stream 回复完毕后触发',
|
||||
valueType: 'string',
|
||||
type: 'source',
|
||||
targets: []
|
||||
},
|
||||
{
|
||||
key: 'finish',
|
||||
label: 'core.module.output.label.running done',
|
||||
description: 'core.module.output.description.running done',
|
||||
valueType: 'boolean',
|
||||
type: 'source',
|
||||
targets: []
|
||||
},
|
||||
{
|
||||
key: 'history',
|
||||
label: '新的上下文',
|
||||
description: '将本次回复内容拼接上历史记录,作为新的上下文返回',
|
||||
valueType: 'chatHistory',
|
||||
type: 'source',
|
||||
targets: []
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,422 @@
|
||||
/*
|
||||
universal mode.
|
||||
@author: FastGpt Team
|
||||
*/
|
||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { jsonRes } from '@fastgpt/service/common/response';
|
||||
import type { AppSimpleEditFormType } from '@fastgpt/global/core/app/type.d';
|
||||
import type { ModuleItemType } from '@fastgpt/global/core/module/type';
|
||||
import { FlowNodeInputTypeEnum, FlowNodeTypeEnum } from '@fastgpt/global/core/module/node/constant';
|
||||
import { ModuleDataTypeEnum } from '@fastgpt/global/core/module/constants';
|
||||
import { ModuleInputKeyEnum } from '@fastgpt/global/core/module/constants';
|
||||
import type { FlowNodeInputItemType } from '@fastgpt/global/core/module/node/type.d';
|
||||
import { FormatForm2ModulesProps } from '@fastgpt/global/core/app/api';
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
||||
try {
|
||||
const { formData, chatModelList } = req.body as FormatForm2ModulesProps;
|
||||
|
||||
const modules =
|
||||
formData.dataset.datasets.length > 0
|
||||
? datasetTemplate(formData)
|
||||
: simpleChatTemplate(formData);
|
||||
|
||||
jsonRes<ModuleItemType[]>(res, {
|
||||
data: modules
|
||||
});
|
||||
} catch (err) {
|
||||
jsonRes(res, {
|
||||
code: 500,
|
||||
error: err
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function chatModelInput(formData: AppSimpleEditFormType): FlowNodeInputItemType[] {
|
||||
return [
|
||||
{
|
||||
key: 'model',
|
||||
value: formData.aiSettings.model,
|
||||
type: 'custom',
|
||||
label: '对话模型',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'temperature',
|
||||
value: formData.aiSettings.temperature,
|
||||
type: 'slider',
|
||||
label: '温度',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'maxToken',
|
||||
value: formData.aiSettings.maxToken,
|
||||
type: 'custom',
|
||||
label: '回复上限',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'systemPrompt',
|
||||
value: formData.aiSettings.systemPrompt || '',
|
||||
type: 'textarea',
|
||||
label: '系统提示词',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: ModuleInputKeyEnum.aiChatIsResponseText,
|
||||
value: true,
|
||||
type: 'hidden',
|
||||
label: '返回AI内容',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'quoteTemplate',
|
||||
value: formData.aiSettings.quoteTemplate || '',
|
||||
type: 'hidden',
|
||||
label: '引用内容模板',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'quotePrompt',
|
||||
value: formData.aiSettings.quotePrompt || '',
|
||||
type: 'hidden',
|
||||
label: '引用内容提示词',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'switch',
|
||||
type: 'target',
|
||||
label: '触发器',
|
||||
connected: formData.dataset.datasets.length > 0 && !!formData.dataset.searchEmptyText
|
||||
},
|
||||
{
|
||||
key: 'quoteQA',
|
||||
type: 'target',
|
||||
label: '引用内容',
|
||||
connected: formData.dataset.datasets.length > 0
|
||||
},
|
||||
{
|
||||
key: 'history',
|
||||
type: 'target',
|
||||
label: '聊天记录',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'userChatInput',
|
||||
type: 'target',
|
||||
label: '用户问题',
|
||||
connected: true
|
||||
}
|
||||
];
|
||||
}
|
||||
function simpleChatTemplate(formData: AppSimpleEditFormType): ModuleItemType[] {
|
||||
return [
|
||||
{
|
||||
name: '用户问题(对话入口)',
|
||||
flowType: FlowNodeTypeEnum.questionInput,
|
||||
inputs: [
|
||||
{
|
||||
key: 'userChatInput',
|
||||
connected: true,
|
||||
label: '用户问题',
|
||||
type: 'target'
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
key: 'userChatInput',
|
||||
targets: [
|
||||
{
|
||||
moduleId: 'chatModule',
|
||||
key: 'userChatInput'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
position: {
|
||||
x: 464.32198615344566,
|
||||
y: 1602.2698463081606
|
||||
},
|
||||
moduleId: 'userChatInput'
|
||||
},
|
||||
{
|
||||
name: '聊天记录',
|
||||
flowType: FlowNodeTypeEnum.historyNode,
|
||||
inputs: [
|
||||
{
|
||||
key: 'maxContext',
|
||||
value: 6,
|
||||
connected: true,
|
||||
type: 'numberInput',
|
||||
label: '最长记录数'
|
||||
},
|
||||
{
|
||||
key: 'history',
|
||||
type: 'hidden',
|
||||
label: '聊天记录',
|
||||
connected: true
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
key: 'history',
|
||||
targets: [
|
||||
{
|
||||
moduleId: 'chatModule',
|
||||
key: 'history'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
position: {
|
||||
x: 452.5466249541586,
|
||||
y: 1276.3930310334215
|
||||
},
|
||||
moduleId: 'history'
|
||||
},
|
||||
{
|
||||
name: 'AI 对话',
|
||||
flowType: FlowNodeTypeEnum.chatNode,
|
||||
inputs: chatModelInput(formData),
|
||||
showStatus: true,
|
||||
outputs: [
|
||||
{
|
||||
key: 'answerText',
|
||||
label: 'AI回复',
|
||||
description: '直接响应,无需配置',
|
||||
type: 'hidden',
|
||||
targets: []
|
||||
},
|
||||
{
|
||||
key: 'finish',
|
||||
label: '回复结束',
|
||||
description: 'AI 回复完成后触发',
|
||||
valueType: 'boolean',
|
||||
type: 'source',
|
||||
targets: []
|
||||
}
|
||||
],
|
||||
position: {
|
||||
x: 981.9682828103937,
|
||||
y: 890.014595014464
|
||||
},
|
||||
moduleId: 'chatModule'
|
||||
}
|
||||
];
|
||||
}
|
||||
function datasetTemplate(formData: AppSimpleEditFormType): ModuleItemType[] {
|
||||
return [
|
||||
{
|
||||
name: '用户问题(对话入口)',
|
||||
flowType: FlowNodeTypeEnum.questionInput,
|
||||
inputs: [
|
||||
{
|
||||
key: 'userChatInput',
|
||||
label: '用户问题',
|
||||
type: 'target',
|
||||
connected: true
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
key: 'userChatInput',
|
||||
targets: [
|
||||
{
|
||||
moduleId: 'chatModule',
|
||||
key: 'userChatInput'
|
||||
},
|
||||
{
|
||||
moduleId: 'datasetSearch',
|
||||
key: 'userChatInput'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
position: {
|
||||
x: 464.32198615344566,
|
||||
y: 1602.2698463081606
|
||||
},
|
||||
moduleId: 'userChatInput'
|
||||
},
|
||||
{
|
||||
name: '聊天记录',
|
||||
flowType: FlowNodeTypeEnum.historyNode,
|
||||
inputs: [
|
||||
{
|
||||
key: 'maxContext',
|
||||
value: 6,
|
||||
connected: true,
|
||||
type: 'numberInput',
|
||||
label: '最长记录数'
|
||||
},
|
||||
{
|
||||
key: 'history',
|
||||
type: 'hidden',
|
||||
label: '聊天记录',
|
||||
connected: true
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
key: 'history',
|
||||
targets: [
|
||||
{
|
||||
moduleId: 'chatModule',
|
||||
key: 'history'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
position: {
|
||||
x: 452.5466249541586,
|
||||
y: 1276.3930310334215
|
||||
},
|
||||
moduleId: 'history'
|
||||
},
|
||||
{
|
||||
name: '知识库搜索',
|
||||
flowType: FlowNodeTypeEnum.datasetSearchNode,
|
||||
showStatus: true,
|
||||
inputs: [
|
||||
{
|
||||
key: 'datasets',
|
||||
value: formData.dataset.datasets,
|
||||
type: FlowNodeInputTypeEnum.custom,
|
||||
label: '关联的知识库',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'similarity',
|
||||
value: formData.dataset.similarity,
|
||||
type: FlowNodeInputTypeEnum.slider,
|
||||
label: '相似度',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'limit',
|
||||
value: formData.dataset.limit,
|
||||
type: FlowNodeInputTypeEnum.slider,
|
||||
label: '单次搜索上限',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'switch',
|
||||
type: FlowNodeInputTypeEnum.target,
|
||||
label: '触发器',
|
||||
connected: false
|
||||
},
|
||||
{
|
||||
key: 'userChatInput',
|
||||
type: FlowNodeInputTypeEnum.target,
|
||||
label: '用户问题',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'rerank',
|
||||
type: FlowNodeInputTypeEnum.switch,
|
||||
label: '结果重排',
|
||||
description: '将召回的结果进行进一步重排,可增加召回率',
|
||||
plusField: true,
|
||||
connected: true,
|
||||
value: formData.dataset.rerank
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
key: 'isEmpty',
|
||||
targets: formData.dataset.searchEmptyText
|
||||
? [
|
||||
{
|
||||
moduleId: 'emptyText',
|
||||
key: 'switch'
|
||||
}
|
||||
]
|
||||
: []
|
||||
},
|
||||
{
|
||||
key: 'unEmpty',
|
||||
targets: formData.dataset.searchEmptyText
|
||||
? [
|
||||
{
|
||||
moduleId: 'chatModule',
|
||||
key: 'switch'
|
||||
}
|
||||
]
|
||||
: []
|
||||
},
|
||||
{
|
||||
key: 'quoteQA',
|
||||
targets: [
|
||||
{
|
||||
moduleId: 'chatModule',
|
||||
key: 'quoteQA'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
position: {
|
||||
x: 956.0838440206068,
|
||||
y: 887.462827870246
|
||||
},
|
||||
moduleId: 'datasetSearch'
|
||||
},
|
||||
...(formData.dataset.searchEmptyText
|
||||
? [
|
||||
{
|
||||
name: '指定回复',
|
||||
flowType: FlowNodeTypeEnum.answerNode,
|
||||
inputs: [
|
||||
{
|
||||
key: ModuleInputKeyEnum.switch,
|
||||
type: FlowNodeInputTypeEnum.target,
|
||||
label: '触发器',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: ModuleInputKeyEnum.answerText,
|
||||
value: formData.dataset.searchEmptyText,
|
||||
type: FlowNodeInputTypeEnum.textarea,
|
||||
valueType: ModuleDataTypeEnum.string,
|
||||
label: '回复的内容',
|
||||
connected: true
|
||||
}
|
||||
],
|
||||
outputs: [],
|
||||
position: {
|
||||
x: 1553.5815811529146,
|
||||
y: 637.8753731306779
|
||||
},
|
||||
moduleId: 'emptyText'
|
||||
}
|
||||
]
|
||||
: []),
|
||||
{
|
||||
name: 'AI 对话',
|
||||
flowType: FlowNodeTypeEnum.chatNode,
|
||||
inputs: chatModelInput(formData),
|
||||
showStatus: true,
|
||||
outputs: [
|
||||
{
|
||||
key: 'answerText',
|
||||
label: 'AI回复',
|
||||
description: '直接响应,无需配置',
|
||||
type: 'hidden',
|
||||
targets: []
|
||||
},
|
||||
{
|
||||
key: 'finish',
|
||||
label: '回复结束',
|
||||
description: 'AI 回复完成后触发',
|
||||
valueType: 'boolean',
|
||||
type: 'source',
|
||||
targets: []
|
||||
}
|
||||
],
|
||||
position: {
|
||||
x: 1551.71405495818,
|
||||
y: 977.4911578918461
|
||||
},
|
||||
moduleId: 'chatModule'
|
||||
}
|
||||
];
|
||||
}
|
||||
@@ -4,13 +4,14 @@ import { connectToDatabase } from '@/service/mongo';
|
||||
import { MongoApp } from '@fastgpt/service/core/app/schema';
|
||||
import type { AppUpdateParams } from '@fastgpt/global/core/app/api';
|
||||
import { authApp } from '@fastgpt/service/support/permission/auth/app';
|
||||
import { SystemOutputEnum } from '@/constants/app';
|
||||
import { ModuleOutputKeyEnum } from '@fastgpt/global/core/module/constants';
|
||||
|
||||
/* 获取我的模型 */
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
||||
try {
|
||||
await connectToDatabase();
|
||||
const { name, avatar, type, intro, modules, permission } = req.body as AppUpdateParams;
|
||||
const { name, avatar, type, simpleTemplateId, intro, modules, permission } =
|
||||
req.body as AppUpdateParams;
|
||||
const { appId } = req.query as { appId: string };
|
||||
|
||||
if (!appId) {
|
||||
@@ -28,19 +29,12 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
{
|
||||
name,
|
||||
type,
|
||||
simpleTemplateId,
|
||||
avatar,
|
||||
intro,
|
||||
permission,
|
||||
...(modules && {
|
||||
modules: modules.map((modules) => ({
|
||||
...modules,
|
||||
outputs: modules.outputs.sort((a, b) => {
|
||||
// finish output always at last
|
||||
if (a.key === SystemOutputEnum.finish) return 1;
|
||||
if (b.key === SystemOutputEnum.finish) return -1;
|
||||
return 0;
|
||||
})
|
||||
}))
|
||||
modules
|
||||
})
|
||||
}
|
||||
);
|
||||
|
||||
@@ -52,7 +52,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
/* start process */
|
||||
const { responseData } = await dispatchModules({
|
||||
res,
|
||||
modules: modules,
|
||||
appId,
|
||||
modules,
|
||||
variables,
|
||||
teamId,
|
||||
tmbId,
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { jsonRes } from '@fastgpt/service/common/response';
|
||||
import { connectToDatabase } from '@/service/mongo';
|
||||
import { MongoChat } from '@fastgpt/service/core/chat/chatSchema';
|
||||
import { MongoChatItem } from '@fastgpt/service/core/chat/chatItemSchema';
|
||||
import type { InitChatResponse } from '@fastgpt/global/core/chat/api.d';
|
||||
import type { ChatItemType } from '@fastgpt/global/core/chat/type.d';
|
||||
import { authApp } from '@fastgpt/service/support/permission/auth/app';
|
||||
import type { ChatSchema } from '@fastgpt/global/core/chat/type.d';
|
||||
import { getGuideModule } from '@/global/core/app/modules/utils';
|
||||
import { getGuideModule } from '@fastgpt/global/core/module/utils';
|
||||
import { getChatModelNameListByModules } from '@/service/core/app/module';
|
||||
import { TaskResponseKeyEnum } from '@fastgpt/global/core/chat/constants';
|
||||
import { authChat } from '@fastgpt/service/support/permission/auth/chat';
|
||||
import { ModuleOutputKeyEnum } from '@fastgpt/global/core/module/constants';
|
||||
|
||||
/* 初始化我的聊天框,需要身份验证 */
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
@@ -55,7 +53,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
{
|
||||
chatId
|
||||
},
|
||||
`dataId obj value adminFeedback userFeedback ${TaskResponseKeyEnum.responseData}`
|
||||
`dataId obj value adminFeedback userFeedback ${ModuleOutputKeyEnum.responseData}`
|
||||
)
|
||||
.sort({ _id: -1 })
|
||||
.limit(30);
|
||||
|
||||
@@ -9,8 +9,15 @@ import { authUserNotVisitor } from '@fastgpt/service/support/permission/auth/use
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
||||
try {
|
||||
await connectToDatabase();
|
||||
const { name, tags, avatar, vectorModel, agentModel, parentId, type } =
|
||||
req.body as CreateDatasetParams;
|
||||
const {
|
||||
name,
|
||||
tags,
|
||||
avatar,
|
||||
vectorModel = global.vectorModels[0].model,
|
||||
agentModel,
|
||||
parentId,
|
||||
type
|
||||
} = req.body as CreateDatasetParams;
|
||||
|
||||
// 凭证校验
|
||||
const { teamId, tmbId } = await authUserNotVisitor({ req, authToken: true });
|
||||
|
||||
@@ -51,8 +51,9 @@ export default withNextCors(async function handler(req: NextApiRequest, res: Nex
|
||||
|
||||
// token check
|
||||
const token = countPromptTokens(formatQ, 'system');
|
||||
const vectorModelData = getVectorModel(vectorModel);
|
||||
|
||||
if (token > getVectorModel(vectorModel).maxToken) {
|
||||
if (token > vectorModelData.maxToken) {
|
||||
return Promise.reject('Q Over Tokens');
|
||||
}
|
||||
|
||||
@@ -70,7 +71,7 @@ export default withNextCors(async function handler(req: NextApiRequest, res: Nex
|
||||
collectionId,
|
||||
q: formatQ,
|
||||
a: formatA,
|
||||
model: vectorModel,
|
||||
model: vectorModelData.model,
|
||||
indexes
|
||||
});
|
||||
|
||||
@@ -78,7 +79,7 @@ export default withNextCors(async function handler(req: NextApiRequest, res: Nex
|
||||
teamId,
|
||||
tmbId,
|
||||
tokenLen: tokenLen,
|
||||
model: vectorModel
|
||||
model: vectorModelData.model
|
||||
});
|
||||
|
||||
jsonRes<string>(res, {
|
||||
|
||||
28
projects/app/src/pages/api/core/plugin/getPreviewModule.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
get plugin preview modules
|
||||
*/
|
||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { jsonRes } from '@fastgpt/service/common/response';
|
||||
import { connectToDatabase } from '@/service/mongo';
|
||||
import { getPluginPreviewModule } from '@fastgpt/service/core/plugin/controller';
|
||||
import { authPluginCanUse } from '@fastgpt/service/support/permission/auth/plugin';
|
||||
import { FlowModuleTemplateType } from '@fastgpt/global/core/module/type';
|
||||
import { authCert } from '@fastgpt/service/support/permission/auth/common';
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
||||
try {
|
||||
const { id } = req.query as { id: string };
|
||||
await connectToDatabase();
|
||||
const { teamId, tmbId } = await authCert({ req, authToken: true });
|
||||
await authPluginCanUse({ id, teamId, tmbId });
|
||||
|
||||
jsonRes<FlowModuleTemplateType>(res, {
|
||||
data: await getPluginPreviewModule({ id })
|
||||
});
|
||||
} catch (err) {
|
||||
jsonRes(res, {
|
||||
code: 500,
|
||||
error: err
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { jsonRes } from '@fastgpt/service/common/response';
|
||||
import { connectToDatabase } from '@/service/mongo';
|
||||
import { getPluginModuleDetail } from '@fastgpt/service/core/plugin/controller';
|
||||
import { authPluginCrud } from '@fastgpt/service/support/permission/auth/plugin';
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
||||
try {
|
||||
const { id } = req.query as { id: string };
|
||||
await connectToDatabase();
|
||||
await authPluginCrud({ req, authToken: true, id, per: 'r' });
|
||||
|
||||
jsonRes(res, {
|
||||
data: await getPluginModuleDetail({ id })
|
||||
});
|
||||
} catch (err) {
|
||||
jsonRes(res, {
|
||||
code: 500,
|
||||
error: err
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { jsonRes } from '@fastgpt/service/common/response';
|
||||
import { connectToDatabase } from '@/service/mongo';
|
||||
import { authCert } from '@fastgpt/service/support/permission/auth/common';
|
||||
import { getUserPlugins2Templates } from '@fastgpt/service/core/plugin/controller';
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
||||
try {
|
||||
await connectToDatabase();
|
||||
const { teamId } = await authCert({ req, authToken: true });
|
||||
|
||||
jsonRes(res, {
|
||||
data: await getUserPlugins2Templates({ teamId })
|
||||
});
|
||||
} catch (err) {
|
||||
jsonRes(res, {
|
||||
code: 500,
|
||||
error: err
|
||||
});
|
||||
}
|
||||
}
|
||||