chore: 初始化仓库,导入项目基线代码
Academy v0.8.3 完整代码基线:Go 后端(internal/cmd/cli/mcp-server/docreader)、 Vue 前端(frontend)、数据库迁移(migrations)、部署编排(docker/helm/deploy)与文档。 今日开发的培训推送管理改动随后单独提交。
This commit is contained in:
commit
7ec21f35b0
5767 files changed
+1436788
No files matched your search
@@ -0,0 +1,44 @@
|
||||
package browserskill
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
// HumanStepWait matches BrowserSkill's default help window.
|
||||
HumanStepWait = 5 * time.Minute
|
||||
// HumanStepTimeout leaves time for the native result before cancellation.
|
||||
HumanStepTimeout = HumanStepWait + 15*time.Second
|
||||
)
|
||||
|
||||
// IsHumanStep identifies browser operations that can wait for user input.
|
||||
func IsHumanStep(method string) bool {
|
||||
return method == "request_help" || method == "tab_borrow"
|
||||
}
|
||||
|
||||
func clusterTimeout(operation, method string) time.Duration {
|
||||
if operation == "call" && IsHumanStep(method) {
|
||||
return HumanStepTimeout
|
||||
}
|
||||
return 2 * time.Minute
|
||||
}
|
||||
|
||||
func humanTimeoutMS(value any) int64 {
|
||||
// Local callers use Go integers; cluster and model inputs use JSON numbers.
|
||||
raw, _ := json.Marshal(value)
|
||||
var ms float64
|
||||
if json.Unmarshal(raw, &ms) == nil && ms >= 1 && ms <= float64(HumanStepWait.Milliseconds()) {
|
||||
return int64(ms)
|
||||
}
|
||||
return HumanStepWait.Milliseconds()
|
||||
}
|
||||
|
||||
func pausedError() *RPCError {
|
||||
return &RPCError{
|
||||
Code: "task_paused",
|
||||
Message: "Browser is connected, but this task is paused for user intervention. " +
|
||||
"Ask the user to complete any manual step, click Continue operation in the conversation browser preview, " +
|
||||
"then continue in this same conversation. Do not reconnect or pair again. Observe before acting.",
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user