AI代码解读助手
这是一个VSCode扩展,允许您在编辑器中直接使用各种大语言模型进行代码解释、注释生成、代码补全等操作。
环境变量配置
为了使用不同平台的大语言模型,本扩展通过环境变量来配置基于Openai SDK的API密钥、基础URL和模型名称。您需要设置以下环境变量:
LLM_API_KEY
- 您的API密钥
LLM_BASE_URL
- API的基础URL
LLM_MODEL_NAME
- 要使用的模型名称
环境变量设置示例
OpenAI
LLM_API_KEY=您的OpenAI API密钥
LLM_BASE_URL=https://api.openai.com/v1
LLM_MODEL_NAME=gpt-4
如何设置环境变量
Windows
在CMD中使用以下命令:
set LLM_API_KEY=您的API密钥
set LLM_BASE_URL=你的api调用url
set LLM_MODEL_NAME=model-name
或者在系统环境变量设置中添加。
macOS/Linux
在终端中使用以下命令:
export LLM_API_KEY="您的API密钥"
export LLM_BASE_URL="https://api.example.com/v1"
export LLM_MODEL_NAME="model-name"
您也可以将这些命令添加到您的 .bashrc
或 .zshrc
文件中以使它们永久生效。
功能说明
本扩展提供以下功能:
常用工具
- 解释代码:分析并解释当前代码的功能和用途
- 生成注释:为代码自动添加注释
- 补全代码:自动完成代码片段并修复问题
- 架构图:生成代码架构的可视化图表
高级工具
- 优化:分析代码性能并提供优化建议
- 重构:提供代码重构建议和实现
- 调试:帮助查找和修复代码中的错误
- 测试:生成适合当前代码的测试用例
- 文档:为代码生成完整的文档
- 代码审查:全面审查代码质量和规范
使用方法
- 确保已设置必要的环境变量
- 打开VSCode并加载此扩展
- 通过命令面板或右键菜单访问扩展功能
- 通过侧边栏的聊天面板与AI助手交互
如果你有任何的问题、遇到bug、或者有新想法、有新功能的需求,可以联系开发者:
邮箱:2953566338@qq.com
AI Code Interpretation Assistant
This is a VSCode extension that allows you to directly use various large language models in the editor for tasks such as code explanation, comment generation, code completion, and more.
Environment Variable Configuration
To use different platforms' large language models, this extension configures the OpenAI SDK-based API key, base URL, and model name via environment variables. You need to set the following environment variables:
LLM_API_KEY
- Your API key
LLM_BASE_URL
- The base URL of the API
LLM_MODEL_NAME
- The model name you want to use
Example of Environment Variable Setup
OpenAI
LLM_API_KEY=您的OpenAI API密钥
LLM_BASE_URL=https://api.openai.com/v1
LLM_MODEL_NAME=gpt-4
How to Set Environment Variables
Windows
Use the following commands in CMD:
set LLM_API_KEY=Your API Key
set LLM_BASE_URL=Your API Base URL
set LLM_MODEL_NAME=model-name
Alternatively, you can add them to the system environment variables.
macOS/Linux
Use the following commands in the terminal:
export LLM_API_KEY="Your API Key"
export LLM_BASE_URL="https://api.example.com/v1"
export LLM_MODEL_NAME="model-name"
Features
This extension provides the following features:
- Code Explanation: Analyze and explain the functionality and purpose of the current code
- Comment Generation: Automatically add comments to the code
- Code Completion: Automatically complete code snippets and fix issues
- Architecture Diagram: Generate visual diagrams of code architecture
- Optimization: Analyze code performance and provide optimization suggestions
- Refactoring: Provide code refactoring suggestions and implementations
- Debugging: Help find and fix errors in the code
- Testing: Generate appropriate test cases for the current code
- Documentation: Generate comprehensive documentation for the code
- Code Review: Conduct thorough code quality and standards review
How to Use
- Ensure that the necessary environment variables are set
- Open VSCode and load this extension
- Access the extension features through the command palette or right-click menu
- Interact with the AI assistant via the chat panel in the sidebar
If you have any questions, encounter bugs, or have new ideas and feature requests, please contact the developer:
Email: 2953566338@qq.com