[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-Bryley--neoai.nvim":3,"tool-Bryley--neoai.nvim":64},[4,17,27,35,43,56],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":16},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,3,"2026-04-05T11:01:52",[13,14,15],"开发框架","图像","Agent","ready",{"id":18,"name":19,"github_repo":20,"description_zh":21,"stars":22,"difficulty_score":23,"last_commit_at":24,"category_tags":25,"status":16},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",140436,2,"2026-04-05T23:32:43",[13,15,26],"语言模型",{"id":28,"name":29,"github_repo":30,"description_zh":31,"stars":32,"difficulty_score":23,"last_commit_at":33,"category_tags":34,"status":16},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107662,"2026-04-03T11:11:01",[13,14,15],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":23,"last_commit_at":41,"category_tags":42,"status":16},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[13,26],{"id":44,"name":45,"github_repo":46,"description_zh":47,"stars":48,"difficulty_score":23,"last_commit_at":49,"category_tags":50,"status":16},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",84991,"2026-04-05T10:45:23",[14,51,52,53,15,54,26,13,55],"数据工具","视频","插件","其他","音频",{"id":57,"name":58,"github_repo":59,"description_zh":60,"stars":61,"difficulty_score":10,"last_commit_at":62,"category_tags":63,"status":16},3128,"ragflow","infiniflow\u002Fragflow","RAGFlow 是一款领先的开源检索增强生成（RAG）引擎，旨在为大语言模型构建更精准、可靠的上下文层。它巧妙地将前沿的 RAG 技术与智能体（Agent）能力相结合，不仅支持从各类文档中高效提取知识，还能让模型基于这些知识进行逻辑推理和任务执行。\n\n在大模型应用中，幻觉问题和知识滞后是常见痛点。RAGFlow 通过深度解析复杂文档结构（如表格、图表及混合排版），显著提升了信息检索的准确度，从而有效减少模型“胡编乱造”的现象，确保回答既有据可依又具备时效性。其内置的智能体机制更进一步，使系统不仅能回答问题，还能自主规划步骤解决复杂问题。\n\n这款工具特别适合开发者、企业技术团队以及 AI 研究人员使用。无论是希望快速搭建私有知识库问答系统，还是致力于探索大模型在垂直领域落地的创新者，都能从中受益。RAGFlow 提供了可视化的工作流编排界面和灵活的 API 接口，既降低了非算法背景用户的上手门槛，也满足了专业开发者对系统深度定制的需求。作为基于 Apache 2.0 协议开源的项目，它正成为连接通用大模型与行业专有知识之间的重要桥梁。",77062,"2026-04-04T04:44:48",[15,14,13,26,54],{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":69,"readme_en":70,"readme_zh":71,"quickstart_zh":72,"use_case_zh":73,"hero_image_url":74,"owner_login":75,"owner_name":76,"owner_avatar_url":77,"owner_bio":76,"owner_company":76,"owner_location":76,"owner_email":76,"owner_twitter":76,"owner_website":76,"owner_url":78,"languages":79,"stars":88,"forks":89,"last_commit_at":90,"license":91,"difficulty_score":23,"env_os":92,"env_gpu":93,"env_ram":92,"env_deps":94,"category_tags":100,"github_topics":101,"view_count":10,"oss_zip_url":76,"oss_zip_packed_at":76,"status":16,"created_at":111,"updated_at":112,"faqs":113,"releases":144},609,"Bryley\u002Fneoai.nvim","neoai.nvim","Neovim plugin for intracting with GPT models from OpenAI","neoai.nvim 是一款专为 Neovim 用户打造的 AI 辅助插件，将 OpenAI 的 GPT 模型能力直接集成到编辑环境中。许多开发者在使用 AI 时不得不频繁切换浏览器和编辑器，这容易打断编码节奏。neoai.nvim 通过内置的图形界面和多种交互模式，让用户在编写代码的同时就能随时向 AI 提问、生成代码片段或润色文本，无需离开当前工作区。\n\n适合习惯使用 Neovim 进行开发的程序员，尤其是那些追求高效工作流、希望在不中断思路的情况下获得智能提示的开发者。neoai.nvim 的亮点在于支持上下文感知模式，能理解当前代码环境并提供更精准的建议，同时提供专门的快捷键来快速总结文本或生成 Git 提交信息。此外，生成的代码会自动存入寄存器，方便直接粘贴使用。\n\n使用前需配置 OpenAI API Key，并留意账户消费情况。虽然目前处于早期开发阶段，但 neoai.nvim 致力于成为提升编码效率的得力助手，让 AI 真正融入日常开发流程，在保持专注的同时享受智能化带来的便利。","![NeoAI tests](https:\u002F\u002Fgithub.com\u002FBryley\u002Fneoai.nvim\u002Factions\u002Fworkflows\u002Fmain.yml\u002Fbadge.svg)\n# NeoAI\nNeoAI is a Neovim plugin that brings the power of OpenAI's GPT-4 directly to\nyour editor. It helps you generate code, rewrite text, and even get suggestions\nin-context with your code. The plugin is built with a user-friendly interface,\nmaking it easy to interact with the AI and get the assistance you need.\n\n**Note:** This plugin is in early it's early changes and is subject to change.\n\n## Motivation\nThe primary motivation behind this plugin is to provide a seamless integration of AI chat-assistants, like ChatGPT, into your Neovim coding workflow. The goal is to create a tool that works in harmony with you, allowing you to ask questions and receive assistance without disrupting your focus or coding rhythm. Unlike most existing plugins, which tend to prioritize entertainment over productivity, this plugin emphasizes efficiency and utility. By facilitating a smooth and responsive coding experience, it aims to enhance productivity and make coding more enjoyable.\n\n## Installation\nTo install NeoAI, you can use your favorite plugin manager. For example,\nwith vim-plug, add the following line to your `init.vim` or `.vimrc`, note that\nit also requires the [nui](https:\u002F\u002Fgithub.com\u002FMunifTanjim\u002Fnui.nvim) dependency\nand curl installed on the system:\n\n```\nPlug 'MunifTanjim\u002Fnui.nvim'\nPlug 'Bryley\u002Fneoai.nvim'\n```\nThen run `:PlugInstall` to install the plugins.\n\nFor lazy.nvim:\n\n```lua\nreturn {\n    \"Bryley\u002Fneoai.nvim\",\n    dependencies = {\n        \"MunifTanjim\u002Fnui.nvim\",\n    },\n    cmd = {\n        \"NeoAI\",\n        \"NeoAIOpen\",\n        \"NeoAIClose\",\n        \"NeoAIToggle\",\n        \"NeoAIContext\",\n        \"NeoAIContextOpen\",\n        \"NeoAIContextClose\",\n        \"NeoAIInject\",\n        \"NeoAIInjectCode\",\n        \"NeoAIInjectContext\",\n        \"NeoAIInjectContextCode\",\n    },\n    keys = {\n        { \"\u003Cleader>as\", desc = \"summarize text\" },\n        { \"\u003Cleader>ag\", desc = \"generate git message\" },\n    },\n    config = function()\n        require(\"neoai\").setup({\n            -- Options go here\n        })\n    end,\n}\n```\n\nFor packer:\n\n```lua\nuse ({\n    \"Bryley\u002Fneoai.nvim\",\n    require = { \"MunifTanjim\u002Fnui.nvim\" },\n    cmd = {\n        \"NeoAI\",\n        \"NeoAIOpen\",\n        \"NeoAIClose\",\n        \"NeoAIToggle\",\n        \"NeoAIContext\",\n        \"NeoAIContextOpen\",\n        \"NeoAIContextClose\",\n        \"NeoAIInject\",\n        \"NeoAIInjectCode\",\n        \"NeoAIInjectContext\",\n        \"NeoAIInjectContextCode\",\n    },\n    config = function()\n        require(\"neoai\").setup({\n            -- Options go here\n        })\n    end,\n})\n\n\n```\n\n## Showcase and Usage\n\nTo use this plugin make sure you have an OpenAI API key which can be created\n[here](https:\u002F\u002Fplatform.openai.com\u002Faccount\u002Fapi-keys). Save this key in your\nenvironment variables as `OPENAI_API_KEY`.\n\n**IMPORTANT NOTE** : This plugin is not responsible for unintentional purchases\nmade to OpenAI. While using this plugin I would recommend you frequently check\nthe [usage](https:\u002F\u002Fplatform.openai.com\u002Faccount\u002Fusage)\nof your account and\n[setup limits](https:\u002F\u002Fplatform.openai.com\u002Faccount\u002Fbilling\u002Flimits),\nso you don't spend more that you can afford.\n\nThis plugin introduces 3 modes or ways to interact with the AI models.\n\n### Normal GUI Mode\n\nIn the default mode, a GUI opens up on the side using the `:NeoAI` command,\nallowing you to chat with the model. This operation is similar to what you\nget when using it in a browser, but now it's made more convenient by the GUI\nbeing inside your editor.\n\n![Normal Mode GUI](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FBryley_neoai.nvim_readme_3782be0dc6a7.gif)\n\nIn the Prompt Buffer, you can send text by pressing Enter while in insert mode.\nAdditionally, you can insert a newline by using Control Enter. This mapping\ncan be changed in the config.\n\nAlso note that the plugin has a feature where the output from the model\nautomatically gets saved to the `g` register and all code snippets get saved to\nthe `c` register. These can be changed in the config.\n\n### Context Mode\n\nThe Context mode works similarly to the Normal mode. However, you have the\nability to provide additional information about what you want to change. For\ninstance, if you are reading someone else's code and need a description of what\nit does, you can highlight the code in the buffer via the visual mode. Then,\nyou can run `:NeoAIContext` and type something like \"Please explain this code\nfor me\" in the prompt buffer.\n\n![Context Mode GUI](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FBryley_neoai.nvim_readme_eb3abc7227ec.gif)\n\nAdditionally, you can highlight some text and request \"Fix up the punctuation\nand grammar in this text\" to obtain a better version of the text.\n\nNote that if you run the command without any selection then the whole buffer is\npassed in.\n\n### Inject Mode\n\nThe final mode is known as \"inject mode\" by using `:NeoAIInject`. This mode\noperates without the graphical user interface, allowing you to quickly send a\nprompt to the model and have the resulting output automatically inserted below\nyour cursor. All of this can be done without opening the GUI. Additionally,\nthere is a sub-mode within Inject mode that can be executed with context.\n\n![Inject Mode](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FBryley_neoai.nvim_readme_5931758ae6c9.gif)\n\n\n### Shortcuts\n\nOne feature of this plugin is creating shortcuts, which are explained below.\nThe plugin includes two built-in shortcuts; the first one reformats selected\ntext to improve readability, with the default key bind being `\u003Cleader>as` (A\nfor AI and S for summarize).\n\n![Summarize Shortcut](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FBryley_neoai.nvim_readme_3eb6f510ec25.gif)\n\nThe other built-in shortcut is auto generating git commit messages for you:\n\n![Git Commit Message](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FBryley_neoai.nvim_readme_5f987399b579.gif)\n\n**Caution**: Be aware that overusing this feature might lead to an accumulation\nof data sent to the model, which can result in high costs. To avoid this, it\nis recommended that smaller commits be made or the feature be used less\nfrequently. It is imperative to keep track of your usage, which can be\nmonitored through [this link](https:\u002F\u002Fplatform.openai.com\u002Faccount\u002Fusage)\n\n\n## Setup\nTo set up the plugin, add the following code with default values to your `init.lua` (or put\nunder the `config` option if using lazy.nvim or packer.nvim.\n\n```lua\nrequire(\"neoai\").setup({\n    -- Below are the default options, feel free to override what you would like changed\n    ui = {\n        output_popup_text = \"NeoAI\",\n        input_popup_text = \"Prompt\",\n        width = 30, -- As percentage eg. 30%\n        output_popup_height = 80, -- As percentage eg. 80%\n        submit = \"\u003CEnter>\", -- Key binding to submit the prompt\n    },\n    models = {\n        {\n            name = \"openai\",\n            model = \"gpt-3.5-turbo\",\n            params = nil,\n        },\n    },\n    register_output = {\n        [\"g\"] = function(output)\n            return output\n        end,\n        [\"c\"] = require(\"neoai.utils\").extract_code_snippets,\n    },\n    inject = {\n        cutoff_width = 75,\n    },\n    prompts = {\n        context_prompt = function(context)\n            return \"Hey, I'd like to provide some context for future \"\n                .. \"messages. Here is the code\u002Ftext that I want to refer \"\n                .. \"to in our upcoming conversations:\\n\\n\"\n                .. context\n        end,\n    },\n    mappings = {\n        [\"select_up\"] = \"\u003CC-k>\",\n        [\"select_down\"] = \"\u003CC-j>\",\n    },\n    open_ai = {\n        api_key = {\n            env = \"OPENAI_API_KEY\",\n            value = nil,\n            -- `get` is is a function that retrieves an API key, can be used to override the default method.\n            -- get = function() ... end\n\n            -- Here is some code for a function that retrieves an API key. You can use it with\n            -- the Linux 'pass' application.\n            -- get = function()\n            --     local key = vim.fn.system(\"pass show openai\u002Fmytestkey\")\n            --     key = string.gsub(key, \"\\n\", \"\")\n            --     return key\n            -- end,\n        },\n    },\n    shortcuts = {\n        {\n            name = \"textify\",\n            key = \"\u003Cleader>as\",\n            desc = \"fix text with AI\",\n            use_context = true,\n            prompt = [[\n                Please rewrite the text to make it more readable, clear,\n                concise, and fix any grammatical, punctuation, or spelling\n                errors\n            ]],\n            modes = { \"v\" },\n            strip_function = nil,\n        },\n        {\n            name = \"gitcommit\",\n            key = \"\u003Cleader>ag\",\n            desc = \"generate git commit message\",\n            use_context = false,\n            prompt = function()\n                return [[\n                    Using the following git diff generate a consise and\n                    clear git commit message, with a short title summary\n                    that is 75 characters or less:\n                ]] .. vim.fn.system(\"git diff --cached\")\n            end,\n            modes = { \"n\" },\n            strip_function = nil,\n        },\n    },\n})\n```\n\n### Options\nThe setup function accepts a table of options to configure the plugin. The\navailable options are as follows:\n\n### UI Options\n - `output_popup_text`: Header text shown on the output popup window (default: \"NeoAI\").\n - `input_popup_text`: Header text shown on the input popup window (default: \"Prompt\").\n - `width`: Width of the window as a percentage (e.g., 30 = 30%, default: 30).\n - `output_popup_height`: Height of the output popup as a percentage (e.g., 80 = 80%, default: 80).\n - `submit`: Key binding to submit the prompt. If set to \u003CEnter>, \u003CC-Enter> will be mapped to insert a newline. (default: \"\u003CEnter>\").\n\n### Model Options\n - `models`: A list of models to use:\n    - `name`: The name of the model provider (eg. \"openai\")\n    - `model`: Either a string of the model name to use or a list of model names\n    - `params`: A table of parameters to pass into the model (eg. temperature, top_p)\n\n### Register Output\n - `register_output`: A table with a register as the key and a function that takes the raw output from the AI and outputs what you want to save into that register. Example:\n\n```lua\nregister_output = {\n    [\"g\"] = function(output)\n        return output\n    end,\n    [\"c\"] = require(\"neoai.utils\").extract_code_snippets,\n}\n```\n\n### Inject Options\n - `cutoff_width`: When injecting, if the text becomes longer than this value, it should go to a new line. If set to nil, the length is ignored (default: 75).\n\n### Prompt Options\n - `context_prompt`: A function that generates the prompt to be used when using Context modes. Example:\n\n```lua\ncontext_prompt = function(context)\n    return \"Hi ChatGPT, I'd like to provide some context for future \"\n        .. \"messages. Here is the code\u002Ftext that I want to refer \"\n        .. \"to in our upcoming conversations:\\n\\n\"\n        .. context\nend\n```\n\n### OpenAI Options:\n- `open_api_key_env` (deprecated, use `api_key.env` instead): The environment variable containing the OpenAI API key. The default value is \"OPENAI_API_KEY \".\n- `api_key.env`: The environment variable containing the OpenAI API key. The default value is \"OPENAI_API_KEY\".\n- `api_key.value`: The OpenAI API key, which takes precedence over `api_key .env`.\n- `api_key.get`: A function that retrieves the OpenAI API key. For an example implementation, refer to the [Setup](#Setup) section. It has the higher precedence.\n\n### Mappings\n - `mappings`: A table containing the following actions that can be keys:\n\n    - `select_up`: Selects the output window when in the input window\n    - `select_down`: Selects the input window when in the output window\n\nThe value is the keybinding(s) for that actions or `nil` if no action\n\n### Shortcut Options\n - `shortcuts`: An array of shortcuts. Each shortcut is a table containing:\n - `name`: A string. The name of the shortcut, can trigger using :NeoAIShortcut \u003Cname>\n - `key`: The keybind value to listen for or nil if no keybind for the shortcut.\n - `desc` A string or nil. The description of the keybind if any\n - `use_context`: If the context from the selection\u002Fbuffer should be used.\n - `prompt`: The prompt to send or a function to generate the prompt to send.\n - `modes`: A list of modes to set the keybind up for \"n\" for normal, \"v\" for visual.\n - `strip_function`: The strip function to use (optional).\n\n\n## User Commands\n### :NeoAI [prompt]\nSmart toggles the NeoAI window. If the window is closed, it will open and send\nthe optional [prompt]. If the window is open and focused, it will close, finally\nif the window is open but not focused, it will focus the window and send the\noptional [prompt].\n\n### :NeoAIToggle [prompt]\nToggles the NeoAI window. If the window is closed, it will open and send the\noptional [prompt]. If the window is open, it will close.\n\n### :NeoAIOpen [prompt]\nOpens the NeoAI window and sends the optional [prompt].\n\n### :NeoAIClose\nCloses the NeoAI window.\n\n### :NeoAIContext [prompt]\nSmart toggles the NeoAI window with context. If the window is closed, it will\nopen and send the optional [prompt]. If the window is open and focused, it\nwill close, finally if the window is open but not focused, it will focus the\nwindow and send the optional [prompt]. The context used for this command is the\nvisually selected text or the entire buffer if no selection is made.\n\n### :NeoAIContextOpen [prompt]\nOpens the NeoAI window with context and sends the optional [prompt]. The\ncontext used for this command is the visually selected text or the entire\nbuffer if no selection is made.\n\n### :NeoAIContextClose\nCloses the NeoAI window with context.\n\n### :NeoAIInject [prompt]\nSends the [prompt] to the AI and directly injects the AI response into the\nbuffer without opening the NeoAI window.\n\n### :NeoAIInjectCode [prompt]\nSends the [prompt] to the AI and directly injects the AI response into the\nbuffer without opening the NeoAI window. The response will be stripped of\neverything except code snippets.\n\n### :NeoAIInjectContext [prompt]\nSends the [prompt] to the AI with context and directly injects the AI response\ninto the buffer without opening the NeoAI window. The context used for this\ncommand is the visually selected text or the entire buffer if no selection\nis made.\n\n### :NeoAIInjectContextCode [prompt]\nSends the [prompt] to the AI with context and directly injects the AI response\ninto the buffer without opening the NeoAI window. The response will be stripped\nof everything except code snippets. The context used for this command is the\nvisually selected text or the entire buffer if no selection is made.\n\n### :NeoAIShortcut &lt;shortcut&gt;\nTriggers a NeoAI shortcut that is created in the config via it's name instead of\na keybinding.\n\n\n## Roadmap:\n\n- [X] [Issue 1](https:\u002F\u002Fgithub.com\u002FBryley\u002Fneoai.nvim\u002Fissues\u002F1)\n    - [X] Add description option for shortcuts\n    - [X] Have ability to have shortcuts be run via user command instead\n- [ ] Tests (Started)\n- [ ] Multiple chat sessions\n- [ ] Telescope Integration\n- [ ] Switching Models\n- [ ] Better Colours (eg. highlighting user input)\n- [ ] Highlight context when inside NeoAIContext buffer or make context clear\n- [ ] Keymap for replacing context with newly generated code\n- [ ] Support for:\n    - [ ] Amazon CodeWhisperer\n    - [ ] Github Copilot\n- [X] Better error detection\n- [X] Back and forth conversations\n- [X] Context using visual mode\n- [X] Fix when using :q on NeoAI GUI\n- [X] Config\n- [X] Add custom keybinds for context related issues\n- [X] Join undos of inject\n- [X] Inject fix mark sometimes not set inject mode.\n- [X] Inject strip output for code or other.\n    - Make sure to match end of file as well and use for inject mode\n- [X] Context using buffer\n- [X] Strip code from output and put in buffer\n- [X] Add setup config\n- [X] Better way to focus on GUI window\n\n## License\nLicensed under the MIT License. Check the LICENSE file for details.\n","![NeoAI tests](https:\u002F\u002Fgithub.com\u002FBryley\u002Fneoai.nvim\u002Factions\u002Fworkflows\u002Fmain.yml\u002Fbadge.svg)\n# NeoAI\nNeoAI 是一个 Neovim 插件，它将 OpenAI 的 GPT-4 的强大功能直接带入你的编辑器。它帮助你生成代码、重写文本，甚至根据上下文获取建议。该插件构建了用户友好的界面，使得与 AI 交互并获得所需帮助变得容易。\n\n**注意：** 此插件正处于早期变更阶段，并且可能会发生变化。\n\n## 动机\n本插件背后的主要动机是将 AI 聊天助手（如 ChatGPT）无缝集成到你的 Neovim 编码工作流中。目标是创建一个与你和谐工作的工具，让你能够提问并获得帮助，而不会打断你的专注力或编码节奏。与大多数优先考虑娱乐而非生产力的现有插件不同，本插件强调效率和实用性。通过促进流畅且响应迅速的编码体验，旨在提高生产力并使编码更加愉快。\n\n## 安装\n要安装 NeoAI，你可以使用你喜欢的插件管理器。例如，使用 vim-plug，将以下行添加到你的 `init.vim` 或 `.vimrc` 中，注意它也需要在系统上安装 [nui](https:\u002F\u002Fgithub.com\u002FMunifTanjim\u002Fnui.nvim) 依赖和 curl：\n\n```\nPlug 'MunifTanjim\u002Fnui.nvim'\nPlug 'Bryley\u002Fneoai.nvim'\n```\n然后运行 `:PlugInstall` 来安装插件。\n\n对于 lazy.nvim：\n\n```lua\nreturn {\n    \"Bryley\u002Fneoai.nvim\",\n    dependencies = {\n        \"MunifTanjim\u002Fnui.nvim\",\n    },\n    cmd = {\n        \"NeoAI\",\n        \"NeoAIOpen\",\n        \"NeoAIClose\",\n        \"NeoAIToggle\",\n        \"NeoAIContext\",\n        \"NeoAIContextOpen\",\n        \"NeoAIContextClose\",\n        \"NeoAIInject\",\n        \"NeoAIInjectCode\",\n        \"NeoAIInjectContext\",\n        \"NeoAIInjectContextCode\",\n    },\n    keys = {\n        { \"\u003Cleader>as\", desc = \"summarize text\" },\n        { \"\u003Cleader>ag\", desc = \"generate git message\" },\n    },\n    config = function()\n        require(\"neoai\").setup({\n            -- Options go here\n        })\n    end,\n}\n```\n\n对于 packer：\n\n```lua\nuse ({\n    \"Bryley\u002Fneoai.nvim\",\n    require = { \"MunifTanjim\u002Fnui.nvim\" },\n    cmd = {\n        \"NeoAI\",\n        \"NeoAIOpen\",\n        \"NeoAIClose\",\n        \"NeoAIToggle\",\n        \"NeoAIContext\",\n        \"NeoAIContextOpen\",\n        \"NeoAIContextClose\",\n        \"NeoAIInject\",\n        \"NeoAIInjectCode\",\n        \"NeoAIInjectContext\",\n        \"NeoAIInjectContextCode\",\n    },\n    config = function()\n        require(\"neoai\").setup({\n            -- Options go here\n        })\n    end,\n})\n\n\n```\n\n## 展示与使用\n要使用此插件，请确保你拥有 OpenAI API（应用程序编程接口）密钥，可以在 [这里](https:\u002F\u002Fplatform.openai.com\u002Faccount\u002Fapi-keys) 创建。将此密钥保存到你的环境变量 `OPENAI_API_KEY` 中。\n\n**重要提示**：本插件不对意外进行的 OpenAI 购买负责。使用此插件时，我建议你经常检查账户的 [使用情况](https:\u002F\u002Fplatform.openai.com\u002Faccount\u002Fusage) 并 [设置限制](https:\u002F\u002Fplatform.openai.com\u002Faccount\u002Fbilling\u002Flimits)，以免花费超出承受能力的金额。\n\n本插件引入了 3 种模式或与 AI 模型交互的方式。\n\n### 普通 GUI 模式\n在默认模式下，使用 `:NeoAI` 命令会在侧边打开一个 GUI（图形用户界面），允许你与模型聊天。此操作类似于在浏览器中使用时的体验，但现在由于 GUI 位于编辑器内而变得更加方便。\n\n![Normal Mode GUI](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FBryley_neoai.nvim_readme_3782be0dc6a7.gif)\n\n在 Prompt Buffer（提示缓冲区）中，你可以在插入模式下按 Enter 发送文本。此外，可以使用 Control Enter 插入换行符。此映射可以在配置中更改。\n\n另外请注意，该插件有一个功能，即模型的输出会自动保存到 `g` 寄存器，所有代码片段都会保存到 `c` 寄存器。这些可以在配置中更改。\n\n### 上下文模式\n上下文模式的工作原理与普通模式类似。但是，你有能力提供关于你想要更改内容的额外信息。例如，如果你正在阅读他人的代码并需要描述其作用，可以通过 visual 模式（可视模式）高亮显示缓冲区中的代码。然后，运行 `:NeoAIContext` 并在提示缓冲区中输入类似“请为我解释这段代码”的内容。\n\n![Context Mode GUI](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FBryley_neoai.nvim_readme_eb3abc7227ec.gif)\n\n此外，你可以高亮一些文本并要求“修复这段文本的标点和语法”，以获得更好的文本版本。\n\n请注意，如果在不选择任何内容的情况下运行命令，则整个缓冲区将被传递进去。\n\n### 注入模式\n最后一种模式被称为“注入模式”，通过使用 `:NeoAIInject` 启用。此模式在没有图形用户界面的情况下运行，允许你快速向模型发送提示，并将生成的输出自动插入到光标下方。所有这些都可以在不打开 GUI 的情况下完成。此外，注入模式内还有一个可以结合上下文执行的子模式。\n\n![Inject Mode](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FBryley_neoai.nvim_readme_5931758ae6c9.gif)\n\n\n### 快捷键\n本插件的一个功能是创建快捷键，如下所述。该插件包含两个内置快捷键；第一个重新格式化选定的文本以提高可读性，默认键位绑定为 `\u003Cleader>as`（A 代表 AI，S 代表总结）。\n\n![Summarize Shortcut](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FBryley_neoai.nvim_readme_3eb6f510ec25.gif)\n\n另一个内置快捷键是为你自动生成 git 提交信息：\n\n![Git Commit Message](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FBryley_neoai.nvim_readme_5f987399b579.gif)\n\n**警告**：请注意，过度使用此功能可能会导致发送给模型的数据积累，从而导致高昂的费用。为了避免这种情况，建议进行较小的提交或较少频率地使用此功能。跟踪使用情况至关重要，可以通过 [此链接](https:\u002F\u002Fplatform.openai.com\u002Faccount\u002Fusage) 进行监控。\n\n## 设置\n要设置此插件，请将以下代码（使用默认值）添加到你的 `init.lua` 文件中（如果使用 lazy.nvim 或 packer.nvim，请将其放入 `config` 选项下）。\n\n```lua\nrequire(\"neoai\").setup({\n    -- Below are the default options, feel free to override what you would like changed\n    ui = {\n        output_popup_text = \"NeoAI\",\n        input_popup_text = \"Prompt\",\n        width = 30, -- As percentage eg. 30%\n        output_popup_height = 80, -- As percentage eg. 80%\n        submit = \"\u003CEnter>\", -- Key binding to submit the prompt\n    },\n    models = {\n        {\n            name = \"openai\",\n            model = \"gpt-3.5-turbo\",\n            params = nil,\n        },\n    },\n    register_output = {\n        [\"g\"] = function(output)\n            return output\n        end,\n        [\"c\"] = require(\"neoai.utils\").extract_code_snippets,\n    },\n    inject = {\n        cutoff_width = 75,\n    },\n    prompts = {\n        context_prompt = function(context)\n            return \"Hey, I'd like to provide some context for future \"\n                .. \"messages. Here is the code\u002Ftext that I want to refer \"\n                .. \"to in our upcoming conversations:\\n\\n\"\n                .. context\n        end,\n    },\n    mappings = {\n        [\"select_up\"] = \"\u003CC-k>\",\n        [\"select_down\"] = \"\u003CC-j>\",\n    },\n    open_ai = {\n        api_key = {\n            env = \"OPENAI_API_KEY\",\n            value = nil,\n            -- `get` is is a function that retrieves an API key, can be used to override the default method.\n            -- get = function() ... end\n\n            -- Here is some code for a function that retrieves an API key. You can use it with\n            -- the Linux 'pass' application.\n            -- get = function()\n            --     local key = vim.fn.system(\"pass show openai\u002Fmytestkey\")\n            --     key = string.gsub(key, \"\\n\", \"\")\n            --     return key\n            -- end,\n        },\n    },\n    shortcuts = {\n        {\n            name = \"textify\",\n            key = \"\u003Cleader>as\",\n            desc = \"fix text with AI\",\n            use_context = true,\n            prompt = [[\n                Please rewrite the text to make it more readable, clear,\n                concise, and fix any grammatical, punctuation, or spelling\n                errors\n            ]],\n            modes = { \"v\" },\n            strip_function = nil,\n        },\n        {\n            name = \"gitcommit\",\n            key = \"\u003Cleader>ag\",\n            desc = \"generate git commit message\",\n            use_context = false,\n            prompt = function()\n                return [[\n                    Using the following git diff generate a consise and\n                    clear git commit message, with a short title summary\n                    that is 75 characters or less:\n                ]] .. vim.fn.system(\"git diff --cached\")\n            end,\n            modes = { \"n\" },\n            strip_function = nil,\n        },\n    },\n})\n```\n\n### 选项\n设置函数接受一个包含选项的表 (table) 来配置插件。可用选项如下：\n\n### UI (用户界面) 选项\n - `output_popup_text`: 输出弹窗窗口上显示的标题文本（默认：\"NeoAI\"）。\n - `input_popup_text`: 输入弹窗窗口上显示的标题文本（默认：\"Prompt\"）。\n - `width`: 窗口宽度的百分比（例如，30 = 30%，默认：30）。\n - `output_popup_height`: 输出弹窗高度的百分比（例如，80 = 80%，默认：80）。\n - `submit`: 提交提示词的按键绑定。如果设置为 \u003CEnter>，\u003CC-Enter> 将被映射为插入新行。（默认：\"\u003CEnter>\"）。\n\n### 模型选项\n - `models`: 要使用的模型列表：\n    - `name`: 模型提供商的名称（例如：\"openai\"）\n    - `model`: 要使用的模型名称字符串或模型名称列表\n    - `params`: 传递给模型的参数表（例如 temperature, top_p）\n\n### 寄存器输出\n - `register_output`: 一个以寄存器为键的表，以及一个接受 AI 原始输出并决定保存到该寄存器的内容的函数。示例：\n\n```lua\nregister_output = {\n    [\"g\"] = function(output)\n        return output\n    end,\n    [\"c\"] = require(\"neoai.utils\").extract_code_snippets,\n}\n```\n\n### 注入选项\n - `cutoff_width`: 当注入时，如果文本长度超过此值，应换行。如果设置为 nil，则忽略长度（默认：75）。\n\n### 提示词选项\n - `context_prompt`: 一个生成用于上下文模式 (Context modes) 的提示词的函数。示例：\n\n```lua\ncontext_prompt = function(context)\n    return \"Hi ChatGPT, I'd like to provide some context for future \"\n        .. \"messages. Here is the code\u002Ftext that I want to refer \"\n        .. \"to in our upcoming conversations:\\n\\n\"\n        .. context\nend\n```\n\n### OpenAI 选项:\n- `open_api_key_env` (已弃用，请使用 `api_key.env` 代替): 包含 OpenAI API 密钥的环境变量。默认值为 \"OPENAI_API_KEY \"。\n- `api_key.env`: 包含 OpenAI API 密钥的环境变量。默认值为 \"OPENAI_API_KEY\"。\n- `api_key.value`: OpenAI API 密钥，其优先级高于 `api_key .env`。\n- `api_key.get`: 用于检索 OpenAI API 密钥的函数。有关实现示例，请参阅 [设置](#Setup) 部分。它具有更高的优先级。\n\n### 映射\n - `mappings`: 包含以下操作的表，这些操作可以作为键：\n\n    - `select_up`: 在输入窗口中选择输出窗口\n    - `select_down`: 在输出窗口中选择输入窗口\n\n值是这些操作的按键绑定，如果没有操作则为 `nil`\n\n### 快捷方式选项\n - `shortcuts`: 快捷方式数组。每个快捷方式是一个包含以下内容的表：\n - `name`: 字符串。快捷方式的名称，可以使用 :NeoAIShortcut \u003Cname> 触发\n - `key`: 监听的键绑定值，如果快捷方式没有键绑定则为 nil。\n - `desc` 字符串或 nil。按键绑定的描述（如果有）\n - `use_context`: 是否应使用选中\u002F缓冲区的上下文。\n - `prompt`: 要发送的提示词或生成要发送的提示词的函数。\n - `modes`: 设置按键绑定的模式列表，\"n\" 代表正常模式，\"v\" 代表可视模式。\n - `strip_function`: 要使用的剥离函数（可选）。\n\n\n## 用户命令\n### :NeoAI [prompt]\n智能切换 NeoAI 窗口。如果窗口已关闭，它将打开并发送可选的 [prompt]。如果窗口已打开且聚焦，它将关闭。最后，如果窗口已打开但未聚焦，它将聚焦窗口并发送可选的 [prompt]。\n\n### :NeoAIToggle [prompt]\n切换 NeoAI 窗口。如果窗口已关闭，它将打开并发送可选的 [prompt]。如果窗口已打开，它将关闭。\n\n### :NeoAIOpen [prompt]\n打开 NeoAI 窗口并发送可选的 [prompt]。\n\n### :NeoAIClose\n关闭 NeoAI 窗口。\n\n### :NeoAIContext [prompt]\n智能地根据上下文 (context) 切换 NeoAI 窗口。如果窗口关闭，它将打开并发送可选的 [prompt]。如果窗口已打开且聚焦，它将关闭；最后，如果窗口已打开但未聚焦，它将聚焦该窗口并发送可选的 [prompt]。此命令使用的上下文 (context) 是可视模式下选中的文本 (visual mode)，如果没有进行选择，则为整个缓冲区 (buffer)。\n\n### :NeoAIContextOpen [prompt]\n打开带有上下文 (context) 的 NeoAI 窗口并发送可选的 [prompt]。此命令使用的上下文 (context) 是可视模式下选中的文本 (visual mode)，如果没有进行选择，则为整个缓冲区 (buffer)。\n\n### :NeoAIContextClose\n关闭带有上下文 (context) 的 NeoAI 窗口。\n\n### :NeoAIInject [prompt]\n将 [prompt] 发送给 AI，并直接将 AI 响应注入到缓冲区 (buffer) 中，无需打开 NeoAI 窗口。\n\n### :NeoAIInjectCode [prompt]\n将 [prompt] 发送给 AI，并直接将 AI 响应注入到缓冲区 (buffer) 中，无需打开 NeoAI 窗口。响应将被剥离所有非代码片段的内容。\n\n### :NeoAIInjectContext [prompt]\n将 [prompt] 与上下文 (context) 一起发送给 AI，并直接将 AI 响应注入到缓冲区 (buffer) 中，无需打开 NeoAI 窗口。此命令使用的上下文 (context) 是可视模式下选中的文本 (visual mode)，如果没有进行选择，则为整个缓冲区 (buffer)。\n\n### :NeoAIInjectContextCode [prompt]\n将 [prompt] 与上下文 (context) 一起发送给 AI，并直接将 AI 响应注入到缓冲区 (buffer) 中，无需打开 NeoAI 窗口。响应将被剥离所有非代码片段的内容。此命令使用的上下文 (context) 是可视模式下选中的文本 (visual mode)，如果没有进行选择，则为整个缓冲区 (buffer)。\n\n### :NeoAIShortcut &lt;shortcut&gt;\n触发在配置中通过其名称创建的 NeoAI 快捷方式，而不是通过键绑定 (keybinding)。\n\n\n## Roadmap:\n\n- [X] [问题 1](https:\u002F\u002Fgithub.com\u002FBryley\u002Fneoai.nvim\u002Fissues\u002F1)\n    - [X] 为快捷方式添加描述选项\n    - [X] 能够通过用户命令运行快捷方式\n- [ ] 测试 (已开始)\n- [ ] 多个聊天会话\n- [ ] Telescope 集成\n- [ ] 切换模型\n- [ ] 更好的颜色（例如高亮用户输入）\n- [ ] 在 NeoAIContext 缓冲区内部时高亮上下文，或使上下文清晰可见\n- [ ] 用于用新生成的代码替换上下文的键映射\n- [ ] 支持：\n    - [ ] Amazon CodeWhisperer\n    - [ ] Github Copilot\n- [X] 更好的错误检测\n- [X] 来回对话\n- [X] 使用可视模式 (visual mode) 的上下文\n- [X] 修复在 NeoAI 图形用户界面 (GUI) 上使用 :q 的问题\n- [X] 配置\n- [X] 为上下文相关问题添加自定义键绑定\n- [X] 合并注入操作的撤销\n- [X] 修复注入标记有时未设置注入模式的问题。\n- [X] 注入时剥离输出以获取代码或其他内容。\n    - 确保也匹配文件末尾并用于注入模式\n- [X] 使用缓冲区的上下文\n- [X] 从输出中剥离代码并放入缓冲区\n- [X] 添加设置配置\n- [X] 更好地聚焦图形用户界面 (GUI) 窗口的方法\n\n## License\n采用 MIT 许可证授权。有关详细信息，请查看 LICENSE 文件。","# NeoAI Neovim 插件快速上手指南\n\n## 环境准备\n\n在使用 NeoAI 之前，请确保您的开发环境满足以下要求：\n\n*   **Neovim**: 已安装并正常运行。\n*   **系统依赖**: 需要安装 `curl` 工具。\n*   **插件依赖**: 需安装 [`nui.nvim`](https:\u002F\u002Fgithub.com\u002FMunifTanjim\u002Fnui.nvim)。\n*   **OpenAI 账户**: 拥有有效的 OpenAI API Key。\n*   **环境变量**: 将 API Key 保存为系统环境变量 `OPENAI_API_KEY`。\n\n> **注意**: 此插件涉及 API 调用，请注意控制使用成本，建议定期检查 [OpenAI 用量](https:\u002F\u002Fplatform.openai.com\u002Faccount\u002Fusage) 并设置账单限额。\n\n## 安装步骤\n\n您可以根据使用的插件管理器选择相应的配置方式。\n\n### 使用 vim-plug\n\n在 `init.vim` 或 `.vimrc` 中添加以下内容：\n\n```vim\nPlug 'MunifTanjim\u002Fnui.nvim'\nPlug 'Bryley\u002Fneoai.nvim'\n```\n\n然后运行 `:PlugInstall` 进行安装。\n\n### 使用 lazy.nvim\n\n在 `lua\u002Fplugins\u002F` 下的配置文件中添加：\n\n```lua\nreturn {\n    \"Bryley\u002Fneoai.nvim\",\n    dependencies = {\n        \"MunifTanjim\u002Fnui.nvim\",\n    },\n    cmd = {\n        \"NeoAI\",\n        \"NeoAIOpen\",\n        \"NeoAIClose\",\n        \"NeoAIToggle\",\n        \"NeoAIContext\",\n        \"NeoAIContextOpen\",\n        \"NeoAIContextClose\",\n        \"NeoAIInject\",\n        \"NeoAIInjectCode\",\n        \"NeoAIInjectContext\",\n        \"NeoAIInjectContextCode\",\n    },\n    keys = {\n        { \"\u003Cleader>as\", desc = \"summarize text\" },\n        { \"\u003Cleader>ag\", desc = \"generate git message\" },\n    },\n    config = function()\n        require(\"neoai\").setup({\n            -- Options go here\n        })\n    end,\n}\n```\n\n### 使用 packer.nvim\n\n```lua\nuse ({\n    \"Bryley\u002Fneoai.nvim\",\n    require = { \"MunifTanjim\u002Fnui.nvim\" },\n    cmd = {\n        \"NeoAI\",\n        \"NeoAIOpen\",\n        \"NeoAIClose\",\n        \"NeoAIToggle\",\n        \"NeoAIContext\",\n        \"NeoAIContextOpen\",\n        \"NeoAIContextClose\",\n        \"NeoAIInject\",\n        \"NeoAIInjectCode\",\n        \"NeoAIInjectContext\",\n        \"NeoAIInjectContextCode\",\n    },\n    config = function()\n        require(\"neoai\").setup({\n            -- Options go here\n        })\n    end,\n})\n```\n\n## 基本使用\n\n### 初始化配置\n\n在 Neovim 的配置文件（如 `init.lua`）中运行 `setup` 函数以加载默认选项或自定义配置：\n\n```lua\nrequire(\"neoai\").setup({\n    ui = {\n        output_popup_text = \"NeoAI\",\n        input_popup_text = \"Prompt\",\n        width = 30, \n        output_popup_height = 80, \n        submit = \"\u003CEnter>\", \n    },\n    models = {\n        {\n            name = \"openai\",\n            model = \"gpt-3.5-turbo\",\n            params = nil,\n        },\n    },\n    open_ai = {\n        api_key = {\n            env = \"OPENAI_API_KEY\",\n            value = nil,\n        },\n    },\n    -- ... 其他配置项\n})\n```\n\n### 交互模式\n\n插件提供三种主要交互模式：\n\n1.  **Normal GUI Mode (普通模式)**\n    *   命令：`:NeoAI`\n    *   功能：在编辑器侧边打开 GUI 窗口与 AI 聊天，类似浏览器体验。\n    *   输入：按 `Enter` 发送消息，`Ctrl + Enter` 换行。\n\n2.  **Context Mode (上下文模式)**\n    *   命令：`:NeoAIContext`\n    *   功能：选中代码或文本后运行，AI 将基于选中的内容进行解释或修改。\n    *   示例：选中一段代码，输入 \"Please explain this code for me\"。\n\n3.  **Inject Mode (注入模式)**\n    *   命令：`:NeoAIInject`\n    *   功能：无 GUI 界面，直接将 AI 生成的内容插入到光标下方。\n\n### 内置快捷键\n\n插件预设了以下快捷操作（需在配置中启用）：\n\n*   **总结文本**: `\u003Cleader>as` (默认绑定)\n*   **生成 Git Commit Message**: `\u003Cleader>ag` (默认绑定)\n\n### 输出寄存器\n\n模型输出的内容会自动保存到特定寄存器中，方便后续操作：\n*   `g` 寄存器：保存完整输出。\n*   `c` 寄存器：仅保存代码片段。","后端工程师小李正在紧急修复一个 Python 微服务模块，需要快速重构复杂逻辑并编写规范的 Git 提交记录。\n\n### 没有 neoai.nvim 时\n- 需要频繁在浏览器聊天窗口和 Neovim 之间切换，复制粘贴代码极易出错。\n- 向 AI 提问时无法直接关联当前光标处的代码，需手动复制大段逻辑描述背景。\n- 编写 Git 提交信息时必须离开编辑器打开记事本或网页，打断了核心编码流程。\n- 每次交互都要重新输入 API Key 或配置，缺乏持久化的便捷体验。\n- 注意力被分散，难以维持深度工作状态，导致修复 Bug 的时间延长。\n\n### 使用 neoai.nvim 后\n- 通过 `:NeoAI` 命令直接在编辑器侧边栏唤起对话界面，无需切换任何窗口。\n- 利用 Context 模式自动提取当前选区代码作为上下文，AI 理解更加精准到位。\n- 按下快捷键即可生成符合规范的 Git 消息，结果自动存入寄存器方便粘贴。\n- 所有交互均在终端内完成，配合快捷键映射，极大减少了鼠标操作频率。\n- 保持了完整的编码心流，从问题咨询到代码注入一气呵成，效率显著提升。\n\nneoai.nvim 通过将 AI 助手无缝嵌入 Neovim 工作流，让开发者在不离开键盘的情况下获得智能辅助。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FBryley_neoai.nvim_cf9d0e3f.png","Bryley",null,"https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002FBryley_28195215.jpg","https:\u002F\u002Fgithub.com\u002FBryley",[80,84],{"name":81,"color":82,"percentage":83},"Lua","#000080",98.8,{"name":85,"color":86,"percentage":87},"Shell","#89e051",1.2,572,52,"2026-03-20T18:28:14","MIT","未说明","无需本地 GPU，依赖 OpenAI 云端 API",{"notes":95,"python":96,"dependencies":97},"需配置 OPENAI_API_KEY 环境变量；属于 Neovim 插件（基于 Lua），无本地模型推理；需安装 curl 命令；注意 OpenAI API 调用可能产生费用","无需 Python",[98,99],"nui.nvim","curl",[15,26,53],[102,103,104,105,106,107,108,109,110],"chatgpt","gpt","gpt-4","gpt3-turbo","neovim","neovim-plugin","nvim","nvim-plugin","openai","2026-03-27T02:49:30.150509","2026-04-06T08:40:51.907628",[114,119,124,129,134,139],{"id":115,"question_zh":116,"answer_zh":117,"source_url":118},2497,"在 LazyVim 中如何正确配置 OpenAI API Key？","插件建议优先通过环境变量读取密钥以保护安全。默认使用 `OPENAI_API_KEY` 环境变量（例如：`$ OPENAI_API_KEY=***** nvim`）。如果在配置文件中设置，请注意 `open_api_key_env` 选项仅用于指定环境变量名称，而不是直接填入密钥字符串。此外，有用户反馈配置值时不要加双引号，否则可能报错。","https:\u002F\u002Fgithub.com\u002FBryley\u002Fneoai.nvim\u002Fissues\u002F2",{"id":120,"question_zh":121,"answer_zh":122,"source_url":123},2498,"如何在 NeoAI 侧边栏和主编辑器窗口之间切换焦点？","目前主要通过 `:NeoAI` 命令来控制窗口状态。该命令会根据当前光标位置和窗口状态执行不同操作：若窗口未打开则打开并聚焦；若窗口已打开但未聚焦则聚焦窗口；若已在窗口内聚焦则关闭窗口。由于没有默认的快捷键跳转，建议用户根据需求自定义键绑定来调用此命令。","https:\u002F\u002Fgithub.com\u002FBryley\u002Fneoai.nvim\u002Fissues\u002F32",{"id":125,"question_zh":126,"answer_zh":127,"source_url":128},2499,"运行 `:NeoAI` 时报错 \"attempt to index field 'ui'\" 如何解决？","这通常是由于插件加载顺序或包管理器（如 Packer）配置问题导致的。解决方法是在插件配置的 `config` 函数中显式调用 `require(\"neoai\").setup()`。例如：\n```lua\nuse {\n    'Bryley\u002Fneoai.nvim',\n    requires = { \"MunifTanjim\u002Fnui.nvim\" },\n    config = function()\n        require(\"neoai\").setup()\n    end,\n}\n```\n如果不确定是否生效，可添加 `vim.notify(\"Running NeoAI setup!\")` 进行调试。","https:\u002F\u002Fgithub.com\u002FBryley\u002Fneoai.nvim\u002Fissues\u002F11",{"id":130,"question_zh":131,"answer_zh":132,"source_url":133},2500,"关闭 NeoAI 界面后能否保留之前的对话历史？","目前插件不支持保存对话历史。当关闭侧边栏窗口时，当前的上下文记忆会被清除，再次打开时将开始全新的会话。维护者表示计划在未来更新中添加保存和查看过往聊天的功能，但目前无法实现跨会话的记忆保持。","https:\u002F\u002Fgithub.com\u002FBryley\u002Fneoai.nvim\u002Fissues\u002F5",{"id":135,"question_zh":136,"answer_zh":137,"source_url":138},2501,"配置中使用了已弃用的 `open_api_key_env` 选项该怎么办？","`open_api_key_env` 选项已被弃用，官方建议使用 `api_key.env` 替代。该选项用于指定包含 API 密钥的环境变量名（默认为 `OPENAI_API_KEY`）。最新版本的插件已修复了相关的弃用警告，请检查并更新您的配置文件以确保兼容性。","https:\u002F\u002Fgithub.com\u002FBryley\u002Fneoai.nvim\u002Fissues\u002F63",{"id":140,"question_zh":141,"answer_zh":142,"source_url":143},2502,"点击 NeoAI 输出面板区域为什么会报错？","这是一个已知问题，通常与上下文功能或特定发行版（如 LazyVim）的冲突有关。部分用户在纯 Neovim 环境下未遇到此问题。建议尝试在最小化配置下测试以排查冲突。如果错误持续出现（涉及 promise-async），可能需要等待后续修复或调整相关依赖配置。","https:\u002F\u002Fgithub.com\u002FBryley\u002Fneoai.nvim\u002Fissues\u002F7",[]]