Project Icon

chatgpt-vscode

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

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


A Visual Studio Code - ChatGPT Integration

Prompt OpenAI's GPT-4, GPT-3.5, GPT-3 and Codex models within Visual Studio Code

This repository is meant for documentation, bug reports and feature requests

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?

⏫ GPT-4o & 2024 Models available
  • 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.
⚡ Generate commit messages functionality added
  • Generate commit messages right within VS Code:

    Genie: Generate commit messages
  • 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

    Genie: submenu
⏫ GPT-4 & GPT-3.5 Turbo models added
  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.
✨ Azure OpenAI Service support & more
  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

    Genie: Azure OpenAI Service setting
  1. Rename and remove your conversations within sidebar
  • You don't need to update the genie.json file to update your conversation's name.

    Genie: Rename conversation
  1. Improved autoscroll behaviour
  • Autoscroll will be disabled if you interrupt the stream
💡 Quick fix problems
  • 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

    Genie: Quick fix
💬 Save your conversations and continue at any time
  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


Genie - ChatGPT Conversation History - Watch Video


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.

    Genie: Conversation History
  • 💡 Quick fix the problems in your code

    Genie: Quick fix
  • ✨ Supports Azure OpenAI Service

    Genie: Azure OpenAI Service setting
  • 🔁 See diff between your code and Genie's suggestion right within editor with one click.

    Genie: Diff
  • 📃 Get streaming answers to your prompt in editor or sidebar conversation.

    Genie: Streaming
  • Customize what you are asking with the selected code. The extension will remember your prompt for subsequent questions.

    Genie: Context menu options
  • Automatic partial code response detection. If AI doesn't finish responding, you will have the option to continue and combine answers

    Genie: Partial response detection
  • Copy or insert the code ChatGPT is suggesting right into your editor.

    Genie: Home page
  • 🍻 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

    Genie: Home page

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:
项目侧边栏1项目侧边栏2
推荐项目
Project Cover

豆包MarsCode

豆包 MarsCode 是一款革命性的编程助手,通过AI技术提供代码补全、单测生成、代码解释和智能问答等功能,支持100+编程语言,与主流编辑器无缝集成,显著提升开发效率和代码质量。

Project Cover

AI写歌

Suno AI是一个革命性的AI音乐创作平台,能在短短30秒内帮助用户创作出一首完整的歌曲。无论是寻找创作灵感还是需要快速制作音乐,Suno AI都是音乐爱好者和专业人士的理想选择。

Project Cover

有言AI

有言平台提供一站式AIGC视频创作解决方案,通过智能技术简化视频制作流程。无论是企业宣传还是个人分享,有言都能帮助用户快速、轻松地制作出专业级别的视频内容。

Project Cover

Kimi

Kimi AI助手提供多语言对话支持,能够阅读和理解用户上传的文件内容,解析网页信息,并结合搜索结果为用户提供详尽的答案。无论是日常咨询还是专业问题,Kimi都能以友好、专业的方式提供帮助。

Project Cover

阿里绘蛙

绘蛙是阿里巴巴集团推出的革命性AI电商营销平台。利用尖端人工智能技术,为商家提供一键生成商品图和营销文案的服务,显著提升内容创作效率和营销效果。适用于淘宝、天猫等电商平台,让商品第一时间被种草。

Project Cover

吐司

探索Tensor.Art平台的独特AI模型,免费访问各种图像生成与AI训练工具,从Stable Diffusion等基础模型开始,轻松实现创新图像生成。体验前沿的AI技术,推动个人和企业的创新发展。

Project Cover

SubCat字幕猫

SubCat字幕猫APP是一款创新的视频播放器,它将改变您观看视频的方式!SubCat结合了先进的人工智能技术,为您提供即时视频字幕翻译,无论是本地视频还是网络流媒体,让您轻松享受各种语言的内容。

Project Cover

美间AI

美间AI创意设计平台,利用前沿AI技术,为设计师和营销人员提供一站式设计解决方案。从智能海报到3D效果图,再到文案生成,美间让创意设计更简单、更高效。

Project Cover

AIWritePaper论文写作

AIWritePaper论文写作是一站式AI论文写作辅助工具,简化了选题、文献检索至论文撰写的整个过程。通过简单设定,平台可快速生成高质量论文大纲和全文,配合图表、参考文献等一应俱全,同时提供开题报告和答辩PPT等增值服务,保障数据安全,有效提升写作效率和论文质量。

投诉举报邮箱: service@vectorlightyear.com
@2024 懂AI·鲁ICP备2024100362号-6·鲁公网安备37021002001498号