package providers

import (
	"ai-css/library/logger"
	"net/url"
	"os"
)

const (
	PROXY_ENV_NAME = "AI-CSS_CLOUD_MODEL_PROXY"
)

var envProxyUrl string

func init() {
	envProxyUrl = os.Getenv(PROXY_ENV_NAME)
}

// GetRemoteProxy 国内测试时使用，方便验收
func GetRemoteProxy() *url.URL {
	if envProxyUrl == "" {
		return nil
	}

	proxyURL, err := url.Parse(envProxyUrl)
	if err != nil {
		logger.Errorf("cloud model get remote proxy failed url:%s", envProxyUrl)
		return nil
	}
	return proxyURL
}
