{"id":122,"date":"2025-05-03T17:50:28","date_gmt":"2025-05-03T09:50:28","guid":{"rendered":"http:\/\/dongdong.me\/?p=122"},"modified":"2025-05-03T19:44:56","modified_gmt":"2025-05-03T11:44:56","slug":"coze-%e5%88%9b%e5%bb%ba%e6%8f%92%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/dongdong.me\/index.php\/2025\/05\/03\/coze-%e5%88%9b%e5%bb%ba%e6%8f%92%e4%bb%b6\/","title":{"rendered":"COZE-\u521b\u5efa\u63d2\u4ef6"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u4ee5<a href=\"https:\/\/api.vvhan.com\/\">https:\/\/api.vvhan.com\/<\/a>\u63d0\u4f9b\u7684\u5929\u6c14api\u63a5\u53e3\u4e3a\u4f8b\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='http:\/\/dongdong.me\/wp-content\/uploads\/2025\/05\/image-10-1024x505.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"505\" data-original=\"http:\/\/dongdong.me\/wp-content\/uploads\/2025\/05\/image-10-1024x505.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-123\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">COZE\u4e2d\u6dfb\u52a0\u63d2\u4ef6\uff0c\u5de6\u4e0b\u89d2\u6dfb\u52a0\u4f9d\u8d56\uff0c\u5de6\u4e0a\u89d2\u6dfb\u52a0\u5de5\u5177\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f7f\u7528args.input\u83b7\u53d6\u4f20\u5165\u503c\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='http:\/\/dongdong.me\/wp-content\/uploads\/2025\/05\/image-11.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"530\" height=\"153\" data-original=\"http:\/\/dongdong.me\/wp-content\/uploads\/2025\/05\/image-11.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-124\"  sizes=\"auto, (max-width: 530px) 100vw, 530px\" \/><\/div><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='http:\/\/dongdong.me\/wp-content\/uploads\/2025\/05\/image-12.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"688\" height=\"368\" data-original=\"http:\/\/dongdong.me\/wp-content\/uploads\/2025\/05\/image-12.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-125\"  sizes=\"auto, (max-width: 688px) 100vw, 688px\" \/><\/div><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='http:\/\/dongdong.me\/wp-content\/uploads\/2025\/05\/image-13.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"475\" height=\"163\" data-original=\"http:\/\/dongdong.me\/wp-content\/uploads\/2025\/05\/image-13.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-126\"  sizes=\"auto, (max-width: 475px) 100vw, 475px\" \/><\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee3\u7801\u5982\u4e0b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from runtime import Args\nfrom typings.get_weather.get_weather import Input, Output\nimport requests\n\"\"\"\nEach file needs to export a function named `handler`. This function is the entrance to the Tool.\n\nParameters:\nargs: parameters of the entry function.\nargs.input - input parameters, you can get test input value by args.input.xxx.\nargs.logger - logger instance used to print logs, injected by runtime.\n\nRemember to fill in input\/output in Metadata, it helps LLM to recognize and use tool.\n\nReturn:\nThe return data of the function, which should match the declared output parameters.\n\"\"\"\ndef handler(args: Args&#91;Input])->Output:\n    city = args.input.city\n    url = \"https:\/\/api.vvhan.com\/api\/weather\"\n    params={\n        \"city\":city\n    }\n    res = requests.get(url=url,params=params).json()\n    # res.pop(\"pm2.5\")\n    # \u4f7f\u7528pop\u65b9\u6cd5\u5220\u9664\n    if \"air\" in res:\n        pm25_value = res&#91;\"air\"]&#91;\"pm2.5\"]\n        # \u5220\u9664\u65e7\u7684 \"pm2.5\" \u952e\n        del res&#91;\"air\"]&#91;\"pm2.5\"]\n        # \u6dfb\u52a0\u65b0\u7684 \"pm25\" \u952e\n        res&#91;\"air\"]&#91;\"pm25\"] = pm25_value\n    return res<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8f93\u51fa\u5b8c\u70b9\u51fb\u66f4\u65b0\u8f93\u51fa\u53c2\u6570\u5373\u53ef\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='http:\/\/dongdong.me\/wp-content\/uploads\/2025\/05\/image-14.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"547\" height=\"397\" data-original=\"http:\/\/dongdong.me\/wp-content\/uploads\/2025\/05\/image-14.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-127\"  sizes=\"auto, (max-width: 547px) 100vw, 547px\" \/><\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5https:\/\/api.vvhan.com\/\u63d0\u4f9b\u7684\u5929\u6c14api\u63a5\u53e3\u4e3a\u4f8b\u3002 COZE\u4e2d\u6dfb\u52a0\u63d2\u4ef6\uff0c\u5de6\u4e0b\u89d2\u6dfb\u52a0\u4f9d\u8d56\uff0c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-122","post","type-post","status-publish","format-standard","hentry","category-ai-study"],"_links":{"self":[{"href":"https:\/\/dongdong.me\/index.php\/wp-json\/wp\/v2\/posts\/122","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dongdong.me\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dongdong.me\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dongdong.me\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dongdong.me\/index.php\/wp-json\/wp\/v2\/comments?post=122"}],"version-history":[{"count":1,"href":"https:\/\/dongdong.me\/index.php\/wp-json\/wp\/v2\/posts\/122\/revisions"}],"predecessor-version":[{"id":128,"href":"https:\/\/dongdong.me\/index.php\/wp-json\/wp\/v2\/posts\/122\/revisions\/128"}],"wp:attachment":[{"href":"https:\/\/dongdong.me\/index.php\/wp-json\/wp\/v2\/media?parent=122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dongdong.me\/index.php\/wp-json\/wp\/v2\/categories?post=122"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dongdong.me\/index.php\/wp-json\/wp\/v2\/tags?post=122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}