Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 70b144f1e5 |
+4
-1
@@ -71,7 +71,10 @@ func main() {
|
|||||||
if strings.TrimSpace(settingsRuntime.clientID) == "" || strings.TrimSpace(settingsRuntime.secret) == "" {
|
if strings.TrimSpace(settingsRuntime.clientID) == "" || strings.TrimSpace(settingsRuntime.secret) == "" {
|
||||||
log.Fatal("DingTalk credentials are required; configure DINGTALK_CLIENT_ID and DINGTALK_CLIENT_SECRET in the protected runtime environment")
|
log.Fatal("DingTalk credentials are required; configure DINGTALK_CLIENT_ID and DINGTALK_CLIENT_SECRET in the protected runtime environment")
|
||||||
}
|
}
|
||||||
client, err := weknora.NewClient(os.Getenv("WEKNORA_BASE_URL"), os.Getenv("WEKNORA_API_KEY"), 120*time.Second)
|
// 0 = no client-side total timeout. WeKnora's smart-reasoning agent can run
|
||||||
|
// 20+ tool rounds and stream far longer than 120s; the total-time cap cut the
|
||||||
|
// SSE mid-answer and the failure branch overwrote the streamed card.
|
||||||
|
client, err := weknora.NewClient(os.Getenv("WEKNORA_BASE_URL"), os.Getenv("WEKNORA_API_KEY"), 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,9 +86,8 @@ func NewClient(baseURL, apiKey string, timeout time.Duration) (*Client, error) {
|
|||||||
if strings.TrimSpace(apiKey) == "" {
|
if strings.TrimSpace(apiKey) == "" {
|
||||||
return nil, errors.New("WEKNORA_API_KEY is required")
|
return nil, errors.New("WEKNORA_API_KEY is required")
|
||||||
}
|
}
|
||||||
if timeout <= 0 {
|
// timeout <= 0 keeps Go's default: no client-side total timeout on the HTTP
|
||||||
timeout = 120 * time.Second
|
// client, so long-lived agent SSE streams are never cut by a duration cap.
|
||||||
}
|
|
||||||
return &Client{baseURL: parsed.String(), apiKey: apiKey, http: &http.Client{Timeout: timeout}}, nil
|
return &Client{baseURL: parsed.String(), apiKey: apiKey, http: &http.Client{Timeout: timeout}}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user