{"id":6356,"date":"2024-09-23T02:12:51","date_gmt":"2024-09-22T18:12:51","guid":{"rendered":"https:\/\/www.aisharenet.com\/?p=6356"},"modified":"2025-01-17T21:59:29","modified_gmt":"2025-01-17T13:59:29","slug":"alog","status":"publish","type":"post","link":"https:\/\/www.kdjingpai.com\/en\/alog\/","title":{"rendered":"ALog\uff1a\u4fbf\u643aAI\u8bed\u97f3\u65e5\u8bb0\u5e94\u7528\uff0c\u652f\u6301\u8bed\u97f3\u8f6c\u6587\u5b57\u3002"},"content":{"rendered":"<p>ALog \u662f\u4e00\u4e2a\u57fa\u4e8e\u4eba\u5de5\u667a\u80fd\u7684\u8bed\u97f3\u65e5\u8bb0\u5e94\u7528\uff0c\u65e8\u5728\u5e2e\u52a9\u7528\u6237\u901a\u8fc7\u8bed\u97f3\u8bb0\u5f55\u65e5\u5e38\u751f\u6d3b\u3002\u8be5\u9879\u76ee\u7531 duxins \u5f00\u53d1\uff0c\u5e76\u5728 GitHub \u4e0a\u5f00\u6e90\u3002\u7528\u6237\u53ef\u4ee5\u901a\u8fc7\u8bed\u97f3\u8f93\u5165\u8bb0\u5f55\u65e5\u8bb0\uff0c\u5e94\u7528\u4f1a\u81ea\u52a8\u5c06\u8bed\u97f3\u8f6c\u6362\u4e3a\u6587\u5b57\uff0c\u5e76\u8fdb\u884c\u667a\u80fd\u5206\u6790\u548c\u5206\u7c7b\u3002ALog \u652f\u6301\u591a\u5e73\u53f0\u4f7f\u7528\uff0c\u5e76\u63d0\u4f9b\u4e86\u8be6\u7ec6\u7684\u5b89\u88c5\u548c\u4f7f\u7528\u6307\u5357\uff0c\u65b9\u4fbf\u7528\u6237\u5feb\u901f\u4e0a\u624b\u3002<\/p>\n<p>\u9879\u76ee\u7684\u90e8\u7f72\u5305\u62ec\u6784\u5efa\u9879\u76ee\u548c\u90e8\u7f72\u670d\u52a1\u5668\u7aef\u4ee3\u7801\u5230 Cloudflare\u3002\u5728 Cloudflare \u4e0a\u914d\u7f6e worker \u65f6\u9700\u8981\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\uff0c\u5982 OpenAI API \u5bc6\u94a5\u7b49\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6357\" title=\"-1\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/09\/9788e1864169308.png\" alt=\"-1\" width=\"1250\" height=\"907\" srcset=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/09\/9788e1864169308.png 1250w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/09\/9788e1864169308-300x218.png 300w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/09\/9788e1864169308-1024x743.png 1024w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2024\/09\/9788e1864169308-768x557.png 768w\" sizes=\"auto, (max-width: 1250px) 100vw, 1250px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h2>\u529f\u80fd\u5217\u8868<\/h2>\n<ul>\n<li>\u8bed\u97f3\u8bb0\u5f55\uff1a\u901a\u8fc7\u8bed\u97f3\u8f93\u5165\u8bb0\u5f55\u65e5\u8bb0\u5185\u5bb9<\/li>\n<li>\u8bed\u97f3\u8f6c\u6587\u5b57\uff1a\u81ea\u52a8\u5c06\u8bed\u97f3\u8f6c\u6362\u4e3a\u6587\u5b57<\/li>\n<li>\u667a\u80fd\u5206\u6790\uff1a\u5bf9\u65e5\u8bb0\u5185\u5bb9\u8fdb\u884c\u667a\u80fd\u5206\u6790\u548c\u5206\u7c7b<\/li>\n<li>\u591a\u5e73\u53f0\u652f\u6301\uff1a\u652f\u6301 iOS \u548c Android \u5e73\u53f0<\/li>\n<li>\u5f00\u6e90\u9879\u76ee\uff1a\u4ee3\u7801\u516c\u5f00\uff0c\u7528\u6237\u53ef\u4ee5\u81ea\u7531\u4fee\u6539\u548c\u6269\u5c55\u529f\u80fd<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2>\u4f7f\u7528\u5e2e\u52a9<\/h2>\n<h3>\u5b89\u88c5\u6d41\u7a0b<\/h3>\n<ol>\n<li><strong>\u514b\u9686\u4ed3\u5e93<\/strong>\uff1a\u9996\u5148\uff0c\u514b\u9686 ALog \u7684 GitHub \u4ed3\u5e93\u3002\n<pre><code class=\"language-bash\">git <span class=\"hljs-built_in\">clone<\/span> https:\/\/github.com\/duxins\/alog\r\n<\/code><\/pre>\n<p>&nbsp;<\/li>\n<li><strong>\u5b89\u88c5\u4f9d\u8d56<\/strong>\uff1a\u4f7f\u7528 Homebrew \u5b89\u88c5 xcodegen\u3002\n<pre><code class=\"language-bash\">brew install xcodegen\r\n<\/code><\/pre>\n<p>&nbsp;<\/li>\n<li><strong>\u5b89\u88c5 Ruby gems<\/strong>\uff1a\u5728\u9879\u76ee\u76ee\u5f55\u4e0b\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u3002\n<pre><code class=\"language-bash\">bundle install\r\n<\/code><\/pre>\n<p>&nbsp;<\/li>\n<li><strong>\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/strong>\uff1a\u590d\u5236\u00a0<code>.env.example<\/code>\u00a0\u6587\u4ef6\u5e76\u91cd\u547d\u540d\u4e3a\u00a0<code>.env<\/code>\uff0c\u7136\u540e\u6839\u636e\u9700\u8981\u66f4\u65b0\u5176\u4e2d\u7684\u952e\u503c\u3002\n<pre><code class=\"language-bash\"><span class=\"hljs-built_in\">cp<\/span> .env.example .<span class=\"hljs-built_in\">env<\/span>\r\n<\/code><\/pre>\n<p>&nbsp;<\/li>\n<li><strong>\u751f\u6210\u9879\u76ee\u6587\u4ef6<\/strong>\uff1a\u8fd0\u884c xcodegen \u751f\u6210\u9879\u76ee\u6587\u4ef6\u3002\n<pre><code class=\"language-bash\">xcodegen\r\n<\/code><\/pre>\n<p>&nbsp;<\/li>\n<\/ol>\n<h3>\u4f7f\u7528\u6d41\u7a0b<\/h3>\n<ol>\n<li><strong>\u542f\u52a8\u5e94\u7528<\/strong>\uff1a\u6253\u5f00\u751f\u6210\u7684 Xcode \u9879\u76ee\u6587\u4ef6\uff0c\u7f16\u8bd1\u5e76\u8fd0\u884c\u5e94\u7528\u3002<\/li>\n<li><strong>\u8bed\u97f3\u8bb0\u5f55<\/strong>\uff1a\u70b9\u51fb\u5e94\u7528\u5185\u7684\u5f55\u97f3\u6309\u94ae\uff0c\u5f00\u59cb\u8bed\u97f3\u8bb0\u5f55\u65e5\u8bb0\u5185\u5bb9\u3002<\/li>\n<li><strong>\u8bed\u97f3\u8f6c\u6587\u5b57<\/strong>\uff1a\u5f55\u97f3\u7ed3\u675f\u540e\uff0c\u5e94\u7528\u4f1a\u81ea\u52a8\u5c06\u8bed\u97f3\u8f6c\u6362\u4e3a\u6587\u5b57\uff0c\u5e76\u663e\u793a\u5728\u65e5\u8bb0\u5217\u8868\u4e2d\u3002<\/li>\n<li><strong>\u667a\u80fd\u5206\u6790<\/strong>\uff1a\u5e94\u7528\u4f1a\u5bf9\u65e5\u8bb0\u5185\u5bb9\u8fdb\u884c\u667a\u80fd\u5206\u6790\u548c\u5206\u7c7b\uff0c\u7528\u6237\u53ef\u4ee5\u901a\u8fc7\u5206\u7c7b\u6807\u7b7e\u67e5\u770b\u4e0d\u540c\u7c7b\u578b\u7684\u65e5\u8bb0\u3002<\/li>\n<li><strong>\u591a\u5e73\u53f0\u4f7f\u7528<\/strong>\uff1aALog \u652f\u6301 iOS \u548c Android \u5e73\u53f0\uff0c\u7528\u6237\u53ef\u4ee5\u5728\u4e0d\u540c\u8bbe\u5907\u4e0a\u540c\u6b65\u4f7f\u7528\u3002<\/li>\n<\/ol>\n<h3>\u90e8\u7f72\u670d\u52a1\u5668\u7aef\u4ee3\u7801\u5230 Cloudflare<\/h3>\n<ol>\n<li><strong>\u521b\u5efa Cloudflare Worker<\/strong>\uff1a\u767b\u5f55 Cloudflare \u540e\uff0c\u5bfc\u822a\u5230 \u201cWorkers &amp; Pages\u201d \u90e8\u5206\uff0c\u70b9\u51fb \u201cCreate Application\u201d \u2192 \u201cCreate Worker\u201d\u3002\u6839\u636e\u9700\u8981\u91cd\u547d\u540d Worker\uff0c\u7136\u540e\u70b9\u51fb \u201cDeploy\u201d\u3002<\/li>\n<li><strong>\u914d\u7f6e Worker<\/strong>\uff1a\u90e8\u7f72\u540e\uff0c\u70b9\u51fb \u201cQuick Edit\u201d \u6309\u94ae\uff0c\u5c06\u00a0<code>Server\/src\/worker.js<\/code>\u00a0\u6587\u4ef6\u7684\u5185\u5bb9\u7c98\u8d34\u5230 Cloudflare Worker \u7f16\u8f91\u5668\u4e2d\uff0c\u70b9\u51fb \u201cSave and deploy\u201d\u3002<\/li>\n<li><strong>\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<\/strong>\uff1a\u5728 Worker\u2019s Settings \u6807\u7b7e\u4e0b\uff0c\u5bfc\u822a\u5230 Variables \u90e8\u5206\uff0c\u8bbe\u7f6e\u4ee5\u4e0b\u53d8\u91cf\uff1a\n<ul>\n<li><code>OPENAI_KEY<\/code>\uff1a\u5fc5\u9700\uff0c\u60a8\u7684 OpenAI API \u5bc6\u94a5\u3002<\/li>\n<li><code>HMAC_KEY<\/code>\uff1a\u53ef\u9009\uff0c\u4e0e\u5ba2\u6237\u7aef\u4f7f\u7528\u7684\u5bc6\u94a5\u4e00\u81f4\u3002<\/li>\n<li><code>AI_MODEL<\/code>\uff1a\u53ef\u9009\uff0c\u9ed8\u8ba4\u6a21\u578b\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u66f4\u65b0 API \u57fa\u7840 URL<\/strong>\uff1a\u6253\u5f00\u00a0<code>Constants.swift<\/code>\u00a0\u6587\u4ef6\uff0c\u5c06\u00a0<code>api_base_url<\/code>\u00a0\u5e38\u91cf\u66f4\u65b0\u4e3a\u5df2\u90e8\u7f72\u7684 Cloudflare Worker \u7684 URL\u3002<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>ALog \u662f\u4e00\u4e2a\u57fa\u4e8e\u4eba\u5de5\u667a\u80fd\u7684\u8bed\u97f3\u65e5\u8bb0\u5e94\u7528\uff0c\u65e8\u5728\u5e2e\u52a9\u7528\u6237\u901a\u8fc7\u8bed\u97f3\u8bb0\u5f55\u65e5\u5e38\u751f\u6d3b\u3002\u8be5\u9879\u76ee\u7531 duxins \u5f00\u53d1\uff0c\u5e76\u5728 GitHub \u4e0a\u5f00\u6e90\u3002\u7528\u6237\u53ef\u4ee5\u901a\u8fc7\u8bed\u97f3\u8f93\u5165\u8bb0\u5f55\u65e5\u8bb0\uff0c\u5e94\u7528\u4f1a\u81ea\u52a8\u5c06\u8bed\u97f3\u8f6c\u6362\u4e3a\u6587\u5b57\uff0c\u5e76\u8fdb\u884c\u667a\u80fd\u5206\u6790\u548c\u5206\u7c7b\u3002ALog \u652f\u6301\u591a\u5e73\u53f0\u4f7f\u7528&#8230;<\/p>\n","protected":false},"author":1,"featured_media":61009,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[230,216],"class_list":["post-6356","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tool","tag-aikaiyuanxiangmu","tag-aiyuyinzhuanwenben"],"_links":{"self":[{"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/posts\/6356","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/comments?post=6356"}],"version-history":[{"count":0,"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/posts\/6356\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/media\/61009"}],"wp:attachment":[{"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/media?parent=6356"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/categories?post=6356"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/en\/wp-json\/wp\/v2\/tags?post=6356"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}