YooooEX's 101 - 编译 Sweep AI IDEA 插件实现代码补全

2026-04-29 10:042阅读0评论SEO问题
  • 内容介绍
  • 文章标签
  • 相关推荐
问题描述:
TL;DR专用
  • 整个 IDEA
  • 拉插件仓库 sweepai/jetbrains_plugin
  • IDEA 打开仓库, 编译依赖 gradle :buildPlugin
  • build/distributions/找编译产物, 安装插件
  • 模型跑起来 huggingface
  • 打开插件设置, 插件设置 AccountSweep API URL, 本地模式则勾选 Enable Local Autocomplete Server

在对应的地方部署服务

# uvx sweep-autocomplete --help # usage: sweep-autocomplete [-h] [--host HOST] [--port PORT] # Sweep Autocomplete Server # options: # -h, --help show this help message and exit # --host HOST Bind host (default: 0.0.0.0) # --port PORT Bind port (default: 8081) uvx sweep-autocomplete --port 8081

sweep-autocomplete 提供以下环境变量配置:

  • NEXT_EDIT_AUTOCOMPLETE_ENDPOINT: 远端地址(/v1/completions), 填写地址即可, 无需补充路径
  • MODEL_REPO: 远端模型repo(huggingface), 默认为 sweepai/sweep-next-edit-0.5B
  • MODEL_FILENAME: 远端模型文件名称, 默认为 sweep-next-edit-0.5b.q8_0.gguf

在设置了 NEXT_EDIT_AUTOCOMPLETE_ENDPOINT 后, 将忽略本地LLM逻辑(MODEL_REPO/MODEL_FILENAME无效)

前言

discord996×387 24.4 KB

专注 IDEA 系列的插件 Sweep AI 倒了, 虽然推荐了替代FireBender, 但为了补全给9$一个月还是感觉贵, 于是就有了这个记录.

官方在 Github 和 huggingface 上放出了对应的插件仓库和模型, 想着跑一下, 要是效果可以就能放到token上了买号.

准备施法材料

你需要的材料有:

  • IntelliJ IDEA: 用的 2025.3.4

  • 一个能装载模型的环境: 云端或自己电脑跑

    环境配置如下
    spec682×411 15.6 KB

  • 插件仓库: sweepai/jetbrains_plugin

  • 模型: huggingface(用的是sweep-next-edit-1.5B.q8_0,用sweep-next-edit-v2-7B撑不住这么多并发)

编译 IDEA 插件

确认编译环境是否符合要求

plugin-dev-req723×362 12.4 KB

把仓库拉下来, 使用 IDEA 打开

调整 gradle 依赖

build.gradle.kts

... // 插件id, 改id要动逻辑, 懒得动 val pluginId = "dev.sweep.assistant" // 插件名称 val pluginName = "Sweep AI customization by yooooex" // 版本号 version = "1.29.3-yooooex" ... intellijPlatform { ... pluginVerification { // https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#target-platforms // https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-types.html#IntelliJPlatformType ides { select { types.set(listOf(IntelliJPlatformType.WebStorm)) channels.set(listOf(ProductRelease.Channel.RELEASE)) // 最低/最高版本支持 sinceBuild.set("242") untilBuild.set("243.*") } ... select { types.set( listOf( IntelliJPlatformType.IntellijIdeaUltimate, IntelliJPlatformType.IntellijIdeaCommunity, IntelliJPlatformType.GoLand, IntelliJPlatformType.PyCharmCommunity, IntelliJPlatformType.PyCharmProfessional, IntelliJPlatformType.CLion, IntelliJPlatformType.Rider, IntelliJPlatformType.AndroidStudio, IntelliJPlatformType.RustRover, IntelliJPlatformType.RubyMine, IntelliJPlatformType.PhpStorm, ), ) channels.set(listOf(ProductRelease.Channel.RELEASE)) // 最低/最高版本支持 sinceBuild.set("241") untilBuild.set("253.*") } } } } ... dependencies { ... intellijPlatform { // https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html#target-platforms // https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-types.html#IntelliJPlatformType // 使用你的idea版本 intellijIdeaUltimate("2025.3.4") } ... }

编译

调整完配置, 运行 gradle :buildPlugin 编译插件, 产出物位于 build/distributions 下.

部署服务

模型

使用你喜欢的软件跑模型, 这里使用的是LM Studio.

lmstudio749×639 18.6 KB

并发要弄高点, 因为 Next Edit 预测的原因, 编辑文件后的光标移动也会触发请求.

转发服务

在对应的地方部署服务

# uvx sweep-autocomplete --help # usage: sweep-autocomplete [-h] [--host HOST] [--port PORT] # Sweep Autocomplete Server # options: # -h, --help show this help message and exit # --host HOST Bind host (default: 0.0.0.0) # --port PORT Bind port (default: 8081) uvx sweep-autocomplete --port 8081

sweep-autocomplete 提供以下环境变量配置:

  • NEXT_EDIT_AUTOCOMPLETE_ENDPOINT: 远端地址(/v1/completions), 填写地址即可, 无需补充路径
  • MODEL_REPO: 远端模型repo(huggingface), 默认为 sweepai/sweep-next-edit-0.5B
  • MODEL_FILENAME: 远端模型文件名称, 默认为 sweep-next-edit-0.5b.q8_0.gguf

若在本地部署, 根据环境选择合适的模型即可(MODEL_REPO/MODEL_FILENAME).

转发到其他服务时设置 NEXT_EDIT_AUTOCOMPLETE_ENDPOINT .

在设置了 NEXT_EDIT_AUTOCOMPLETE_ENDPOINT 后, 将忽略本地LLM逻辑(MODEL_REPO/MODEL_FILENAME无效)

插件配置

安装

打开要安装插件的 IDE, 在设置中找到插件页, 点击齿轮图标选择 Install Plugin from Disk 安装.

设置

打开插件设置, 插件设置 Account

根据 转发服务 部署的方式, 选择要填写的数据

  • 远端部署: Sweep API URL 填写 URL
  • 本地模式: 勾选 Enable Local Autocomplete Server

完结

没了, 就是这样, 开始用吧. 有用请给我赞求求了

CC BY-NC-SA 4.0 license

网友解答:
--【壹】--:

牛逼,到时候试试,正在找sweep替代,还找不到。


--【贰】--: lRaccoon:

LM加载完模型然后呢

然后就能调了
image1329×798 60.9 KB

lRaccoon:

sweep-autocomplete又是什么

pypi.org

Client Challenge

就是按钮对应的服务, 本地模式用的
不是本地模式就是在服务端部署了这个
image886×472 28.8 KB

lRaccoon:

提供的环境变量又是在哪看的?

溜源码看的
image1920×1050 455 KB


--【叁】--:

跑了个 支持2026.1 的版本。

GitHub

Release 1.29.3.coooolfan · Coooolfan/sweepai_jetbrains_plugin

feat Support IntelliJ IDEA 2026.1 b6d9cc6

试了一下在m4上跑1.5B的版本,不够快+不够聪明 还是需要上7B的版本


--【肆】--:

LM加载完模型然后呢?怎么部署 sweep-autocomplete又是什么 提供的环境变量又是在哪看的?


--【伍】--:

我也试过编译Sweep的这个插件,还用codex修改了一部分代码,接硅基的 FIM 模型。只能说,api整体响应时间都太高了,实际使用体验很差。除非选择自己部署,但问题又来了:硬件去哪儿找


--【陆】--:

佬 不至于吧
最小的0.5b q8量化有个1~2G显存的卡就能跑了