chatgpt-vscode

chatgpt-vscode

ChatGPT 集成的 VS Code 智能开发辅助工具

chatgpt-vscode 是一款集成 ChatGPT 的 Visual Studio Code 扩展,支持 OpenAI 的 GPT-4、GPT-3.5 和 Codex 模型。该扩展提供代码生成、错误检测、测试编写和代码优化等功能。它还支持对话历史保存、Azure OpenAI 服务集成、一键式代码修复以及自定义提示词。通过流式对话和便捷的操作,为开发者提供高效的 AI 辅助编程体验。

Visual Studio CodeChatGPTOpenAIAI助手开发工具Github开源项目
<h2 align="center"><img src="https://raw.githubusercontent.com/ai-genie/chatgpt-vscode/main/images/ai-logo.png" height="64"><br>A Visual Studio Code - ChatGPT Integration</h2> <p align="center"><strong>Prompt OpenAI's GPT-4, GPT-3.5, GPT-3 and Codex models within Visual Studio Code</strong></p> <p align="center"><strong>This repository is meant for documentation, bug reports and feature requests</strong></p> <p align="center"> <a href="https://marketplace.visualstudio.com/items?itemName=genieai.chatgpt-vscode" alt="Marketplace version"> <img src="https://img.shields.io/visual-studio-marketplace/v/genieai.chatgpt-vscode?color=orange&label=VS%20Code%20Marketplace" /> </a> <a href="https://marketplace.visualstudio.com/items?itemName=genieai.chatgpt-vscode" alt="Marketplace download count"> <img src="https://img.shields.io/visual-studio-marketplace/d/genieai.chatgpt-vscode?color=blueviolet&label=Downloads" /> </a> <a href="https://github.com/ai-genie/chatgpt-vscode" alt="Github star count"> <img src="https://img.shields.io/github/stars/ai-genie/chatgpt-vscode?color=blue&label=Github%20Stars" /> </a> </p>

Testimonials

❄️ Featured by Snowflake on Medium blogpost

🎌 Blogpost VSCode に ChatGPT の拡張機能を入れてコードレビューやバグを発見してもらう

💙 Reviews on Twitter

❤️ ChatGPT the pair programmer - VS Code on Youtube

💙 Generative AI on LinkedIn

Level up your developer experience with Genie

  • ➕ Use GPT-4o and other improved models via your own OpenAI API Key.
  • ✨ Use your own Azure OpenAI Service deployments
  • ⚡ Generate commit messages from your git changes
  • 💬 Store your conversation history on your disk and continue at any time.
  • 💡 Use Genie in Problems window to explain and suggest fix for compile-time errors.
  • 🔁 See diff between your code and Genie's suggestion right within editor with one click.
  • 👤 Rename and personalize your assistant.
  • 📃 Get streaming answers to your prompt in editor or sidebar conversation.
  • 🔥 Streaming conversation support and stop the response to save your tokens.
  • 📝 Create files or fix your code with one click or with keyboard shortcuts.
  • ➡️ Export all your conversation history at once in Markdown format.

📣 What's new?

<details open> <summary><strong> ⏫ GPT-4o & 2024 Models available</strong></summary>
  • You can now use gpt-4o and other 2024 models with improved maxTokens.
  • New models include: gpt-4o, gpt-4o-2024-05-13, gpt-4-turbo, gpt-4-turbo-2024, gpt-4-turbo-preview, gpt-4-0125-preview
  • Editor View is now fixed and uses your selected model instead of legacy models.
  • Fixed Genie: Generate commit message problems due to vscode updating its APIs.
  • Added new menu item to run Genie: Generate commit message command.
</details> <details open> <summary><strong> ⚡ Generate commit messages functionality added</strong></summary>
  • Generate commit messages right within VS Code:

    <img src="https://raw.githubusercontent.com/ai-genie/chatgpt-vscode/main/images/generate-commit-messages.png" alt="Genie: Generate commit messages" style="max-width: 100%;max-height: 240px;">
  • You can update your commit message prompt from the extension settings. You may also opt-out if you prefer to use other commit message generators.

  • Genie: Generate a commit message command and shortcut supports multi-folder workspaces.

    Misc.

  • Update your generate commit message prompt: genieai.promptPrefix.commit-message

  • Opt-out of the Quick Fix actions setting is added: genieai.quickFix.enable

  • Opt-out of the Generate Commit Message functionality: genieai.enableGenerateCommitMessage

  • All of Genie's context menu items are now wrapped under Genie submenu

    <img src="https://raw.githubusercontent.com/ai-genie/chatgpt-vscode/main/images/genie-submenu.png" alt="Genie: submenu" style="max-width: 100%;max-height: 240px;">
