Skip to content

Commit 1ba749a

Browse files
committed
fix(code): adjust migration plan logic and message handling #308
- Update comment in bridge.vm to reflect the need for adjusting migration plans based on prior information. - Modify condition in CustomLLMProvider.kt to handle messages with size less than or equal to 3 when using plan for the second round.
1 parent 35028e0 commit 1ba749a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

core/src/main/kotlin/cc/unitmesh/devti/llms/custom/CustomLLMProvider.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class CustomLLMProvider(val project: Project, var llmConfig: LlmConfig = LlmConf
4646
usePlanForSecondRound: Boolean
4747
): Flow<String> {
4848
/// 如果第二轮使用 plan,且 plan 不为空,则使用 plan, 3 = System + User + Assistant
49-
if (usePlanForSecondRound && messages.size == 3 && LlmConfig.load(ModelType.Plan).isNotEmpty()) {
49+
if (usePlanForSecondRound && messages.size <= 3 && LlmConfig.load(ModelType.Plan).isNotEmpty()) {
5050
backupForReasonConfig = llmConfig
5151
llmConfig = LlmConfig.load(ModelType.Plan).first()
5252
} else {

core/src/main/resources/genius/zh/code/bridge.vm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,14 @@ Here is an example output to the USER:
8383
/containerView [注释:获取项目模块信息,如果是多模块项目]
8484
/file:build.gradle [注释:获取项目构建文件信息,如果当前项目使用的是 build.gradle ]
8585
</devin>
86+
// 请等待用户/工具回复,再继续
8687
</you.answer1>
8788
// 等待用户/工具回复
8889
<tool.response1>
8990
//..
9091
</tool.response1>
9192
<you.answer2>
92-
// 如果没有获取到足够的信息,继续调用工具获取信息
93+
// 根据先前的信息,你得考虑是否需要调整迁移计划。
9394
根据您提供的信息,这是一个 xx 项目....,在继续之前,我需要确认这个信息。请允许我调用工具来获取这些信息:
9495
<devin>
9596
/dir:. [注释:如果先前没有获取目录信息,你需要再次获取]
@@ -103,6 +104,7 @@ Here is an example output to the USER:
103104
//..
104105
</tool.response2>
105106
<you.answer3>
107+
// 根据先前的信息,你得考虑是否需要调整迁移计划。
106108
// 在手动修改代码之前,你应该考虑各种自动化工具的可能性,比如 Java 里的 OpenRewrite (直接生成 Yaml Receipt 即可),JS 里的 jscodeshift(生成 JS 代码即可)
107109
// 在获取到足够的信息后,你可以开始提供迁移方案;由于用户使用的是 IDEA,所以需要考虑相关的能力,比如修改完 build.gradle.kts 后,是否需要同步到 IDEA 中。
108110
现在我已经了解了项目的目录结构和组件列表,接下来我将为您提供迁移方案。我将先使用 Mermaid 生成迁移方案图:

0 commit comments

Comments
 (0)