Skip to content

Commit 91bb330

Browse files
committed
fix(sketch): refine context information prompts and logging in language injector
1 parent 76aafb8 commit 91bb330

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ have created a routes.py and main.js file, and updated the main.html file.
5454
// In this step 1, you should analysis the context information is enough or not, if not, you should call DevIn tool
5555
// to get the context information.
5656
// For example:
57-
为了帮助您创建基于 Python 的照片存储应用程序,我需要了解更多关于您的代码库的信息。请允许我调用工具来获取上下文信息。请执行以下 DevIn 代码
57+
我将帮助您创建基于 Python 的照片存储应用程序,在那之前我需要了解更多关于您的代码库的信息。请允许我调用工具来获取上下文信息:
5858
<devin>
5959
/dir:src // 获取项目文件夹信息和目录结构
6060
/${context.searchTool}:.*photo.*
@@ -148,7 +148,7 @@ feat: add delete blog functionality
148148
优化 SketchRunContext 代码结构
149149
</user.question>
150150
<you.answer.step1>
151-
为了帮助优化 SketchRunContext 代码结构需要根据具体的代码库进行分析,请帮助我调用工具获取代码库的上下文信息,以便于更好地理解代码结构。
151+
优化 SketchRunContext 代码结构需要根据具体的代码库进行分析,请帮助我调用工具获取代码库的上下文信息,以便于更好地理解代码结构。
152152
<devin> // 请尽可能只用一个 DevIn 代码块来获取上下文信息
153153
/dir:src/main/java
154154
/file:SketchRunContext.java // 使用绝对路径时,一定要从用户那里得到正确的路径

exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/DevInLanguageInjector.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import cc.unitmesh.devti.language.parser.CodeBlockElement
66
import cc.unitmesh.devti.language.psi.DevInTypes
77
import com.intellij.lang.Language
88
import com.intellij.openapi.diagnostic.logger
9+
import com.intellij.openapi.progress.ProcessCanceledException
910
import com.intellij.openapi.util.TextRange
1011
import com.intellij.psi.InjectedLanguagePlaces
1112
import com.intellij.psi.LanguageInjector
@@ -37,6 +38,8 @@ class DevInLanguageInjector : LanguageInjector {
3738
try {
3839
val textRange = TextRange.create(first.startOffsetInParent, last.startOffsetInParent + last.textLength)
3940
registrar.addPlace(language, textRange, null, null)
41+
} catch (e: ProcessCanceledException) {
42+
logger<DevInLanguageInjector>().warn("Operation was canceled", e)
4043
} catch (e: Exception) {
4144
logger<DevInLanguageInjector>().warn("Failed to inject language", e)
4245
}

exts/ext-endpoints/src/233/main/kotlin/cc/unitmesh/endpoints/provider/EndpointsContextProvider.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class EndpointsContextProvider : ChatContextProvider {
2828
.filterIsInstance<EndpointsUrlTargetProvider<SpringBeanPointer<*>, UrlMappingElement>>()
2929

3030
return availableProviders.map {
31-
val text = "This project has http endpoints from ${it.presentation}"
31+
val text = "\n- This project has http endpoints from ${it.presentation.title}"
3232
ChatContextItem(EndpointsContextProvider::class, text)
3333
}
3434
}

0 commit comments

Comments
 (0)