{"id":466704,"date":"2025-07-10T15:01:12","date_gmt":"2025-07-10T15:01:12","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=466704"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=466704","title":{"rendered":"<span>\u0412\u0435\u0440\u0441\u0442\u0430\u0435\u043c \u0441\u0432\u043e\u0435\u0433\u043e \u0418\u0418 CLI \u0430\u0433\u0435\u043d\u0442\u0430 \u043d\u0430\u2026 Go???<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/acf\/189\/cd4\/acf189cd49a256040c4101cf6a3f27a0.jpg\" width=\"1284\" height=\"856\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/acf\/189\/cd4\/acf189cd49a256040c4101cf6a3f27a0.jpg 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/acf\/189\/cd4\/acf189cd49a256040c4101cf6a3f27a0.jpg 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0412\u0441\u0435 \u0443\u0436\u0435 \u0441\u043b\u044b\u0448\u0430\u043b\u0438 \u043f\u0440\u043e Gemini CLI, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u043c\u043e\u0449\u043d\u043e\u0439 gemini 2.5  \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438. \u042d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u043e, \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439. \u041d\u043e \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u043c \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0430 \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a \u043e\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438\u0437\u043d\u0443\u0442\u0440\u0438? \u0410 \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435\u0442\u0443 VPN \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0433\u0443\u0433\u043b\u0430? \u0418\u043b\u0438, \u0447\u0442\u043e \u0435\u0449\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435, \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439, \u043f\u0443\u0441\u0442\u044c \u0438 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439, \u0430\u043d\u0430\u043b\u043e\u0433? \u0427\u0435\u043c \u043c\u044b \u0445\u0443\u0436\u0435? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0432\u0435\u0440\u0441\u0442\u0430\u0435\u043c \u0441\u0432\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043d\u0430&#8230; GOLANG?<\/p>\n<p>\u0414\u0430, \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a. \u041c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d-\u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043c\u0435\u043d\u0438\u0442 \u0441\u043e\u0431\u043e\u0439 \u0432\u0441\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 CLI. \u041c\u043e\u044f \u0446\u0435\u043b\u044c \u2014 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442, \u043f\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0440\u0443\u0436\u0438\u0442\u044c Go, \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0438 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u044f\u0437\u044b\u043a\u043e\u0432\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c. <\/p>\n<p>\u041c\u043e\u044f \u0438\u0434\u0435\u044f \u043f\u0440\u043e\u0441\u0442\u0430: \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e CLI-\u0430\u0433\u0435\u043d\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0443\u0448\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a AI \u0437\u0430 \u0441\u043e\u0432\u0435\u0442\u043e\u043c \u0438\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0442\u044c \u044d\u0442\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043d\u0430\u043c \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0430 \u0437\u0430\u0442\u0435\u043c, \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0435\u0451 \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u043e\u0439, AI \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a, \u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u0435. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u044b, \u043d\u043e \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0443\u0442\u0438\u043d\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u043d\u0435 \u0432\u044b\u0445\u043e\u0434\u044f \u0438\u0437 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u043c\u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430\u043c\u0438, \u0431\u0443\u0434\u0443 \u043f\u0440\u0438\u0437\u043d\u0430\u0442\u0435\u043b\u0435\u043d \u0437\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 \u043d\u0430 \u043c\u043e\u0439 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c-\u043a\u0430\u043d\u0430\u043b. \u0422\u0430\u043c \u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u044e \u043f\u043e\u043b\u0435\u0437\u043d\u044be \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b \u043f\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435, \u0440\u0430\u0437\u0431\u043e\u0440\u044b \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0439, \u0441\u043e\u0432\u0435\u0442\u044b \u043a\u0430\u043a \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u043e\u0442\u0431\u043e\u0440\u043d\u044b\u0435 \u043c\u0435\u043c\u044b:\u00a0<a href=\"https:\/\/t.me\/nullPointerDotEXE\" rel=\"noopener noreferrer nofollow\">https:\/\/t.me\/nullPointerDotEXE<\/a>.  <\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>github.com\/fatih\/color<\/code> \u0434\u043b\u044f \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430 \u0438 <code>github.com\/joho\/godotenv<\/code> \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0440\u0430\u0437\u0443 \u0441\u0434\u0435\u043b\u0430\u0439\u0442\u0435 <code>go get github.com\/fatih\/color <\/code> \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 <code>go get github.com\/joho\/godotenv<\/code> .<\/p>\n<p>\u041a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 <a href=\"https:\/\/github.com\/Role1776\/AI_CLI_Agent\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/Role1776\/AI_CLI_Agent<\/a> . \u0411\u0443\u0434\u0443 \u043f\u0440\u0438\u0437\u043d\u0430\u0442\u0435\u043b\u0435\u043d \u0437\u0430 \u0432\u0430\u0448 \u043b\u0430\u0439\u043a. <\/p>\n<h2>\u0428\u0430\u0433 0. \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. <\/h2>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u044c\u0435\u043c \u043a\u043e\u0434 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u043a\u0435\u0442\u043e\u0432. \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043f\u0430\u043f\u043e\u043a \u0438 \u0444\u0430\u0439\u043b\u043e\u0432:<\/p>\n<pre><code>agent\/  \u251c\u2500\u2500 cmd\/ \u2502   \u2514\u2500\u2500 cli_agent\/ \u2502       \u2514\u2500\u2500 main.go      # \u0422\u043e\u0447\u043a\u0430 \u0432\u0445\u043e\u0434\u0430 \u0432 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u251c\u2500\u2500 internal\/ \u2502   \u251c\u2500\u2500 app\/ \u2502   \u2502   \u2514\u2500\u2500 app.go       # \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2502   \u251c\u2500\u2500 config\/ \u2502   \u2502   \u2514\u2500\u2500 config.go    # \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u2502   \u251c\u2500\u2500 shell\/ \u2502   \u2502   \u2514\u2500\u2500 shell.go     # \u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434 \u2502   \u2514\u2500\u2500 ui\/ \u2502       \u2514\u2500\u2500 ui.go        # \u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u251c\u2500\u2500 .env \u251c\u2500\u2500 go.mod \u2514\u2500\u2500 go.sum<\/code><\/pre>\n<p>C\u0438\u043b\u044c\u043d\u043e \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0442\u044c \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443, \u0442\u043a \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u0443 \u043d\u0430 500 \u0441\u0442\u0440\u043e\u0447\u0435\u043a \u043a\u043e\u0434\u0430, \u0430 \u043d\u0435 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0442\u043e\u0440 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043c\u0441\u044f \u0442\u0430\u043a\u0438\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c. <\/p>\n<h2>\u0428\u0430\u0433 1. \u041e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c\u0441\u044f<\/h2>\n<pre><code class=\"go\">var ( successColor = color.New(color.FgGreen).Add(color.Bold).SprintFunc() borderColor  = color.New(color.FgWhite).Add(color.Bold).SprintFunc() labelColor   = color.New(color.FgHiWhite).Add(color.Bold).SprintFunc() aiColor      = color.New(color.FgHiCyan).Add(color.Bold).SprintFunc() errorColor   = color.New(color.FgRed).Add(color.Bold).SprintFunc() ) <\/code><\/pre>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445. \u042d\u0442\u043e \u043d\u0435 \u0431\u043e\u043b\u0435\u0435, \u0447\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u0430. \u041c\u044b \u0436\u0435 \u043f\u0438\u0448\u0435\u043c \u0430\u043d\u0430\u043b\u043e\u0433 gemini, \u0432\u0435\u0434\u044c \u0442\u0430\u043a? \u041d\u0443 \u0432\u043e\u0442 \u0438 \u0442\u0435\u043a\u0441\u0442 \u0431\u0443\u0434\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e\u0436\u0435 \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u043c. <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0443 \u043d\u0430\u0441 \u0438\u0434\u0443\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438. \u041c\u043e\u0434\u0435\u043b\u044c\u043a\u0438 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0435, \u043d\u043e \u043d\u0435 \u0441\u0430\u043c\u044b\u0435 \u0441\u043b\u0430\u0431\u044b\u0435. \u041a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0442\u0443\u0442 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e qwen3 \u043d\u0430 30b \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432. Api \u043a\u043b\u044e\u0447 \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0430 openrouter \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435. <\/p>\n<pre><code class=\"go\">const ( systemPromptBase            = \"System Context:\\n\" simpleChatPromptTemplate    = \"You are an AI agent. Answer the user's question based on the information available. NEVER USE SMILEYS.\" commandGenPromptTemplate    = \"You are an AI agent. Your task is to generate commands based on the user's query. Answer only with the command, without extra words, explanations, and markdown formatting. Only raw command. Never use smileys. Try to generate commands that do not produce very long logs\" errorAnalysisPromptTemplate = \"Analyze the error execution of command and explain simply what went wrong. Original query: '%s'. Error: '%s'\" summaryPromptTemplate       = \"Briefly explain the result of executing the command, based on the original user query. Original query: '%s'. Command output: '%s'\" )<\/code><\/pre>\n<p>\u041d\u0443 \u0442\u0443\u0442 \u0441\u0430\u043c\u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u0442\u0435 \u0442\u0435\u043a\u0441\u0442\u044b. 1 \u043f\u0440\u043e\u043c\u043f\u0442 \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043f\u043a. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0431\u0440\u0430\u0442\u044c, \u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0430 \u043f\u043e\u0434 mac os \u0438\u043b\u0438 linux, \u0442\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u043a\u0435 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e. 2 \u043f\u0440\u043e\u043c\u043f\u0442 \u0434\u043b\u044f \u0440\u0435\u0436\u0438\u043c\u0430 \u0447\u0430\u0442\u0430. 3 \u0434\u043b\u044f \u0430\u0433\u0435\u043d\u0442\u0430. 4 \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043e\u0448\u0438\u0431\u043e\u043a \u0438 5 \u0434\u043b\u044f \u043e\u0442\u0447\u0435\u0442\u043e\u0432. <\/p>\n<p>\u0418\u0434\u0435\u043c \u0434\u0430\u043b\u0435\u0435<\/p>\n<pre><code class=\"go\">type Message struct { Role    string `json:\"role\"` Content string `json:\"content\"` }  type APIRequest struct { Model    string    `json:\"model\"` Messages []Message `json:\"messages\"` }  type APIResponse struct { Choices []Choice `json:\"choices\"` }  type Choice struct { Message ResponseMessage `json:\"message\"` }  type ResponseMessage struct { Content string `json:\"content\"` }  type App struct { client       *http.Client history      []Message autoComplete bool reader       *bufio.Reader config       *config.Config }<\/code><\/pre>\n<p><strong>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043a\u0438 \u0438 \u043a\u043e\u043d\u0444\u0438\u0433.<\/strong> <\/p>\n<p>\u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u0438. \u0412\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 API \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438. \u0410 \u0432\u043e\u0442 app \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0413\u043e\u0440\u043e\u0434\u0438\u0442\u044c DI, \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0438 \u043f\u0440\u043e\u0447\u0438\u0439 \u043e\u0432\u0435\u0440\u0445\u0435\u0434 \u0432 <strong>\u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435<\/strong> \u044f \u043d\u0435 \u0431\u0443\u0434\u0443. \u0421\u0435\u0439\u0447\u0430\u0441 \u0443 \u043d\u0430\u0441 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043b\u0430\u0439\u0442\u043e\u0432\u0430\u044f CLI&#8217;\u043a\u0430 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c. <\/p>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043a\u0443 App \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c. <\/p>\n<pre><code class=\"go\">func NewApp(config *config.Config, client *http.Client) *App { return &amp;App{ client:       client, autoComplete: false, reader:       bufio.NewReader(os.Stdin), config:       config, history: []Message{ { Role:    \"system\", Content: systemPromptBase + \"\\n\" + shell.GetSystemInfo(), }, }, } }<\/code><\/pre>\n<p>\u0418 \u0442\u0430\u043a \u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433:<\/p>\n<pre><code class=\"go\">type Config struct { Model    string ApiUrl   string ApiToken string Timeout  int Retries  int }  func LoadConfig() (*Config, error) { err := godotenv.Load() if err != nil { return nil, err }  retries, err := strconv.Atoi(os.Getenv(\"RETRIES\")) if err != nil { return nil, err }  timeout, err := strconv.Atoi(os.Getenv(\"TIMEOUT\")) if err != nil { return nil, err }  return &amp;Config{ Model:    os.Getenv(\"MODEL\"), ApiUrl:   os.Getenv(\"API_URL\"), ApiToken: os.Getenv(\"API_TOKEN\"), Timeout:  timeout, Retries:  retries, }, nil } <\/code><\/pre>\n<p>\u042d\u0442\u043e \u0441\u0430\u043c\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0438 \u0431\u0430\u0437\u043e\u0432\u0430\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0438\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f. \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 .env \u0444\u0430\u0439\u043b \u0441 \u043f\u043e\u043b\u044f\u043c\u0438:<\/p>\n<pre><code class=\"bash\">MODEL=\"qwen\/qwen3-30b-a3b:free\" API_URL=\"https:\/\/openrouter.ai\/api\/v1\/chat\/completions\" API_TOKEN=\"\u0432\u0430\u0448 \u043a\u043b\u044e\u0447(\u0441\u043c \u043d\u0438\u0436\u0435 \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c)\" RETRIES=3 TIMEOUT=60<\/code><\/pre>\n<h2>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u043a<\/h2>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>getSystemInfo()<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u043a \u044e\u0437\u0435\u0440\u0430. <\/p>\n<pre><code class=\"go\">func GetSystemInfo() string { osName := runtime.GOOS  shell := \"bash\" if osName == \"windows\" { shell = \"PowerShell\" }  currentUser, err := user.Current() username := \"unknown\" if err == nil { username = currentUser.Username }  cwd, err := os.Getwd() if err != nil { cwd = \"unknown\" }  return fmt.Sprintf( \"System Context:\\n- OS: %s\\n- Shell: %s\\n- User: %s\\n- CWD: %s\\n\", osName, shell, username, cwd, ) }<\/code><\/pre>\n<p>\u0418\u0442\u0430\u043a, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c API \u043a\u043b\u044e\u0447. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0430\u044f, \u0442\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u043c\u0435\u043b\u043e \u0448\u0430\u0433 2. <\/p>\n<h2>\u0428\u0430\u0433 2. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c API \u043a\u043b\u044e\u0447 \u0434\u043b\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u043d\u0430 openrouter<\/h2>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u043d\u0430 \u0441\u0430\u0439\u0442 <a href=\"https:\/\/openrouter.ai\/sign-in?redirect_url=https%3A%2F%2Fopenrouter.ai%2Fsettings%2Fkeys\" rel=\"noopener noreferrer nofollow\">\u043e\u043f\u0435\u043d\u0440\u043e\u0443\u0442\u0435\u0440\u0430 <\/a>\u0438 \u0432\u043e\u0439\u0434\u0438\u0442\u0435 \u043b\u044e\u0431\u044b\u043c \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1bb\/e87\/9e3\/1bbe879e3d5186b5e123927dc4bfdcf8.jpg\" width=\"1256\" height=\"911\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/1bb\/e87\/9e3\/1bbe879e3d5186b5e123927dc4bfdcf8.jpg 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1bb\/e87\/9e3\/1bbe879e3d5186b5e123927dc4bfdcf8.jpg 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0432\u0435\u0434\u0438\u0442\u0435 \u043a\u0443\u0440\u0441\u043e\u0440 \u043d\u0430 \u0441\u0432\u043e\u044e \u0438\u043a\u043e\u043d\u043a\u0443. \u0422\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u043a\u043b\u0430\u0434\u043a\u0430 &#171;keys&#187;. \u0412\u043e\u0442 \u044d\u0442\u043e \u0432\u043e\u0442 \u0432\u0430\u043c \u0442\u0443\u0434\u0430 \u0432\u043e\u0442. <\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6bf\/740\/cf4\/6bf740cf4f83bbb7398402929df2863b.jpg\" width=\"772\" height=\"512\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/6bf\/740\/cf4\/6bf740cf4f83bbb7398402929df2863b.jpg 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6bf\/740\/cf4\/6bf740cf4f83bbb7398402929df2863b.jpg 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0435 \u043a\u043b\u044e\u0447, \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442\u0435 \u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0435. <\/p>\n<p>\u0421\u043b\u043e\u0436\u043d\u043e? \u041d\u0435 \u0434\u0443\u043c\u0430\u044e. <\/p>\n<h2>\u0428\u0430\u0433 3. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430. <\/h2>\n<p>C\u0435\u0440\u0434\u0446\u0435 \u043d\u0430\u0448\u0435\u0439 \u0443\u0442\u0438\u043b\u0438\u0442\u044b, \u0431\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d\u043e \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0445\u043e\u0442\u044c \u043a\u0430\u043a-\u0442\u043e. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0442\u0438\u043f\u0438\u0447\u043d\u0430\u044f \u0438 \u043f\u0440\u043e\u0441\u0442\u0430\u044f. \u041e\u043d\u0430 \u0434\u0435\u043b\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a API \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0442\u0432\u0435\u0442.  \u042d\u0442\u043e \u044f\u0434\u0440\u043e \u043b\u043e\u0433\u0438\u043a\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c API \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0435\u043a\u0441\u0442\u0430.  <\/p>\n<pre><code class=\"go\">func (a *App) generateContent(messages []Message) (string, error) { reqBody := APIRequest{ Model:    a.config.Model, Messages: messages, }  bodyBytes, err := json.Marshal(reqBody) if err != nil { return \"\", fmt.Errorf(\"error encoding JSON: %w\", err) }  req, err := http.NewRequest(\"POST\", a.config.ApiUrl, bytes.NewBuffer(bodyBytes)) if err != nil { return \"\", fmt.Errorf(\"error creating request: %w\", err) } req.Header.Set(\"Content-Type\", \"application\/json\") req.Header.Set(\"Authorization\", \"Bearer \"+a.config.ApiToken)  resp, err := a.client.Do(req) if err != nil { return \"\", fmt.Errorf(\"error executing request: %w\", err) } defer resp.Body.Close()  respBytes, err := io.ReadAll(resp.Body) if err != nil { return \"\", fmt.Errorf(\"error reading response: %w\", err) }  if resp.StatusCode != http.StatusOK { return \"\", fmt.Errorf(\"API returned error (status %d): %s\", resp.StatusCode, string(respBytes)) } var result APIResponse if err := json.Unmarshal(respBytes, &amp;result); err != nil { return \"\", fmt.Errorf(\"error decoding response: %w\", err) }  if len(result.Choices) &gt; 0 &amp;&amp; result.Choices[0].Message.Content != \"\" { return result.Choices[0].Message.Content, nil } return \"\", fmt.Errorf(\"API did not return content in the response\") }<\/code><\/pre>\n<p>\u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a API \u044f\u0437\u044b\u043a\u043e\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439. \u041e\u043d\u0430 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 <code>App<\/code>, \u0438 \u0435\u0451 \u0446\u0435\u043b\u044c \u2014 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441, \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 API-\u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442 \u0438 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043d\u0442.<\/p>\n<h3>\u041f\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0439 \u0440\u0430\u0437\u0431\u043e\u0440:<\/h3>\n<ol>\n<li>\n<p><strong>\u0424\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0435\u043b\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/strong><br \/> \u0421\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 <code>APIRequest<\/code>, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0430\u044f:<\/p>\n<ul>\n<li>\n<p>\u043c\u043e\u0434\u0435\u043b\u044c, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 (<code>a.config.Model<\/code>)<\/p>\n<\/li>\n<li>\n<p>\u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e (<code>messages<\/code>)<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0432 JSON \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>json.Marshal<\/code>.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/strong><br \/> \u0421\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 JSON \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 <code>POST<\/code>-\u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0430\u0434\u0440\u0435\u0441 <code>a.config.ApiUrl<\/code>.<br \/> \u0422\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438:<\/p>\n<ul>\n<li>\n<p><code>Content-Type: application\/json<\/code><\/p>\n<\/li>\n<li>\n<p><code>Authorization: Bearer &lt;\u0442\u043e\u043a\u0435\u043d&gt;<\/code> (\u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a API)<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043e\u0442\u0432\u0435\u0442\u0430<\/strong><br \/> \u0417\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 HTTP-\u043a\u043b\u0438\u0435\u043d\u0442 (<code>a.client.Do(req)<\/code>), \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e:<\/p>\n<ul>\n<li>\n<p>\u0442\u0435\u043b\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>io.ReadAll<\/code><\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430: \u0435\u0441\u043b\u0438 \u043e\u043d \u043d\u0435 <code>200 OK<\/code>, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u0441 \u0442\u0435\u043b\u043e\u043c \u043e\u0442\u0432\u0435\u0442\u0430<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0414\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043e\u0442\u0432\u0435\u0442\u0430<\/strong><br \/> \u0415\u0441\u043b\u0438 \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430 \u2014 200, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0430\u0440\u0441\u0438\u043d\u0433 JSON-\u043e\u0442\u0432\u0435\u0442\u0430 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <code>APIResponse<\/code>. \u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f:<\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u0442\u044c \u043b\u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u0438\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 <code>result.Choices<\/code><\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u0442\u044c \u043b\u0438 \u0442\u0435\u043a\u0441\u0442 \u0432 <code>Choices[0].Message.Content<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u0451 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442.<\/p>\n<\/li>\n<\/ol>\n<h3>\u0427\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f:<\/h3>\n<ul>\n<li>\n<p><strong>\u0423\u0441\u043f\u0435\u0445<\/strong>: \u0442\u0435\u043a\u0441\u0442, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 LLM (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, ChatGPT)<\/p>\n<\/li>\n<li>\n<p><strong>\u041e\u0448\u0438\u0431\u043a\u0430<\/strong>: \u0435\u0441\u043b\u0438 API \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d, \u043f\u0440\u0438\u0448\u0451\u043b \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u0438\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u0435\u0440\u043d\u0443\u043b\u0430 \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u0435\u0440\u043d\u0451\u0442 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443<\/p>\n<\/li>\n<\/ul>\n<h2>\u0428\u0430\u0433 4. \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043e\u0442 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438. <\/h2>\n<p>\u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u0430 \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435. <\/p>\n<pre><code class=\"go\">func ExecuteCommand(command string) (string, error) { var cmd *exec.Cmd if runtime.GOOS == \"windows\" { cmd = exec.Command(\"powershell\", \"-NoProfile\", \"-Command\", command) } else { cmd = exec.Command(\"bash\", \"-c\", command) }  output, err := cmd.CombinedOutput()  return strings.ToValidUTF8(string(output), \"\"), err }<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>executeCommand<\/code> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u044c, \u0441\u043e\u0431\u0438\u0440\u0430\u044f \u0432\u0435\u0441\u044c \u0432\u044b\u0432\u043e\u0434 (\u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0438), \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0435\u0433\u043e \u0432 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u0443\u044e UTF-8 \u0441\u0442\u0440\u043e\u043a\u0443 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 (\u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430). \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0430\u0441\u044c \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439, \u0442\u0435\u043a\u0441\u0442 \u0435\u0451 \u0432\u044b\u0432\u043e\u0434\u0430 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u2014 \u044d\u0442\u043e \u0432\u0430\u0436\u043d\u043e \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e. \u0415\u0441\u043b\u0438 \u0432 \u0432\u044b\u0432\u043e\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u043a\u0438\u0440\u0438\u043b\u043b\u0438\u0446\u0430, \u0442\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0431\u0443\u0434\u0443\u0442 \u0431\u0438\u0442\u044b\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u0432\u0441\u0435 \u0432 UTF8. \u0422\u0430\u043a \u0436\u0435 \u0435\u0441\u0442\u044c \u0433\u0438\u0431\u043a\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b. <\/p>\n<p>\u0412 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a \u044d\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u0438\u0434\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0438. \u0417\u0430\u0447\u0435\u043c? \u042f \u043e\u0442\u0432\u0435\u0447\u0443 \u0437\u0430\u0447\u0435\u043c. \u0425\u043e\u0442\u044c \u043c\u044b \u0432 \u043f\u0440\u043e\u043c\u043f\u0442\u0435 \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043d\u0430\u0434\u043e \u0441\u0440\u0430\u0437\u0443, \u043d\u043e \u043e\u0442 \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u043c\u044b \u043d\u0435 \u043b\u0438\u0448\u0435\u043d\u044b. \u041d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0431\u044b\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u0438\u0437-\u0437\u0430 \u0434\u043b\u0438\u043d\u044b \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043f\u0435\u0440\u0435\u0441\u0442\u0440\u0430\u0445\u043e\u0432\u044b\u0432\u0430\u0435\u043c\u0441\u044f. <\/p>\n<pre><code class=\"go\">func cleanCommand(cmdStr string) string { cmdStr = strings.TrimPrefix(cmdStr, \"```powershell\") cmdStr = strings.TrimPrefix(cmdStr, \"```bash\") cmdStr = strings.TrimPrefix(cmdStr, \"```\") cmdStr = strings.TrimSuffix(cmdStr, \"```\") cmdStr = strings.TrimPrefix(cmdStr, \"Command: \")  if strings.HasPrefix(strings.ToLower(cmdStr), \"powershell -command \") { firstQuote := strings.Index(cmdStr, \"\\\"\") lastQuote := strings.LastIndex(cmdStr, \"\\\"\") if firstQuote != -1 &amp;&amp; lastQuote &gt; firstQuote { cmdStr = cmdStr[firstQuote+1 : lastQuote] } } return strings.TrimSpace(cmdStr) }<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>cleanCommand<\/code> \u043e\u0447\u0438\u0449\u0430\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043e\u0442 \u043b\u0438\u0448\u043d\u0435\u0433\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043e\u0431\u0451\u0440\u0442\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u043b\u0438 \u0431\u044b\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c\u044e. \u041e\u043d\u0430 \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u044b \u0432\u0440\u043e\u0434\u0435 <code>powershell`, bash, \"Command: \", \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u0440\u0435\u0437\u0430\u0435\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u044e\u0449\u0438\u0435 <\/code>&#171;&#171;.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0441\u0442\u0440\u043e\u043a\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 <code>powershell -command \"...\"<\/code>, \u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u0430\u0432\u044b\u0447\u0435\u043a. \u0412 \u0438\u0442\u043e\u0433\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0447\u0438\u0441\u0442\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430, \u0433\u043e\u0442\u043e\u0432\u0430\u044f \u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e.<\/p>\n<h2>\u0428\u0430\u0433 5. \u041f\u0438\u0448\u0435\u043c \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430<\/h2>\n<p>\u0422\u0443\u0442 \u044f \u043f\u0440\u044f\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0437\u0430\u043e\u0441\u0442\u0440\u044f\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0435 \u0431\u0443\u0434\u0443. \u0412 \u0446\u0435\u043b\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0438 \u0431\u0435\u0437 \u044d\u0442\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043d\u043e \u0442\u043a \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u0441\u0432\u043e\u044e gemini CLI, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0420\u043e\u0441\u0441\u0438\u0438, \u0442\u043e \u0431\u0435\u0437 \u043d\u0438\u0445 \u043d\u0435 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c. <\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u044b\u0432\u043e\u0434\u0430 \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0439 \u043d\u0430\u0434\u043f\u0438\u0441\u0438 CLI AGENT. <\/p>\n<pre><code class=\"go\">func PrintHeader() { var asciiHeader = []string{ \"  \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557     \u2588\u2588\u2557     \u2588\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2557   \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\", \"  \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2551     \u2588\u2588\u2551    \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2551\u255a\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255d\", \"  \u2588\u2588\u2551     \u2588\u2588\u2551     \u2588\u2588\u2551    \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551  \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551   \u2588\u2588\u2551   \", \"  \u2588\u2588\u2551     \u2588\u2588\u2551     \u2588\u2588\u2551    \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255d  \u2588\u2588\u2551\u255a\u2588\u2588\u2557\u2588\u2588\u2551   \u2588\u2588\u2551   \", \"  \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551    \u2588\u2588\u2551  \u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551  \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u255a\u2588\u2588\u2588\u2588\u2551   \u2588\u2588\u2551   \", \"  \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d    \u255a\u2550\u255d  \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d  \u255a\u2550\u255d\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u2550\u2550\u255d   \u255a\u2550\u255d   \", \"                                                                            \", \"                             (by oyminirole)                                \", } colors := []*color.Color{ color.New(color.FgHiCyan), color.New(color.FgCyan), color.New(color.FgHiBlue), color.New(color.FgBlue), color.New(color.FgHiMagenta), color.New(color.FgMagenta), }  for _, line := range asciiHeader { lineLength := len(line) step := float64(len(colors)) \/ float64(lineLength)  for i, char := range line { colorIndex := int(float64(i) * step) if colorIndex &gt;= len(colors) { colorIndex = len(colors) - 1 } colors[colorIndex].Printf(\"%c\", char) } fmt.Println() }  color.New(color.FgHiCyan).Add(color.Bold).Println(\"\\nInformation:\") fmt.Println(\" \u2022 Use a \\\"!\\\" before your query to get answers to questions, or just enter your query. Example: !How to create a folder?\") fmt.Println(\" \u2022 To agent mode, just enter your query without \\\"!\\\". Agent will execute commands and provide reports with results.\") fmt.Println(\" \u2022 To exit the program, press Ctrl+C or close the terminal window.\") fmt.Println(strings.Repeat(\"\u2500\", 70)) }<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>printHeader<\/code> \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439 ASCII-\u0431\u0430\u043d\u043d\u0435\u0440 \u0441 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u043d\u043e\u0439 \u0446\u0432\u0435\u0442\u043e\u0432\u043e\u0439 \u0437\u0430\u043b\u0438\u0432\u043a\u043e\u0439, \u0430 \u0437\u0430\u0442\u0435\u043c \u2014 \u043a\u0440\u0430\u0442\u043a\u0443\u044e \u0441\u043f\u0440\u0430\u0432\u043a\u0443 \u043f\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e CLI-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u043d\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442 \u043b\u043e\u0433\u043e\u0442\u0438\u043f \u0441 \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c\u043e\u043c (oyminirole \u044d\u0442\u043e \u044f \u043a\u0441\u0442\u0430), \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u043b\u0430\u0432\u043d\u044b\u0439 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442 \u0438\u0437 \u0448\u0435\u0441\u0442\u0438 \u0446\u0432\u0435\u0442\u043e\u0432. \u0417\u0430\u0442\u0435\u043c \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f: \u043a\u0430\u043a \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b (<code>!<\/code>), \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0436\u0438\u043c \u0430\u0433\u0435\u043d\u0442\u0430 \u0438 \u043a\u0430\u043a \u0432\u044b\u0439\u0442\u0438 \u0438\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0412\u0441\u0451 \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u043e \u0432 \u0441\u0442\u0438\u043b\u0435 \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 CLI-\u043f\u043e\u043c\u043e\u0449\u0438.<\/p>\n<p>\u041a\u0443\u0434\u0430 \u0436\u0435 \u0431\u0435\u0437 \u0441\u043f\u0438\u043d\u0435\u0440\u0430. <\/p>\n<pre><code class=\"go\">func startSpinner(text string) chan bool { stop := make(chan bool) go func() { frames := []string{\"\u280b\", \"\u2819\", \"\u2839\", \"\u2838\", \"\u283c\", \"\u2834\", \"\u2826\", \"\u2827\", \"\u2807\"} i := 0 for { select { case &lt;-stop: fmt.Print(\"\\r\\033[K\") \/\/\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043e\u0447\u0438\u0441\u0442\u043a\u0443 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435 return default: fmt.Print(\"\\r\\033[K\") \/\/\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043e\u0447\u0438\u0441\u0442\u043a\u0443 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435 fmt.Print(text + \" \") color.New(color.FgHiCyan).Add(color.Bold).Print(frames[i%len(frames)]) time.Sleep(100 * time.Millisecond) i++ } } }() return stop }<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>startSpinner<\/code> \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0441\u043f\u0438\u043d\u043d\u0435\u0440 (\u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438) \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u0435, \u0447\u0442\u043e\u0431\u044b \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0438\u0434\u0451\u0442 \u0444\u043e\u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043e\u0442\u0432\u0435\u0442\u0430).<\/p>\n<p>\u0421\u043f\u0438\u043d\u043d\u0435\u0440 \u043a\u0440\u0443\u0442\u0438\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438, \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <code>frames<\/code> (\u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0442\u0438\u043f\u0430 <code>\u280b<\/code>, <code>\u2819<\/code> \u0438 \u0442.\u0434.). \u041a\u0430\u0436\u0434\u044b\u0435 100 \u043c\u0441 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u0434\u0440, \u043f\u043e\u043a\u0430 \u0432 \u043a\u0430\u043d\u0430\u043b <code>stop<\/code> \u043d\u0435 \u043f\u0440\u0438\u0434\u0451\u0442 \u0441\u0438\u0433\u043d\u0430\u043b \u2014 \u0442\u043e\u0433\u0434\u0430 \u0441\u043f\u0438\u043d\u043d\u0435\u0440 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u0441\u0442\u0440\u043e\u043a\u0430 \u043e\u0447\u0438\u0449\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0439 \u043a\u0430\u043d\u0430\u043b <code>chan bool<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u0438\u0437\u0432\u043d\u0435. <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u043e\u0432<\/p>\n<pre><code class=\"go\">func PrintErrorBox(errorOutput, aiAnalysis string) { width := 80  fmt.Printf(\" %s\\n\", ErrorColor(\"\u256d\u2500[ Error ]\"+strings.Repeat(\"\u2500\", width-16))) fmt.Printf(\" %s %s\\n\", BorderColor(\"\u2502\"), LabelColor(\"Error log:\")) for _, line := range strings.Split(strings.TrimSpace(errorOutput), \"\\n\") { fmt.Printf(\" %s   %s\\n\", BorderColor(\"\u2502\"), ErrorColor(line)) } if aiAnalysis != \"\" { fmt.Printf(\" %s %s\\n\", BorderColor(\"\u2502\"), BorderColor(strings.Repeat(\"\u00b7\", width-4))) fmt.Printf(\" %s %s\\n\", BorderColor(\"\u2502\"), AiColor(\"AI summary:\")) for _, line := range strings.Split(strings.TrimSpace(aiAnalysis), \"\\n\") { fmt.Printf(\" %s   %s\\n\", BorderColor(\"\u2502\"), AiColor(line)) } } fmt.Printf(\" %s\\n\", ErrorColor(\"\u2570\"+strings.Repeat(\"\u2500\", width-2))) }  func PrintResultBox(commandOutput, aiSummary string) { width := 80  fmt.Printf(\" %s\\n\", SuccessColor(\"\u256d\u2500[ Result ]\"+strings.Repeat(\"\u2500\", width-16))) fmt.Printf(\" %s %s\\n\", BorderColor(\"\u2502\"), LabelColor(\"Command output:\")) for _, line := range strings.Split(strings.TrimSpace(commandOutput), \"\\n\") { fmt.Printf(\" %s   %s\\n\", BorderColor(\"\u2502\"), line) }  fmt.Printf(\" %s %s\\n\", BorderColor(\"\u2502\"), BorderColor(strings.Repeat(\"\u00b7\", width-4))) fmt.Printf(\" %s %s\\n\", BorderColor(\"\u2502\"), AiColor(\"AI summary:\")) for _, line := range strings.Split(strings.TrimSpace(aiSummary), \"\\n\") { fmt.Printf(\" %s   %s\\n\", BorderColor(\"\u2502\"), AiColor(line)) }  fmt.Printf(\" %s\\n\", SuccessColor(\"\u2570\"+strings.Repeat(\"\u2500\", width-2))) }  func SimpleResultBox(commandOutput string) { width := 80  fmt.Printf(\" %s\\n\", SuccessColor(\"\u256d\u2500[ Result ]\"+strings.Repeat(\"\u2500\", width-16))) fmt.Printf(\" %s %s\\n\", BorderColor(\"\u2502\"), LabelColor(\"Command output:\")) for _, line := range strings.Split(strings.TrimSpace(commandOutput), \"\\n\") { fmt.Printf(\" %s   %s\\n\", BorderColor(\"\u2502\"), line) } fmt.Printf(\" %s\\n\", SuccessColor(\"\u2570\"+strings.Repeat(\"\u2500\", width-2))) } <\/code><\/pre>\n<p>\u0417\u043d\u0430\u044e, \u0447\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043e\u0447\u0435\u043d\u044c \u0441\u0442\u0440\u0430\u0448\u043d\u043e, \u043d\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0433\u043e \u043e\u043d\u0438 \u043d\u0435 \u0434\u0435\u043b\u0430\u044e\u0442. \u0417\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0442\u044c \u0432\u0430\u043c \u044d\u0442\u043e \u043d\u0435 \u043d\u0430\u0434\u043e. \u042d\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <strong>\u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0432\u043e\u0434\u044f\u0442 \u043a\u0440\u0430\u0441\u0438\u0432\u043e \u0442\u0435\u043a\u0441\u0442 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c<\/strong>. <\/p>\n<h2>\u0428\u0430\u0433 6. \u041f\u0438\u0448\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443<\/h2>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0438\u0441\u0442\u043e\u0440\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0434\u043b\u044f \u043f\u043e\u0434\u043c\u0435\u043d\u044b \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439. <\/p>\n<pre><code class=\"go\">func (a *App) prepareAPImessages(systemPrompt, userInput string) []Message { messages := make([]Message, 0, len(a.history)+2) \/\/\u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u044c messages = append(messages, Message{Role: \"system\", Content: systemPrompt}) messages = append(messages, a.history...) messages = append(messages, Message{Role: \"user\", Content: userInput}) return messages }<\/code><\/pre>\n<p> \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0433\u043e\u0442\u043e\u0432\u0438\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0432 API \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u044f\u0437\u044b\u043a\u043e\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 (LLM).   <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0447\u0430\u0442:<\/p>\n<pre><code class=\"go\">func (a *App) handleSimpleChat(userInput string) { spiner := ui.StartSpiner(\"Thinking...\")  cleanInput := strings.TrimPrefix(userInput, \"!\") messagesToGenerate := a.prepareAPImessages(simpleChatPromptTemplate, cleanInput)  response, err := a.generateContent(messagesToGenerate) if err != nil { spiner &lt;- true log.Println(ui.ErrorColor(err.Error())) return } spiner &lt;- true        a.history = append(a.history, Message{Role: \"user\", Content: userInput}) a.history = append(a.history, Message{Role: \"assistant\", Content: response}) ui.SimpleResultBox(response) }<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>handleSimpleChat<\/code> \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0432\u0432\u043e\u0434 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0447\u0430\u0442\u0430 (\u0432\u043e\u043f\u0440\u043e\u0441-\u043e\u0442\u0432\u0435\u0442) \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<h4>\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u043e \u0448\u0430\u0433\u0430\u043c:<\/h4>\n<ol>\n<li>\n<p><strong>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0441\u043f\u0438\u043d\u043d\u0435\u0440<\/strong> \u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u044c\u044e &#171;Thinking&#8230;&#187;, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0438\u0434\u0451\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043f\u0440\u043e\u043c\u043f\u0442<\/strong> \u0434\u043b\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438:<\/p>\n<ul>\n<li>\n<p>\u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c <code>simpleChatPromptTemplate<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u043e\u0431\u0449\u0435\u043d\u0438\u044f (<code>a.History<\/code>);<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 (\u0432\u0432\u043e\u0434 \u0431\u0435\u0437 <code>!<\/code> \u0432 \u043d\u0430\u0447\u0430\u043b\u0435).<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <\/strong><code><strong>GenerateContent<\/strong><\/code> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0442 AI.<\/p>\n<\/li>\n<li>\n<p><strong>\u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443<\/strong>, \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u2014 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0435\u0451 \u0432 \u0432\u0438\u0434\u0435 \u043a\u0440\u0430\u0441\u043d\u043e\u0439 \u0440\u0430\u043c\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u041e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0441\u043f\u0438\u043d\u043d\u0435\u0440<\/strong>, \u0435\u0441\u043b\u0438 \u0432\u0441\u0451 \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/strong> \u0432 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u0441\u0442\u043e\u0440\u0438\u044e<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0435\u0447\u0430\u0442\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/strong> \u0432 \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0439 \u0440\u0430\u043c\u043a\u0435.<\/p>\n<\/li>\n<\/ol>\n<p>\u0418\u0442\u043e\u0433: \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0447\u0430\u0442-\u0440\u0435\u0436\u0438\u043c, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0441\u0432\u043e\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 \u0441 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0435\u0439 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u0438 \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u043c \u0432\u044b\u0432\u043e\u0434\u043e\u043c. \u041d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e. <\/p>\n<p>\u0418\u0434\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435. \u0412\u043e\u0442 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u043c \u043a \u0441\u0430\u043c\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0435 \u0430\u0433\u0435\u043d\u0442\u0430. \u041d\u043e \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434. <\/p>\n<pre><code class=\"go\">func (a *App) askForConfirmation(command string) bool { fmt.Print(\"Confirm command? [y\/n]: \", ui.AiColor(command), \"\\n&gt; \") confirmInput, _ := a.reader.ReadString('\\n') confirmInput = strings.ToLower(strings.TrimSpace(confirmInput)) fmt.Print(\"\\033[2A\\033[J\") return confirmInput == \"y\" || confirmInput == \"yes\" }<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>askForConfirmation<\/code> \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <code>true<\/code>, \u0435\u0441\u043b\u0438 \u043e\u0442\u0432\u0435\u0442 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439. \u0422\u0430\u043a \u0436\u0435 \u043e\u043d\u0430 <strong>\u043e\u0447\u0438\u0449\u0430\u0435\u0442 2 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432\u0432\u0435\u0440\u0445<\/strong> (<code>\\033[2A<\/code>) \u0438 <strong>\u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0438\u0445 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435<\/strong> (<code>\\033[J<\/code>), \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0440\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u044b \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u0438\u0437 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430.  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0430\u043c \u0430\u0433\u0435\u043d\u0442. <\/p>\n<pre><code class=\"go\">func (a *App) handleAgentMode(userInput string, autoComplete bool) { attemptHistory := a.prepareAPImessages(commandGenPromptTemplate, userInput) var lastError string for i := 0; i &lt; a.config.Retries; i++ { spiner := ui.StartSpiner(\"Command generation...\") command, err := a.generateContent(attemptHistory) spiner &lt;- true  if err != nil { ui.PrintErrorBox(fmt.Sprintf(\"Command generation error:\\n%v\", err), \"\") return }  cleanCommand := cleanCommand(command) if !autoComplete { if !a.askForConfirmation(cleanCommand) { log.Println(ui.AiColor(\"Command cancelled by user.\")) return } } attemptHistory = append(attemptHistory, Message{Role: \"assistant\", Content: command}) spinerExecution := ui.StartSpiner(\"Command execution...\") commandOutput, err := shell.ExecuteCommand(cleanCommand) spinerExecution &lt;- true  if err == nil { spinnerSummary := ui.StartSpiner(\"Generating summary...\")  summaryPrompt := []Message{ { Role:    \"system\", Content: \"You are an AI agent who short explain the result of executing the command, based on the original user query. NEVER USE SMILEYS.\", }, { Role:    \"user\", Content: fmt.Sprintf(summaryPromptTemplate, userInput, commandOutput), }, } summary, err := a.generateContent(summaryPrompt) spinnerSummary &lt;- true if err != nil { ui.PrintErrorBox(fmt.Sprintf(\"Summary generation error:\\n%v\", err), \"\") return } ui.PrintResultBox(commandOutput, summary) a.history = append(a.history, Message{Role: \"user\", Content: userInput}, Message{Role: \"assistant\", Content: fmt.Sprintf(\"Command: `%s`\\nSummary: %s\", command, summary)}, ) return } lastError = commandOutput errorFeedback := fmt.Sprintf(\"This command did not work. Output was:\\n%s\\nTry another command.\", commandOutput) attemptHistory = append(attemptHistory, Message{Role: \"user\", Content: errorFeedback})  time.Sleep(time.Second) }  spinnerErrorAnalysis := ui.StartSpiner(\"Generating error analysis...\") analysis, err := a.generateContent([]Message{ { Role:    \"system\", Content: \"You are an AI agent who short explain the result of executing the command, based on the original user query. NEVER USE SMILEYS.\", }, { Role:    \"user\", Content: fmt.Sprintf(errorAnalysisPromptTemplate, userInput, lastError), }, }) spinnerErrorAnalysis &lt;- true if err != nil { ui.PrintErrorBox(fmt.Sprintf(\"Error analysis generation error:\\n%v\", err), \"\") return } ui.PrintErrorBox(fmt.Sprintf(\"Failed to execute task after %d attempts.\", a.config.Retries), analysis) }<\/code><\/pre>\n<p>\u0421\u043e\u0433\u043b\u0430\u0441\u0435\u043d, \u043f\u0443\u0433\u0430\u0435\u0442. \u041c\u0435\u0442\u043e\u0434 <code>handleCommandMode<\/code> \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 <strong>\u0440\u0435\u0436\u0438\u043c \u0430\u0433\u0435\u043d\u0442\u0430<\/strong>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043f\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0443, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0435\u0451 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0430\u0432\u0442\u043e\u043a\u043e\u043c\u043f\u043b\u0438\u0442\u0430, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442, \u0430 \u0437\u0430\u0442\u0435\u043c \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043a\u0440\u0430\u0442\u043a\u0438\u0439 \u043e\u0442\u0447\u0451\u0442 \u0438\u043b\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u0438 \u043d\u0435\u0443\u0434\u0430\u0447\u0435.<\/p>\n<h4>\u041f\u043e\u0448\u0430\u0433\u043e\u0432\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430<\/h4>\n<ol>\n<li>\n<p><strong>\u0421\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043a\u043e\u043f\u0438\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439<\/strong> \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0447\u0430\u0442\u0430, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0439 \u0441\u0435\u0441\u0441\u0438\u0438, \u043d\u0435 \u0432\u043b\u0438\u044f\u044f \u043d\u0430 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u0441\u0442\u043e\u0440\u0438\u044e.<\/p>\n<\/li>\n<li>\n<p><strong>\u0417\u0430\u043f\u0443\u0441\u043a \u0434\u043e <\/strong><code><strong>MaxRetries<\/strong><\/code><strong> \u043f\u043e\u043f\u044b\u0442\u043e\u043a<\/strong>:<\/p>\n<ul>\n<li>\n<p><strong>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/strong>: \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u043f\u0440\u043e\u043c\u043f\u0442 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0432\u0432\u043e\u0434\u0430. \u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u043f\u0438\u043d\u043d\u0435\u0440.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435<\/strong>: \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443. \u041f\u0440\u0438 \u043e\u0442\u043a\u0430\u0437\u0435 \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443.<\/p>\n<\/li>\n<li>\n<p><strong>\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/strong>: \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438, \u0441 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0435\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u2014 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f, \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043f\u0430\u0443\u0437\u0430 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u043e\u043f\u044b\u0442\u043a\u0430.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f <strong>\u043a\u0440\u0430\u0442\u043a\u0438\u0439 AI-\u043e\u0442\u0447\u0451\u0442<\/strong> \u043f\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0432\u043e\u0434 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438 \u043e\u0442\u0447\u0451\u0442 \u043a\u0440\u0430\u0441\u0438\u0432\u043e \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 <code>printResultBox<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0440\u0430\u0443\u043d\u0434\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u043e\u0431\u0449\u0443\u044e \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u043b\u0438\u0441\u044c<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f <strong>\u0430\u043d\u0430\u043b\u0438\u0437 \u043e\u0448\u0438\u0431\u043a\u0438<\/strong> (AI \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442, \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c).<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0440\u0430\u0441\u043d\u0430\u044f \u0440\u0430\u043c\u043a\u0430 \u0441 \u0447\u0438\u0441\u043b\u043e\u043c \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u044b\u0445 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u043e\u043c.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h4>\u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 CLI<\/h4>\n<p>\u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u2014 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 CLI-\u0430\u0433\u0435\u043d\u0442\u0430. \u041e\u043d \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0432\u0432\u043e\u0434 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043e\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u043e\u0442\u0447\u0451\u0442\u044b, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044f \u0432\u044b\u0441\u043e\u043a\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0430\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438.<\/p>\n<h2>\u0428\u0430\u0433 7. \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u0441\u0435 \u0432 \u0435\u0434\u0438\u043d\u043e\u0435 \u0446\u0435\u043b\u043e\u0435. <\/h2>\n<p>\u0412\u0441\u0435 \u0441\u0430\u043c\u043e\u0435 \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0437\u0430\u0434\u0438. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0431\u0435\u0440\u0435\u043c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. <\/p>\n<pre><code class=\"go\">func (a *App) promptUser() (string, error) { fmt.Println(\"\u256d\u2500\" + strings.Repeat(\"\u2500\", 66)) color.New(color.FgHiWhite).Print(\"\u2502 &gt; Enter your query: \") userInput, err := a.reader.ReadString('\\n') color.New(color.FgHiWhite).Println(\"\u2570\" + strings.Repeat(\"\u2500\", 65)) if err != nil { return \"\", err } return strings.TrimSpace(userInput), nil }  func (a *App) CleanHistory() { a.history = []Message{ { Role:    \"system\", Content: systemPromptBase + \"\\n\" + shell.GetSystemInfo(), }, } }  func isCommandPrefixed(input string) bool { return strings.HasPrefix(strings.ToLower(strings.TrimSpace(input)), \"!\") }  func (a *App) Run() { ui.PrintHeader()  for { userInput, err := a.promptUser() if err != nil { fmt.Println(\"Error reading input:\", err) continue }  switch userInput { case \"\/exit\": log.Println(ui.AiColor(\"exit\")) return case \"\/clear\": a.CleanHistory() log.Println(ui.SuccessColor(\"History cleared\")) continue case \"\/auto-true\": a.autoComplete = true log.Println(ui.SuccessColor(\"Auto complete enabled\")) continue case \"\/auto-false\": a.autoComplete = false log.Println(ui.SuccessColor(\"Auto complete disabled\")) continue default: if isCommandPrefixed(userInput) { a.handleSimpleChat(userInput) } else { a.handleAgentMode(userInput, a.autoComplete) } }  } }  func main() { cfg, err := config.LoadConfig() if err != nil { log.Fatal(err) }  client := &amp;http.Client{ Timeout: time.Duration(cfg.Timeout) * time.Second, }  defer client.CloseIdleConnections()  agent := app.NewApp(cfg, client) agent.Run() } <\/code><\/pre>\n<h4>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0432\u0432\u043e\u0434\u0430<\/h4>\n<p>\u0412 \u043c\u0435\u0442\u043e\u0434\u0435 <code>Run<\/code> \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u0446\u0438\u043a\u043b CLI-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439:<\/p>\n<ul>\n<li>\n<p>\u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0432\u0432\u043e\u0434 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b (<code>\/exit<\/code>, <code>\/clear<\/code>, <code>\/auto-true<\/code>, <code>\/auto-false<\/code>).<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0432\u0432\u043e\u0434\u0430 \u0440\u0435\u0448\u0430\u0435\u0442, \u043a\u0430\u043a \u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>isCommandPrefixed<\/code>.<\/p>\n<\/li>\n<\/ul>\n<h4>\u0420\u043e\u043b\u044c isCommandPrefixed<\/h4>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>isCommandPrefixed<\/code> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0432\u0432\u043e\u0434 \u0441 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 <code>!<\/code>. \u042d\u0442\u043e\u0442 \u0441\u0438\u043c\u0432\u043e\u043b \u0441\u043b\u0443\u0436\u0438\u0442 \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c <strong>\u0440\u0435\u0436\u0438\u043c\u0430 \u0447\u0430\u0442\u0430 <\/strong> \u2014 \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0445\u043e\u0447\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u043e\u0442 AI \u0431\u0435\u0437 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434 \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435.<\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0432\u043e\u0434 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 <code>!<\/code> \u2014 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0432 <strong>\u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0447\u0430\u0442-\u0440\u0435\u0436\u0438\u043c\u0435<\/strong> (<code>handleSimpleChat<\/code>).<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435\u0442 \u2014 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0440\u0435\u0436\u0438\u043c \u0430\u0433\u0435\u043d\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 <strong>\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435<\/strong> (<code>handleAgentMode<\/code>).<\/p>\n<\/li>\n<\/ul>\n<h4>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/h4>\n<p>\u0418\u0442\u043e\u0433\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439 CLI-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0433\u0434\u0435:<\/p>\n<ul>\n<li>\n<p><code>!\u041a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0443?<\/code> \u2192 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 \u0418\u0418;<\/p>\n<\/li>\n<li>\n<p><code>\u0441\u043e\u0437\u0434\u0430\u0439 \u043c\u043d\u0435 \u043f\u0430\u043f\u043a\u0443 \u043d\u0430 \u0440\u0430\u0431\u043e\u0447\u0435\u043c \u0441\u0442\u043e\u043b\u0435<\/code> \u2192 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u043e\u044f\u0441\u043d\u044f\u0435\u0442\u0441\u044f.<\/p>\n<\/li>\n<\/ul>\n<h2>\u0428\u0430\u0433 7. \u0412\u043e\u0441\u0445\u0438\u0449\u0430\u0435\u043c\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c. <\/h2>\n<p>\u041f\u043e\u0437\u0434\u0440\u0430\u0432\u043b\u044f\u044e, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0438 \u043a\u0440\u0430\u0441\u0438\u0432\u0443\u044e CLI&#8217;\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0434\u0443\u0448\u0435 \u0443\u0434\u043e\u0431\u043d\u043e, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044f \u043d\u043e\u0432\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b. \u041f\u0440\u0438\u0447\u0435\u043c \u0441 \u043d\u0435\u043f\u043b\u043e\u0445\u0438\u043c\u0438 \u0444\u0438\u0448\u043a\u0430\u043c\u0438. \u0423 \u043d\u0430\u0441 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442 \u0441\u0430\u043c\u043e\u0430\u043d\u0430\u043b\u0438\u0437 \u0438 \u0447\u0438\u043d\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0438. \u0427\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u0443\u0447\u0448\u0435? <\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bec\/805\/8d2\/bec8058d2cc0d64ef0d707434a2cedf7.jpg\" width=\"1280\" height=\"750\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/bec\/805\/8d2\/bec8058d2cc0d64ef0d707434a2cedf7.jpg 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bec\/805\/8d2\/bec8058d2cc0d64ef0d707434a2cedf7.jpg 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u044b \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0438 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435. \u0421\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0434\u043d\u044f\u0442\u044c \u0434\u043e\u043a\u0435\u0440 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b, \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043d\u0438\u0445 \u043a\u043e\u0434, \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043d\u043d\u0443 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0432\u0430\u0448\u0435\u043c \u043f\u043a, \u043d\u0430\u0439\u0442\u0438 \u0432\u0441\u044f\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0436\u0440\u0443\u0442 \u043f\u0430\u043c\u044f\u0442\u044c \u0438 \u0442\u0434. <\/p>\n<p>\u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u0448\u043b\u043e \u043a\u0440\u0430\u0439\u043d\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c \u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c. <\/p>\n<p>\u041f\u043e \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u0438 \u0436\u0434\u0443 \u0432\u0430\u0448\u0438\u0445 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432. \u0413\u0443\u0434\u043b\u0430\u043a!<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/926694\/\"> https:\/\/habr.com\/ru\/articles\/926694\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><\/figure>\n<p>\u0412\u0441\u0435 \u0443\u0436\u0435 \u0441\u043b\u044b\u0448\u0430\u043b\u0438 \u043f\u0440\u043e Gemini CLI, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u043c\u043e\u0449\u043d\u043e\u0439 gemini 2.5  \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438. \u042d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u043e, \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439. \u041d\u043e \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u043c \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0430 \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a \u043e\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438\u0437\u043d\u0443\u0442\u0440\u0438? \u0410 \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435\u0442\u0443 VPN \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0433\u0443\u0433\u043b\u0430? \u0418\u043b\u0438, \u0447\u0442\u043e \u0435\u0449\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435, \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439, \u043f\u0443\u0441\u0442\u044c \u0438 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0439, \u0430\u043d\u0430\u043b\u043e\u0433? \u0427\u0435\u043c \u043c\u044b \u0445\u0443\u0436\u0435? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0432\u0435\u0440\u0441\u0442\u0430\u0435\u043c \u0441\u0432\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043d\u0430&#8230; GOLANG?<\/p>\n<p>\u0414\u0430, \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a. \u041c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d-\u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043c\u0435\u043d\u0438\u0442 \u0441\u043e\u0431\u043e\u0439 \u0432\u0441\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 CLI. \u041c\u043e\u044f \u0446\u0435\u043b\u044c \u2014 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442, \u043f\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0440\u0443\u0436\u0438\u0442\u044c Go, \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0438 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u044f\u0437\u044b\u043a\u043e\u0432\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c. <\/p>\n<p>\u041c\u043e\u044f \u0438\u0434\u0435\u044f \u043f\u0440\u043e\u0441\u0442\u0430: \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e CLI-\u0430\u0433\u0435\u043d\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0443\u0448\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a AI \u0437\u0430 \u0441\u043e\u0432\u0435\u0442\u043e\u043c \u0438\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0442\u044c \u044d\u0442\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043d\u0430\u043c \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0430 \u0437\u0430\u0442\u0435\u043c, \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0435\u0451 \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u043e\u0439, AI \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a, \u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u0435. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u044b, \u043d\u043e \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0443\u0442\u0438\u043d\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438, \u043d\u0435 \u0432\u044b\u0445\u043e\u0434\u044f \u0438\u0437 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u043c\u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430\u043c\u0438, \u0431\u0443\u0434\u0443 \u043f\u0440\u0438\u0437\u043d\u0430\u0442\u0435\u043b\u0435\u043d \u0437\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 \u043d\u0430 \u043c\u043e\u0439 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c-\u043a\u0430\u043d\u0430\u043b. \u0422\u0430\u043c \u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u044e \u043f\u043e\u043b\u0435\u0437\u043d\u044be \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b \u043f\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435, \u0440\u0430\u0437\u0431\u043e\u0440\u044b \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0439, \u0441\u043e\u0432\u0435\u0442\u044b \u043a\u0430\u043a \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u043e\u0442\u0431\u043e\u0440\u043d\u044b\u0435 \u043c\u0435\u043c\u044b:\u00a0<a href=\"https:\/\/t.me\/nullPointerDotEXE\" rel=\"noopener noreferrer nofollow\">https:\/\/t.me\/nullPointerDotEXE<\/a>.  <\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>github.com\/fatih\/color<\/code> \u0434\u043b\u044f \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430 \u0438 <code>github.com\/joho\/godotenv<\/code> \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0440\u0430\u0437\u0443 \u0441\u0434\u0435\u043b\u0430\u0439\u0442\u0435 <code>go get github.com\/fatih\/color <\/code> \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 <code>go get github.com\/joho\/godotenv<\/code> .<\/p>\n<p>\u041a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 <a href=\"https:\/\/github.com\/Role1776\/AI_CLI_Agent\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/Role1776\/AI_CLI_Agent<\/a> . \u0411\u0443\u0434\u0443 \u043f\u0440\u0438\u0437\u043d\u0430\u0442\u0435\u043b\u0435\u043d \u0437\u0430 \u0432\u0430\u0448 \u043b\u0430\u0439\u043a. <\/p>\n<h2>\u0428\u0430\u0433 0. \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. <\/h2>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u044c\u0435\u043c \u043a\u043e\u0434 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u043a\u0435\u0442\u043e\u0432. \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043f\u0430\u043f\u043e\u043a \u0438 \u0444\u0430\u0439\u043b\u043e\u0432:<\/p>\n<pre><code>agent\/  \u251c\u2500\u2500 cmd\/ \u2502   \u2514\u2500\u2500 cli_agent\/ \u2502       \u2514\u2500\u2500 main.go      # \u0422\u043e\u0447\u043a\u0430 \u0432\u0445\u043e\u0434\u0430 \u0432 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u251c\u2500\u2500 internal\/ \u2502   \u251c\u2500\u2500 app\/ \u2502   \u2502   \u2514\u2500\u2500 app.go       # \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2502   \u251c\u2500\u2500 config\/ \u2502   \u2502   \u2514\u2500\u2500 config.go    # \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u2502   \u251c\u2500\u2500 shell\/ \u2502   \u2502   \u2514\u2500\u2500 shell.go     # \u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434 \u2502   \u2514\u2500\u2500 ui\/ \u2502       \u2514\u2500\u2500 ui.go        # \u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u251c\u2500\u2500 .env \u251c\u2500\u2500 go.mod \u2514\u2500\u2500 go.sum<\/code><\/pre>\n<p>C\u0438\u043b\u044c\u043d\u043e \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0442\u044c \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443, \u0442\u043a \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u0443 \u043d\u0430 500 \u0441\u0442\u0440\u043e\u0447\u0435\u043a \u043a\u043e\u0434\u0430, \u0430 \u043d\u0435 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0442\u043e\u0440 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043c\u0441\u044f \u0442\u0430\u043a\u0438\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c. <\/p>\n<h2>\u0428\u0430\u0433 1. \u041e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c\u0441\u044f<\/h2>\n<pre><code class=\"go\">var ( successColor = color.New(color.FgGreen).Add(color.Bold).SprintFunc() borderColor  = color.New(color.FgWhite).Add(color.Bold).SprintFunc() labelColor   = color.New(color.FgHiWhite).Add(color.Bold).SprintFunc() aiColor      = color.New(color.FgHiCyan).Add(color.Bold).SprintFunc() errorColor   = color.New(color.FgRed).Add(color.Bold).SprintFunc() ) <\/code><\/pre>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445. \u042d\u0442\u043e \u043d\u0435 \u0431\u043e\u043b\u0435\u0435, \u0447\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u0430. \u041c\u044b \u0436\u0435 \u043f\u0438\u0448\u0435\u043c \u0430\u043d\u0430\u043b\u043e\u0433 gemini, \u0432\u0435\u0434\u044c \u0442\u0430\u043a? \u041d\u0443 \u0432\u043e\u0442 \u0438 \u0442\u0435\u043a\u0441\u0442 \u0431\u0443\u0434\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e\u0436\u0435 \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u043c. <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0443 \u043d\u0430\u0441 \u0438\u0434\u0443\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438. \u041c\u043e\u0434\u0435\u043b\u044c\u043a\u0438 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0435, \u043d\u043e \u043d\u0435 \u0441\u0430\u043c\u044b\u0435 \u0441\u043b\u0430\u0431\u044b\u0435. \u041a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0442\u0443\u0442 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e qwen3 \u043d\u0430 30b \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432. Api \u043a\u043b\u044e\u0447 \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0430 openrouter \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435. <\/p>\n<pre><code class=\"go\">const ( systemPromptBase            = \"System Context:\\n\" simpleChatPromptTemplate    = \"You are an AI agent. Answer the user's question based on the information available. NEVER USE SMILEYS.\" commandGenPromptTemplate    = \"You are an AI agent. Your task is to generate commands based on the user's query. Answer only with the command, without extra words, explanations, and markdown formatting. Only raw command. Never use smileys. Try to generate commands that do not produce very long logs\" errorAnalysisPromptTemplate = \"Analyze the error execution of command and explain simply what went wrong. Original query: '%s'. Error: '%s'\" summaryPromptTemplate       = \"Briefly explain the result of executing the command, based on the original user query. Original query: '%s'. Command output: '%s'\" )<\/code><\/pre>\n<p>\u041d\u0443 \u0442\u0443\u0442 \u0441\u0430\u043c\u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u0442\u0435 \u0442\u0435\u043a\u0441\u0442\u044b. 1 \u043f\u0440\u043e\u043c\u043f\u0442 \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043f\u043a. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0431\u0440\u0430\u0442\u044c, \u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0430 \u043f\u043e\u0434 mac os \u0438\u043b\u0438 linux, \u0442\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u043a\u0435 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e. 2 \u043f\u0440\u043e\u043c\u043f\u0442 \u0434\u043b\u044f \u0440\u0435\u0436\u0438\u043c\u0430 \u0447\u0430\u0442\u0430. 3 \u0434\u043b\u044f \u0430\u0433\u0435\u043d\u0442\u0430. 4 \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043e\u0448\u0438\u0431\u043e\u043a \u0438 5 \u0434\u043b\u044f \u043e\u0442\u0447\u0435\u0442\u043e\u0432. <\/p>\n<p>\u0418\u0434\u0435\u043c \u0434\u0430\u043b\u0435\u0435<\/p>\n<pre><code class=\"go\">type Message struct { Role    string `json:\"role\"` Content string `json:\"content\"` }  type APIRequest struct { Model    string    `json:\"model\"` Messages []Message `json:\"messages\"` }  type APIResponse struct { Choices []Choice `json:\"choices\"` }  type Choice struct { Message ResponseMessage `json:\"message\"` }  type ResponseMessage struct { Content string `json:\"content\"` }  type App struct { client       *http.Client history      []Message autoComplete bool reader       *bufio.Reader config       *config.Config }<\/code><\/pre>\n<p><strong>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043a\u0438 \u0438 \u043a\u043e\u043d\u0444\u0438\u0433.<\/strong> <\/p>\n<p>\u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u0438. \u0412\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 API \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438. \u0410 \u0432\u043e\u0442 app \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0413\u043e\u0440\u043e\u0434\u0438\u0442\u044c DI, \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0438 \u043f\u0440\u043e\u0447\u0438\u0439 \u043e\u0432\u0435\u0440\u0445\u0435\u0434 \u0432 <strong>\u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435<\/strong> \u044f \u043d\u0435 \u0431\u0443\u0434\u0443. \u0421\u0435\u0439\u0447\u0430\u0441 \u0443 \u043d\u0430\u0441 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043b\u0430\u0439\u0442\u043e\u0432\u0430\u044f CLI&#8217;\u043a\u0430 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c. <\/p>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043a\u0443 App \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c. <\/p>\n<pre><code class=\"go\">func NewApp(config *config.Config, client *http.Client) *App { return &amp;App{ client:       client, autoComplete: false, reader:       bufio.NewReader(os.Stdin), config:       config, history: []Message{ { Role:    \"system\", Content: systemPromptBase + \"\\n\" + shell.GetSystemInfo(), }, }, } }<\/code><\/pre>\n<p>\u0418 \u0442\u0430\u043a \u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433:<\/p>\n<pre><code class=\"go\">type Config struct { Model    string ApiUrl   string ApiToken string Timeout  int Retries  int }  func LoadConfig() (*Config, error) { err := godotenv.Load() if err != nil { return nil, err }  retries, err := strconv.Atoi(os.Getenv(\"RETRIES\")) if err != nil { return nil, err }  timeout, err := strconv.Atoi(os.Getenv(\"TIMEOUT\")) if err != nil { return nil, err }  return &amp;Config{ Model:    os.Getenv(\"MODEL\"), ApiUrl:   os.Getenv(\"API_URL\"), ApiToken: os.Getenv(\"API_TOKEN\"), Timeout:  timeout, Retries:  retries, }, nil } <\/code><\/pre>\n<p>\u042d\u0442\u043e \u0441\u0430\u043c\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0438 \u0431\u0430\u0437\u043e\u0432\u0430\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0438\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f. \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 .env \u0444\u0430\u0439\u043b \u0441 \u043f\u043e\u043b\u044f\u043c\u0438:<\/p>\n<pre><code class=\"bash\">MODEL=\"qwen\/qwen3-30b-a3b:free\" API_URL=\"https:\/\/openrouter.ai\/api\/v1\/chat\/completions\" API_TOKEN=\"\u0432\u0430\u0448 \u043a\u043b\u044e\u0447(\u0441\u043c \u043d\u0438\u0436\u0435 \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c)\" RETRIES=3 TIMEOUT=60<\/code><\/pre>\n<h2>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u043a<\/h2>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>getSystemInfo()<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u043a \u044e\u0437\u0435\u0440\u0430. <\/p>\n<pre><code class=\"go\">func GetSystemInfo() string { osName := runtime.GOOS  shell := \"bash\" if osName == \"windows\" { shell = \"PowerShell\" }  currentUser, err := user.Current() username := \"unknown\" if err == nil { username = currentUser.Username }  cwd, err := os.Getwd() if err != nil { cwd = \"unknown\" }  return fmt.Sprintf( \"System Context:\\n- OS: %s\\n- Shell: %s\\n- User: %s\\n- CWD: %s\\n\", osName, shell, username, cwd, ) }<\/code><\/pre>\n<p>\u0418\u0442\u0430\u043a, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c API \u043a\u043b\u044e\u0447. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0430\u044f, \u0442\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u043c\u0435\u043b\u043e \u0448\u0430\u0433 2. <\/p>\n<h2>\u0428\u0430\u0433 2. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c API \u043a\u043b\u044e\u0447 \u0434\u043b\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u043d\u0430 openrouter<\/h2>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u043d\u0430 \u0441\u0430\u0439\u0442 <a href=\"https:\/\/openrouter.ai\/sign-in?redirect_url=https%3A%2F%2Fopenrouter.ai%2Fsettings%2Fkeys\" rel=\"noopener noreferrer nofollow\">\u043e\u043f\u0435\u043d\u0440\u043e\u0443\u0442\u0435\u0440\u0430 <\/a>\u0438 \u0432\u043e\u0439\u0434\u0438\u0442\u0435 \u043b\u044e\u0431\u044b\u043c \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0432\u0435\u0434\u0438\u0442\u0435 \u043a\u0443\u0440\u0441\u043e\u0440 \u043d\u0430 \u0441\u0432\u043e\u044e \u0438\u043a\u043e\u043d\u043a\u0443. \u0422\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u043a\u043b\u0430\u0434\u043a\u0430 &#171;keys&#187;. \u0412\u043e\u0442 \u044d\u0442\u043e \u0432\u043e\u0442 \u0432\u0430\u043c \u0442\u0443\u0434\u0430 \u0432\u043e\u0442. <\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0435 \u043a\u043b\u044e\u0447, \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442\u0435 \u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0435. <\/p>\n<p>\u0421\u043b\u043e\u0436\u043d\u043e? \u041d\u0435 \u0434\u0443\u043c\u0430\u044e. <\/p>\n<h2>\u0428\u0430\u0433 3. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430. <\/h2>\n<p>C\u0435\u0440\u0434\u0446\u0435 \u043d\u0430\u0448\u0435\u0439 \u0443\u0442\u0438\u043b\u0438\u0442\u044b, \u0431\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d\u043e \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0445\u043e\u0442\u044c \u043a\u0430\u043a-\u0442\u043e. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0442\u0438\u043f\u0438\u0447\u043d\u0430\u044f \u0438 \u043f\u0440\u043e\u0441\u0442\u0430\u044f. \u041e\u043d\u0430 \u0434\u0435\u043b\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a API \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0442\u0432\u0435\u0442.  \u042d\u0442\u043e \u044f\u0434\u0440\u043e \u043b\u043e\u0433\u0438\u043a\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c API \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0435\u043a\u0441\u0442\u0430.  <\/p>\n<pre><code class=\"go\">func (a *App) generateContent(messages []Message) (string, error) { reqBody := APIRequest{ Model:    a.config.Model, Messages: messages, }  bodyBytes, err := json.Marshal(reqBody) if err != nil { return \"\", fmt.Errorf(\"error encoding JSON: %w\", err) }  req, err := http.NewRequest(\"POST\", a.config.ApiUrl, bytes.NewBuffer(bodyBytes)) if err != nil { return \"\", fmt.Errorf(\"error creating request: %w\", err) } req.Header.Set(\"Content-Type\", \"application\/json\") req.Header.Set(\"Authorization\", \"Bearer \"+a.config.ApiToken)  resp, err := a.client.Do(req) if err != nil { return \"\", fmt.Errorf(\"error executing request: %w\", err) } defer resp.Body.Close()  respBytes, err := io.ReadAll(resp.Body) if err != nil { return \"\", fmt.Errorf(\"error reading response: %w\", err) }  if resp.StatusCode != http.StatusOK { return \"\", fmt.Errorf(\"API returned error (status %d): %s\", resp.StatusCode, string(respBytes)) } var result APIResponse if err := json.Unmarshal(respBytes, &amp;result); err != nil { return \"\", fmt.Errorf(\"error decoding response: %w\", err) }  if len(result.Choices) &gt; 0 &amp;&amp; result.Choices[0].Message.Content != \"\" { return result.Choices[0].Message.Content, nil } return \"\", fmt.Errorf(\"API did not return content in the response\") }<\/code><\/pre>\n<p>\u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a API \u044f\u0437\u044b\u043a\u043e\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439. \u041e\u043d\u0430 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 <code>App<\/code>, \u0438 \u0435\u0451 \u0446\u0435\u043b\u044c \u2014 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441, \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 API-\u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442 \u0438 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043d\u0442.<\/p>\n<h3>\u041f\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0439 \u0440\u0430\u0437\u0431\u043e\u0440:<\/h3>\n<ol>\n<li>\n<p><strong>\u0424\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0435\u043b\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/strong><br \/> \u0421\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 <code>APIRequest<\/code>, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0430\u044f:<\/p>\n<ul>\n<li>\n<p>\u043c\u043e\u0434\u0435\u043b\u044c, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 (<code>a.config.Model<\/code>)<\/p>\n<\/li>\n<li>\n<p>\u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e (<code>messages<\/code>)<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0432 JSON \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>json.Marshal<\/code>.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u0430<\/strong><br \/> \u0421\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 JSON \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 <code>POST<\/code>-\u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0430\u0434\u0440\u0435\u0441 <code>a.config.ApiUrl<\/code>.<br \/> \u0422\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438:<\/p>\n<ul>\n<li>\n<p><code>Content-Type: application\/json<\/code><\/p>\n<\/li>\n<li>\n<p><code>Authorization: Bearer &lt;\u0442\u043e\u043a\u0435\u043d&gt;<\/code> (\u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a API)<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043e\u0442\u0432\u0435\u0442\u0430<\/strong><br \/> \u0417\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 HTTP-\u043a\u043b\u0438\u0435\u043d\u0442 (<code>a.client.Do(req)<\/code>), \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e:<\/p>\n<ul>\n<li>\n<p>\u0442\u0435\u043b\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>io.ReadAll<\/code><\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430: \u0435\u0441\u043b\u0438 \u043e\u043d \u043d\u0435 <code>200 OK<\/code>, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u0441 \u0442\u0435\u043b\u043e\u043c \u043e\u0442\u0432\u0435\u0442\u0430<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0414\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043e\u0442\u0432\u0435\u0442\u0430<\/strong><br \/> \u0415\u0441\u043b\u0438 \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430 \u2014 200, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0430\u0440\u0441\u0438\u043d\u0433 JSON-\u043e\u0442\u0432\u0435\u0442\u0430 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <code>APIResponse<\/code>. \u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f:<\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u0442\u044c \u043b\u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u0438\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 <code>result.Choices<\/code><\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u0442\u044c \u043b\u0438 \u0442\u0435\u043a\u0441\u0442 \u0432 <code>Choices[0].Message.Content<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u0451 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442.<\/p>\n<\/li>\n<\/ol>\n<h3>\u0427\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f:<\/h3>\n<ul>\n<li>\n<p><strong>\u0423\u0441\u043f\u0435\u0445<\/strong>: \u0442\u0435\u043a\u0441\u0442, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 LLM (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, ChatGPT)<\/p>\n<\/li>\n<li>\n<p><strong><\/strong><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-466704","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/466704","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=466704"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/466704\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=466704"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=466704"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=466704"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}