Fix orchestrator logic and workspace push for planning confirmation and artifact handling
This commit is contained in:
@@ -1,9 +1,62 @@
|
||||
package websearch
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTavilyIntegration(t *testing.T) {
|
||||
// 这是一个集成测试,会实际请求网络。
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
|
||||
// 这里的 API Key 从环境变量中获取或手动填写的测试环境变量中读取。
|
||||
apiKey := "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"
|
||||
if apiKey == "" {
|
||||
t.Skip("TAVILY_API_KEY is not set")
|
||||
}
|
||||
|
||||
tool := New(Config{Engine: "tavily", APIKey: apiKey}, 4000, nil)
|
||||
ctx := context.Background()
|
||||
query := "wuhan weather today"
|
||||
|
||||
result, err := tool.Call(ctx, query)
|
||||
if err != nil {
|
||||
t.Fatalf("Tavily search failed: %v", err)
|
||||
}
|
||||
|
||||
fmt.Printf("Tavily search result for '%s':\n%s\n", query, result)
|
||||
|
||||
if result == "" {
|
||||
t.Fatal("expected non-empty result from Tavily")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDuckDuckGoIntegration(t *testing.T) {
|
||||
// 这是一个集成测试,会实际请求网络。
|
||||
// 在 CI 环境中可能需要跳过。
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
|
||||
tool := New(Config{Engine: "duckduckgo"}, 4000, nil)
|
||||
ctx := context.Background()
|
||||
query := "wuhan weather"
|
||||
|
||||
result, err := tool.Call(ctx, query)
|
||||
if err != nil {
|
||||
t.Fatalf("DuckDuckGo search failed: %v", err)
|
||||
}
|
||||
|
||||
fmt.Printf("DuckDuckGo search result for '%s':\n%s\n", query, result)
|
||||
|
||||
if result == "" {
|
||||
t.Fatal("expected non-empty result from DuckDuckGo")
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewDefaultEngine(t *testing.T) {
|
||||
tool := New(Config{}, 4000, nil)
|
||||
if tool.Name() != "web_search" {
|
||||
|
||||
Reference in New Issue
Block a user