</details> <details open> <summary><strong> ⏫ GPT-4 & GPT-3.5 Turbo models added</strong></summary>
  1. Updated model selection
  • You can now use gpt-4-1106-preview (GPT-4 Turbo) and gpt-3.5-turbo-1106 (GPT-3.5 Turbo) via Genie.
  • New models include: gpt-4-1106-preview, gpt-4-0613, gpt-4-32k-0613, gpt-3.5-turbo-1106, gpt-3.5-turbo-16k, gpt-3.5-turbo-instruct
  • Deprecated gpt-4-0314, gpt-4-32k-0314, gpt-3.5-turbo-0301 in favor of the replacement models.
</details> <details open> <summary><strong> ✨ Azure OpenAI Service support & more</strong></summary>
  1. Azure OpenAI Service
  • You can now use your Azure OpenAI deployments with Genie

  • Set your full Azure OpenAI deployment URL in setting: genieai.azure.url following the instructions mentioned in the setting description

  • Ensure to set the extension's model setting to the right base model you used for Azure deployment

    <img src="https://raw.githubusercontent.com/ai-genie/chatgpt-vscode/main/images/azure-oai.png" alt="Genie: Azure OpenAI Service setting" style="max-width: 100%;max-height: 240px;">
  1. Rename and remove your conversations within sidebar
  • You don't need to update the genie.json file to update your conversation's name.

    <img src="https://raw.githubusercontent.com/ai-genie/chatgpt-vscode/main/images/rename-conversation.png" alt="Genie: Rename conversation" style="max-width: 100%;max-height: 240px;">
  1. Improved autoscroll behaviour
  • Autoscroll will be disabled if you interrupt the stream
</details> <details open> <summary><strong> 💡 Quick fix problems</strong></summary>
  • Ask Genie to quick fix the problems that you see in your code

  • Click on the lightbulb on a code piece where you see underlined error

    <img src="https://raw.githubusercontent.com/ai-genie/chatgpt-vscode/main/images/quick-fix.png" alt="Genie: Quick fix" style="max-width: 100%;max-height: 240px;">
</details> <details open> <summary><strong> 💬 Save your conversations and continue at any time</strong></summary>
  1. Conversation history
  • The goal: Collect feedback and measure the compatibility across different machine, OS setups.
  • We are experimenting a new feature to help you store your conversations in your disk using VS Code global storage API.
  • You need to opt-in to use this feature as this is experimental to collect feedback from the users. Setting name: genieai.enableConversationHistory
  • With this experimental feature, keep in mind this feature has limitations at the moment and may have bugs, use it at your own risk.
  • You may want to remove the stored files manually for privacy from time to time, extension doesn't have any way to modify the files other than writing new threads to files.
  • All conversations start with name 'New chat' and you can change it in genie.json file.
  • The conversations are stored only on your machine, using VS Code's provided global storage API for extensions.
  1. Misc. bug fixes and improvements

Conversation history - Demo


<a href="https://www.loom.com/share/1a57be874e5d4ec099493cc68ed31e04"> <p>Genie - ChatGPT Conversation History - Watch Video</p> <img style="max-width:300px;" src="https://cdn.loom.com/sessions/thumbnails/1a57be874e5d4ec099493cc68ed31e04-with-play.gif"> </a>
</details>

Get Started

Get your API Key from here: OpenAI and see OpenAI official docs for available model details

  1. Simply ask any coding question by selecting a code fragment.
  2. Once asked, provide your API Key.

If you face issues regarding your API Key, see FAQ for details on how to reenter/clear it

Features

The extension comes with context menu commands, copy/move suggested code into editor with one-click, conversation window and customization options for OpenAI's ChatGPT prompts.

