Skip to content

Commit f95eade

Browse files
author
smallstone
committed
Based on the changes in the Git diff, a suggested commit message could be:
Add vscode comment and remove unused code Remember to replace the placeholder with an appropriate commit message that accurately describes the changes made.
1 parent d527f20 commit f95eade

4 files changed

Lines changed: 27 additions & 45 deletions

File tree

src/views/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import "./App.css";
66
import "./i18n";
77

88
export default function App() {
9+
// vscode
10+
911
return (
1012
<AppShell
1113
header={<Head />}

src/views/components/MessageMarkdown/index.tsx

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -114,21 +114,6 @@ Use this DevChat workflow to request code writing. Please input your specific re
114114
}),
115115
]);
116116
break;
117-
case "#commit_message":
118-
chat.addMessages([
119-
Message.create({
120-
type: "user",
121-
message: "Explain /commit_message",
122-
}),
123-
Message.create({
124-
type: "bot",
125-
message: `***/commit_message***
126-
127-
Use this DevChat workflow to request a commit message. Generally, you don't need to type anything else, but please give me the output of \`git diff\`. Of course, you don't need to manually execute the command and copy & paste its output. Simply click the "+" button and select \`git diff —cached\` to include only the staged changes, or \`git diff HEAD\` to include all changes.
128-
`,
129-
}),
130-
]);
131-
break;
132117
case "#release_note":
133118
chat.addMessages([
134119
Message.create({
@@ -239,24 +224,29 @@ Generate a professionally written and formatted release note in markdown with th
239224
if (children.includes("You can configure DevChat from")) {
240225
return t("devchat.help");
241226
}
242-
// DevChat key is missing from your environment or settings
227+
if (children.includes("DevChat key is missing from your environment")) {
228+
return t("devchat.setkey");
229+
}
243230
if (
244-
children.includes("DevChat key is missing from your environment ")
231+
children.includes(
232+
"DevChat intelligently navigates your codebase using GPT-4."
233+
)
245234
) {
246-
return t("devchat.setkey");
235+
return t("ask-code-explain");
247236
}
248237
if (
249238
children.includes(
250-
"OPENAI_API_KEY is missing from your environment or settings"
239+
"Use this DevChat workflow to request code writing. Please input your specific requirement"
251240
)
252241
) {
253-
// vscode 用
254-
if (children.includes("Set OpenAI key")) {
255-
return t("devchat.setOpenAIkey");
256-
} else {
257-
// idea 用
258-
return t("devchat.setkey");
259-
}
242+
return t("code-explain");
243+
}
244+
if (
245+
children.includes(
246+
"Generate a professionally written and formatted release note in markdown with this workflow. I just need some basic information"
247+
)
248+
) {
249+
return t("note-explain");
260250
}
261251
}
262252
}

src/views/i18n/zh.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,19 @@
88
"Ask DevChat a question or type ‘/’ for workflow": "向 DevChat 直接提问或输入 '/' 以查看可用的工作流",
99
"How do I use DevChat?": "如何使用 DevChat?",
1010
"balance": "你的账户余额为 {{formatedCurrency}},登录 <4>web.devchat.ai</4> 获得更多 tokens",
11-
"devchat.help": "你想生成一些代码还是对这个项目有疑问?请首先右键单击相关的文件或代码片段,将它们添加到 DevChat 中作为上下文,然后在输入框中写下你的请求或问题,我将基于添加的上下文生成代码或回答你的问题。<br> <br> 你还可以点击输入框左侧的“+”按钮,查看更多添加上下文的快捷方法。此外,在输入框中键入“/”,DevChat 会列出可供使用的各类工作流,按 Tab 键或输入完整命令触发你需要的工作流。聊天愉快! <br> <br>下面是一些工作流的示例:<br> <br> [/code: 基于你的提示词和上下文生成代码](#code) <br> <br> [/commit_message: 根据加入上下文中的代码变更生成提交消息](#commit_message) <br> <br> [/release_note: 根据加入上下文中的提交历史生成提交说明](#release_note) <br> <br> [/ask-code: 询问任何关于当前代码库的信息,并从这位人工智能代理那里获得答案](#ask_code) <br> <br>你可以点击[设置](#settings)来配置 DevChat",
11+
"devchat.help": "你想生成一些代码还是对这个项目有疑问?请首先右键单击相关的文件或代码片段,将它们添加到 DevChat 中作为上下文,然后在输入框中写下你的请求或问题,我将基于添加的上下文生成代码或回答你的问题。<br> <br> 你还可以点击输入框左侧的“+”按钮,查看更多添加上下文的快捷方法。此外,在输入框中键入“/”,DevChat 会列出可供使用的各类工作流,按 Tab 键或输入完整命令触发你需要的工作流。聊天愉快! <br> <br>下面是一些工作流的示例:<br> <br> [/code: 基于你的提示词和上下文生成代码](#code) <br> <br> [/release_note: 根据加入上下文中的提交历史生成提交说明](#release_note) <br> <br> [/ask-code: 询问任何关于当前代码库的信息,并从这位人工智能代理那里获得答案](#ask_code) <br> <br>你可以点击[设置](#settings)来配置 DevChat",
1212
"devchat.setkey": "你的环境或设置中缺少 DevChat 访问密钥。请输入你的 DevChat 访问密钥,这样我就可以开始正常工作了。<br> <br> <button value=\"get_devchat_key\" href=\"https://web.devchat.ai\" component=\"a\">注册获取 DevChat 访问密钥</button> <button value=\"setting_devchat_key\">设置 DevChat 访问密钥</button>",
13-
"devchat.setOpenAIkey": "你的环境或设置中缺少 OpenAI 访问密钥。请输入你的 OpenAI 或者 DevChat 访问密钥,这样我就可以开始正常工作了。<br> <br> <button value=\"get_devchat_key\" href=\"https://web.devchat.ai\" component=\"a\">注册获取 DevChat 密钥</button> <button value=\"setting_devchat_key\">设置 DevChat 密钥</button> <button value=\"setting_devchat_key\">设置 OpenAI 密钥</button>",
1413
"Is DevChat Access Key ready?": "DevChat 访问密钥是否已经设置好?",
1514
"Ask questions about the current project's codebase, which requires proactive acquisition of additional context information to answer.": "询问关于当前项目代码库的问题,我将主动获取相关的上下文信息来回答。",
1615
"Generate code with a general template embedded into the prompt.": "使用隐式嵌入到提示词中的通用模板生成代码。",
1716
"Generate code with a Python-specific template embedded into the prompt.": "使用隐式嵌入到提示词中的 Python 特定模板生成代码。",
1817
"commit changes with commit message in english.": "选择要提交的代码变更,总结英文提交消息,并提交到代码库。",
1918
"Generate a commit message for the given git diff.": "为给定的 git diff 生成提交消息。",
20-
"Generate a release note for the given commit log.": "为给定的提交日志生成发布说明。"
19+
"Generate a release note for the given commit log.": "为给定的提交日志生成发布说明。",
20+
"Explain /ask-code": "解释 /ask-code",
21+
"ask-code-explain": "向我们的 AI 代理提出有关您代码库的任何问题,并获得答案。<br> <br>DevChat 利用 GPT-4 智能地导航您的代码库。它会自动选择和分析最多十个与您的问题最相关的源文件来提供答案。敬请期待 — 我们即将整合更高效的 LLama 2 - 70B 模型。<br> <br> 示例问题:<br> -为什么更改的引导时间有时会显示为 null?<br> -store.findAllAccounts 是如何实现的?<br> -当前的递归检索器会丢弃所有 TextNodes,只查询 IndexNodes。这是一个 bug。我们该如何修复它?",
22+
"Explain /release_note": "解释 /release_note",
23+
"note-explain": "使用这个工作流程,您可以生成专业的、格式化的发布说明(markdown格式)。我只需要关于本次发布的提交的一些基本信息。通过点击“+”按钮并选择 git_log_releasenote 将这些信息添加到上下文中。如果提交的范围与默认命令不同,您还可以选择 <custom command> 并输入如 git log 579398b^..HEAD --pretty=format:\"%h - %B\" 的命令行来包含从提交 579398b(包括此提交)到最新提交的所有变更。",
24+
"Explain /code": "解释 /code",
25+
"code-explain": "使用 DevChat 工作流程来请求编写代码。请输入您的具体需求,并提供适当的实施上下文。您可以选择相关的代码或文件,然后右键点击“添加到 DevChat”。如果您发现上下文仍然不足以解释清楚,您可以通过提供所选代码的类/函数定义来增强我对您代码的理解。要做到这一点,请点击所选代码旁边的“+”按钮,然后选择“符号定义”。请注意,这些信息显示在 DevChat 中可能需要几秒钟时间。"
2126
}

src/views/stores/ChatStore.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { types, flow, Instance } from "mobx-state-tree";
22
import messageUtil from "@/util/MessageUtil";
33
import { ChatContext } from "@/views/stores/InputStore";
4-
import { features } from "process";
5-
import { Slice } from "@tiptap/pm/model";
64
import yaml from "js-yaml";
7-
import { Step } from "@mantine/core";
85

96
interface Context {
107
content: string;
@@ -142,8 +139,6 @@ To get started, here are some of the things that I can do for you:
142139
143140
[/code: write code based on your prompt](#code)
144141
145-
[/commit_message: compose a commit message based on your code changes](#commit_message)
146-
147142
[/release_note: draft a release note based on your latest commits](#release_note)
148143
149144
${
@@ -155,19 +150,9 @@ ${
155150
You can configure DevChat from [Settings](#settings).`;
156151

157152
const setKeyMessage = `
158-
OPENAI_API_KEY is missing from your environment or settings. Kindly input your DevChat key, and I'll ensure DevChat is all set for you.
159-
160-
${process.env.platform === 'vscode'
161-
?`
153+
Devchat key is missing from your environment or settings. Kindly input your DevChat key, and I'll ensure DevChat is all set for you.
162154
<button value="get_devchat_key" href="https://web.devchat.ai" component="a">Register DevChat key</button>
163155
<button value="setting_devchat_key">Set DevChat key</button>
164-
<button value="setting_openai_key">Set OpenAI key</button>
165-
`
166-
:`
167-
<button value="get_devchat_key" href="https://web.devchat.ai">Register DevChat key</button>
168-
<button value="setting_devchat_key">Set DevChat key</button>
169-
`}
170-
171156
`;
172157

173158
const setKeyUser = `Is DevChat Access Key ready?`;

0 commit comments

Comments
 (0)