Skip to content

Commit

Permalink
feat: support add desc when code convert to custom language, add cach…
Browse files Browse the repository at this point in the history
…e for some ai request
  • Loading branch information
2214962083 committed Jul 23, 2024
1 parent 3f867ae commit 227d2ab
Show file tree
Hide file tree
Showing 17 changed files with 776 additions and 370 deletions.
2 changes: 0 additions & 2 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm exec commitlint --edit ${1}
2 changes: 0 additions & 2 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm run test
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
// "--disable-extensions"
"--extensionDevelopmentPath=${workspaceFolder}",
"--disable-extensions"
],
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"preLaunchTask": "npm: watch",
Expand Down
98 changes: 49 additions & 49 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,29 +136,43 @@
"configuration": {
"title": "%config.title%",
"properties": {
"aide.aiPrompt": {
"aide.openaiKey": {
"type": "string",
"default": "#{content}",
"scope": "resource",
"description": "%config.aiPrompt.description%"
"default": "",
"markdownDescription": "%config.openaiKey.description%"
},
"aide.aiCommand": {
"aide.openaiModel": {
"type": "string",
"default": "",
"default": "gpt-4o",
"markdownDescription": "%config.openaiModel.description%"
},
"aide.openaiBaseUrl": {
"type": "string",
"default": "https://api.openai.com/v1",
"markdownDescription": "%config.openaiBaseUrl.description%"
},
"aide.codeViewerHelperPrompt": {
"type": "string",
"default": "You are a programming language commentator.\nYou need to help me add comments to #{sourceLanguage} code as much as possible to make it readable for beginners.\nDo not change the original code, just add as detailed comments as possible,\nbecause my purpose is only to understand and read. Please use my native language #{locale} as the commenting language.\nPlease do not reply with any text other than the code, and do not use markdown syntax.\nHere is the code you need to comment on:\n\n#{content}",
"scope": "resource",
"description": "%config.aiCommand.description%"
"markdownDescription": "%config.codeViewerHelperPrompt.description%"
},
"aide.aiCommandCopyBeforeRun": {
"type": "boolean",
"default": true,
"aide.convertLanguagePairs": {
"type": "object",
"default": {},
"scope": "resource",
"description": "%config.aiCommandCopyBeforeRun.description%"
"markdownDescription": "%config.convertLanguagePairs.description%"
},
"aide.respectGitIgnore": {
"aide.autoRememberConvertLanguagePairs": {
"type": "boolean",
"default": true,
"markdownDescription": "%config.autoRememberConvertLanguagePairs.description%"
},
"aide.aiPrompt": {
"type": "string",
"default": "#{content}",
"scope": "resource",
"description": "%config.respectGitIgnore.description%"
"markdownDescription": "%config.aiPrompt.description%"
},
"aide.ignorePatterns": {
"type": "array",
Expand All @@ -177,39 +191,25 @@
"**/.parcel-cache/**"
],
"scope": "resource",
"description": "%config.ignorePatterns.description%"
"markdownDescription": "%config.ignorePatterns.description%"
},
"aide.autoRememberConvertLanguagePairs": {
"aide.respectGitIgnore": {
"type": "boolean",
"default": true,
"description": "%config.autoRememberConvertLanguagePairs.description%"
},
"aide.convertLanguagePairs": {
"type": "object",
"default": {},
"scope": "resource",
"description": "%config.convertLanguagePairs.description%"
"markdownDescription": "%config.respectGitIgnore.description%"
},
"aide.codeViewerHelperPrompt": {
"type": "string",
"default": "You are a programming language commentator.\nYou need to help me add comments to #{sourceLanguage} code as much as possible to make it readable for beginners.\nDo not change the original code, just add as detailed comments as possible,\nbecause my purpose is only to understand and read. Please use my native language #{locale} as the commenting language.\nPlease do not reply with any text other than the code, and do not use markdown syntax.\nHere is the code you need to comment on:\n\n#{content}",
"scope": "resource",
"description": "%config.codeViewerHelperPrompt.description%"
},
"aide.openaiKey": {
"aide.aiCommand": {
"type": "string",
"default": "",
"description": "%config.openaiKey.description%"
},
"aide.openaiBaseUrl": {
"type": "string",
"default": "https://api.openai.com/v1",
"description": "%config.openaiBaseUrl.description%"
"scope": "resource",
"markdownDescription": "%config.aiCommand.description%"
},
"aide.openaiModel": {
"type": "string",
"default": "gpt-4o",
"description": "%config.openaiModel.description%"
"aide.aiCommandCopyBeforeRun": {
"type": "boolean",
"default": true,
"scope": "resource",
"markdownDescription": "%config.aiCommandCopyBeforeRun.description%"
}
}
}
Expand All @@ -236,16 +236,16 @@
"@commitlint/cz-commitlint": "^19.2.0",
"@ianvs/prettier-plugin-sort-imports": "^4.3.1",
"@langchain/anthropic": "^0.2.6",
"@langchain/core": "0.2.17",
"@langchain/core": "0.2.18",
"@langchain/openai": "^0.2.4",
"@types/fs-extra": "^11.0.4",
"@types/global-agent": "^2.1.3",
"@types/node": "^20.14.11",
"@types/shell-quote": "^1.7.5",
"@types/vscode": "1.82.0",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
"@vscode/vsce": "^2.31.0",
"@typescript-eslint/eslint-plugin": "^7.17.0",
"@typescript-eslint/parser": "^7.17.0",
"@vscode/vsce": "^2.31.1",
"commitizen": "^4.3.0",
"dotenv": "^16.4.5",
"eslint": "^8.57.0",
Expand All @@ -264,27 +264,27 @@
"fs-extra": "^11.2.0",
"glob": "^10.4.3",
"global-agent": "^3.0.0",
"husky": "^9.1.0",
"husky": "^9.1.1",
"ignore": "^5.3.1",
"inquirer": "^9.3.4",
"knip": "^5.26.0",
"knip": "^5.27.0",
"langchain": "^0.2.10",
"lint-staged": "^15.2.7",
"minimatch": "^9.0.5",
"pnpm": "^9.5.0",
"pnpm": "^9.6.0",
"prettier": "^3.3.3",
"rimraf": "^6.0.1",
"shell-quote": "^1.8.1",
"tsup": "^8.1.2",
"tsup": "^8.2.2",
"typescript": "5.4.5",
"undici": "^6.19.2",
"undici": "^6.19.4",
"vite": "^5.3.4",
"vitest": "^2.0.3",
"vitest": "^2.0.4",
"zod": "^3.23.8"
},
"pnpm": {
"overrides": {
"@langchain/core": "0.2.17"
"@langchain/core": "0.2.18"
}
},
"commitlint": {
Expand Down
23 changes: 12 additions & 11 deletions package.nls.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
"command.renameVariable": "✨ Aide: Rename Variable",
"command.smartPaste": "✨ Aide: Smart Paste",
"config.title": "Aide Configuration",
"config.aiPrompt.description": "Template for copied content, use #{content} as a placeholder for file content",
"config.aiCommand.description": "Custom AI command template. Available variables: #{filesRelativePath}, #{filesFullPath}, #{content}",
"config.aiCommandCopyBeforeRun.description": "Copy AI command to clipboard before running",
"config.ignorePatterns.description": "Ignored file name patterns, supports glob syntax",
"config.respectGitIgnore.description": "Respect .gitignore file",
"config.autoRememberConvertLanguagePairs.description": "Automatically remember convert language pairs",
"config.convertLanguagePairs.description": "Default convert language pairs",
"config.codeViewerHelperPrompt.description": "Code viewer helper prompt template",
"config.openaiKey.description": "OpenAI Key",
"config.openaiBaseUrl.description": "OpenAI Base URL",
"config.openaiModel.description": "OpenAI Model",
"config.openaiKey.description": "OpenAI Key, [click to view online documentation](https://aide.nicepkg.cn/guide/configuration/openai-key)",
"config.openaiModel.description": "OpenAI Model, [click to view online documentation](https://aide.nicepkg.cn/guide/configuration/openai-model)",
"config.openaiBaseUrl.description": "OpenAI Base URL, [click to view online documentation](https://aide.nicepkg.cn/guide/configuration/openai-base-url)",
"config.codeViewerHelperPrompt.description": "Code viewer helper prompt template, [click to view online documentation](https://aide.nicepkg.cn/guide/configuration/code-viewer-helper-prompt)",
"config.convertLanguagePairs.description": "Default convert language pairs, [click to view online documentation](https://aide.nicepkg.cn/guide/configuration/convert-language-pairs)",
"config.autoRememberConvertLanguagePairs.description": "Automatically remember convert language pairs, [click to view online documentation](https://aide.nicepkg.cn/guide/configuration/auto-remember-convert-language-pairs)",
"config.aiPrompt.description": "Template for copied content, use #{content} as a placeholder for file content, [click to view online documentation](https://aide.nicepkg.cn/guide/configuration/ai-prompt)",
"config.ignorePatterns.description": "Ignored file name patterns, supports glob syntax, [click to view online documentation](https://aide.nicepkg.cn/guide/configuration/ignore-patterns)",
"config.respectGitIgnore.description": "Respect .gitignore file, [click to view online documentation](https://aide.nicepkg.cn/guide/configuration/respect-git-ignore)",
"config.aiCommand.description": "Custom AI command template. Available variables: #{filesRelativePath}, #{filesFullPath}, #{content}, [click to view online documentation](https://aide.nicepkg.cn/guide/configuration/ai-command)",
"config.aiCommandCopyBeforeRun.description": "Copy AI command to clipboard before running, [click to view online documentation](https://aide.nicepkg.cn/guide/configuration/ai-command-copy-before-run)",
"error.noWorkspace": "Unable to determine workspace folder",
"error.invalidConfigKey": "Invalid configuration key",
"error.invalidConfigValueType": "Invalid configuration value type",
Expand All @@ -32,6 +32,7 @@
"error.noActiveEditor": "No file is currently open",
"error.noTargetLanguage": "No target language selected",
"error.noContext": "Context not initialized",
"error.emptyClipboard": "Clipboard is empty",
"info.copied": "File contents have been copied to clipboard",
"info.customLanguage": "Custom language",
"info.noAiSuggestionsVariableName": "AI thinks your variable name is already good",
Expand Down
23 changes: 12 additions & 11 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
"command.renameVariable": "✨ Aide: Rename Variable",
"command.smartPaste": "✨ Aide: Smart Paste",
"config.title": "Aide Configuration",
"config.aiPrompt.description": "Template for copied content, use #{content} as a placeholder for file content",
"config.aiCommand.description": "Custom AI command template. Available variables: #{filesRelativePath}, #{filesFullPath}, #{content}",
"config.aiCommandCopyBeforeRun.description": "Copy AI command to clipboard before running",
"config.ignorePatterns.description": "Ignored file name patterns, supports glob syntax",
"config.respectGitIgnore.description": "Respect .gitignore file",
"config.autoRememberConvertLanguagePairs.description": "Automatically remember convert language pairs",
"config.convertLanguagePairs.description": "Default convert language pairs",
"config.codeViewerHelperPrompt.description": "Code viewer helper prompt template",
"config.openaiKey.description": "OpenAI Key",
"config.openaiBaseUrl.description": "OpenAI Base URL",
"config.openaiModel.description": "OpenAI Model",
"config.openaiKey.description": "OpenAI Key, [click to view online documentation](https://aide.nicepkg.cn/guide/configuration/openai-key)",
"config.openaiModel.description": "OpenAI Model, [click to view online documentation](https://aide.nicepkg.cn/guide/configuration/openai-model)",
"config.openaiBaseUrl.description": "OpenAI Base URL, [click to view online documentation](https://aide.nicepkg.cn/guide/configuration/openai-base-url)",
"config.codeViewerHelperPrompt.description": "Code viewer helper prompt template, [click to view online documentation](https://aide.nicepkg.cn/guide/configuration/code-viewer-helper-prompt)",
"config.convertLanguagePairs.description": "Default convert language pairs, [click to view online documentation](https://aide.nicepkg.cn/guide/configuration/convert-language-pairs)",
"config.autoRememberConvertLanguagePairs.description": "Automatically remember convert language pairs, [click to view online documentation](https://aide.nicepkg.cn/guide/configuration/auto-remember-convert-language-pairs)",
"config.aiPrompt.description": "Template for copied content, use #{content} as a placeholder for file content, [click to view online documentation](https://aide.nicepkg.cn/guide/configuration/ai-prompt)",
"config.ignorePatterns.description": "Ignored file name patterns, supports glob syntax, [click to view online documentation](https://aide.nicepkg.cn/guide/configuration/ignore-patterns)",
"config.respectGitIgnore.description": "Respect .gitignore file, [click to view online documentation](https://aide.nicepkg.cn/guide/configuration/respect-git-ignore)",
"config.aiCommand.description": "Custom AI command template. Available variables: #{filesRelativePath}, #{filesFullPath}, #{content}, [click to view online documentation](https://aide.nicepkg.cn/guide/configuration/ai-command)",
"config.aiCommandCopyBeforeRun.description": "Copy AI command to clipboard before running, [click to view online documentation](https://aide.nicepkg.cn/guide/configuration/ai-command-copy-before-run)",
"error.noWorkspace": "Unable to determine workspace folder",
"error.invalidConfigKey": "Invalid configuration key",
"error.invalidConfigValueType": "Invalid configuration value type",
Expand All @@ -32,6 +32,7 @@
"error.noActiveEditor": "No file is currently open",
"error.noTargetLanguage": "No target language selected",
"error.noContext": "Context not initialized",
"error.emptyClipboard": "Clipboard is empty",
"info.copied": "File contents have been copied to clipboard",
"info.customLanguage": "Custom language",
"info.noAiSuggestionsVariableName": "AI thinks your variable name is already good",
Expand Down
23 changes: 12 additions & 11 deletions package.nls.zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
"command.renameVariable": "✨ Aide: 重命名变量",
"command.smartPaste": "✨ Aide: 智能粘贴",
"config.title": "Aide 配置",
"config.aiPrompt.description": "复制内容的模板,使用#{content}作为文件内容的占位符",
"config.aiCommand.description": "自定义 AI 命令模板。可用变量:#{filesRelativePath}, #{filesFullPath}, #{content}",
"config.aiCommandCopyBeforeRun.description": "运行前将 AI 命令复制到剪贴板",
"config.ignorePatterns.description": "忽略的文件名模式, 支持 glob 语法",
"config.respectGitIgnore.description": "是否尊重 .gitignore 文件",
"config.autoRememberConvertLanguagePairs.description": "是否自动记住转换语言对照表",
"config.convertLanguagePairs.description": "默认转换语言对照表",
"config.codeViewerHelperPrompt.description": "代码查看器助手 prompt 模板",
"config.openaiKey.description": "OpenAI Key",
"config.openaiBaseUrl.description": "OpenAI Base URL",
"config.openaiModel.description": "OpenAI Model",
"config.openaiKey.description": "OpenAI Key, [点击查看在线文档](https://aide.nicepkg.cn/zh/guide/configuration/openai-key)",
"config.openaiModel.description": "OpenAI Model, [点击查看在线文档](https://aide.nicepkg.cn/zh/guide/configuration/openai-model)",
"config.openaiBaseUrl.description": "OpenAI Base URL, [点击查看在线文档](https://aide.nicepkg.cn/zh/guide/configuration/openai-base-url)",
"config.codeViewerHelperPrompt.description": "代码查看器助手 prompt 模板, [点击查看在线文档](https://aide.nicepkg.cn/zh/guide/configuration/code-viewer-helper-prompt)",
"config.convertLanguagePairs.description": "默认转换语言对照表, [点击查看在线文档](https://aide.nicepkg.cn/zh/guide/configuration/convert-language-pairs)",
"config.autoRememberConvertLanguagePairs.description": "是否自动记住转换语言对照表, [点击查看在线文档](https://aide.nicepkg.cn/zh/guide/configuration/auto-remember-convert-language-pairs)",
"config.aiPrompt.description": "复制内容的模板,使用#{content}作为文件内容的占位符, [点击查看在线文档](https://aide.nicepkg.cn/zh/guide/configuration/ai-prompt)",
"config.ignorePatterns.description": "忽略的文件名模式, 支持 glob 语法, [点击查看在线文档](https://aide.nicepkg.cn/zh/guide/configuration/ignore-patterns)",
"config.respectGitIgnore.description": "是否尊重 .gitignore 文件, [点击查看在线文档](https://aide.nicepkg.cn/zh/guide/configuration/respect-git-ignore)",
"config.aiCommand.description": "自定义 AI 命令模板。可用变量:#{filesRelativePath}, #{filesFullPath}, #{content}, [点击查看在线文档](https://aide.nicepkg.cn/zh/guide/configuration/ai-command)",
"config.aiCommandCopyBeforeRun.description": "运行前将 AI 命令复制到剪贴板, [点击查看在线文档](https://aide.nicepkg.cn/zh/guide/configuration/ai-command-copy-before-run)",
"error.noWorkspace": "无法确定工作区文件夹",
"error.invalidConfigKey": "无效的配置键",
"error.invalidConfigValueType": "无效的配置值类型",
Expand All @@ -32,6 +32,7 @@
"error.noActiveEditor": "未打开任何文件",
"error.noTargetLanguage": "未选择目标语言",
"error.noContext": "上下文未初始化",
"error.emptyClipboard": "剪贴板为空",
"info.copied": "文件内容已复制到剪贴板",
"info.customLanguage": "自定义语言",
"info.noAiSuggestionsVariableName": " AI 觉得你这个变量名字已经很好了",
Expand Down
Loading

0 comments on commit 227d2ab

Please sign in to comment.