We recently introduced Genie to Problems window. You can investigate your compile-time errors asking Genie. Simply click on Lightbulb/suggestion icon to ask Genie to help you. The credits for this idea goes to @cahaseler; if you are interested in seeing his Genie-companion extension visit this issue

  • 💬 Store your conversation history on your disk and continue at any time.

    <img src="https://raw.githubusercontent.com/ai-genie/chatgpt-vscode/main/images/convo-history.png" alt="Genie: Conversation History" style="max-width: 100%;max-height: 480px;">
  • 💡 Quick fix the problems in your code

    <img src="https://raw.githubusercontent.com/ai-genie/chatgpt-vscode/main/images/quick-fix.png" alt="Genie: Quick fix" style="max-width: 100%;max-height: 480px;">
  • ✨ Supports Azure OpenAI Service

    <img src="https://raw.githubusercontent.com/ai-genie/chatgpt-vscode/main/images/azure-oai.png" alt="Genie: Azure OpenAI Service setting" style="max-width: 100%;max-height: 240px;">
  • 🔁 See diff between your code and Genie's suggestion right within editor with one click.

    <img src="https://raw.githubusercontent.com/ai-genie/chatgpt-vscode/main/images/diff.png" alt="Genie: Diff" style="max-width: 100%;max-height: 480px;">
  • 📃 Get streaming answers to your prompt in editor or sidebar conversation.

    <img src="https://raw.githubusercontent.com/ai-genie/chatgpt-vscode/main/images/streaming.png" alt="Genie: Streaming" style="max-width: 100%;max-height: 480px;">
  • Customize what you are asking with the selected code. The extension will remember your prompt for subsequent questions.

    <img src="https://raw.githubusercontent.com/ai-genie/chatgpt-vscode/main/images/context-menu.png" alt="Genie: Context menu options" style="max-width: 100%;max-height: 480px;">
  • Automatic partial code response detection. If AI doesn't finish responding, you will have the option to continue and combine answers

    <img src="https://raw.githubusercontent.com/ai-genie/chatgpt-vscode/main/images/incomplete.png" alt="Genie: Partial response detection" style="max-width: 100%;max-height: 480px;">
  • Copy or insert the code ChatGPT is suggesting right into your editor.

    <img src="https://raw.githubusercontent.com/ai-genie/chatgpt-vscode/main/images/diff-copy-insert.png" alt="Genie: Home page" style="max-width: 100%;max-height: 480px;">
  • 🍻 Optimized for dialogue

  • Edit and resend a previous prompt

  • 📤 Export all your conversation history with one click

  • Ad-hoc prompt prefixes for you to customize what you are asking ChatGPT

    <img src="https://raw.githubusercontent.com/ai-genie/chatgpt-vscode/main/images/home-page.png" alt="Genie: Home page" style="max-width: 100%;max-height: 480px;">

Customization

You may assign a keyboard shortcut to any of the following commands using VS Code's built-in keybindings menu.

  • You can enable/disable all of your context menu items. Simply go to settings and find the prompt that you would like to disable. Custom prompts are hidden by default.
  • Genie: Ad-hoc prompt: Ad-hoc custom prompt prefix for the selected code. Right click on a selected block of code, run command.
    • You will be asked to fill in your preferred custom prefix and the extension will remember that string for your subsequent ad-hoc queries.
  • Genie: Add tests: Write tests for you. Right click on a selected block of code, run command.
    • "default": "Implement tests for the following code",
    • "description": "The prompt prefix used for adding tests for the selected code"
  • Genie: Find bugs: Analyze and find bugs in your code. Right click on a selected block of code, run command.
    • "default": "Find problems with the following code",
    • "description": "The prompt prefix used for finding problems for the selected code"
  • Genie: Optimize: Add suggestions to your code to improve. Right click on a selected block of code, run command.
    • "default": "Optimize the following code",
    • "description": "The prompt prefix used for optimizing the selected code"
  • Genie: Explain: Explain the selected code. Right click on a selected block of code, run command.
    • "default": "Explain the following code",
    • "description": "The prompt prefix used for explaining the selected code"
  • Genie: Add comments: Add comments for the selected code. Right click on a selected block of code, run command.
    • "default": "Add comments for the following code",
    • "description": "The prompt prefix used for adding comments for the selected code"
  • Genie: Custom prompt 1: Your custom prompt 1. It's disabled by default, please set to a custom prompt and enable it if you prefer using customized prompt
    • "default": "",
  • Genie: Custom prompt 2: Your custom prompt 2. It's disabled by default, please set to a custom prompt and enable it if you prefer using customized prompt
    • "default": "",
  • Genie: Generate code: If you select a Codex model (code-*) you will see this option in your context menu. This option will not feed the ChatGPT with any context like the other text completion prompts.

Other available commands

  • Genie: Clear API Key: Clears the API Key from VS Code Secrets Storage
  • Genie: Show conversations: List of conversations that Genie stored after enabling conversation history setting.
  • Genie: What's new: See what is recently released.
  • Genie: Start a new chat: Start a new chat with AI.
  • Genie: Ask anything: Free-form text questions within conversation window.
  • Genie: Reset session: Clears the current session and resets your connection with ChatGPT
  • Genie: Clear conversation: Clears the conversation window and resets the thread to start a new conversation with ChatGPT.
  • Genie: Export conversation: Exports the whole conversation in Markdown for you to easily store and find the Q&A list.
  • Genie: Focus on Genie View: Focuses on Genie window if it was hidden. You can move Genie window to right sidebar or bottom bar by dragging the Genie icon.

Troubleshooting

