{"id":663,"date":"2024-03-07T21:28:38","date_gmt":"2024-03-07T13:28:38","guid":{"rendered":"https:\/\/blog.osvlabs.com\/?p=663"},"modified":"2024-03-07T21:45:32","modified_gmt":"2024-03-07T13:45:32","slug":"%e5%9c%a8%e6%9c%ac%e5%9c%b0%e8%bf%90%e8%a1%8ccode-autopilot","status":"publish","type":"post","link":"https:\/\/blog.osvlabs.com\/?p=663","title":{"rendered":"\u5728\u672c\u5730\u8fd0\u884c Code Autopilot"},"content":{"rendered":"<p>\u7b80\u5355\u6574\u7406\u4e00\u4e0b\u5982\u4f55\u4f7f\u7528continue\u6269\u5c55\u914d\u5408ollama\u8ba9VS Code\u652f\u6301\u672c\u5730\u8fd0\u884c\u7684LLM\u5b9e\u73b0AI\u4ee3\u7801\u8865\u5168<\/p>\n<h2>Requirements<\/h2>\n<ul>\n<li>Ollama.ai<\/li>\n<li>continue.dev<\/li>\n<\/ul>\n<h2>\u5728\u672c\u5730\u51c6\u5907LLM\u8fd0\u884c\u73af\u5883<\/h2>\n<h3>Install Ollama<\/h3>\n<h4>On the Mac<\/h4>\n<p>\u4e0b\u8f7d ollama app <a href=\"https:\/\/ollama.com\/download\">https:\/\/ollama.com\/download<\/a> \u8fd0\u884c\u5373\u53ef<\/p>\n<h4>On Linux \/ WSL<\/h4>\n<h5>CPU Only<\/h5>\n<pre><code class=\"language-bash\">docker run -d -v ollama:\/root\/.ollama -p 11434:11434 --name ollama ollama\/ollama<\/code><\/pre>\n<h5>Nvidia GPU<\/h5>\n<p>\u5b89\u88c5 <a href=\"https:\/\/docs.nvidia.com\/datacenter\/cloud-native\/container-toolkit\/latest\/install-guide.html#installation\" title=\"Nvidia container toolkit\">Nvidia container toolkit<\/a><br \/>\nRun Ollama inside a Docker container<\/p>\n<pre><code class=\"language-bash\">docker run -d --gpus=all -v ollama:\/root\/.ollama -p 11434:11434 --name ollama ollama\/ollama<\/code><\/pre>\n<h3>Install LLM Model<\/h3>\n<p>\u8fd9\u91cc\u5b89\u88c5 <a href=\"https:\/\/ollama.com\/library\/starcoder:3b\" title=\"&lt;code&gt;starcoder:3b&lt;\/code&gt;\"><code>starcoder:3b<\/code><\/a><\/p>\n<h4>Mac<\/h4>\n<pre><code class=\"language-bash\">ollama run starcoder:3b<\/code><\/pre>\n<h4>Docker<\/h4>\n<pre><code class=\"language-bash\">docker exec -it ollama ollama run starcoder:3b<\/code><\/pre>\n<p>\u786e\u4fdd\u6a21\u578b\u4e0b\u8f7d\u5b8c\u6210\uff0c\u5e76\u6210\u529f\u542f\u52a8<br \/>\n<img src=\"https:\/\/blog.osvlabs.com\/wp-content\/uploads\/2024\/03\/Pasted-image-20240307210329.png\" alt=\"\" \/><\/p>\n<h2>\u5728VSCode\u5b89\u88c5 continue \u6269\u5c55<\/h2>\n<p>VSCode Extension <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=Continue.continue\">https:\/\/marketplace.visualstudio.com\/items?itemName=Continue.continue<\/a><br \/>\n<img src=\"https:\/\/blog.osvlabs.com\/wp-content\/uploads\/2024\/03\/Pasted-image-20240307205142.png\" alt=\"\" \/><\/p>\n<h3>\u914d\u7f6eTab\u81ea\u52a8\u8865\u5168<\/h3>\n<p>\u5728VS Code\u6269\u5c55\u5b89\u88c5\u540e\uff0c\u8fdb\u5165&quot;Settings&quot; \u70b9\u51fb\u7bad\u5934\u7f16\u8f91settings.json<br \/>\n<img src=\"https:\/\/blog.osvlabs.com\/wp-content\/uploads\/2024\/03\/Pasted-image-20240307205754.png\" alt=\"\" \/><br \/>\n\u5728JSON\u914d\u7f6e\u4e2d\u589e\u52a0 tab auto complete \u914d\u7f6e<\/p>\n<pre><code class=\"language-jsonc\">{\n...\n    &quot;tabAutocompleteModel&quot;: {\n        &quot;title&quot;: &quot;Tab Autocomplete Model&quot;,\n        &quot;provider&quot;: &quot;ollama&quot;,\n        &quot;model&quot;: &quot;starcoder:3b&quot;,\n        &quot;apiBase&quot;: &quot;https:\/\/127.0.0.1:11434&quot; \/\/ ollama api endpoint\n    },\n\n    &quot;tabAutocompleteOptions&quot;: {\n        &quot;useCopyBuffer&quot;: false, \/\/Determines whether the copy buffer will be considered when constructing the prompt. (Boolean)\n        &quot;maxPromptTokens&quot;: 400, \/\/The maximum number of prompt tokens to use. A smaller number will yield faster completions, but less context. (Number)\n        &quot;prefixPercentage&quot;: 0.5 \/\/ The percentage of the input that should be dedicated to the prefix. (Number)\n    },\n    &quot;continue.enableTabAutocomplete&quot;: true\n}<\/code><\/pre>\n<p><img src=\"https:\/\/blog.osvlabs.com\/wp-content\/uploads\/2024\/03\/Pasted-image-20240307210058.png\" alt=\"\" \/><\/p>\n<h2>\u6d4b\u8bd5<\/h2>\n<p>\u4f7f\u7528VS Code\u65b0\u5efa\u4e00\u4e2aPython\uff0c\u8fd9\u91cc\u6211\u4eec\u6dfb\u52a0\u4e00\u4e2a\u6ce8\u91ca\u6765\u83b7\u5f97\u57ce\u5e02\u5929\u6c14\u5e76\u8f93\u51faJSON<br \/>\n<img src=\"https:\/\/blog.osvlabs.com\/wp-content\/uploads\/2024\/03\/Pasted-image-20240307211141.png\" alt=\"\" \/><br \/>\n\u51fa\u73b0\u9884\u89c8\u540e\u53ef\u6572\u51fbTab\u8865\u5168<br \/>\n<img src=\"https:\/\/blog.osvlabs.com\/wp-content\/uploads\/2024\/03\/Pasted-image-20240307211239.png\" alt=\"\" \/><br \/>\n\u9664\u4e86<code>starcoder-3b<\/code>\u5916\uff0c\u8fd8\u53ef\u4ee5\u9009\u62e9 <code>starcoder-1b<\/code> \u6216\u8005 <code>deepseek-1b<\/code> \u8fd9\u79cd\u66f4\u5c0f\u7684\u6a21\u578b\u4ee5\u63d0\u5347\u901f\u5ea6\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7b80\u5355\u6574\u7406\u4e00\u4e0b\u5982\u4f55\u4f7f\u7528continue\u6269\u5c55\u914d\u5408ollama\u8ba9VS Code\u652f\u6301\u672c\u5730\u8fd0\u884c\u7684LLM\u5b9e\u73b0AI\u4ee3\u7801\u8865\u5168 Requirements Ollama.ai continue.dev \u5728\u672c\u5730\u51c6\u5907LLM\u8fd0\u2026<\/p>\n","protected":false},"author":12,"featured_media":665,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[16,18,17],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":5}},"_links":{"self":[{"href":"https:\/\/blog.osvlabs.com\/index.php?rest_route=\/wp\/v2\/posts\/663"}],"collection":[{"href":"https:\/\/blog.osvlabs.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.osvlabs.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.osvlabs.com\/index.php?rest_route=\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.osvlabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=663"}],"version-history":[{"count":5,"href":"https:\/\/blog.osvlabs.com\/index.php?rest_route=\/wp\/v2\/posts\/663\/revisions"}],"predecessor-version":[{"id":674,"href":"https:\/\/blog.osvlabs.com\/index.php?rest_route=\/wp\/v2\/posts\/663\/revisions\/674"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.osvlabs.com\/index.php?rest_route=\/wp\/v2\/media\/665"}],"wp:attachment":[{"href":"https:\/\/blog.osvlabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=663"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.osvlabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=663"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.osvlabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=663"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}