Reorganize project structure: - backend/cmd/openteam/ — entry point - backend/internal/ — core packages - backend/middleware/ — HTTP middleware - backend/router/ — route setup - backend/wire/ — dependency injection - backend/pkg/ — shared utilities - backend/go.mod, go.sum — Go module files Updated Makefile to work from backend/ directory. Removed old lowercase makefile.
50 lines
1.0 KiB
Go
50 lines
1.0 KiB
Go
package proxy
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// HandleChat handles POST /v1/chat/completions
|
|
func (g *Gateway) HandleChat(c *gin.Context) {
|
|
req, err := g.ParseRequest(c, "chat")
|
|
if err != nil {
|
|
g.writeError(c, http.StatusBadRequest, err.Error())
|
|
return
|
|
}
|
|
|
|
g.Dispatch(c, req)
|
|
}
|
|
|
|
// HandleMessages handles POST /v1/messages
|
|
func (g *Gateway) HandleMessages(c *gin.Context) {
|
|
req, err := g.ParseRequest(c, "messages")
|
|
if err != nil {
|
|
g.writeError(c, http.StatusBadRequest, err.Error())
|
|
return
|
|
}
|
|
|
|
g.Dispatch(c, req)
|
|
}
|
|
|
|
// HandleResponses handles POST /v1/responses
|
|
func (g *Gateway) HandleResponses(c *gin.Context) {
|
|
req, err := g.ParseRequest(c, "responses")
|
|
if err != nil {
|
|
g.writeError(c, http.StatusBadRequest, err.Error())
|
|
return
|
|
}
|
|
|
|
g.Dispatch(c, req)
|
|
}
|
|
|
|
// HandleModels handles GET /v1/models
|
|
func (g *Gateway) HandleModels(c *gin.Context) {
|
|
// TODO: Return list of available models based on enabled channels
|
|
c.JSON(http.StatusOK, gin.H{
|
|
"object": "list",
|
|
"data": []interface{}{},
|
|
})
|
|
}
|