FAQ

  • For general FAQ please visit OpenAI's own page: https://help.openai.com/en/articles/7039783-chatgpt-api-faq
  • How can I clear or re-enter API key: use Genie: Clear API Key command. Click Commands on the home page to see all commands available. You can also click on Change API Key on the home page.
  • Editor view uses text-davinci-003: It's by design at the moment since it's the only model that can guarantee a code response and the view doesn't need a conversational context. Please follow this issue for details #24
  • Is the ChatGPT API included in the ChatGPT Plus subscription?: No, the ChatGPT API and ChatGPT Plus subscription are billed separately.
  • Can I view the API Key after storing it?: VS Code secrets storage won't allow you to read the API Key after storing it. You may clear or reenter another key if you are facing issues.
  • Does Genie support proxies: See this issue to enable local proxy: https://github.com/ai-genie/chatgpt-vscode/issues/7
  • Usage in Remote environments: See this issue about remote/SSH:

编辑推荐精选

Trae

Trae

字节跳动发布的AI编程神器IDE

Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。

AI工具TraeAI IDE协作生产力转型热门
蛙蛙写作

蛙蛙写作

AI小说写作助手,一站式润色、改写、扩写

蛙蛙写作—国内先进的AI写作平台,涵盖小说、学术、社交媒体等多场景。提供续写、改写、润色等功能,助力创作者高效优化写作流程。界面简洁,功能全面,适合各类写作者提升内容品质和工作效率。

AI辅助写作AI工具蛙蛙写作AI写作工具学术助手办公助手营销助手AI助手
问小白

问小白

全能AI智能助手,随时解答生活与工作的多样问题

问小白,由元石科技研发的AI智能助手,快速准确地解答各种生活和工作问题,包括但不限于搜索、规划和社交互动,帮助用户在日常生活中提高效率,轻松管理个人事务。

热门AI助手AI对话AI工具聊天机器人
Transly

Transly

实时语音翻译/同声传译工具

Transly是一个多场景的AI大语言模型驱动的同声传译、专业翻译助手,它拥有超精准的音频识别翻译能力,几乎零延迟的使用体验和支持多国语言可以让你带它走遍全球,无论你是留学生、商务人士、韩剧美剧爱好者,还是出国游玩、多国会议、跨国追星等等,都可以满足你所有需要同传的场景需求,线上线下通用,扫除语言障碍,让全世界的语言交流不再有国界。

讯飞智文

讯飞智文

一键生成PPT和Word,让学习生活更轻松

讯飞智文是一个利用 AI 技术的项目,能够帮助用户生成 PPT 以及各类文档。无论是商业领域的市场分析报告、年度目标制定,还是学生群体的职业生涯规划、实习避坑指南,亦或是活动策划、旅游攻略等内容,它都能提供支持,帮助用户精准表达,轻松呈现各种信息。

AI办公办公工具AI工具讯飞智文AI在线生成PPTAI撰写助手多语种文档生成AI自动配图热门
讯飞星火

讯飞星火

深度推理能力全新升级,全面对标OpenAI o1

科大讯飞的星火大模型,支持语言理解、知识问答和文本创作等多功能,适用于多种文件和业务场景,提升办公和日常生活的效率。讯飞星火是一个提供丰富智能服务的平台,涵盖科技资讯、图像创作、写作辅助、编程解答、科研文献解读等功能,能为不同需求的用户提供便捷高效的帮助,助力用户轻松获取信息、解决问题,满足多样化使用场景。

热门AI开发模型训练AI工具讯飞星火大模型智能问答内容创作多语种支持智慧生活
Spark-TTS

Spark-TTS

一种基于大语言模型的高效单流解耦语音令牌文本到语音合成模型

Spark-TTS 是一个基于 PyTorch 的开源文本到语音合成项目,由多个知名机构联合参与。该项目提供了高效的 LLM(大语言模型)驱动的语音合成方案,支持语音克隆和语音创建功能,可通过命令行界面(CLI)和 Web UI 两种方式使用。用户可以根据需求调整语音的性别、音高、速度等参数,生成高质量的语音。该项目适用于多种场景,如有声读物制作、智能语音助手开发等。

咔片PPT

咔片PPT

AI助力,做PPT更简单!

咔片是一款轻量化在线演示设计工具,借助 AI 技术,实现从内容生成到智能设计的一站式 PPT 制作服务。支持多种文档格式导入生成 PPT,提供海量模板、智能美化、素材替换等功能,适用于销售、教师、学生等各类人群,能高效制作出高品质 PPT,满足不同场景演示需求。

讯飞绘文

讯飞绘文

选题、配图、成文,一站式创作,让内容运营更高效

讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。

热门AI辅助写作AI工具讯飞绘文内容运营AI创作个性化文章多平台分发AI助手
材料星

材料星

专业的AI公文写作平台,公文写作神器

AI 材料星,专业的 AI 公文写作辅助平台,为体制内工作人员提供高效的公文写作解决方案。拥有海量公文文库、9 大核心 AI 功能,支持 30 + 文稿类型生成,助力快速完成领导讲话、工作总结、述职报告等材料,提升办公效率,是体制打工人的得力写作神器。

下拉加载更多