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:

编辑推荐精选

音述AI

音述AI

全球首个AI音乐社区

音述AI是全球首个AI音乐社区,致力让每个人都能用音乐表达自我。音述AI提供零门槛AI创作工具,独创GETI法则帮助用户精准定义音乐风格,AI润色功能支持自动优化作品质感。音述AI支持交流讨论、二次创作与价值变现。针对中文用户的语言习惯与文化背景进行专门优化,支持国风融合、C-pop等本土音乐标签,让技术更好地承载人文表达。

QoderWork

QoderWork

阿里Qoder团队推出的桌面端AI智能体

QoderWork 是阿里推出的本地优先桌面 AI 智能体,适配 macOS14+/Windows10+,以自然语言交互实现文件管理、数据分析、AI 视觉生成、浏览器自动化等办公任务,自主拆解执行复杂工作流,数据本地运行零上传,技能市场可无限扩展,是高效的 Agentic 生产力办公助手。

lynote.ai

lynote.ai

一站式搞定所有学习需求

不再被海量信息淹没,开始真正理解知识。Lynote 可摘要 YouTube 视频、PDF、文章等内容。即时创建笔记,检测 AI 内容并下载资料,将您的学习效率提升 10 倍。

AniShort

AniShort

为AI短剧协作而生

专为AI短剧协作而生的AniShort正式发布,深度重构AI短剧全流程生产模式,整合创意策划、制作执行、实时协作、在线审片、资产复用等全链路功能,独创无限画布、双轨并行工业化工作流与Ani智能体助手,集成多款主流AI大模型,破解素材零散、版本混乱、沟通低效等行业痛点,助力3人团队效率提升800%,打造标准化、可追溯的AI短剧量产体系,是AI短剧团队协同创作、提升制作效率的核心工具。

seedancetwo2.0

seedancetwo2.0

能听懂你表达的视频模型

Seedance two是基于seedance2.0的中国大模型,支持图像、视频、音频、文本四种模态输入,表达方式更丰富,生成也更可控。

nano-banana纳米香蕉中文站

nano-banana纳米香蕉中文站

国内直接访问,限时3折

输入简单文字,生成想要的图片,纳米香蕉中文站基于 Google 模型的 AI 图片生成网站,支持文字生图、图生图。官网价格限时3折活动

扣子-AI办公

扣子-AI办公

职场AI,就用扣子

AI办公助手,复杂任务高效处理。办公效率低?扣子空间AI助手支持播客生成、PPT制作、网页开发及报告写作,覆盖科研、商业、舆情等领域的专家Agent 7x24小时响应,生活工作无缝切换,提升50%效率!

堆友

堆友

多风格AI绘画神器

堆友平台由阿里巴巴设计团队创建,作为一款AI驱动的设计工具,专为设计师提供一站式增长服务。功能覆盖海量3D素材、AI绘画、实时渲染以及专业抠图,显著提升设计品质和效率。平台不仅提供工具,还是一个促进创意交流和个人发展的空间,界面友好,适合所有级别的设计师和创意工作者。

图像生成AI工具AI反应堆AI工具箱AI绘画GOAI艺术字堆友相机AI图像热门
码上飞

码上飞

零代码AI应用开发平台

零代码AI应用开发平台,用户只需一句话简单描述需求,AI能自动生成小程序、APP或H5网页应用,无需编写代码。

Vora

Vora

免费创建高清无水印Sora视频

Vora是一个免费创建高清无水印Sora视频的AI工具

下拉加载更多