mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-30 23:26:39 +08:00
28 lines
436 B
Go
28 lines
436 B
Go
package controller
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"net/http"
|
|
)
|
|
|
|
func Success(c *gin.Context, data interface{}) {
|
|
c.JSON(http.StatusOK, gin.H{
|
|
"message": "",
|
|
"success": true,
|
|
"data": data,
|
|
})
|
|
}
|
|
|
|
func Err(c *gin.Context, err error) {
|
|
c.JSON(http.StatusOK, gin.H{
|
|
"success": false,
|
|
"message": err.Error(),
|
|
})
|
|
}
|
|
|
|
func OpenAiErr(c *gin.Context, err OpenAIError) {
|
|
c.JSON(http.StatusOK, gin.H{
|
|
"error": err,
|
|
})
|
|
}
|