package main import ( "log" "github.com/gin-gonic/gin" "tencenthw/pkg/config" "tencenthw/pkg/handler" ) func main() { // Load configuration cfg, err := config.LoadConfig() if err != nil { log.Fatalf("Failed to load configuration: %v", err) } // Initialize handlers ocrHandler := handler.NewOCRHandler( cfg.TencentSecretID, cfg.TencentSecretKey, cfg.GeminiAPIKey, cfg.APIKey, ) rateHandler := handler.NewRateHandler( cfg.GeminiAPIKey, cfg.APIKey, ) // Setup Gin router r := gin.Default() // Register routes r.POST("/ocr", ocrHandler.HandleOCR) r.POST("/rate", rateHandler.HandleRate) // Start server if err := r.Run("localhost:8080"); err != nil { log.Fatalf("Failed to start server: %v", err) } }