Initial open-source release (MIT): image2api AI gateway
Full Go backend + Vue 3 frontend, OpenAI-compatible API, multi-provider account pools, billing/admin, Docker one-command deploy with auto HTTPS. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"backend/internal/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type SiteHandler struct {
|
||||
site *service.SiteService
|
||||
}
|
||||
|
||||
func NewSiteHandler(site *service.SiteService) *SiteHandler {
|
||||
return &SiteHandler{site: site}
|
||||
}
|
||||
|
||||
func (h *SiteHandler) Public(c *gin.Context) {
|
||||
title, err := h.site.Title(c.Request.Context())
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"detail": "failed to load site"})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"title": title, "contact": h.site.Contact(c.Request.Context())})
|
||||
}
|
||||
Reference in New Issue
Block a user