{"id":3046,"date":"2023-08-28T10:09:55","date_gmt":"2023-08-28T02:09:55","guid":{"rendered":"https:\/\/xinchewhd.com.cn\/?p=3046"},"modified":"2023-08-28T10:09:55","modified_gmt":"2023-08-28T02:09:55","slug":"%e3%80%90%e5%bc%80%e6%ba%90%e6%8e%a8%e8%8d%90%e3%80%91openai%e6%8e%a5%e5%8f%a3%e7%ae%a1%e7%90%86%e5%88%86%e5%8f%91%e7%b3%bb%e7%bb%9f%ef%bc%8c%e6%94%af%e6%8c%81%e5%a4%9a%e7%a7%8d%e6%b8%a0%e9%81%93","status":"publish","type":"post","link":"https:\/\/xinchewhd.com.cn\/index.php\/uncategorized\/%e3%80%90%e5%bc%80%e6%ba%90%e6%8e%a8%e8%8d%90%e3%80%91openai%e6%8e%a5%e5%8f%a3%e7%ae%a1%e7%90%86%e5%88%86%e5%8f%91%e7%b3%bb%e7%bb%9f%ef%bc%8c%e6%94%af%e6%8c%81%e5%a4%9a%e7%a7%8d%e6%b8%a0%e9%81%93\/","title":{"rendered":"\u3010\u5f00\u6e90\u63a8\u8350\u3011OpenAI\u63a5\u53e3\u7ba1\u7406\u5206\u53d1\u7cfb\u7edf\uff0c\u652f\u6301\u591a\u79cd\u6e20\u9053\uff0c\u53ef\u7528\u4e8e\u4e8c\u6b21\u5206\u53d1\u7ba1\u7406key\uff0c\u4ee3\u7801\u5168\u5f00\u6e90"},"content":{"rendered":"<blockquote style=\"text-align: left;\"><p>PHP\u5b66\u4e60\u7f51\u5c06\u4e0d\u5b9a\u65f6\u5206\u4eab\u4f18\u8d28\u5f00\u6e90\u9879\u76ee\uff0c\u4f18\u8d28\u6280\u672f\u6587\u7ae0\uff0c\u7cbe\u9009\u9762\u8bd5\u9898\u548c\u8d44\u6e90\uff0c\u5927\u5bb6\u53ef\u4ee5\u628aPHP\u5b66\u4e60\u7f51\u8bbe\u4e3a?\u661f\u6807\uff0c\u7b2c\u4e00\u65f6\u95f4\u83b7\u53d6\u6700\u65b0\u63a8\u9001\uff0c\u4ee5\u9632\u9519\u8fc7\u4f18\u8d28\u5185\u5bb9<\/p><\/blockquote>\n<p style=\"text-align: left;\">\u4eca\u5929\u63a8\u8350\u7684\u8fd9\u4e2a\u7cfb\u7edf\uff0c\u662f\u4e00\u4e2aOpenAI\u7684\u63a5\u53e3\u7ba1\u7406\u5206\u53d1\u7cfb\u7edf\uff0c\u6211\u770b\u4e86\u4ee3\u7801\u5168\u5f00\u6e90\uff0c\u53ef\u7528\u4e8e\u4e8c\u6b21\u5206\u53d1\u7ba1\u7406key\uff0c\u53ef\u4ee5\u82b1\u94b1\u8d2d\u4e70key\uff0c\u5df2\u7ecf\u6253\u5305\u597dDocker\uff0c\u53ef\u4ee5\u4e00\u952e\u5b89\u88c5\uff0c \u4e0d\u8fc7\u6211\u4e0d\u662f\u7528key\u5b89\u88c5\u7684\uff0c\u4e0b\u9762\u6211\u8bf4\u4e00\u4e0b\u6211\u7684\u5b89\u88c5\u65b9\u5f0f\u3002<\/p>\n<h3 style=\"text-align: left;\">\u5f00\u53d1\u73af\u5883<\/h3>\n<p style=\"text-align: left;\">go \u8bed\u97f3<\/p>\n<p style=\"text-align: left;\">mysql 5.5\u4ee5\u4e0a<\/p>\n<p style=\"text-align: left;\">redis<\/p>\n<p style=\"text-align: left;\">node \u73af\u5883\uff0c\u9700\u8981\u5b89\u88c5 pm2\u5bf9\u8fdb\u7a0b\u7ba1\u7406\u3002<\/p>\n<h3 style=\"text-align: left;\">\u6f14\u793a\u622a\u56fe<\/h3>\n<p><img class=\"lazyload\"alt=\"\" data-href=\"\" \/><noscript><img class=\"lazyload\"alt=\"\" data-href=\"\" \/><noscript><img alt=\"\" data-href=\"\" \/><\/noscript><\/noscript><\/p>\n<p><img class=\"lazyload\"alt=\"\" data-href=\"\" \/><noscript><img class=\"lazyload\"alt=\"\" data-href=\"\" \/><noscript><img alt=\"\" data-href=\"\" \/><\/noscript><\/noscript><\/p>\n<h3 style=\"text-align: left;\">\u529f\u80fd\u652f\u6301<\/h3>\n<p style=\"text-align: left;\">OpenAI \u5b98\u65b9\u901a\u9053<\/p>\n<p style=\"text-align: left;\">\u81ea\u5b9a\u4e49\u6e20\u9053\uff1a\u4f8b\u5982\u5404\u79cd\u672a\u6536\u5f55\u7684\u7b2c\u4e09\u65b9\u4ee3\u7406\u670d\u52a1<\/p>\n<p style=\"text-align: left;\">\u652f\u6301\u901a\u8fc7\u8d1f\u8f7d\u5747\u8861\u7684\u65b9\u5f0f\u8bbf\u95ee\u591a\u4e2a\u6e20\u9053\u3002<\/p>\n<p style=\"text-align: left;\">\u652f\u6301 stream \u6a21\u5f0f\uff0c\u53ef\u4ee5\u901a\u8fc7\u6d41\u5f0f\u4f20\u8f93\u5b9e\u73b0\u6253\u5b57\u673a\u6548\u679c\u3002<\/p>\n<p style=\"text-align: left;\">\u652f\u6301\u591a\u673a\u90e8\u7f72<\/p>\n<p style=\"text-align: left;\">\u652f\u6301\u4ee4\u724c\u7ba1\u7406\uff0c\u8bbe\u7f6e\u4ee4\u724c\u7684\u8fc7\u671f\u65f6\u95f4\u548c\u989d\u5ea6\u3002<\/p>\n<p style=\"text-align: left;\">\u652f\u6301\u5151\u6362\u7801\u7ba1\u7406\uff0c\u652f\u6301\u6279\u91cf\u751f\u6210\u548c\u5bfc\u51fa\u5151\u6362\u7801\uff0c\u53ef\u4f7f\u7528\u5151\u6362\u7801\u4e3a\u8d26\u6237\u8fdb\u884c\u5145\u503c\u3002<\/p>\n<p style=\"text-align: left;\">\u652f\u6301\u901a\u9053\u7ba1\u7406\uff0c\u6279\u91cf\u521b\u5efa\u901a\u9053\u3002<\/p>\n<p style=\"text-align: left;\">\u652f\u6301\u7528\u6237\u5206\u7ec4\u4ee5\u53ca\u6e20\u9053\u5206\u7ec4\uff0c\u652f\u6301\u4e3a\u4e0d\u540c\u5206\u7ec4\u8bbe\u7f6e\u4e0d\u540c\u7684\u500d\u7387\u3002<\/p>\n<p style=\"text-align: left;\">\u652f\u6301\u6e20\u9053\u8bbe\u7f6e\u6a21\u578b\u5217\u8868\u3002<\/p>\n<p style=\"text-align: left;\">\u652f\u6301\u67e5\u770b\u989d\u5ea6\u660e\u7ec6\u3002<\/p>\n<p style=\"text-align: left;\">\u652f\u6301\u7528\u6237\u9080\u8bf7\u5956\u52b1\u3002<\/p>\n<p style=\"text-align: left;\">\u652f\u6301\u4ee5\u7f8e\u5143\u4e3a\u5355\u4f4d\u663e\u793a\u989d\u5ea6\u3002<\/p>\n<p style=\"text-align: left;\">\u652f\u6301\u53d1\u5e03\u516c\u544a\uff0c\u8bbe\u7f6e\u5145\u503c\u94fe\u63a5\uff0c\u8bbe\u7f6e\u65b0\u7528\u6237\u521d\u59cb\u989d\u5ea6\u3002<\/p>\n<p style=\"text-align: left;\">\u652f\u6301\u6a21\u578b\u6620\u5c04\uff0c\u91cd\u5b9a\u5411\u7528\u6237\u7684\u8bf7\u6c42\u6a21\u578b\u3002<\/p>\n<p style=\"text-align: left;\">\u652f\u6301\u5931\u8d25\u81ea\u52a8\u91cd\u8bd5\u3002<\/p>\n<p style=\"text-align: left;\">\u652f\u6301\u7ed8\u56fe\u63a5\u53e3\u3002<\/p>\n<p style=\"text-align: left;\">\u652f\u6301\u4e30\u5bcc\u7684\u81ea\u5b9a\u4e49\u8bbe\u7f6e\uff0c<\/p>\n<p style=\"text-align: left;\">\u652f\u6301\u81ea\u5b9a\u4e49\u7cfb\u7edf\u540d\u79f0\uff0clogo \u4ee5\u53ca\u9875\u811a\u3002<\/p>\n<p style=\"text-align: left;\">\u652f\u6301\u81ea\u5b9a\u4e49\u9996\u9875\u548c\u5173\u4e8e\u9875\u9762\uff0c\u53ef\u4ee5\u9009\u62e9\u4f7f\u7528 HTML &amp; Markdown \u4ee3\u7801\u8fdb\u884c\u81ea\u5b9a\u4e49\uff0c\u6216\u8005\u4f7f\u7528\u4e00\u4e2a\u5355\u72ec\u7684\u7f51\u9875\u901a\u8fc7 iframe \u5d4c\u5165\u3002<\/p>\n<p style=\"text-align: left;\">\u652f\u6301\u901a\u8fc7\u7cfb\u7edf\u8bbf\u95ee\u4ee4\u724c\u8bbf\u95ee\u7ba1\u7406 API\u3002<\/p>\n<p style=\"text-align: left;\">\u652f\u6301 Cloudflare Turnstile \u7528\u6237\u6821\u9a8c\u3002<\/p>\n<p style=\"text-align: left;\">\u652f\u6301\u7528\u6237\u7ba1\u7406\uff0c\u652f\u6301\u591a\u79cd\u7528\u6237\u767b\u5f55\u6ce8\u518c\u65b9\u5f0f<\/p>\n<h3 style=\"text-align: left;\">\u642d\u5efa\u65b9\u5f0f<\/h3>\n<p style=\"text-align: left;\">\u6211\u8fd9\u91cc\u9009\u7528\u7684\u662fnginx\u7684\u642d\u5efa\u65b9\u5f0f\uff0c\u9996\u5148\u4e0b\u8f7d\u9879\u76ee\u5230\u670d\u52a1\u5668\u7684\u9879\u76ee\u76ee\u5f55\u4e0b\uff0c\u7136\u540e\u6267\u884c\u4e00\u4e0b\u547d\u4ee4<\/p>\n<pre style=\"text-align: left; line-height: 1.5;\"><code>#\u00a0\u6784\u5efa\u524d\u7aefcd\u00a0one-api\/webnpm\u00a0installnpm\u00a0run\u00a0build#\u00a0\u6784\u5efa\u540e\u7aefcd\u00a0..go\u00a0mod\u00a0downloadgo\u00a0build\u00a0-ldflags\u00a0\"-s\u00a0-w\"\u00a0-o\u00a0one-apichmod\u00a0u+x\u00a0one-api.\/one-api\u00a0--port\u00a03000\u00a0--log-dir\u00a0.\/logs\u00a0#\u542f\u52a8\u547d\u4ee4<\/code><\/pre>\n<p style=\"text-align: left;\">\u542f\u52a8\u540e\u8bbf\u95ee http:\/\/127.0.0.1:3000 \u5373\u53ef\u767b\u5f55\uff0c\u521d\u59cb\u767b\u5f55\u7528\u6237\u540d\uff1aroot , \u5bc6\u7801\uff1a123456<\/p>\n<p style=\"text-align: left;\">\u90e8\u7f72\u73af\u5883\u53d8\u91cf<\/p>\n<p style=\"text-align: left;\">REDIS_CONN_STRING\uff1a\u8bbe\u7f6e\u4e4b\u540e\u5c06\u4f7f\u7528 Redis \u4f5c\u4e3a\u8bf7\u6c42\u9891\u7387\u9650\u5236\u7684\u5b58\u50a8\uff0c\u800c\u975e\u4f7f\u7528\u5185\u5b58\u5b58\u50a8\u3002<\/p>\n<pre style=\"text-align: left; line-height: 1.5;\"><code>\u4f8b\u5b50\uff1aREDIS_CONN_STRING=redis:\/\/default:redispw@localhost:49153<\/code><\/pre>\n<p style=\"text-align: left;\">SQL_DSN\uff1a\u8bbe\u7f6e\u4e4b\u540e\u5c06\u4f7f\u7528\u6307\u5b9a\u6570\u636e\u5e93\u800c\u975e SQLite\uff0c\u8bf7\u4f7f\u7528 MySQL 8.0 \u7248\u672c\u3002<\/p>\n<pre style=\"text-align: left; line-height: 1.5;\"><code>\u4f8b\u5b50\uff1aSQL_DSN=root:123456@tcp(localhost:3306)\/oneapi<\/code><\/pre>\n<p style=\"text-align: left;\">\u6ce8\u610f\u9700\u8981\u63d0\u524d\u5efa\u7acb\u6570\u636e\u5e93 oneapi\uff0c\u65e0\u9700\u624b\u52a8\u5efa\u8868\uff0c\u7a0b\u5e8f\u5c06\u81ea\u52a8\u5efa\u8868\u3002<\/p>\n<p style=\"text-align: left;\">\u76ee\u524d\u6211\u53ea\u90e8\u7f72\u4e86\u8fd9\u4e24\u4e2a\uff0c\u4e00\u4e2a\u662f redis\uff0c\u4e00\u4e2a\u662f mysql \u5c06\u6570\u636e\u5199\u5165\u6570\u636e\u5e93\u4e2d\u3002<\/p>\n<h3 style=\"text-align: left;\">PM2\u5b89\u88c5<\/h3>\n<pre style=\"text-align: left; line-height: 1.5;\"><code>yarn\u00a0global\u00a0add\u00a0pm2<\/code><\/pre>\n<p style=\"text-align: left;\">\u5b89\u88c5\u540e\u5728\u9879\u76ee\u76ee\u5f55\u751f\u6210\u542f\u52a8\u6587\u4ef6 pm2 init simple\uff0c\u4e4b\u540e\u4f1a\u751f\u6210 ecosystem.config.js \u914d\u7f6e\u6587\u4ef6\uff0c\u4fee\u6539\u4e3a\u4ee5\u4e0b\u5185\u5bb9\u3002<\/p>\n<pre style=\"text-align: left; line-height: 1.5;\"><code>module.exports\u00a0=\u00a0{apps\u00a0:\u00a0[{name\u00a0:\u00a0\"one-api\",script\u00a0:\u00a0\".\/one-api\u00a0--port\u00a03000\u00a0--log-dir\u00a0.\/logs\",watch:\u00a0true}]}<\/code><\/pre>\n<p style=\"text-align: left;\">\u542f\u52a8\uff1apm2 start ecosystem.config.js<\/p>\n<p style=\"text-align: left;\">\u505c\u6b62\uff1apm2 stop ecosystem.config.js<\/p>\n<p style=\"text-align: left;\">\u81f3\u6b64\u6574\u4e2a\u9879\u76ee\u5373\u53ef\u542f\u52a8\u8d77\u6765\u3002<\/p>\n<p>\u672c\u7bc7\u6587\u7ae0\u6765\u6e90\u4e8e\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4f5c\u8005\uff1a\u539f\u521b Hi\u98de\u98de PHP\u5b66\u4e60\u7f51 PHP\u5b66\u4e60\u7f51 \u5fae\u4fe1\u53f7 gh_72592a908697 \u529f\u80fd\u4ecb\u7ecd \u6bcf\u5929\u5b66\u4e00\u70b9\uff0c\u6bcf\u5929\u8fdb\u6b65\u4e00\u70b9 \uff1a\uff09 \u53d1\u8868\u4e8e<br \/>\n\u8f6c\u8f7d\u5730\u5740\uff1ahttps:\/\/mp.weixin.qq.com\/s\/B_9lAXuEjiunpyIKzDnaYg<\/p>\n","raw":"","protected":false},"excerpt":{"rendered":"<p>PHP\u5b66\u4e60\u7f51\u5c06\u4e0d\u5b9a\u65f6\u5206\u4eab\u4f18\u8d28\u5f00\u6e90\u9879\u76ee\uff0c\u4f18\u8d28\u6280\u672f\u6587\u7ae0\uff0c\u7cbe\u9009\u9762\u8bd5\u9898\u548c\u8d44\u6e90\uff0c\u5927\u5bb6\u53ef\u4ee5\u628aPHP\u5b66\u4e60\u7f51\u8bbe\u4e3a?\u661f\u6807\uff0c\u7b2c\u4e00\u65f6\u95f4\u83b7\u53d6\u6700\u65b0\u63a8\u9001\uff0c\u4ee5\u9632 &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-3046","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"post_thumbnail_image":"","content_first_image":null,"post_medium_image_300":"","post_thumbnail_image_624":"","post_frist_image":null,"post_medium_image":"","post_large_image":"","post_full_image":"","post_all_images":[],"videoAdId":"","listAd":"0","listAdId":"","listAdEvery":6,"total_comments":0,"category_name":"\u672a\u5206\u7c7b","post_date":"2023-08-28","like_count":"0","praiseWord":"\u9f13\u52b1","copyright_state":"","excitationAd":"0","rewardedVideoAdId":"","detailAdId":"","detailAd":"0","enterpriseMinapp":"0","audios":[],"postImageUrl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230519082947553.jpg","avatarurls":[],"related_posts":null,"pageviews":301,"next_post_id":2915,"next_post_title":"JVM\u5165\u95e8","previous_post_id":2981,"previous_post_title":"\u5206\u4eab\u514d\u8d39api\u63a5\u53e3","_links":{"self":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/3046","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/comments?post=3046"}],"version-history":[{"count":0,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/3046\/revisions"}],"wp:attachment":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media?parent=3046"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/categories?post=3046"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/tags?post=3046"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}