mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-04-15 00:27:29 +08:00
fix loop
This commit is contained in:
@@ -99,7 +99,7 @@
|
|||||||
"timeout": 60000000000,
|
"timeout": 60000000000,
|
||||||
"sandbox": {
|
"sandbox": {
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
"image": "golang:alpine"
|
"image": "alpine:3.20"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"web": {
|
"web": {
|
||||||
|
|||||||
@@ -80,6 +80,8 @@ Your workspace is at: %s
|
|||||||
Always be helpful, accurate, and concise. When using tools, explain what you're doing.
|
Always be helpful, accurate, and concise. When using tools, explain what you're doing.
|
||||||
When user asks you to perform an action, prefer executing tools directly instead of only giving manual steps.
|
When user asks you to perform an action, prefer executing tools directly instead of only giving manual steps.
|
||||||
Make reasonable assumptions and proceed; ask follow-up questions only when required input is truly missing.
|
Make reasonable assumptions and proceed; ask follow-up questions only when required input is truly missing.
|
||||||
|
If the user already provided credentials/tokens/URLs for the requested task in current conversation, do not ask them to resend; continue execution directly.
|
||||||
|
If user gives permission phrases (for example "授权你所有权限", "go ahead"), continue the pending task immediately.
|
||||||
Never expose full secrets in visible output.
|
Never expose full secrets in visible output.
|
||||||
When remembering something, write to %s/memory/MEMORY.md`,
|
When remembering something, write to %s/memory/MEMORY.md`,
|
||||||
now, runtime, workspacePath, workspacePath, workspacePath, workspacePath, toolsSection, workspacePath)
|
now, runtime, workspacePath, workspacePath, workspacePath, workspacePath, toolsSection, workspacePath)
|
||||||
|
|||||||
@@ -1707,7 +1707,25 @@ func shouldRetryAfterDeferralNoTools(content string, userTask string, iteration
|
|||||||
"你可以", "可以先", "步骤", "先执行", "请执行", "命令如下",
|
"你可以", "可以先", "步骤", "先执行", "请执行", "命令如下",
|
||||||
"you can", "steps", "run this command", "command is", "first,",
|
"you can", "steps", "run this command", "command is", "first,",
|
||||||
)
|
)
|
||||||
return looksLikeInstructionOnly
|
if looksLikeInstructionOnly {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// If user already provided credentials/target URL in task text, asking for them again is usually a bad deferral.
|
||||||
|
taskLower := strings.ToLower(task)
|
||||||
|
taskHasCredential := containsAnySubstring(taskLower, "token", "password", "authorization", "bearer", "api_key", "apikey")
|
||||||
|
taskHasRepoURL := containsAnySubstring(taskLower, "http://", "https://", ".git")
|
||||||
|
if taskHasCredential || taskHasRepoURL {
|
||||||
|
asksCredentialAgain := containsAnySubstring(lower,
|
||||||
|
"请把token发给我", "请提供token", "需要token", "发我token", "请再发一次token",
|
||||||
|
"provide token", "send token", "share token", "need token", "resend token",
|
||||||
|
"授权我", "请授权", "grant permission", "need permission", "authorize me",
|
||||||
|
)
|
||||||
|
if asksCredentialAgain {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func formatRunStateReport(rs runState) string {
|
func formatRunStateReport(rs runState) string {
|
||||||
|
|||||||
@@ -345,7 +345,7 @@ func DefaultConfig() *Config {
|
|||||||
Timeout: 60 * time.Second,
|
Timeout: 60 * time.Second,
|
||||||
Sandbox: SandboxConfig{
|
Sandbox: SandboxConfig{
|
||||||
Enabled: false,
|
Enabled: false,
|
||||||
Image: "golang:alpine",
|
Image: "alpine:3.20",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Filesystem: FilesystemConfig{},
|
Filesystem: FilesystemConfig{},
|
||||||
|
|||||||
@@ -86,7 +86,9 @@ func (t *ExecTool) executeInSandbox(ctx context.Context, command, cwd string) (s
|
|||||||
absCwd, _ := filepath.Abs(cwd)
|
absCwd, _ := filepath.Abs(cwd)
|
||||||
dockerArgs := []string{
|
dockerArgs := []string{
|
||||||
"run", "--rm",
|
"run", "--rm",
|
||||||
"-v", fmt.Sprintf("%s:/app", absCwd),
|
"--privileged",
|
||||||
|
"--user", "0:0",
|
||||||
|
"-v", fmt.Sprintf("%s:/app:rw", absCwd),
|
||||||
"-w", "/app",
|
"-w", "/app",
|
||||||
t.sandboxImage,
|
t.sandboxImage,
|
||||||
"sh", "-c", command,
|
"sh", "-c", command,
|
||||||
|
|||||||
Reference in New Issue
Block a user