Skip to content

Commit 1a61641

Browse files
committed
feat(toolbar): update SummaryMessagesAction with Chinese prompts #383
- Remove unused imports and simplify prompt generation - Update template to use Chinese language - Add related prompt references in comments - Change action icon to AllIcons.Nodes.Target
1 parent 1a7d40c commit 1a61641

File tree

2 files changed

+49
-51
lines changed

2 files changed

+49
-51
lines changed

core/src/main/kotlin/cc/unitmesh/devti/gui/toolbar/SummaryMessagesAction.kt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
package cc.unitmesh.devti.gui.toolbar
22

33
import cc.unitmesh.devti.AutoDevIcons
4-
import cc.unitmesh.devti.indexer.DomainDictGenerateAction
5-
import cc.unitmesh.devti.indexer.DomainDictGenerateContext
6-
import cc.unitmesh.devti.indexer.provider.LangDictProvider
7-
import cc.unitmesh.devti.indexer.usage.PromptEnhancer
84
import cc.unitmesh.devti.llms.LlmFactory
95
import cc.unitmesh.devti.observer.agent.AgentStateService
106
import cc.unitmesh.devti.settings.coder.coderSetting
@@ -35,6 +31,11 @@ import javax.swing.JComponent
3531
import kotlin.io.path.createDirectories
3632
import kotlin.io.path.exists
3733

34+
/**
35+
* Related prompts:
36+
* https://gist.github.com/transitive-bullshit/487c9cb52c75a9701d312334ed53b20c
37+
* https://www.reddit.com/r/ClaudeAI/comments/1jr52qj/here_is_claude_codes_compact_prompt/
38+
*/
3839
class SummaryMessagesAction : AnAction("Summary Messages", "Summary all current messages to memorize.md", AllIcons.Nodes.Target),
3940
CustomComponentAction {
4041
override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.EDT
@@ -88,7 +89,7 @@ class SummaryMessagesAction : AnAction("Summary Messages", "Summary all current
8889
AutoDevStatusService.notifyApplication(AutoDevStatus.Error)
8990
e.printStackTrace()
9091
} finally {
91-
updatePresentation(presentation, AutoDevIcons.AI_COPILOT, true)
92+
updatePresentation(presentation, AllIcons.Nodes.Target, true)
9293
}
9394
}
9495
}
@@ -123,13 +124,10 @@ class SummaryMessagesAction : AnAction("Summary Messages", "Summary all current
123124
}
124125

125126
private suspend fun buildPrompt(project: Project): String {
126-
val names = LangDictProvider.all(project)
127127
val templateRender = TemplateRender(GENIUS_CODE)
128128
val template = templateRender.getTemplate("memory.vm")
129-
val readmeMe = PromptEnhancer.readmeFile(project)
130129

131-
val context = DomainDictGenerateContext(names.joinToString(", "), readmeMe)
132-
val prompt = templateRender.renderTemplate(template, context)
130+
val prompt = templateRender.renderTemplate(template)
133131
return prompt
134132
}
135133
}
Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,66 @@
1-
Your task is to create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions.
2-
This summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing development work without losing context.
1+
你的任务是创建一个对话内容的详细摘要,特别关注用户的明确请求和你之前的操作。
2+
这个摘要应该全面捕捉技术细节、代码模式和架构决策,这些对于在不丢失上下文的情况下继续开发工作是必不可少的。
33

4-
Before providing your final summary, wrap your analysis in <analysis> tags to organize your thoughts and ensure you've covered all necessary points. In your analysis process:
4+
在提供最终摘要之前,请用<analysis>标签包裹你的分析,以组织你的思路并确保你已经涵盖了所有必要的要点。在你的分析过程中:
55

6-
1. Chronologically analyze each message and section of the conversation. For each section thoroughly identify:
7-
- The user's explicit requests and intents
8-
- Your approach to addressing the user's requests
9-
- Key decisions, technical concepts and code patterns
10-
- Specific details like file names, full code snippets, function signatures, file edits, etc
11-
2. Double-check for technical accuracy and completeness, addressing each required element thoroughly.
6+
1. 按时间顺序分析对话中的每条消息和每个部分。对每个部分进行彻底识别:
7+
- 用户的明确请求和意图
8+
- 你解决用户请求的方法
9+
- 关键决策、技术概念和代码模式
10+
- 具体细节,如文件名、完整代码片段、函数签名、文件编辑等
11+
2. 仔细检查技术准确性和完整性,彻底解决每个所需的要素。
1212

13-
Your summary should include the following sections:
13+
你的摘要应包括以下部分:
1414

