# 5分钟搭建本地AI编程助手:Yi-Coder模型与Cursor编辑器整合指南 **Published by:** [wildcard教程](https://paragraph.com/@wildcard-10/) **Published on:** 2025-03-04 **URL:** https://paragraph.com/@wildcard-10/5-ai-yi-coder-cursor ## Content Yi-Coder 是一款开源的高性能代码语言大模型,专为高效编程设计。它支持52种编程语言,擅长处理需要长上下文理解的任务,如项目级代码理解和生成。该模型提供两种参数规模(15亿和90亿),并分为基础版和聊天版。 在本教程中,您将学习如何:使用与OpenAI兼容的API在本地运行Yi-Coder模型将Yi-Coder集成到Cursor编辑器Cursor 是当前最热门的AI代码编辑器之一。它支持使用专门为编码任务训练的大语言模型(如Yi-Coder)来完成编码辅助任务。您可以将Yi-Coder-9B配置为Cursor的私有LLM后端。本地运行Yi-Coder模型要获取Cursor所需的本地Yi-Coder-9B的公共HTTPS端点,请按照以下步骤操作:安装开源Gaia节点——一组轻量且可移植的LLM推理工具。Gaia的技术栈基于WasmEdge,这是一个专为无服务器计算和边缘应用优化的WebAssembly运行时。这种架构使得Yi-Coder能够在不同环境中高效部署,提供灵活性和可扩展性。使用以下命令安装Gaia节点: bash curl -sSfL 'https://github.com/GaiaNet-AI/gaianet-node/releases/latest/download/install.sh' | bash下载并初始化模型: bash gaianet init --config https://raw.githubusercontent.com/GaiaNet-AI/node-configs/main/yi-coder-9b-chat/config.json启动节点: bash gaianet start 启动后,您将获得一个HTTPS URL,例如:https://NODE-ID.us.gaianet.network。您还可以在浏览器中访问 http://localhost:8080 来提问编程相关问题。Yi-Coder运行界面我们以8k上下文窗口启动了Yi-Coder-9B模型。如果您的机器具有较大的GPU内存(例如24GB),则可以将上下文大小增加到128k。较大的上下文大小在编码中特别有用,因为我们需要将大量源代码文件塞入LLM提示中才能完成复杂的任务。将Yi-Coder-9B集成到Cursor接下来,让我们使用在本地运行的Yi-Coder-9B配置Cursor。使用您的Gaia节点URL覆盖Cursor的默认OpenAI URL,并修复模型名称和“API密钥”。现在,您可以开始使用Yi-Coder-9B进行编码任务了!让我们测试Yi-Coder-9B来编写一个简单的搜索页面。生成搜索页面我提示模型生成了一个简单的搜索页面。修改按钮标签然后,我要求Yi-Coder-9B修改按钮上的文字标签。Yi-Coder-9B解释了搜索按钮的工作原理。网页运行效果网页如预期运行! 👉 野卡 WildCard | 一分钟注册,轻松订阅海外线上服务参考资料[1] Yi-Coder: _https://huggingface.co/blog/lorinma/yi-coder_ [2] WasmEdge: _https://github.com/WasmEdge/WasmEdge_ [3] http://localhost:8080: _http://localhost:8080/_ [4] 此处: _https://docs.gaianet.ai/user-guide/apps/cursor/#configure-cursor_ [5] LlamaEdge 文档: _https://llamaedge.com/docs/category/drop-in-replacement-for-openai_ [6] WasmEdge discord: _https://discord.com/invite/U4B5sFTkFc_关于 WasmEdgeWasmEdge 是轻量级、安全、高性能、可扩展、兼容OCI的软件容器与运行环境。目前是 CNCF 沙箱项目。WasmEdge 被应用在 SaaS、云原生,service mesh、边缘计算、边缘云、微服务、流数据处理、LLM 推理等领域。 ## Publication Information - [wildcard教程](https://paragraph.com/@wildcard-10/): Publication homepage - [All Posts](https://paragraph.com/@wildcard-10/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@wildcard-10): Subscribe to updates