package providers import ( "context" "cursor-api-proxy/internal/apitypes" "cursor-api-proxy/internal/config" "cursor-api-proxy/internal/providers/cursor" "cursor-api-proxy/internal/providers/geminiweb" "fmt" ) type Provider interface { Name() string Close() error Generate(ctx context.Context, model string, messages []apitypes.Message, tools []apitypes.Tool, cb func(apitypes.StreamChunk)) error } func NewProvider(cfg config.BridgeConfig) (Provider, error) { providerType := cfg.Provider if providerType == "" { providerType = "cursor" } switch providerType { case "cursor": return cursor.NewProvider(cfg), nil case "gemini-web": // 使用新的 Playwright provider return geminiweb.NewPlaywrightProvider(cfg) default: return nil, fmt.Errorf("unknown provider: %s", providerType) } }