15-
1. Primary Request and Intent: Capture all of the user's explicit requests and intents in detail
16-
2. Key Technical Concepts: List all important technical concepts, technologies, and frameworks discussed.
17-
3. Files and Code Sections: Enumerate specific files and code sections examined, modified, or created. Pay special attention to the most recent messages and include full code snippets where applicable and include a summary of why this file read or edit is important.
18-
4. Problem Solving: Document problems solved and any ongoing troubleshooting efforts.
19-
5. Pending Tasks: Outline any pending tasks that you have explicitly been asked to work on.
20-
6. Current Work: Describe in detail precisely what was being worked on immediately before this summary request, paying special attention to the most recent messages from both user and assistant. Include file names and code snippets where applicable.
21-
7. Optional Next Step: List the next step that you will take that is related to the most recent work you were doing. IMPORTANT: ensure that this step is DIRECTLY in line with the user's explicit requests, and the task you were working on immediately before this summary request. If your last task was concluded, then only list next steps if they are explicitly in line with the users request. Do not start on tangential requests without confirming with the user first.
22-
8. If there is a next step, include direct quotes from the most recent conversation showing exactly what task you were working on and where you left off. This should be verbatim to ensure there's no drift in task interpretation.
15+
1. 主要请求和意图:详细捕捉用户的所有明确请求和意图
16+
2. 关键技术概念:列出所有重要的技术概念、技术和框架。
17+
3. 文件和代码部分:列举已检查、修改或创建的特定文件和代码部分。特别注意最近的消息,并在适用的情况下包含完整的代码片段,并包含为什么这个文件读取或编辑很重要的摘要。
18+
4. 问题解决:记录已解决的问题和任何正在进行的故障排除工作。
19+
5. 待处理任务:概述明确要求你处理的任何待处理任务。
20+
6. 当前工作:详细描述在此摘要请求之前正在进行的工作,特别注意用户和助手最近的消息。在适用的情况下包含文件名和代码片段。
21+
7. 可选下一步:列出与你最近所做工作相关的下一步。重要提示:确保这一步直接符合用户的明确请求,以及你在此摘要请求之前正在处理的任务。如果你的上一个任务已经结束,那么只有在明确符合用户请求的情况下才列出下一步。未经用户确认,不要开始处理切线请求。
22+
8. 如果有下一步,请包含最近对话中的直接引用,准确显示你正在处理的任务以及你停止的位置。这应该是逐字的,以确保任务解释没有偏差。
2323

24-
Here's an example of how your output should be structured:
24+
以下是你的输出结构应该是什么样的例子:
2525

2626
<example>
2727
<analysis>
28-
[Your thought process, ensuring all points are covered thoroughly and accurately]
28+
[你的思考过程,确保所有要点都得到彻底和准确的覆盖]
2929
</analysis>
3030

3131
<summary>
32-
1. Primary Request and Intent:
33-
[Detailed description]
32+
1. 主要请求和意图:
33+
[详细描述]
3434

35-
2. Key Technical Concepts:
36-
- [Concept 1]
37-
- [Concept 2]
35+
2. 关键技术概念:
36+
- [概念1]
37+
- [概念2]
3838
- [...]
3939

40-
3. Files and Code Sections:
41-
- [File Name 1]
42-
- [Summary of why this file is important]
43-
- [Summary of the changes made to this file, if any]
44-
- [Important Code Snippet]
45-
- [File Name 2]
46-
- [Important Code Snippet]
40+
3. 文件和代码部分:
41+
- [文件名1]
42+
- [为什么这个文件很重要的摘要]
43+
- [对此文件所做更改的摘要,如果有的话]
44+
- [重要代码片段]
45+
- [文件名2]
46+
- [重要代码片段]
4747
- [...]
4848

49-
4. Problem Solving:
50-
[Description of solved problems and ongoing troubleshooting]
49+
4. 问题解决:
50+
[已解决问题和正在进行的故障排除的描述]
5151

52-
5. Pending Tasks:
53-
- [Task 1]
54-
- [Task 2]
52+
5. 待处理任务:
53+
- [任务1]
54+
- [任务2]
5555
- [...]
5656

57-
6. Current Work:
58-
[Precise description of current work]
57+
6. 当前工作:
58+
[当前工作的精确描述]
5959

60-
7. Optional Next Step:
61-
[Optional Next step to take]
60+
7. 可选下一步:
61+
[可选的下一步操作]
6262

6363
</summary>
6464
</example>
6565

66-
Please provide your summary based on the conversation so far, following this structure and ensuring precision and thoroughness in your response.
66+
请根据到目前为止的对话提供你的摘要,遵循这个结构并确保你的回应准确和全面。

0 commit comments

Comments
 (0)