{"id":11642,"date":"2023-05-27T07:00:02","date_gmt":"2023-05-26T22:00:02","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=11642"},"modified":"2023-05-27T22:48:19","modified_gmt":"2023-05-27T13:48:19","slug":"laravel%e3%81%a8chatgpt-api%e3%81%ae%e5%bc%b7%e5%8a%9b%e3%82%b3%e3%83%a9%e3%83%9c%ef%bc%81%e9%96%a2%e9%80%a3%e3%83%87%e3%83%bc%e3%82%bf%e6%a4%9c%e7%b4%a2%e3%81%8c%e3%81%93%e3%82%8c%e3%81%a7%e7%b0%a1","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=11642","title":{"rendered":"Laravel\u3068ChatGPT API\u306e\u5f37\u529b\u30b3\u30e9\u30dc\uff01\u95a2\u9023\u30c7\u30fc\u30bf\u691c\u7d22\u304c\u3053\u308c\u3067\u7c21\u5358\u30fb\u52b9\u7387\u7684\u306b\u306a\u308b\uff01"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u307e\u3060\u307e\u3060<code>ChatGPT<\/code>\u306e\u7814\u7a76\u3092\u3057\u3066\u3044\u3066\u53ef\u80fd\u6027\u3092\u611f\u3058\u3066\u3044\u308b\u4eca\u65e5\u3053\u306e\u9803\u3067\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u3042\u308b\u7a0b\u5ea6\u30a6\u30a7\u30d6\u7248\u306e<code>ChatGPT<\/code>\u306f\u4e00\u6bb5\u843d\u3057\u305f\u306e\u3067\u3001\u30d7\u30ed\u30b0\u30e9\u30de\u306e\u79c1\u3068\u3057\u3066\u306f\u3084\u308a\u305f\u3044\u3053\u3068\u304c\u601d\u3044\u6d6e\u304b\u3073\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u308c\u304c\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><strong style=\"font-size: 35px;\">Laravel \u304b\u3089 ChatGPT \u3092\u4f7f\u3046<\/strong><\/p>\n<p>\u3067\u3059\u3002<\/p>\n<p>\u305d\u3046\u3067\u3059\u3002<br \/>\n\u3082\u3061\u308d\u3093\u30a6\u30a7\u30d6\u7248\u304c\u3042\u308c\u3070\u4f55\u3067\u3082\u8cea\u554f\u3067\u304d\u308b\u306e\u3067\u3044\u3044\u306e\u3067\u3059\u304c\u3001\u30b7\u30b9\u30c6\u30e0\u306b\u95a2\u9023\u3059\u308b\u3053\u3068\u3092\u3044\u3061\u3044\u3061\u30b3\u30d4\u30da\u3059\u308b\u306e\u306f\u9762\u5012\u306a\u306e\u3067\u3001\u81ea\u52d5\u5316\u3057\u305f\u3044\u3068\u3053\u308d\u3067\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u2757<\/p>\n<p>\u4eca\u56de\u306f\u300c<strong>Laravel \uff06 ChatGPT API<\/strong>\u300d\u3092\u30b3\u30e9\u30dc\u3055\u305b\u3066\u7c21\u5358\u306b\u300c\u95a2\u9023\u30c7\u30fc\u30bf\u691c\u7d22\u300d\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u203b \u3053\u3053\u3067\u8a00\u3046\u95a2\u9023\u691c\u7d22\u3068\u306f\u3001\u300c<strong>\u30ad\u30fc\u30ef\u30fc\u30c9\u304c\u542b\u307e\u308c\u3066\u3044\u306a\u3044\u306e\u306b\u691c\u7d22\u306b\u5f15\u3063\u304b\u304b\u308b\u3088\u3046\u306b\u3059\u308b<\/strong>\u300d\u3068\u3044\u3046\u610f\u5473\u3067\u4f7f\u3063\u3066\u3044\u307e\u3059<\/p>\n<p>\u305c\u3072\u4f55\u304b\u306e\u53c2\u8003\u306b\u306a\u308a\u307e\u3057\u305f\u3089\u5b09\u3057\u3044\u3067\u3059\u3002\ud83d\ude04\u2728<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9470 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/08\/no_13.png\" alt=\"\" width=\"294\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/08\/no_13.png 294w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2021\/08\/no_13-276x300.png 276w\" sizes=\"auto, (max-width: 294px) 100vw, 294px\" \/>\u300c\u3042\u3042\u3001GW\u306b\u713c\u8089\u3067<br \/>\n\u98df\u3063\u305f\u3001\u3042\u306e\u30c0\u30c3\u30ab\u30eb\u30d3<br \/>\n\u3046\u307e\u304b\u3063\u305f\u306a\u3041\u301c\u2728\u300d<\/p>\n<p><strong>\u958b\u767a\u74b0\u5883\uff1a<\/strong> Laravel 10.x\u3001React\u3001Inertia.js\u3001Chat API<\/p>\n<h1>\u3084\u308a\u305f\u3044\u3053\u3068<\/h1>\n<p>\u4eca\u56de\u306f\u3001\u4e8b\u524d\u306bDB\u306b\u300c<strong>\u30d4\u30a2\u30ce<\/strong>\u300d\u306b\u95a2\u9023\u3059\u308b\u30c6\u30ad\u30b9\u30c8\u3092\u4fdd\u5b58\u3057\u3066\u304a\u304d\u307e\u3059\u3002<br \/>\n\u305f\u3060\u3057\u3001<strong>\u3053\u306e\u30c6\u30ad\u30b9\u30c8\u306b\u306f\u300c\u30d4\u30a2\u30ce\u300d\u3068\u3044\u3046\u6587\u5b57\u306f\u542b\u3081\u307e\u305b\u3093\u3002<\/strong><\/p>\n<p>\u305d\u3057\u3066\u3001\u9006\u306b\u691c\u7d22\u306f\u300c<strong>\u30d4\u30a2\u30ce<\/strong>\u300d\u3092\u30ad\u30fc\u30ef\u30fc\u30c9\u306b\u3057\u307e\u3059\u3002\uff08\u3064\u307e\u308a\u3001\u666e\u901a\u3067\u306f\u691c\u7d22\u3067\u304d\u306a\u3044\u3082\u306e\u304c\u691c\u7d22\u7d50\u679c\u306b\u51fa\u3066\u304f\u308c\u3070\u6210\u529f\u3068\u3044\u3046\u308f\u3051\u3067\u3059\u306d\ud83d\ude04\uff09<\/p>\n<p>\u3067\u306f\u697d\u3057\u3093\u3067\u3084\u3063\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u2757<\/p>\n<h1>\u524d\u63d0\u3068\u3057\u3066<\/h1>\n<p>\u4eca\u56de\u306e\u5b9f\u884c\u74b0\u5883\uff08<code>Inertia<\/code>\uff09\u306f\u624b\u3063\u53d6\u308a\u65e9\u3044\u306e\u3067\u3001<code>Laravel Breeze<\/code>\u304b\u3089<code>React<\/code>\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f\u4ee5\u4e0b\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\ud83d\udcdd<strong> \u53c2\u8003\u30da\u30fc\u30b8\uff1a<\/strong> <a href=\"https:\/\/laravel.com\/docs\/10.x\/starter-kits#laravel-breeze\" target=\"_blank\" rel=\"noopener\">Laravel Breeze<\/a><\/p>\n<h1>OpenAI \u306e API \u30ad\u30fc\u3092\u53d6\u5f97\u3059\u308b<\/h1>\n<p>\u307e\u305a\u306f<code>API<\/code>\u30ad\u30fc\u304c\u306a\u3044\u3068\u59cb\u307e\u308a\u307e\u305b\u3093\u306e\u3067\u3001\u5148\u306b\u53d6\u5f97\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><code>API<\/code>\u30ad\u30fc\u306f<code>ChatGPT<\/code>\u306e\u65b9\u3067\u306f\u306a\u304f\u3001<code>OpenAI<\/code>\u306e\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u30da\u30fc\u30b8\u3067\u53d6\u5f97\u3057\u307e\u3059\u306e\u3067\u3001\u4ee5\u4e0b\u306e\u30da\u30fc\u30b8\u3078\u30a2\u30af\u30bb\u30b9\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\ud83d\udcdd <a href=\"https:\/\/platform.openai.com\/overview\" target=\"_blank\" rel=\"noopener\">OpenAI\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0<\/a><\/p>\n<p>\u3059\u308b\u3068\u3001\u30da\u30fc\u30b8\u53f3\u4e0a\u306b\u30ed\u30b0\u30a4\u30f3\u30da\u30fc\u30b8\u3078\u79fb\u52d5\u3059\u308b\u30ea\u30f3\u30af\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u300c<strong>Log in<\/strong>\u300d\u3092\u30af\u30ea\u30c3\u30af\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11643\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_1.png\" alt=\"\" width=\"160\" height=\"51\" \/><\/p>\n<p>\u305d\u3057\u3066\u3001\u30d5\u30a9\u30fc\u30e0\u304b\u3089\u30ed\u30b0\u30a4\u30f3\u3092\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11644\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_2.png\" alt=\"\" width=\"348\" height=\"424\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_2.png 348w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_2-246x300.png 246w\" sizes=\"auto, (max-width: 348px) 100vw, 348px\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001<code>API<\/code>\u30ad\u30fc\u3092\u7ba1\u7406\u3059\u308b\u30da\u30fc\u30b8\u306b\u79fb\u52d5\u3059\u308b\u306e\u3067\u3001\u300c<strong>Create new secret key<\/strong>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11645\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_4.png\" alt=\"\" width=\"341\" height=\"296\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_4.png 341w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_4-300x260.png 300w\" sizes=\"auto, (max-width: 341px) 100vw, 341px\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u304a\u597d\u307f\u3067\u5f8c\u3067\u308f\u304b\u308a\u3084\u3059\u3044\u540d\u524d\u3092\u5165\u529b\u3057\uff08\u4efb\u610f\uff09\u3001\u300c<strong>Create secret key<\/strong>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11646\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_5.png\" alt=\"\" width=\"504\" height=\"198\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_5.png 504w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_5-300x118.png 300w\" sizes=\"auto, (max-width: 504px) 100vw, 504px\" \/><\/p>\n<p>\u65b0\u3057\u3044<code>API<\/code>\u30ad\u30fc\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u3001\u30b3\u30d4\u30fc\u3057\u3066<code>.env<\/code>\u3078\u767b\u9332\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11647\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_6.png\" alt=\"\" width=\"511\" height=\"263\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_6.png 511w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_6-300x154.png 300w\" sizes=\"auto, (max-width: 511px) 100vw, 511px\" \/><\/p>\n<p><strong>.env<\/strong><\/p>\n<pre>\/\/ \u7701\u7565\r\n\r\n# OpenAI\r\n<strong>OPENAI_API_KEY=sk-*********************************************<\/strong><\/pre>\n<p><strong>\u203b\u3054\u6ce8\u610f\uff1a<\/strong>\u3053\u306e\u30ad\u30fc\u3092\u4f7f\u3048\u3070\u4ed6\u306e\u4eba\u3067\u3042\u3063\u3066\u3082<code>API<\/code>\u304c\u4f7f\u3048\u308b\uff08\uff1d\u3064\u307e\u308a\u8ab2\u91d1\u3055\u308c\u308b\uff09\u306e\u3067\u7d76\u5bfe\u306b\u6d41\u51fa\u3057\u306a\u3044\u3088\u3046\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h1>OpenAI\u306b\u8ab2\u91d1\u767b\u9332\u3059\u308b<\/h1>\n<p>\u52d8\u9055\u3044\u3057\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3001<code>ChatGPT<\/code>\u306b\u8ab2\u91d1\u3057\u3066\u3044\u3066\u3082<code>OpenAI<\/code>\u3067\u8ab2\u91d1\u767b\u9332\u3057\u306a\u3044\u3068<code>API<\/code>\u306f\u4f7f\u3048\u307e\u305b\u3093\u3002<\/p>\n<p>\u3067\u3059\u306e\u3067\u3001\u307e\u3060\u767b\u9332\u3055\u308c\u3066\u3044\u306a\u3044\u65b9\u306f\u3053\u306e\u4f5c\u696d\u3082\u884c\u3063\u3066\u304f\u3060\u3055\u3044\u3002\uff08\u3059\u3067\u306b\u5b8c\u4e86\u3057\u3066\u3044\u308b\u4eba\u306f\u6b21\u306e\u9805\u76ee\u307e\u3067\u8aad\u307f\u98db\u3070\u3057\u3066\u304f\u3060\u3055\u3044\uff09<\/p>\n<p>\u307e\u305a\u3001<code>OpenAI<\/code>\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u306e\u753b\u9762\u5de6\u5074\u306b\u3042\u308b\u30e1\u30cb\u30e5\u30fc\u304b\u3089\u300c<strong>Billing &gt; Overview<\/strong>\u300d\u3092\u9078\u629e\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11659\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_8.png\" alt=\"\" width=\"244\" height=\"381\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_8.png 244w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_8-192x300.png 192w\" sizes=\"auto, (max-width: 244px) 100vw, 244px\" \/><\/p>\n<p>\u30da\u30fc\u30b8\u79fb\u52d5\u3057\u305f\u5148\u306b\u300c<strong>Set up paid account<\/strong>\u300d\u3068\u3044\u3046\u30dc\u30bf\u30f3\u304c\u3042\u308b\u306e\u3067\u3001\u3053\u308c\u3092\u30af\u30ea\u30c3\u30af\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11660\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_9.png\" alt=\"\" width=\"331\" height=\"275\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_9.png 331w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_9-300x249.png 300w\" sizes=\"auto, (max-width: 331px) 100vw, 331px\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001\u652f\u6255\u3044\u30bf\u30a4\u30d7\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u3001\u4eca\u56de\u306f\u300c<strong>I&#8217;m an individual<\/strong>\uff08\u500b\u4eba\uff09\u300d\u3067\u4f7f\u7528\u3057\u307e\u3059\u3002\uff08\u4f1a\u793e\u306e\u305f\u3081\u306b\u4f7f\u3046\u5834\u5408\u306f\u4e0b\u306e\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u304f\u3060\u3055\u3044\uff09<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11661\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_10.png\" alt=\"\" width=\"393\" height=\"169\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_10.png 393w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_10-300x129.png 300w\" sizes=\"auto, (max-width: 393px) 100vw, 393px\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001\u30af\u30ec\u30b8\u30c3\u30c8\u30ab\u30fc\u30c9\u60c5\u5831\u306e\u30d5\u30a9\u30fc\u30e0\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u4e2d\u8eab\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002\uff08\u306a\u304a\u3001\u4f4f\u6240\u306f\u4e00\u5fdc <a href=\"https:\/\/kimini.jp\/\" target=\"_blank\" rel=\"noopener\">\u541b\u306b\u5c4a\u3051<\/a> \u3092\u4f7f\u3063\u3066\u82f1\u8a9e\u8868\u8a18\u306b\u3057\u307e\u3057\u305f\uff09<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11662\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_11.png\" alt=\"\" width=\"506\" height=\"483\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_11.png 506w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_11-300x286.png 300w\" sizes=\"auto, (max-width: 506px) 100vw, 506px\" \/><\/p>\n<p>\u305d\u3057\u3066\u3001\u300c<strong>Set up payment method<\/strong>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u30af\u30ec\u30b8\u30c3\u30c8\u30ab\u30fc\u30c9\u306e\u767b\u9332\u306f\u5b8c\u4e86\u3067\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001\u3053\u308c\u3067<code>OpenAI<\/code>\u5074\u306e\u4f5c\u696d\u306fOK\u3067\u3059\u2757<br \/>\n\u6b21\u304b\u3089\u306f<code>Laravel<\/code>\u3067\u306e\u4f5c\u696d\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h1>\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/h1>\n<p>\u306a\u3093\u3068\u3001<code>OpenAI<\/code>\u306f<code>Laravel<\/code>\u7528\u306b\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u7528\u610f\u3057\u3066\u304f\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u3053\u3061\u3089\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>composer require openai-php\/laravel\r\n<\/strong><\/pre>\n<p>\u203b \u306a\u304a\u3001\u79c1\u306e\u30b1\u30fc\u30b9\u3067\u306f\u4f9d\u5b58\u95a2\u4fc2\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u304c\u3001<code>composer.lock<\/code>\u3092\u524a\u9664\u3057\u3066\u304b\u3089\u5b9f\u884c\u3059\u308b\u3068\u3046\u307e\u304f\u3044\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u7d9a\u3051\u3066\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u5c02\u7528<code>config<\/code>\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre><strong>php artisan vendor:publish --provider=\"OpenAI\\Laravel\\ServiceProvider\"\r\n<\/strong><\/pre>\n<p>\u3053\u308c\u3092\u5b9f\u884c\u3059\u308b\u3068<code>config\/openai.php<\/code>\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<h1>\u30e2\u30c7\u30eb\uff06\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u3053\u3053\u304b\u3089\u306f<code>Laravel<\/code>\u306e\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u3044\u304f\u90e8\u5206\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u307e\u305a\u306f<code>DB<\/code>\u307e\u308f\u308a\u3067\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong> php artisan make:model Article -ms\r\n<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001\u30e2\u30c7\u30eb\uff06\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\uff06Seeder\u306e\uff13\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u305d\u308c\u305e\u308c\u4e2d\u8eab\u3092\u6b21\u306e\u3088\u3046\u306b\u3057\u307e\u3059\u3002\uff08\u30e2\u30c7\u30eb\u306f\u5909\u66f4\u306a\u3057\u3067\u3059\uff09<\/p>\n<p><strong>database\/migrations\/****_**_**_******_create_articles_table.php<\/strong><\/p>\n<pre>\/\/ \u7701\u7565\r\n\r\npublic function up(): void\r\n{\r\n    Schema::create('articles', function (Blueprint $table) {\r\n        $table-&gt;id();\r\n        <strong>$table-&gt;string('title')-&gt;comment('\u30bf\u30a4\u30c8\u30eb');\r\n        $table-&gt;text('content')-&gt;comment('\u672c\u6587');<\/strong>\r\n        $table-&gt;timestamps();\r\n    });\r\n}\r\n<\/pre>\n<p>\u305d\u3057\u3066\u3001<code>Seeder<\/code>\u3067\u3059\u3002<\/p>\n<p><strong>database\/seeders\/ArticleSeeder.php<\/strong><\/p>\n<pre>\/\/ \u7701\u7565\r\n\r\npublic function run(): void\r\n{\r\n    <strong>\/\/ \uff11\u4ef6\u3060\u3051\u8ffd\u52a0\u3059\u308b\r\n    $article = new Article();\r\n    $article-&gt;title = '\u30d5\u30ec\u30c7\u30ea\u30c3\u30af\u30fb\u30b7\u30e7\u30d1\u30f3';\r\n    $article-&gt;content =\r\n&lt;&lt;&lt;TEXT\r\n\u30dd\u30fc\u30e9\u30f3\u30c9\u51fa\u8eab\u306e\u3001\u524d\u671f\u30ed\u30de\u30f3\u6d3e\u97f3\u697d\u3092\u4ee3\u8868\u3059\u308b\u4f5c\u66f2\u5bb6\u3002\u5f53\u6642\u306e\u30e8\u30fc\u30ed\u30c3\u30d1\u306b\u304a\u3044\u3066\u3082\uff0a\uff0a\uff0a\uff0a\uff0a\u3068\u3057\u3066\u3001\u307e\u305f\u4f5c\u66f2\u5bb6\u3068\u3057\u3066\u3082\u6709\u540d\u3060\u3063\u305f\u3002\u305d\u306e\u4f5c\u66f2\u306e\u307b\u3068\u3093\u3069\u3092\uff0a\uff0a\uff0a\u72ec\u594f\u66f2\u304c\u5360\u3081\u3001\uff0a\uff0a\uff0a\u306e\u8a69\u4eba[\u6ce8 4]\u3068\u3082\u547c\u3070\u308c\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3002\u69d8\u3005\u306a\u5f62\u5f0f\u30fb\u7f8e\u3057\u3044\u65cb\u5f8b\u30fb\u534a\u97f3\u968e\u7684\u548c\u58f0\u6cd5\u306a\u3069\u306b\u3088\u3063\u3066\uff0a\uff0a\uff0a\u306e\u8868\u73fe\u69d8\u5f0f\u3092\u62e1\u5927\u3057\u3001\uff0a\uff0a\uff0a\u97f3\u697d\u306e\u65b0\u3057\u3044\u5730\u5e73\u3092\u5207\u308a\u958b\u3044\u3066\u3044\u3063\u305f\u3002\u591c\u60f3\u66f2\u3084\u30ef\u30eb\u30c4\u306a\u3069\u3001\u4eca\u65e5\u3067\u3082\u5f7c\u306e\u4f5c\u66f2\u3057\u305f\uff0a\uff0a\uff0a\u66f2\u306f\u30af\u30e9\u30b7\u30c3\u30af\u97f3\u697d\u30d5\u30a1\u30f3\u4ee5\u5916\u306b\u3082\u3088\u304f\u77e5\u3089\u308c\u3066\u304a\u308a\u3001\uff0a\uff0a\uff0a\u306e\u6f14\u594f\u4f1a\u306b\u304a\u3044\u3066\u53d6\u308a\u4e0a\u3052\u3089\u308c\u308b\u3053\u3068\u304c\u591a\u3044\u4f5c\u66f2\u5bb6\u306e\u4e00\u4eba\u3067\u3042\u308b\u3002\u307e\u305f\u3001\u5f37\u3044\u30dd\u30fc\u30e9\u30f3\u30c9\u3078\u306e\u611b\u56fd\u5fc3\u304b\u3089\u30d5\u30e9\u30f3\u30b9\u306e\u4f5c\u66f2\u5bb6\u3068\u3057\u3066\u306e\u5074\u9762\u304c\u5f37\u8abf\u3055\u308c\u308b\u3053\u3068\u306f\u5c11\u306a\u3044\u304c\u3001\u7236\u306e\u51fa\u8eab\u5730\u3067\u4e3b\u8981\u306a\u6d3b\u8e8d\u5730\u3060\u3063\u305f\u540c\u56fd\u306e\u97f3\u697d\u53f2\u306b\u5360\u3081\u308b\u91cd\u8981\u6027\u3082\u7121\u8996\u3067\u304d\u306a\u3044\u3002\r\n1988\u5e74\u304b\u3089\u30dd\u30fc\u30e9\u30f3\u30c9\u3067\u767a\u884c\u3055\u308c\u3066\u3044\u305f5,000\u30ba\u30a6\u30a9\u30c6\u30a3\u7d19\u5e63\u306b\u8096\u50cf\u304c\u4f7f\u7528\u3055\u308c\u3066\u3044\u305f\u3002\u307e\u305f\u30012010\u5e74\u306b\u3082\u30b7\u30e7\u30d1\u30f3\u306e\u8096\u50cf\u3092\u4f7f\u7528\u3057\u305f20\u30ba\u30a6\u30a9\u30c6\u30a3\u306e\u8a18\u5ff5\u7d19\u5e63\u304c\u767a\u884c\u3055\u308c\u3066\u3044\u308b\u30022001\u5e74\u3001\u30dd\u30fc\u30e9\u30f3\u30c9\u6700\u5927\u306e\u7a7a\u6e2f\u300c\u30aa\u30b1\u30f3\u30c1\u30a7\u7a7a\u6e2f\uff08Port lotniczy Warszawa-Ok\u0119cie\uff09\u300d\u304c\u300c\u30ef\u30eb\u30b7\u30e3\u30ef\u30fb\u30b7\u30e7\u30d1\u30f3\u7a7a\u6e2f\u300d\u306b\u6539\u540d\u3055\u308c\u305f\u3002\r\nTEXT;\r\n\r\n    $article-&gt;save();<\/strong>\r\n}\r\n\r\n\/\/ \u7701\u7565\r\n<\/pre>\n<p>\u203b <code>content<\/code>\u306e\u90e8\u5206\u306f <a href=\"https:\/\/ja.wikipedia.org\/wiki\/%E3%83%95%E3%83%AC%E3%83%87%E3%83%AA%E3%83%83%E3%82%AF%E3%83%BB%E3%82%B7%E3%83%A7%E3%83%91%E3%83%B3\" target=\"_blank\" rel=\"noopener\">wikipedia<\/a> \u304b\u3089\u5f15\u7528\u3057\u300c\u30d4\u30a2\u30ce\u300d\u300c\u30d4\u30a2\u30cb\u30b9\u30c8\u300d\u3068\u3044\u3046\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u300c\uff0a\uff0a\uff0a\u300d\u300c\uff0a\uff0a\uff0a\uff0a\uff0a\u300d\u306b\u5909\u66f4\u3057\u305f\u3082\u306e\u3067\u3059\uff08\u76f4\u63a5\u691c\u7d22\u306b\u5f15\u3063\u304b\u304b\u3089\u306a\u3044\u3088\u3046\u306b\u3059\u308b\u305f\u3081\uff09<\/p>\n<p>\u306a\u304a\u3001<code>Seeder<\/code>\u306f\u4f5c\u6210\u3057\u305f\u3060\u3051\u3067\u306f\u6709\u52b9\u306b\u306a\u308a\u307e\u305b\u3093\u306e\u3067\u3001<code>Laravel<\/code>\u3078\u30bb\u30c3\u30c8\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><strong>database\/seeders\/DatabaseSeeder.php<\/strong><\/p>\n<pre>\/\/ \u7701\u7565\r\n\r\npublic function run(): void\r\n{\r\n    \/\/ \u7701\u7565\r\n\r\n<strong>    $this-&gt;call([\r\n        ArticleSeeder::class,\r\n    ]);<\/strong>\r\n}\r\n\r\n\/\/ \u7701\u7565<\/pre>\n<p>\u3067\u306f\u3001\u3053\u306e\u72b6\u614b\u3067<code>DB<\/code>\u3092\u518d\u69cb\u7bc9\u3057\u307e\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre><strong>php artisan migrate:fresh --seed<\/strong><\/pre>\n<p>\u5b9f\u969b\u306e\u30c6\u30fc\u30d6\u30eb\u306f\u3053\u3046\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11653\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_7.png\" alt=\"\" width=\"567\" height=\"274\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_7.png 567w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_7-300x145.png 300w\" sizes=\"auto, (max-width: 567px) 100vw, 567px\" \/><\/p>\n<h1>\u691c\u7d22\u7528\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u7d9a\u3044\u3066\u691c\u7d22\u6a5f\u80fd\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre><strong>php artisan make:controller ArticleController\r\n<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u3001\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p><strong>app\/Http\/Controllers\/ArticleController.php<\/strong><\/p>\n<pre><strong>&lt;?php\r\n\r\nnamespace App\\Http\\Controllers;\r\n\r\nuse App\\Models\\Article;\r\nuse Illuminate\\Http\\Request;\r\nuse Illuminate\\Support\\Arr;\r\nuse Illuminate\\Support\\Str;\r\nuse Inertia\\Inertia;\r\nuse OpenAI\\Laravel\\Facades\\OpenAI;\r\nuse Illuminate\\Support\\Facades\\Cache;\r\n\r\nclass ArticleController extends Controller\r\n{\r\n    public function index()\r\n    {\r\n        return Inertia::render('Article\/Index');\r\n    }\r\n\r\n    public function list(Request $request)\r\n    {\r\n        $keyword = $request-&gt;input('keyword', '');\r\n        $gpt_keywords = $this-&gt;getKeywordsByChatGpt($keyword);\r\n        $articles = [];\r\n\r\n        if(count($gpt_keywords) &gt; 0) {\r\n\r\n            $articles = Article::query()\r\n                -&gt;when($gpt_keywords, function ($query, $gpt_keywords) {\r\n\r\n                    foreach ($gpt_keywords as $gpt_keyword) {\r\n\r\n                        $query-&gt;orWhere('title', 'LIKE', \"%{$gpt_keyword}%\")\r\n                            -&gt;orWhere('content', 'LIKE', \"%{$gpt_keyword}%\");\r\n\r\n                    }\r\n\r\n                })\r\n                -&gt;get();\r\n\r\n        }\r\n\r\n        return [\r\n            'gpt_keywords' =&gt; $gpt_keywords,\r\n            'articles' =&gt; $articles,\r\n        ];\r\n    }\r\n\r\n    private function getKeywordsByChatGpt(string $keyword): array\r\n    {\r\n        $keyword = mb_convert_kana($keyword, 's', 'UTF-8');\r\n        $keywords = collect(explode(' ', $keyword))\r\n            -&gt;filter(function ($keyword) {\r\n\r\n                return Str::length($keyword) &gt; 0; \/\/ \u7a7a\u6587\u5b57\u3092\u9664\u5916\r\n\r\n            })\r\n            -&gt;map(function ($keyword) {\r\n\r\n                return '\u30fb'. $keyword;\r\n\r\n            });\r\n\r\n        if($keywords-&gt;count() === 0) {\r\n\r\n            return [];\r\n\r\n        }\r\n\r\n        $target_keyword_content = $keywords-&gt;implode(\"\\n\");\r\n\r\n        $prompt =\r\n&lt;&lt;&lt;TEXT\r\n\u3042\u306a\u305f\u306f\u512a\u79c0\u306a\u30b3\u30d4\u30fc\u30e9\u30a4\u30bf\u30fc\u3068\u3057\u3066\u56de\u7b54\u3057\u3066\u304f\u3060\u3055\u3044\u3002\r\n\u4ee5\u4e0b\u306e\u300c\u5bfe\u8c61\u30ad\u30fc\u30ef\u30fc\u30c9\u300d\u306b\u95a2\u9023\u3059\u308b\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u6319\u3052\u3066\u304f\u3060\u3055\u3044\r\n\r\n# \u5bfe\u8c61\u30ad\u30fc\u30ef\u30fc\u30c9\r\n{$target_keyword_content}\r\n\r\n\u306a\u304a\u3001\u6761\u4ef6\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002\r\n\r\n\u30fb\u56de\u7b54\u306f\u30ad\u30fc\u30ef\u30fc\u30c9\u306e\u307f\u3067\u300c,\u300d\u3067\u533a\u5207\u308b\r\nTEXT;\r\n\r\n        $cache_key = md5($target_keyword_content);\r\n\r\n        return Cache::rememberForever($cache_key, function () use($prompt) {\r\n\r\n            $result = OpenAI::chat()-&gt;create([\r\n                'model' =&gt; 'gpt-3.5-turbo',\r\n                'messages' =&gt; [\r\n                    ['role' =&gt; 'user', 'content' =&gt; $prompt],\r\n                ],\r\n            ]);\r\n            $gpt_keyword = Arr::get($result, 'choices.0.message.content');\r\n\r\n            return explode(',',\r\n                str_replace(' ', '', $gpt_keyword)\r\n            );\r\n\r\n        });\r\n    }\r\n}\r\n<\/strong><\/pre>\n<p>\u3053\u306e\u4e2d\u3067\u3084\u3063\u3066\u3044\u308b\u3053\u3068\u306f\u3001\u30b7\u30f3\u30d7\u30eb\u306b\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u4f7f\u3063\u3066<code>ChatGPT<\/code>\u306b\u30d7\u30ed\u30f3\u30d7\u30c8\u3092\u9001\u4fe1\u3057\u3001\u305d\u306e\u8fd4\u4fe1\u306b\u542b\u307e\u308c\u3066\u3044\u308b\u300c<strong>\u95a2\u9023\u30ad\u30fc\u30ef\u30fc\u30c9<\/strong>\u300d\u3092\u4f7f\u3063\u3066\u691c\u7d22\u3092\u3057\u3066\u3044\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001API\u3092\u4f7f\u3046\u3054\u3068\u306b\u6599\u91d1\u304c\u304b\u304b\u308b\u306e\u3067\u3001\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001\u30d7\u30ed\u30f3\u30d7\u30c8\u306e\u4e2d\u8eab\u306f\u3001\u4f8b\u3048\u3070\u30ad\u30fc\u30ef\u30fc\u30c9\u304c\u300c<strong>\u30d4\u30a2\u30ce\u3000\u30ae\u30bf\u30fc<\/strong>\u300d\u3060\u3063\u305f\u5834\u5408\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u30d7\u30ed\u30f3\u30d7\u30c8\u4f8b\uff1a<\/p>\n<pre><strong>\u3042\u306a\u305f\u306f\u512a\u79c0\u306a\u30b3\u30d4\u30fc\u30e9\u30a4\u30bf\u30fc\u3068\u3057\u3066\u56de\u7b54\u3057\u3066\u304f\u3060\u3055\u3044\u3002\r\n\u4ee5\u4e0b\u306e\u300c\u5bfe\u8c61\u30ad\u30fc\u30ef\u30fc\u30c9\u300d\u306b\u95a2\u9023\u3059\u308b\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u6319\u3052\u3066\u304f\u3060\u3055\u3044\r\n\r\n# \u5bfe\u8c61\u30ad\u30fc\u30ef\u30fc\u30c9\r\n\u30fb\u30d4\u30a2\u30ce\r\n\u30fb\u30ae\u30bf\u30fc\r\n\r\n\u306a\u304a\u3001\u6761\u4ef6\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002\r\n\r\n\u30fb\u56de\u7b54\u306f\u30ad\u30fc\u30ef\u30fc\u30c9\u306e\u307f\u3067\u300c,\u300d\u3067\u533a\u5207\u308b\r\n<\/strong><\/pre>\n<p>\u306a\u304a\u3001\uff08\u79c1\u306f\u30d3\u30d3\u30ea\u306a\u306e\u3067\uff09\u4eca\u56de\u306f\u5b89\u3044\u300c<strong>gpt-3.5-turbo<\/strong>\u300d\u306b\u3057\u307e\u3057\u305f\u304c\u3001\u3082\u3061\u308d\u3093<code>gpt-4<\/code>\u3082\u5229\u7528\u53ef\u80fd\u3067\u3059\u3002\u305d\u306e\u4ed6\u306e\u30e2\u30c7\u30eb\u306f\u4ee5\u4e0b\u306e\u30da\u30fc\u30b8\u3092\u53c2\u8003\u306b\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>\ud83d\udcdd \u53c2\u8003\u30da\u30fc\u30b8\uff1a<\/strong>\u00a0<a href=\"https:\/\/platform.openai.com\/docs\/models\/model-endpoint-compatibility\" target=\"_blank\" rel=\"noopener\">Model endpoint compatibility<\/a><\/p>\n<p>\u307e\u305f\u3001\u6599\u91d1\u306b\u3064\u3044\u3066\u306f\u4ee5\u4e0b\u30da\u30fc\u30b8\u3067\u3059\u3002<\/p>\n<p><strong>\ud83d\udcdd \u53c2\u8003\u30da\u30fc\u30b8\uff1a<\/strong>\u00a0<a href=\"https:\/\/openai.com\/pricing\" target=\"_blank\" rel=\"noopener\">Pricing<\/a><\/p>\n<h1>\u30d3\u30e5\u30fc\uff08\u691c\u7d22\u30d5\u30a9\u30fc\u30e0\uff09\u3092\u3064\u304f\u308b<\/h1>\n<p>\u6b21\u306b\u3001\u691c\u7d22\u30d5\u30a9\u30fc\u30e0\u3067\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>resources\/js\/Pages\/Article\/Index.jsx<\/strong><\/p>\n<pre><strong>import { useState } from \"react\";\r\nimport axios from \"axios\";\r\n\r\nexport default function ArticleIndex () {\r\n\r\n    const [keyword, setKeyword] = useState(\"\");\r\n    const [articles, setArticles] = useState([]);\r\n    const [gptKeywords, setGptKeywords] = useState([]);\r\n\r\n    const handleSubmit = () =&gt; {\r\n\r\n        const url = route('article.list');\r\n        const params = {\r\n            params: { keyword },\r\n        }\r\n\r\n        axios.get(url, params)\r\n            .then((response) =&gt; {\r\n\r\n                setArticles(response.data.articles);\r\n                setGptKeywords(response.data.gpt_keywords);\r\n\r\n            });\r\n\r\n    };\r\n\r\n    return (\r\n        &lt;div className=\"container mx-auto px-4 py-8\"&gt;\r\n            &lt;div className=\"flex items-center\"&gt;\r\n                &lt;input\r\n                    type=\"text\"\r\n                    className=\"w-full p-2 border border-gray-300 rounded mr-2\"\r\n                    placeholder=\"\u691c\u7d22\u30ad\u30fc\u30ef\u30fc\u30c9...\"\r\n                    value={keyword}\r\n                    onChange={(e) =&gt; setKeyword(e.target.value)}\r\n                \/&gt;\r\n                &lt;button\r\n                    type=\"button\"\r\n                    className=\"bg-blue-500 text-white py-2 px-4 rounded whitespace-nowrap\"\r\n                    onClick={handleSubmit}\r\n                &gt;\r\n                    \u691c\u7d22\r\n                &lt;\/button&gt;\r\n            &lt;\/div&gt;\r\n            {gptKeywords.length &gt; 0 &amp;&amp; (\r\n                &lt;div className=\"mt-5\"&gt;\r\n                    &lt;h2 className=\"text-xl font-bold\"&gt;GPT-3\u306b\u3088\u308b\u30ad\u30fc\u30ef\u30fc\u30c9&lt;\/h2&gt;\r\n                    {gptKeywords.map((gptKeyword, index) =&gt; (\r\n                        &lt;span key={index} className=\"mb-4\"&gt;\u30fb{gptKeyword} &lt;\/span&gt;\r\n                    ))}\r\n                &lt;\/div&gt;\r\n            )}\r\n            {gptKeywords.length &gt; 0 &amp;&amp; (\r\n                &lt;div className=\"mt-5\"&gt;\r\n                    {articles.map((article, index) =&gt; (\r\n                        &lt;div key={index} className=\"mb-4\"&gt;\r\n                            &lt;h3 className=\"text-xl font-bold\"&gt;{article.title}&lt;\/h3&gt;\r\n                            &lt;p&gt;{article.content}&lt;\/p&gt;\r\n                        &lt;\/div&gt;\r\n                    ))}\r\n                &lt;\/div&gt;\r\n            )}\r\n        &lt;\/div&gt;\r\n    );\r\n\r\n};\r\n<\/strong><\/pre>\n<p>\u3053\u308c\u3082\u30b7\u30f3\u30d7\u30eb\u306b\u30ad\u30fc\u30ef\u30fc\u30c9\u3092<code>Ajax<\/code>\u3067\u9001\u4fe1\u3057\u3001\u5e30\u3063\u3066\u304d\u305f\u30c7\u30fc\u30bf\u3092\u30eb\u30fc\u30d7\u3067\u8868\u793a\u3057\u3066\u3044\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<h1>\u30eb\u30fc\u30c8\u3092\u3064\u304f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u6700\u5f8c\u306b\u30eb\u30fc\u30c8\u3067\u3059\u3002<\/p>\n<p><strong>routes\/web.php<\/strong><\/p>\n<pre>\/\/ \u7701\u7565\r\n\r\n<strong>use App\\Http\\Controllers\\ArticleController;\r\n\r\nRoute::get('\/article', [ArticleController::class, 'index'])-&gt;name('article.index');\r\nRoute::get('\/article\/list', [ArticleController::class, 'list'])-&gt;name('article.list');\r\n<\/strong><\/pre>\n<p>\u3053\u308c\u3067\u4f5c\u696d\u306f\u5b8c\u4e86\u3067\u3059\u2757<br \/>\n\u304a\u75b2\u308c\u69d8\u3067\u3057\u305f\ud83d\ude04\u2728<\/p>\n<h1>\u30c6\u30b9\u30c8\u3057\u3066\u307f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u30c6\u30b9\u30c8\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u2757<\/p>\n<p>\u307e\u305a\u3001<code>Vite<\/code>\u3092\u8d77\u52d5\u3057\u3066\u300c<strong>https:\/\/*****\/article<\/strong>\u300d\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u5165\u529b\u30dc\u30c3\u30af\u30b9\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u3001\u300c<strong>\u30d4\u30a2\u30ce<\/strong>\u300d\u3068\u5165\u529b\u3057\u3066\u300c<strong>\u691c\u7d22<\/strong>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11663\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_12.png\" alt=\"\" width=\"500\" height=\"96\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_12.png 500w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_12-300x58.png 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/p>\n<p>\u3059\u308b\u3068\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11664\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_13.png\" alt=\"\" width=\"500\" height=\"687\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_13.png 500w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/05\/laravel_chatgpt_tag_13-218x300.png 218w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/p>\n<p>\u306f\u3044\u2757<\/p>\n<p>\u300c<strong>\u30d4\u30a2\u30ce<\/strong>\u300d\u3068\u3044\u3046\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u542b\u3093\u3067\u3044\u306a\u304b\u3063\u305f\u5148\u307b\u3069\u306e\u30c7\u30fc\u30bf\u3092\u691c\u7d22\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u6210\u529f\u3067\u3059\ud83d\ude04\u2728<\/p>\n<h1>\u4f01\u696d\u69d8\u3078\u306e\u3054\u63d0\u6848<\/h1>\n<p>\u4eca\u3084<code>ChatGPT<\/code>\u306f\u30a6\u30a7\u30d6\u4e0a\u304b\u3089\u3060\u3051\u3067\u306a\u304f<code>API<\/code>\u3092\u901a\u3057\u3066\u3082\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u73fe\u5728\u5229\u7528\u306b\u306a\u3089\u308c\u3066\u3044\u308b\u30b7\u30b9\u30c6\u30e0\u3068\u7d71\u5408\u3059\u308b\u3053\u3068\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u6a5f\u80fd\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u8b70\u4e8b\u9332\u3084\u4f1a\u8b70\u9332\u304c\u767b\u9332\u3055\u308c\u305f\u3068\u304d\u306b\u81ea\u52d5\u3067\u8981\u7d04\u3092\u4f5c\u6210\u3059\u308b<\/li>\n<li>\u904e\u53bb\u306b\u767b\u9332\u3055\u308c\u305f\u30c7\u30fc\u30bf\u304b\u3089\u300c\u3088\u304f\u5165\u529b\u3055\u308c\u308b\u5358\u8a9e\u300d\u3092\u4f5c\u6210\u3057\u3066\u304a\u304d\u81ea\u52d5\u3067\u5165\u529b\u88dc\u5b8c\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b<\/li>\n<li>\u6295\u7a3f\u3055\u308c\u305f\u30c6\u30ad\u30b9\u30c8\u306e\u300c\u611f\u60c5\u300d\u3092\u8aad\u307f\u53d6\u308a\u3001\u3042\u308b\u4e00\u5b9a\u4ee5\u4e0a\u306e\u3082\u306e\u3092\u512a\u5148\u7684\u306b\u5bfe\u5fdc\u3059\u308b<\/li>\n<\/ul>\n<p>\u306a\u3069\u306a\u3069\u3002<\/p>\n<p>\u3082\u3061\u308d\u3093<code>ChatGpt<\/code>\u3067\u3067\u304d\u308b\u3053\u3068\u306f\u4eca\u56de\u306e<code>API<\/code>\u3067\u3082\u540c\u3058\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3082\u3057\u305d\u3046\u3044\u3063\u305f\u958b\u767a\u3092\u3054\u5e0c\u671b\u306e\u5834\u5408\u306f\u305c\u3072\u304a\u554f\u3044\u5408\u308f\u305b\u304b\u3089\u3054\u76f8\u8ac7\u304f\u3060\u3055\u3044\u3002<br \/>\n\u304a\u5f85\u3061\u3057\u3066\u304a\u308a\u307e\u3059\ud83d\ude04<\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f<code>ChatGPT API<\/code>\u3092\u5229\u7528\u3057\u3066\u300c<strong>\u3042\u3044\u307e\u3044\u691c\u7d22<\/strong>\u300d\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u305f\u3060\u3001\u306f\u3058\u3081\u3066<code>API<\/code>\u3092\u4f7f\u3063\u3066\u307f\u305f\u611f\u60f3\u3068\u3057\u3066\u306f\u300c<strong>\u3061\u3087\u3063\u3068\u6642\u9593\u304c\u304b\u304b\u308b<\/strong>\u300d\u3068\u3044\u3046\u3082\u306e\u3067\u3057\u305f\u3002<\/p>\n<p>\u300c<strong>gpt-3.5-turbo<\/strong>\u300d\u3067\u3082\u5c11\u3057\u5f85\u3061\u307e\u3059\u304c\u3001\u300c<strong>gpt-4<\/strong>\u300d\u3060\u3068\u3001\u300c\u3082\u3057\u304b\u3057\u3066\u6b62\u307e\u3063\u3066\u306a\u3044\uff01\uff1f\u300d\u3068\u601d\u3046\u3050\u3089\u3044\u9045\u304b\u3063\u305f\u306e\u3067\u3001\u3082\u3057\u304b\u3059\u308b\u3068\u307e\u3060\u4eca\u56de\u306e\u3088\u3046\u306a\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u6027\u304c\u5fc5\u8981\u306a\u6a5f\u80fd\u3078\u306e\u7d71\u5408\u306f\u5411\u3044\u3066\u3044\u306a\u3044\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\uff08\u30a6\u30a7\u30d6\u7248\u3067\u306f\u305d\u3093\u306a\u306b\u5f85\u3064\u30a4\u30e1\u30fc\u30b8\u306f\u306a\u3044\u306e\u306b\u306a\u2026\ud83e\udd14\u3068\u601d\u3044\u307e\u3057\u305f\u304c\u3001\u30a6\u30a7\u30d6\u7248\u306f\u3061\u3087\u3063\u3068\u305a\u3064\u66f8\u3044\u3066\u304f\u308c\u308b\u304b\u3089\u5f85\u3063\u3066\u3044\u3089\u308c\u308b\u3093\u3067\u3059\u306d\uff09<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u3053\u308c\u3082\u4f7f\u3044\u65b9\u6b21\u7b2c\u3067\u3044\u308d\u3044\u308d\u306a\u4fbf\u5229\u6a5f\u80fd\u3092\u3064\u304f\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u307f\u306a\u3055\u3093\u3082\u30c1\u30e3\u30ec\u30f3\u30b8\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u306d\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\u2757<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6066 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_23.png\" alt=\"\" width=\"370\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_23.png 370w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2020\/03\/no_23-300x259.png 300w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/>\u300c\u53cb\u4eba\u3068\u4eba\u72fc\u30b2\u30fc\u30e0\u3057\u305f\u3089<br \/>\n\u512a\u52dd\u3057\u307e\u3057\u305f\u3002<br \/>\n\u79c1\u306f\u5618\u3064\u304d\u306a\u306e\u304b\u306a\u2026\ud83d\ude05\u300d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u307e\u3060\u307e\u3060ChatGPT\u306e\u7814\u7a76\u3092\u3057\u3066\u3044\u3066\u53ef\u80fd\u6027\u3092\u611f\u3058\u3066\u3044\u308b\u4eca\u65e5\u3053\u306e\u9803\u3067\u3059\u3002 \u305d\u3057\u3066\u3001\u3042\u308b\u7a0b\u5ea6\u30a6\u30a7\u30d6\u7248\u306eChatGPT\u306f\u4e00\u6bb5\u843d\u3057\u305f\u306e\u3067\u3001\u30d7\u30ed\u30b0\u30e9\u30de\u306e\u79c1\u3068\u3057 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=11642\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Laravel\u3068ChatGPT API\u306e\u5f37\u529b\u30b3\u30e9\u30dc\uff01\u95a2\u9023\u30c7\u30fc\u30bf\u691c\u7d22\u304c\u3053\u308c\u3067\u7c21\u5358\u30fb\u52b9\u7387\u7684\u306b\u306a\u308b\uff01&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":11666,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[253,3,118],"tags":[],"class_list":["post-11642","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-chatgpt","category-laravel","category-react-js"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/11642","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11642"}],"version-history":[{"count":13,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/11642\/revisions"}],"predecessor-version":[{"id":11749,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/11642\/revisions\/11749"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/11666"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11642"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11642"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11642"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}