Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

feat: add a Tianditu tool (#6320)

listengd5dca46854c7
diff --git a/api/core/tools/provider/_position.yaml b/api/core/tools/provider/_position.yaml
index fa13629ef75..3a3ff644269 100644
--- a/api/core/tools/provider/_position.yaml
+++ b/api/core/tools/provider/_position.yaml
@@ -30,3 +30,4 @@
- feishu
- feishu_base
- slack
+- tianditu
diff --git a/api/core/tools/provider/builtin/tianditu/_assets/icon.svg b/api/core/tools/provider/builtin/tianditu/_assets/icon.svg
new file mode 100644
index 00000000000..749d4bda265
--- /dev/null
+++ b/api/core/tools/provider/builtin/tianditu/_assets/icon.svg
@@ -0,0 +1,21 @@
+<svg t="1625725643558" class="icon" viewBox="0 0 1910 1910" version="1.1"
+ xmlns="http://www.w3.org/2000/svg" p-id="9218"
+ xmlns:xlink="http://www.w3.org/1999/xlink" width="380" height="380">
+ <defs>
+ <style type="text/css"></style>
+ </defs>
+ <path d="M603.192148 338.381671c31.541162 22.417686 59.172263 52.134153 104.268305 49.266775 19.289637 0 24.503052 15.379575 11.990855 31.019821a67.513728 67.513728 0 0 1-71.68446 21.375002 15.118904 15.118904 0 0 0-22.417685 13.55488 65.949703 65.949703 0 0 0 49.006103 71.163119 357.379617 357.379617 0 0 0 96.969524 3.38872 38.318602 38.318602 0 0 0 33.8872-17.725612 809.904063 809.904063 0 0 1 72.466472-127.728675c9.123477-12.772867 13.81555-16.9436 26.067076-6.516769a106.093001 106.093001 0 0 1 13.294209 15.379575 193.417707 193.417707 0 0 0 68.295741 56.826227c13.294209 5.995428 28.152443 4.692074 42.228663 10.687501-12.772867 17.20427-34.408541 18.768295-49.527445 31.801833H1016.615979c20.33232 0 36.233236-16.9436 54.219519-17.986282 27.891772-1.564025 56.044214 3.649391 84.457328 3.128049a227.304906 227.304906 0 0 0 50.570128-5.995428 20.071649 20.071649 0 0 0 13.81555-23.721039 56.304885 56.304885 0 0 0-30.498479-44.053359 478.070181 478.070181 0 0 0-70.641777-19.550308l13.55488-7.298781a162.919227 162.919227 0 0 0 57.347568-38.057932c9.384148-11.990855 6.256098-28.413113 15.379575-35.451224 21.635673-16.422258 22.678356-44.31403 40.664639-62.560983a60.996959 60.996959 0 0 0 6.516769-63.082325 49.266774 49.266774 0 0 0-53.958848-7.820123 454.609812 454.609812 0 0 0-82.371961 37.015249 13.033538 13.033538 0 0 0-5.474086 3.910061c3.910061 14.597563-4.431403 7.820123-10.16616 6.256099s-15.640246-2.606708-17.464941 4.952744c-4.170732 19.028966-8.862806 5.995428-13.294209 0a39.361285 39.361285 0 0 1-8.862806-22.939027V130.366402c0-26.067076 12.772867-52.134153 7.559452-81.068608a12.512197 12.512197 0 0 0-16.9436-12.772867 123.818613 123.818613 0 0 0-41.446651 16.943599c-21.114332 10.687501-16.422258 22.417686-11.469514 37.53659a130.335382 130.335382 0 0 1 8.862806 32.062504 729.878139 729.878139 0 0 1-3.910061 115.73782 17.464941 17.464941 0 0 1-10.426831 17.725612c-10.426831 4.431403-12.512197-3.910061-17.20427-9.644819a35.972565 35.972565 0 0 0-61.25763-2.867378c-5.995428 5.995428-10.948172 13.033538-18.507624 22.157015a70.381106 70.381106 0 0 0-44.574701-47.442079 18.768295 18.768295 0 0 1-10.948172-26.067077 65.949703 65.949703 0 0 0-56.565556-83.153973 36.233236 36.233236 0 0 1-20.853661-11.208843c-12.772867-11.730184-19.810978-10.687501-28.413113 4.431403a30.237809 30.237809 0 0 0 0 33.626528 52.134153 52.134153 0 0 1 7.038111 35.190553 420.722613 420.722613 0 0 0-4.952745 42.489335 79.765254 79.765254 0 0 1-60.214946 78.201229c-23.199698 8.602135-46.920738 16.682929-70.120436 26.067077-14.336892 5.213415-15.379575 11.469514-2.867378 20.071648z m547.408604-142.586907a9.384148 9.384148 0 0 1 3.910061 2.085366 4.170732 4.170732 0 0 1-4.952744 4.692073 4.692074 4.692074 0 0 1-1.824695-2.606707 3.910061 3.910061 0 0 1 3.910061-4.170732z m-60.736288 60.214946a46.920738 46.920738 0 0 0 34.408541-15.900917 73.248485 73.248485 0 0 1 50.048786-20.853661c13.294209 0 19.289637 5.474086 13.815551 17.464941a318.279003 318.279003 0 0 1-52.134153 73.509156 24.242381 24.242381 0 0 1-19.028966 6.256098 62.821654 62.821654 0 0 1-47.442079-30.75915 21.896344 21.896344 0 0 1 21.114332-29.716467z m-21.635673 104.268306c13.294209-2.346037 19.028966 10.426831 31.01982 20.59299-14.858234 2.606708-26.067076 9.905489-35.451223-2.346037a14.076221 14.076221 0 0 1 5.734756-17.20427z m-93.841475-4.170733a15.640246 15.640246 0 0 1 12.251525 11.469514c0 4.692074 0 6.256098-4.692073 5.734757a12.772867 12.772867 0 0 1-11.730185-9.905489 5.995428 5.995428 0 0 1 5.213416-6.256099z m-79.765254-60.996958a65.428362 65.428362 0 0 1-23.199698 52.134152c-2.346037 0-5.995428 1.824695-6.256099 0 0-13.294209-13.033538-8.080794-20.853661-12.251526 13.033538-21.114332 37.015248-23.199698 51.352141-38.839943z" fill="#E99415" p-id="9219"></path>
+ <path d="M1396.152612 510.424376a67.253057 67.253057 0 0 0 62.300312-42.750006c5.734757-17.725612 5.213415-36.754578 10.948172-55.262202a29.455796 29.455796 0 0 0 40.403969-8.862806c16.161587-19.810978 35.972565-36.493907 50.048786-57.868909a28.673784 28.673784 0 0 1 23.460369-14.858234 81.85062 81.85062 0 0 0 5.734757 41.967993 29.716467 29.716467 0 0 0 37.53659 14.336892 23.72104 23.72104 0 0 0 9.905489-37.797261 20.33232 20.33232 0 0 1 6.516769-32.583845 512.739393 512.739393 0 0 1 83.935986-52.134153 12.512197 12.512197 0 0 0 4.692074-21.896344 70.381106 70.381106 0 0 0-62.560984-22.157015c-21.375003 6.256098-23.199698 4.431403-18.768295-18.246953a49.006104 49.006104 0 0 0-1.303353-39.882627 28.413113 28.413113 0 0 1 0-35.451224c14.597563-27.631101 14.076221-29.195126-11.469514-52.134153 21.635673-7.820123 40.664639-15.640246 59.954276-21.896344 49.788116-15.900917 81.589949 5.734757 82.371961 57.347568a324.27443 324.27443 0 0 0 17.464941 100.879586c9.123477 26.067076 16.9436 53.437507 23.460369 80.547266a908.698283 908.698283 0 0 1 26.067076 184.5549c0 17.725612 14.076221 33.105187 8.080794 52.134153-1.564025 4.692074-1.303354 12.512197-5.995428 12.251526-21.375003 0-42.750005 10.426831-64.646349-1.564024a492.928415 492.928415 0 0 0-57.086897-23.199698 32.583845 32.583845 0 0 1-17.725612-13.815551 35.190553 35.190553 0 0 0-36.754578-17.725612 28.152443 28.152443 0 0 1-31.541162-10.948172 23.460369 23.460369 0 0 1 7.298781-28.673784c6.77744-8.602135 4.170732-12.772867-3.38872-19.550307a80.807937 80.807937 0 0 0-67.774399-19.028966c-11.208843 0-19.289637 15.900917-11.208842 22.939027a85.500011 85.500011 0 0 1 22.678356 59.172264c4.170732 27.891772 52.134153 60.736288 78.201229 49.527445a45.096042 45.096042 0 0 1 42.228664 2.346037c17.464941 8.080794 34.408541 17.725612 52.134153 26.067076a154.317092 154.317092 0 0 0 52.134153 18.768295c39.882627 5.995428 48.745433 2.606708 52.134152-38.057931a530.465005 530.465005 0 0 0-10.42683-218.702771c-22.678356-73.248485-49.527445-144.932945-49.788116-223.134174a55.001531 55.001531 0 0 0-32.062504-47.70275 47.442079 47.442079 0 0 1-24.763723-26.067077A43.271347 43.271347 0 0 0 1707.393504 0.552361c-23.98171-3.649391-41.185981 11.730184-61.25763 18.507625-42.489335 14.597563-76.637205 44.053359-118.083856 65.949703 31.541162 13.033538 58.911593-2.606708 88.888731-2.085366a69.338423 69.338423 0 0 1-34.408541 39.100614 39.361285 39.361285 0 0 0-27.631101 41.446652 52.134153 52.134153 0 0 1-2.085366 18.507624 17.20427 17.20427 0 0 0 8.080793 21.896344c10.426831 9.644818 18.246953 1.824695 26.067077-2.085366a16.161587 16.161587 0 0 1 20.59299 2.867378 14.858234 14.858234 0 0 1-3.38872 20.33232 104.268306 104.268306 0 0 1-13.55488 12.772868 460.865911 460.865911 0 0 1-69.599094 39.882626 125.903979 125.903979 0 0 0-60.214946 52.134153 56.044214 56.044214 0 0 1-18.246953-54.219519 49.527445 49.527445 0 0 0-8.080794-46.138725c-7.038111-13.033538-15.640246-13.294209-20.592991 0a617.268369 617.268369 0 0 1-35.972565 89.670743 6.516769 6.516769 0 0 0 0 3.649391 204.105208 204.105208 0 0 1-13.294209 71.163118 220.527466 220.527466 0 0 0-13.033538 62.039642 57.086897 57.086897 0 0 0 44.574701 54.48019z m198.370451-199.673806a78.201229 78.201229 0 0 1 64.90702-41.18598 10.687501 10.687501 0 0 1 13.033538 3.910061 11.469514 11.469514 0 0 1-4.952744 11.469514 72.987814 72.987814 0 0 1-68.03507 31.019821c-2.867378 2.606708-6.256098 7.038111-10.166159 3.38872a8.080794 8.080794 0 0 1 5.213415-8.602136z m-67.513728 22.157015a65.428362 65.428362 0 0 1-31.019821 34.669212 44.835371 44.835371 0 0 1 31.280492-34.929882zM20.071649 522.15456c11.730184 11.208843 24.503052 21.114332 37.015248 31.541162 47.963421 39.882627 84.978669 34.929882 120.690564-17.20427a506.483294 506.483294 0 0 0 75.07318-191.593012 22.678356 22.678356 0 0 1 16.161587-19.289636 1053.891899 1053.891899 0 0 1 137.634164-40.92531 19.550307 19.550307 0 0 0 14.858233-23.98171 19.810978 19.810978 0 0 0-14.858233-26.067077 111.306416 111.306416 0 0 0-69.338423 6.77744 394.655537 394.655537 0 0 1-61.518301 21.896344 14.336892 14.336892 0 0 1-20.853661-14.858233c-1.303354-14.336892 0-28.673784 0-43.010676s3.649391-19.289637 18.768295-18.768295a250.243933 250.243933 0 0 0 95.926841-11.730185 59.172263 59.172263 0 0 0 41.185981-42.228663 176.474107 176.474107 0 0 1-3.128049-24.242381 36.233236 36.233236 0 0 0-18.246954-41.185981 108.178367 108.178367 0 0 0-80.025924-18.507624c-17.464941 2.085366-35.711895 2.867378-52.134153 5.734756a265.884179 265.884179 0 0 1-104.268306-7.559452c-15.640246-3.649391-16.161587 2.085366-12.772867 13.294209a165.525935 165.525935 0 0 0 52.134153 78.201229 342.782055 342.782055 0 0 1 26.067076 69.599094 198.370451 198.370451 0 0 1-23.98171 64.385679 66.471045 66.471045 0 0 1-60.996959 32.062504 192.896365 192.896365 0 0 1-58.390251-11.208843c-14.858234-4.692074-16.9436 2.606708-14.597563 14.076221a35.190553 35.190553 0 0 0 26.067077 26.067077 166.047277 166.047277 0 0 0 81.589949 1.824695c16.422258-3.128049 20.59299 2.346037 19.810978 16.682929a79.504583 79.504583 0 0 1-2.346037 16.682929c-12.512197 35.190553-22.678356 71.163119-38.057932 104.268306a104.268306 104.268306 0 0 1-26.067076 35.972565 49.527445 49.527445 0 0 1-73.248485 3.38872 78.201229 78.201229 0 0 0-14.076221-9.384148c-7.298781-1.303354-14.076221-8.341464-20.071649-0.521341a15.640246 15.640246 0 0 0 5.995428 19.810978z" fill="#E99517" p-id="9220"></path>
+ <path d="M1909.934687 1019.775048c-5.995428-1.564025-11.990855-3.128049-18.246953-4.431403a3090.773248 3090.773248 0 0 0-352.948215-44.053359c-193.417707-15.379575-387.617426-22.157015-581.556474-21.896344a6864.503897 6864.503897 0 0 0-741.347652 36.754578 1798.628271 1798.628271 0 0 0-215.053381 33.626528 52.134153 52.134153 0 0 0 23.72104 3.649391h13.033538c107.135684-5.995428 214.271368-13.81555 321.407052-17.986283 281.263754-11.469514 562.527509-15.379575 843.791263-9.905489 156.402458 3.128049 312.804917 7.038111 467.64335 15.900917l216.617405 12.512196a52.134153 52.134153 0 0 0 22.939027-4.170732zM911.826332 941.313148a24.503052 24.503052 0 0 0 26.067077-17.20427c22.678356-48.484762 46.399396-96.448183 69.859764-144.672274 17.20427-34.408541 17.20427-34.408541-22.417685-34.408541a20.853661 20.853661 0 0 0-23.72104 14.858234c-8.602135 21.896344-19.028966 43.271347-29.195125 64.646349a46.399396 46.399396 0 0 1-14.076222 23.199698v-69.599094c0-33.105187 0-32.062504-33.105187-33.626528a31.280492 31.280492 0 0 0-34.14787 20.332319c-13.033538 26.067076-28.413113 52.134153-42.750005 80.025925l-3.38872-1.564025c1.303354-20.071649 3.910061-39.621956 3.910061-59.432934 2.867378-39.882627 2.606708-39.361285-38.579273-39.100615a12.251526 12.251526 0 0 0-15.118904 14.597563c-1.824695 47.442079-4.692074 94.623487-7.298781 142.065566-2.085366 39.882627-2.085366 39.100615 38.839943 39.882627a23.98171 23.98171 0 0 0 26.067077-15.379575c11.469514-23.460369 24.503052-46.138725 37.015248-69.077752 5.995428-10.948172 12.251526-21.635673 18.246954-32.583846l2.867378 1.564025v74.551838c0.260671 40.664639 0.260671 39.882627 40.92531 40.92531zM187.943621 912.900035c-7.559452 27.891772-7.559452 26.067076 21.375002 28.413113a20.59299 20.59299 0 0 0 26.067077-18.768295c11.730184-47.70275 26.067076-95.144829 38.318602-142.586908 9.384148-34.929882 9.123477-32.323175-26.067076-35.711894A52.134153 52.134153 0 0 0 183.251547 782.043312a800.519916 800.519916 0 0 1-39.100615 76.637204v-99.836902c1.303354-10.948172-2.085366-13.81555-13.033538-13.815551h-52.134153a13.294209 13.294209 0 0 0-15.900916 11.469514c-15.118904 57.86891-31.019821 115.477148-46.660067 173.085387 0 3.38872-3.128049 9.644818 0 9.905489a314.890283 314.890283 0 0 0 40.92531 0c9.123477 0 7.038111-9.384148 8.602135-14.597563 11.208843-39.100615 21.375003-78.201229 32.062504-117.823185 1.564025 39.621956 1.564025 78.201229 1.824696 117.823185 0 5.213415-4.170732 12.512197 5.734756 14.858234a38.839944 38.839944 0 0 0 49.266775-22.417686l20.071649-36.754578 35.711894-68.29574a13.294209 13.294209 0 0 1 0 14.076221zM1339.065714 941.052478a12.512197 12.512197 0 0 0 14.858234-11.990856c3.649391-16.422258 8.080794-32.583845 13.294209-48.484762 2.085366-6.77744 0-17.986283 10.948172-18.507624a19.289637 19.289637 0 0 1 18.507624 19.550307l11.730184 48.745433a10.948172 10.948172 0 0 0 12.251526 10.687502h48.745433c3.910061 0 10.16616 0 7.820123-6.256099-8.862806-26.067076-5.995428-58.650922-31.801833-80.547266a79.504583 79.504583 0 0 0 55.522873-53.698177c9.384148-33.105187-3.910061-52.134153-38.057932-54.48019-28.673784-1.303354-57.347568 0-86.021352 0-33.887199 0-33.887199 0-42.750005 32.062504l-44.31403 163.70124c18.246953-1.042683 33.887199-1.564025 49.266774-0.782012z m46.920738-130.335382c7.038111-28.673784 7.298781-28.673784 35.972565-26.067077 8.602135 0 18.768295 0 19.550307 12.772868a21.896344 21.896344 0 0 1-15.379575 23.199698 83.675315 83.675315 0 0 1-43.792688 2.606707c1.824695-4.952745 2.606708-9.123477 3.649391-13.294209zM1741.802044 745.028063a11.469514 11.469514 0 0 0-13.81555 8.862806c-16.422258 61.778971-33.365858 123.557942-50.570128 187.161609h85.23934a161.876544 161.876544 0 0 0 20.59299 0 104.268306 104.268306 0 0 0 78.201229-52.134153 171.000021 171.000021 0 0 0 23.460369-81.85062 52.134153 52.134153 0 0 0-53.437507-62.039642h-89.670743z m59.172264 138.937517a56.044214 56.044214 0 0 1-52.134153 11.208843c8.341464-31.019821 17.725612-60.736288 24.242381-90.974096a16.9436 16.9436 0 0 1 22.678357-14.336893 23.199698 23.199698 0 0 1 27.631101 19.028966 104.268306 104.268306 0 0 1-22.678357 75.07318zM419.67993 941.052478a131.899407 131.899407 0 0 1 24.242381 0c9.644818 0 12.512197-2.085366 11.469514-12.512197-4.952745-44.053359-8.862806-87.846047-12.772868-131.899407-1.564025-16.682929 3.128049-38.839944-7.298781-48.224091s-33.365858-3.38872-50.570128-3.38872h-3.910062a13.294209 13.294209 0 0 0-13.81555 7.298781l-119.908552 188.725634a307.591501 307.591501 0 0 1 39.100615 0 27.37043 27.37043 0 0 0 32.844516-19.550308 15.900917 15.900917 0 0 1 15.379575-13.554879h48.484762c7.038111 0 11.208843 2.085366 9.905489 9.384147-3.910061 23.460369 9.123477 25.545735 26.849089 23.72104z m-37.53659-75.333851h-31.019821l35.451224-62.821654h5.734757v52.134152c-0.521342 9.905489-3.649391 10.948172-10.16616 10.687502zM492.928415 940.791807c41.967993 0 41.967993 0 52.134152-40.143298 8.602135-31.280492 8.602135-31.280492 42.228664-32.062504a83.675315 83.675315 0 0 0 88.106718-70.120435 38.839944 38.839944 0 0 0-39.882627-52.134153h-97.230195a11.469514 11.469514 0 0 0-13.81555 8.862806c-16.422258 61.778971-33.105187 123.297271-50.309457 187.161608h17.986282z m80.025924-141.022883a15.900917 15.900917 0 0 1 21.896344-15.118905c9.123477 1.564025 20.33232 0 22.157015 12.772868a24.503052 24.503052 0 0 1-15.640246 26.067076 57.347568 57.347568 0 0 1-35.451224 2.867378 232.518321 232.518321 0 0 0 6.77744-26.588417z" fill="#104D98" p-id="9221"></path>
+ <path d="M318.800344 385.56308a878.981816 878.981816 0 0 0 44.835372 100.618915 106.875013 106.875013 0 0 0 26.067076 32.323174 41.707322 41.707322 0 0 0 47.963421 10.687502c22.939027-11.990855 52.134153-18.507624 58.12958-50.309458a33.365858 33.365858 0 0 0 0-5.213415 48.745433 48.745433 0 0 0-16.9436-38.579273 286.73784 286.73784 0 0 0-141.804895-71.42379c-19.810978-3.38872-25.024393 3.38872-18.246954 21.896345z" fill="#E99517" p-id="9222"></path>
+ <path d="M1609.902638 745.028063h-49.266774a11.208843 11.208843 0 0 0-12.772868 10.16616l-50.048787 185.858255h142.586908c4.170732 0 9.123477 0 10.687502-4.952745a115.477148 115.477148 0 0 0 8.602135-41.185981c0-5.734757-20.071649-1.564025-31.019821-2.346037s-16.161587 0-24.242381 0c-33.887199 0-33.887199 0-26.067076-33.365857s21.114332-75.07318 31.541162-114.173795z" fill="#104D98" p-id="9223"></path>
+ <path d="M1150.600752 202.572203a4.170732 4.170732 0 0 0 4.692074-4.952744 9.384148 9.384148 0 0 0-3.910062-2.085366 3.910061 3.910061 0 0 0-4.692074 4.170732 4.692074 4.692074 0 0 0 3.910062 2.867378z" fill="#F3D297" p-id="9224"></path>
+ <path d="M1599.736478 315.703315c-4.170732 0-5.474086 0-4.952744-4.952745a8.080794 8.080794 0 0 0-5.213416 8.341465c3.649391 3.649391 7.038111-0.782012 10.16616-3.38872z" fill="#F5D39C" p-id="9225"></path>
+ <path d="M1599.736478 315.703315l-4.952744-4.952745c-0.521342 3.649391 0.782012 5.734757 4.952744 4.952745z" fill="#F5D39C" p-id="9226"></path>
+ <path d="M1034.341591 819.05856a23.72104 23.72104 0 0 0 5.734757 32.583846 8.602135 8.602135 0 0 1 3.38872 3.910061 188.464962 188.464962 0 0 0 21.375003 8.602135c5.213415 1.564025 5.734757 4.431403 2.346036 8.341465s-3.128049 2.606708-4.431403 4.170732a23.460369 23.460369 0 0 0 2.346037 36.233236 59.432934 59.432934 0 0 0 23.72104 9.384148 130.335382 130.335382 0 0 0 34.929882 2.867378 31.541162 31.541162 0 0 1 23.460369 5.995428 20.59299 20.59299 0 0 0 8.862806 4.431403 13.55488 13.55488 0 0 0-4.170732-6.77744c-1.824695-2.867378-1.564025-5.213415 2.085366-6.256099a206.451245 206.451245 0 0 1 23.721039-4.952744 7.298781 7.298781 0 0 1 8.080794 6.516769c1.564025 5.213415 3.128049 10.426831 5.213415 15.379575s4.170732 6.256098 9.644819 3.128049a94.623487 94.623487 0 0 0 44.5747-52.134153 15.900917 15.900917 0 0 1 3.910062-7.03811 130.335382 130.335382 0 0 0 23.721039-26.067077 26.067076 26.067076 0 0 0 2.867379-3.910061l4.431403-13.294209v-6.77744a14.597563 14.597563 0 0 0 0-7.559452l-2.085367 7.038111a50.048787 50.048787 0 0 0-2.606707 9.644818 69.077752 69.077752 0 0 1-17.986283 24.242381c-2.867378 3.38872-6.256098 2.085366-6.256098-2.346037 0-8.341464-1.564025-16.682929-2.346037-26.067076a10.948172 10.948172 0 0 1 6.256098-9.123477 50.570128 50.570128 0 0 0 16.9436-20.853661 46.660067 46.660067 0 0 0 0-23.460369c-2.606708 5.474086-2.085366 10.426831-4.170732 14.336892a70.381106 70.381106 0 0 1-16.422258 18.768295 4.431403 4.431403 0 0 1-7.820123-2.085366 117.562515 117.562515 0 0 0-10.687502-23.98171 4.952745 4.952745 0 0 1 2.085366-7.038111 80.547266 80.547266 0 0 0 8.862806-8.341464 13.55488 13.55488 0 0 0-1.824695-22.157015 73.509155 73.509155 0 0 0-29.977138-13.294209 72.205802 72.205802 0 0 0-24.242381-2.346037c6.256098 5.995428 12.512197 11.730184 19.028966 18.768295a8.862806 8.862806 0 0 1 1.303354-8.862806 9.644818 9.644818 0 0 1 7.820123 0 81.068608 81.068608 0 0 1 18.507624 4.431403 26.067076 26.067076 0 0 1 9.905489 7.820123 8.602135 8.602135 0 0 1 0 10.687501 27.891772 27.891772 0 0 1-14.076221 10.948172 12.251526 12.251526 0 0 1-10.426831-4.952744 9.384148 9.384148 0 0 1 0 8.080793 16.9436 16.9436 0 0 1-7.298781 3.649391c-9.905489 2.867378-20.33232 4.692074-30.49848 6.516769s-11.730184 0-13.294209-9.905489c-2.606708-15.118904-7.038111-29.716467-10.687501-44.574701a37.015248 37.015248 0 0 0-2.346037-6.256098c-2.606708-5.995428-3.910061-6.256098-8.862806-1.824695a159.791178 159.791178 0 0 0-37.797261 49.788116c-4.692074 9.905489-6.256098 10.426831-15.900916 5.213415l-2.867379-1.564025a17.464941 17.464941 0 0 1-5.474086-28.673784 73.248485 73.248485 0 0 1 31.541163-22.678356h0H1112.54282l-7.298781 2.606707c-5.213415 2.606708-10.16616 4.952745-15.640246 7.038111l-5.734757 3.38872a70.120435 70.120435 0 0 0-20.332319 16.422258 19.289637 19.289637 0 0 0-4.692074 26.067077 4.431403 4.431403 0 0 1-2.346037 7.03811 57.86891 57.86891 0 0 0-22.157015 16.161588 9.384148 9.384148 0 0 1 0 4.952744z m193.939049 86.803364a114.434465 114.434465 0 0 1-28.413114 34.669212 4.692074 4.692074 0 0 1-3.910061 2.346037c-2.346037 0 0-3.128049-1.303354-4.692074s0-10.426831 0-16.161587a7.038111 7.038111 0 0 1 5.213415-9.384148 107.135684 107.135684 0 0 0 26.067077-11.208843s3.38872-2.606708 4.952744 0-1.824695 3.128049-2.606707 4.692074z m10.948172-56.565555c0 8.602135 0 17.464941-1.564025 26.067076a9.644818 9.644818 0 0 1-5.213415 7.298781 247.115884 247.115884 0 0 1-35.972566 14.858234c-3.38872 0-4.952745 0-5.474086-3.128049 0-9.123477-2.346037-18.246953-3.910061-26.067077a5.213415 5.213415 0 0 1 4.170732-6.516769 177.777461 177.777461 0 0 0 42.750005-15.379575c4.170732-3.910061 5.734757-1.824695 5.213416 2.867379z m-56.565556-41.707323a147.539652 147.539652 0 0 0 40.664639-12.251525 3.649391 3.649391 0 0 1 5.734757 2.606707c2.606708 8.602135 5.213415 17.20427 7.559452 26.067077a4.170732 4.170732 0 0 1-2.606708 4.692073 263.538142 263.538142 0 0 1-46.138725 15.379575 4.431403 4.431403 0 0 1-4.952744-4.170732c-1.564025-8.862806-3.128049-17.725612-4.952745-26.067076-0.782012-4.692074 1.564025-5.474086 4.692074-6.256099z m-12.772868 61.778971c2.346037 9.905489 4.952745 19.550307 7.298782 29.195126 0 3.128049-1.824695 3.649391-4.170732 4.170732a302.117415 302.117415 0 0 1-32.844517 4.692074 9.905489 9.905489 0 0 1-9.905489-5.995428 121.733247 121.733247 0 0 1-11.730184-26.067076c-1.303354-3.649391 0-4.170732 3.38872-4.431403a276.832351 276.832351 0 0 0 41.967993-5.213415 3.910061 3.910061 0 0 1 5.995427 3.910061z m-48.224091-80.025924a296.643329 296.643329 0 0 1 27.891772-50.309457 3.38872 3.38872 0 0 1 3.649391-2.346037c1.824695 0 1.564025 1.824695 1.303353 3.38872a298.728695 298.728695 0 0 0 2.606708 46.920737c0 10.426831 1.303354 10.426831-12.251526 10.16616l-20.071649-2.085366c-3.128049-0.521342-4.692074-2.346037-3.128049-5.734757z m-7.03811 26.067076a4.952745 4.952745 0 0 1 7.03811-4.431403h26.067077c11.208843 0 11.208843 0 13.033538 10.426831a182.469535 182.469535 0 0 0 3.910061 21.896344 3.910061 3.910061 0 0 1-3.910061 5.734757 266.666191 266.666191 0 0 1-43.010676 0 4.431403 4.431403 0 0 1-4.692074-4.692074 125.643308 125.643308 0 0 1 1.303354-28.673784z m-7.820123 72.727143a28.934455 28.934455 0 0 0 7.03811 12.772868c1.564025 1.824695 2.867378 3.910061 0 4.692074a52.134153 52.134153 0 0 1-38.579273-19.028966 15.640246 15.640246 0 0 1-2.346037-9.123477c0-8.341464 0-8.341464 8.602135-8.341464a22.678356 22.678356 0 0 1 25.024394 19.289636z m-40.66464-85.760681a3.910061 3.910061 0 0 1 5.995428-2.085366 89.931414 89.931414 0 0 0 22.417686 7.298781c3.649391 0 5.213415 2.085366 4.170732 5.995428a82.111291 82.111291 0 0 0-2.346037 26.067076c0 3.38872 0 5.995428-4.692074 4.692074a53.958848 53.958848 0 0 1-26.067076-15.118904 14.076221 14.076221 0 0 1-3.910062-11.208843 26.067076 26.067076 0 0 1 4.431403-15.640246z" fill="#E99517" p-id="9227"></path>
+ <path d="M1211.076369 748.156112s58.12958 9.123477 23.98171 34.408541h1.824696l1.564024-1.303354 7.038111-5.995427 3.38872-5.734757v-5.474086l-2.606708-4.170732-4.170732-4.431403-14.597563-7.038111-11.990855-2.346037zM1264.774547 866.76131l-18.246954 10.42683M1059.626655 797.162216a41.707322 41.707322 0 0 0-28.152442 27.891772 26.067076 26.067076 0 0 0 16.943599 32.583845M1238.70747 843.822283c-104.268306 49.006104-173.085387 20.853661-173.085387 20.853661M1040.076348 851.642406a114.434465 114.434465 0 0 0 78.201229 21.114331M1111.239467 783.346665a112.349099 112.349099 0 0 0 4.170732 121.472576" fill="#E99517" p-id="9228"></path>
+ <path d="M1222.024541 778.13325a227.044235 227.044235 0 0 1 17.204271 71.163119s1.824695 70.381106-42.750006 94.102145l23.199698-15.900916 17.204271-23.460369 6.516769-29.195125 3.128049-28.413114-6.256098-23.98171-9.644819-26.067076z" fill="#E99517" p-id="9229"></path>
+ <path d="M1077.612938 891.525032s34.14787 36.754578 140.240871-2.085366c0 0 60.996959-28.413113 63.864337-63.342995l-7.03811 26.067076-15.640246 19.289637-14.858234 9.905489-16.682929 10.166159-29.977138 10.948172-39.100614 10.16616-32.323175 2.606708h-32.323175l-17.464941-13.815551zM1252.001679 867.282651a115.737819 115.737819 0 0 0-30.498479-89.149401" fill="#E99517" p-id="9230"></path>
+ <path d="M1281.718146 825.836A64.125008 64.125008 0 0 1 1249.134301 886.311617l10.948172-15.379575 13.294209-17.464941 4.692073-13.815551z" fill="#E99517" p-id="9231"></path>
+ <path d="M1089.343122 922.805524s104.268306 17.986283 162.919228-38.839944l-60.996959 26.067077z" fill="#E99517" p-id="9232"></path>
+</svg>
\ No newline at end of file
diff --git a/api/core/tools/provider/builtin/tianditu/tianditu.py b/api/core/tools/provider/builtin/tianditu/tianditu.py
new file mode 100644
index 00000000000..1f96be06b02
--- /dev/null
+++ b/api/core/tools/provider/builtin/tianditu/tianditu.py
@@ -0,0 +1,21 @@
+from typing import Any
+
+from core.tools.errors import ToolProviderCredentialValidationError
+from core.tools.provider.builtin.tianditu.tools.poisearch import PoiSearchTool
+from core.tools.provider.builtin_tool_provider import BuiltinToolProviderController
+
+
+class TiandituProvider(BuiltinToolProviderController):
+ def _validate_credentials(self, credentials: dict[str, Any]) -> None:
+ try:
+ PoiSearchTool().fork_tool_runtime(
+ runtime={
+ "credentials": credentials,
+ }
+ ).invoke(user_id='',
+ tool_parameters={
+ 'content': '北京',
+ 'specify': '156110000',
+ })
+ except Exception as e:
+ raise ToolProviderCredentialValidationError(str(e))
diff --git a/api/core/tools/provider/builtin/tianditu/tianditu.yaml b/api/core/tools/provider/builtin/tianditu/tianditu.yaml
new file mode 100644
index 00000000000..77af834bdc5
--- /dev/null
+++ b/api/core/tools/provider/builtin/tianditu/tianditu.yaml
@@ -0,0 +1,32 @@
+identity:
+ author: Listeng
+ name: tianditu
+ label:
+ en_US: Tianditu
+ zh_Hans: 天地图
+ pt_BR: Tianditu
+ description:
+ en_US: The Tianditu tool provided the functions of place name search, geocoding, static maps generation, etc. in China region.
+ zh_Hans: 天地图工具可以调用天地图的接口,实现中国区域内的地名搜索、地理编码、静态地图等功能。
+ pt_BR: The Tianditu tool provided the functions of place name search, geocoding, static maps generation, etc. in China region.
+ icon: icon.svg
+ tags:
+ - utilities
+ - travel
+credentials_for_provider:
+ tianditu_api_key:
+ type: secret-input
+ required: true
+ label:
+ en_US: Tianditu API Key
+ zh_Hans: 天地图Key
+ pt_BR: Tianditu API key
+ placeholder:
+ en_US: Please input your Tianditu API key
+ zh_Hans: 请输入你的天地图Key
+ pt_BR: Please input your Tianditu API key
+ help:
+ en_US: Get your Tianditu API key from Tianditu
+ zh_Hans: 获取您的天地图Key
+ pt_BR: Get your Tianditu API key from Tianditu
+ url: http://lbs.tianditu.gov.cn/home.html
diff --git a/api/core/tools/provider/builtin/tianditu/tools/geocoder.py b/api/core/tools/provider/builtin/tianditu/tools/geocoder.py
new file mode 100644
index 00000000000..484a3768c85
--- /dev/null
+++ b/api/core/tools/provider/builtin/tianditu/tools/geocoder.py
@@ -0,0 +1,33 @@
+import json
+from typing import Any, Union
+
+import requests
+
+from core.tools.entities.tool_entities import ToolInvokeMessage
+from core.tools.tool.builtin_tool import BuiltinTool
+
+
+class GeocoderTool(BuiltinTool):
+
+ def _invoke(self,
+ user_id: str,
+ tool_parameters: dict[str, Any],
+ ) -> Union[ToolInvokeMessage, list[ToolInvokeMessage]]:
+ """
+ invoke tools
+ """
+ base_url = 'http://api.tianditu.gov.cn/geocoder'
+
+ keyword = tool_parameters.get('keyword', '')
+ if not keyword:
+ return self.create_text_message('Invalid parameter keyword')
+
+ tk = self.runtime.credentials['tianditu_api_key']
+
+ params = {
+ 'keyWord': keyword,
+ }
+
+ result = requests.get(base_url + '?ds=' + json.dumps(params, ensure_ascii=False) + '&tk=' + tk).json()
+
+ return self.create_json_message(result)
diff --git a/api/core/tools/provider/builtin/tianditu/tools/geocoder.yaml b/api/core/tools/provider/builtin/tianditu/tools/geocoder.yaml
new file mode 100644
index 00000000000..d6a168f9502
--- /dev/null
+++ b/api/core/tools/provider/builtin/tianditu/tools/geocoder.yaml
@@ -0,0 +1,26 @@
+identity:
+ name: geocoder
+ author: Listeng
+ label:
+ en_US: Get coords converted from address name
+ zh_Hans: 地理编码
+ pt_BR: Get coords converted from address name
+description:
+ human:
+ en_US: Geocoder
+ zh_Hans: 中国区域地理编码查询
+ pt_BR: Geocoder
+ llm: A tool for geocoder in China
+parameters:
+ - name: keyword
+ type: string
+ required: true
+ label:
+ en_US: keyword
+ zh_Hans: 搜索的关键字
+ pt_BR: keyword
+ human_description:
+ en_US: keyword
+ zh_Hans: 搜索的关键字
+ pt_BR: keyword
+ form: llm
diff --git a/api/core/tools/provider/builtin/tianditu/tools/poisearch.py b/api/core/tools/provider/builtin/tianditu/tools/poisearch.py
new file mode 100644
index 00000000000..08a5b8ef42a
--- /dev/null
+++ b/api/core/tools/provider/builtin/tianditu/tools/poisearch.py
@@ -0,0 +1,45 @@
+import json
+from typing import Any, Union
+
+import requests
+
+from core.tools.entities.tool_entities import ToolInvokeMessage
+from core.tools.tool.builtin_tool import BuiltinTool
+
+
+class PoiSearchTool(BuiltinTool):
+
+ def _invoke(self,
+ user_id: str,
+ tool_parameters: dict[str, Any],
+ ) -> Union[ToolInvokeMessage, list[ToolInvokeMessage]]:
+ """
+ invoke tools
+ """
+ geocoder_base_url = 'http://api.tianditu.gov.cn/geocoder'
+ base_url = 'http://api.tianditu.gov.cn/v2/search'
+
+ keyword = tool_parameters.get('keyword', '')
+ if not keyword:
+ return self.create_text_message('Invalid parameter keyword')
+
+ baseAddress = tool_parameters.get('baseAddress', '')
+ if not baseAddress:
+ return self.create_text_message('Invalid parameter baseAddress')
+
+ tk = self.runtime.credentials['tianditu_api_key']
+
+ base_coords = requests.get(geocoder_base_url + '?ds=' + json.dumps({'keyWord': baseAddress,}, ensure_ascii=False) + '&tk=' + tk).json()
+
+ params = {
+ 'keyWord': keyword,
+ 'queryRadius': 5000,
+ 'queryType': 3,
+ 'pointLonlat': base_coords['location']['lon'] + ',' + base_coords['location']['lat'],
+ 'start': 0,
+ 'count': 100,
+ }
+
+ result = requests.get(base_url + '?postStr=' + json.dumps(params, ensure_ascii=False) + '&type=query&tk=' + tk).json()
+
+ return self.create_json_message(result)
diff --git a/api/core/tools/provider/builtin/tianditu/tools/poisearch.yaml b/api/core/tools/provider/builtin/tianditu/tools/poisearch.yaml
new file mode 100644
index 00000000000..01289d24e3d
--- /dev/null
+++ b/api/core/tools/provider/builtin/tianditu/tools/poisearch.yaml
@@ -0,0 +1,38 @@
+identity:
+ name: point_of_interest_search
+ author: Listeng
+ label:
+ en_US: Point of Interest search
+ zh_Hans: 兴趣点搜索
+ pt_BR: Point of Interest search
+description:
+ human:
+ en_US: Search for certain types of points of interest around a location
+ zh_Hans: 搜索某个位置周边的5公里内某种类型的兴趣点
+ pt_BR: Search for certain types of points of interest around a location
+ llm: A tool for searching for certain types of points of interest around a location
+parameters:
+ - name: keyword
+ type: string
+ required: true
+ label:
+ en_US: poi keyword
+ zh_Hans: 兴趣点的关键字
+ pt_BR: poi keyword
+ human_description:
+ en_US: poi keyword
+ zh_Hans: 兴趣点的关键字
+ pt_BR: poi keyword
+ form: llm
+ - name: baseAddress
+ type: string
+ required: true
+ label:
+ en_US: base current point
+ zh_Hans: 当前位置的关键字
+ pt_BR: base current point
+ human_description:
+ en_US: base current point
+ zh_Hans: 当前位置的关键字
+ pt_BR: base current point
+ form: llm
diff --git a/api/core/tools/provider/builtin/tianditu/tools/staticmap.py b/api/core/tools/provider/builtin/tianditu/tools/staticmap.py
new file mode 100644
index 00000000000..ecac4404ca2
--- /dev/null
+++ b/api/core/tools/provider/builtin/tianditu/tools/staticmap.py
@@ -0,0 +1,36 @@
+import json
+from typing import Any, Union
+
+import requests
+
+from core.tools.entities.tool_entities import ToolInvokeMessage
+from core.tools.tool.builtin_tool import BuiltinTool
+
+
+class PoiSearchTool(BuiltinTool):
+
+ def _invoke(self,
+ user_id: str,
+ tool_parameters: dict[str, Any],
+ ) -> Union[ToolInvokeMessage, list[ToolInvokeMessage]]:
+ """
+ invoke tools
+ """
+
+ geocoder_base_url = 'http://api.tianditu.gov.cn/geocoder'
+ base_url = 'http://api.tianditu.gov.cn/staticimage'
+
+ keyword = tool_parameters.get('keyword', '')
+ if not keyword:
+ return self.create_text_message('Invalid parameter keyword')
+
+ tk = self.runtime.credentials['tianditu_api_key']
+
+ keyword_coords = requests.get(geocoder_base_url + '?ds=' + json.dumps({'keyWord': keyword,}, ensure_ascii=False) + '&tk=' + tk).json()
+ coords = keyword_coords['location']['lon'] + ',' + keyword_coords['location']['lat']
+
+ result = requests.get(base_url + '?center=' + coords + '&markers=' + coords + '&width=400&height=300&zoom=14&tk=' + tk).content
+
+ return self.create_blob_message(blob=result,
+ meta={'mime_type': 'image/png'},
+ save_as=self.VARIABLE_KEY.IMAGE.value)
diff --git a/api/core/tools/provider/builtin/tianditu/tools/staticmap.yaml b/api/core/tools/provider/builtin/tianditu/tools/staticmap.yaml
new file mode 100644
index 00000000000..fc54c428066
--- /dev/null
+++ b/api/core/tools/provider/builtin/tianditu/tools/staticmap.yaml
@@ -0,0 +1,26 @@
+identity:
+ name: generate_static_map
+ author: Listeng
+ label:
+ en_US: Generate a static map
+ zh_Hans: 生成静态地图
+ pt_BR: Generate a static map
+description:
+ human:
+ en_US: Generate a static map
+ zh_Hans: 生成静态地图
+ pt_BR: Generate a static map
+ llm: A tool for generate a static map
+parameters:
+ - name: keyword
+ type: string
+ required: true
+ label:
+ en_US: keyword
+ zh_Hans: 搜索的关键字
+ pt_BR: keyword
+ human_description:
+ en_US: keyword
+ zh_Hans: 搜索的关键字
+ pt_BR: keyword
+ form: llm