| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- package tests
- import (
- "os"
- )
- // Config 测试配置结构
- type Config struct {
- // API服务配置
- Qwen3BaseURL string
- Qwen3Model string
- YOLOBaseURL string
- HealthBaseURL string
- SearchBaseURL string
- TTSBaseURL string
- ShudaoBaseURL string
- ShudaoAuthToken string
- ShudaoWorkflowID string
- }
- // LoadConfig 加载测试配置
- func LoadConfig() *Config {
- return &Config{
- Qwen3BaseURL: getEnvOrDefault("QWEN3_BASE_URL", "http://172.16.35.50:8000"),
- Qwen3Model: getEnvOrDefault("QWEN3_MODEL", "Qwen3-30B-A3B-Instruct-2507"),
- YOLOBaseURL: getEnvOrDefault("YOLO_BASE_URL", "http://localhost:8081"),
- HealthBaseURL: getEnvOrDefault("HEALTH_BASE_URL", "http://localhost:8080"),
- SearchBaseURL: getEnvOrDefault("SEARCH_BASE_URL", "http://localhost:8080"),
- TTSBaseURL: getEnvOrDefault("TTS_BASE_URL", "http://172.16.35.50:8000"),
- ShudaoBaseURL: getEnvOrDefault("SHUDAO_BASE_URL", "http://172.16.35.50:8007"),
- ShudaoAuthToken: getEnvOrDefault("SHUDAO_AUTH_TOKEN", "app-55CyO4lmDv1VeXK4QmFpt4ng"),
- ShudaoWorkflowID: getEnvOrDefault("SHUDAO_WORKFLOW_ID", "4wfh1PPDderMtCeb"),
- }
- }
- // GetQwen3ChatURL 获取Qwen3聊天接口URL
- func (c *Config) GetQwen3ChatURL() string {
- return c.Qwen3BaseURL + "/v1/chat/completions"
- }
- // GetYOLOPredictURL 获取YOLO预测接口URL
- func (c *Config) GetYOLOPredictURL() string {
- return c.YOLOBaseURL + "/predict"
- }
- // GetTTSStreamURL 获取TTS流式接口URL
- func (c *Config) GetTTSStreamURL() string {
- return c.TTSBaseURL + "/tts/voice"
- }
- // GetShudaoWorkflowURL 获取蜀道集团工作流接口URL
- func (c *Config) GetShudaoWorkflowURL() string {
- return c.ShudaoBaseURL + "/v1/workflows/run"
- }
- // getEnvOrDefault 获取环境变量或返回默认值
- func getEnvOrDefault(key, defaultValue string) string {
- if value := os.Getenv(key); value != "" {
- return value
- }
- return defaultValue
- }
|