mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-08-17 03:27:02 +08:00
Merge branches 'main' and 'main' of github.com:leookun/cursor-byok
This commit is contained in:
@@ -316,7 +316,7 @@ func buildRequestContextUserInfoSection(requestContext *agentv1.RequestContext)
|
|||||||
lines = append(lines, "Shell: "+shell)
|
lines = append(lines, "Shell: "+shell)
|
||||||
}
|
}
|
||||||
if workspacePaths := env.GetWorkspacePaths(); len(workspacePaths) > 0 {
|
if workspacePaths := env.GetWorkspacePaths(); len(workspacePaths) > 0 {
|
||||||
lines = append(lines, "Workspace Path: "+strings.TrimSpace(workspacePaths[0]))
|
lines = append(lines, buildWorkspacePathsSection(workspacePaths))
|
||||||
}
|
}
|
||||||
isGitRepo := "Unknown"
|
isGitRepo := "Unknown"
|
||||||
repositoryInfo := requestContext.GetRepositoryInfo()
|
repositoryInfo := requestContext.GetRepositoryInfo()
|
||||||
@@ -338,6 +338,32 @@ func buildRequestContextUserInfoSection(requestContext *agentv1.RequestContext)
|
|||||||
return "<user_info>\n" + strings.Join(lines, "\n\n") + "\n</user_info>"
|
return "<user_info>\n" + strings.Join(lines, "\n\n") + "\n</user_info>"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// buildWorkspacePathsSection 构造工作区路径片段。
|
||||||
|
//
|
||||||
|
// 渲染规则:
|
||||||
|
// - 单路径:`Workspace Path: <path>`,与历史格式保持一致;
|
||||||
|
// - 多路径:`Workspace Paths:` 起行,后续每行以 `- <path>` 列出全部路径,顺序保留输入顺序。
|
||||||
|
func buildWorkspacePathsSection(workspacePaths []string) string {
|
||||||
|
trimmedPaths := make([]string, 0, len(workspacePaths))
|
||||||
|
for _, path := range workspacePaths {
|
||||||
|
if path = strings.TrimSpace(path); path != "" {
|
||||||
|
trimmedPaths = append(trimmedPaths, path)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(trimmedPaths) == 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
if len(trimmedPaths) == 1 {
|
||||||
|
return "Workspace Path: " + trimmedPaths[0]
|
||||||
|
}
|
||||||
|
items := make([]string, 0, len(trimmedPaths)+1)
|
||||||
|
items = append(items, "Workspace Paths:")
|
||||||
|
for _, path := range trimmedPaths {
|
||||||
|
items = append(items, "- "+path)
|
||||||
|
}
|
||||||
|
return strings.Join(items, "\n")
|
||||||
|
}
|
||||||
|
|
||||||
// buildRequestContextAgentTranscriptsSection 构造 <agent_transcripts> 片段。
|
// buildRequestContextAgentTranscriptsSection 构造 <agent_transcripts> 片段。
|
||||||
func buildRequestContextAgentTranscriptsSection(requestContext *agentv1.RequestContext) string {
|
func buildRequestContextAgentTranscriptsSection(requestContext *agentv1.RequestContext) string {
|
||||||
if requestContext == nil || requestContext.GetEnv() == nil {
|
if requestContext == nil || requestContext.GetEnv() == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user