健康检查
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 54s

This commit is contained in:
Song367 2025-09-28 10:11:06 +08:00
parent 5b0e17be2e
commit a2994f3905
2 changed files with 15 additions and 1 deletions

View File

@ -4,7 +4,7 @@ FROM golang:1.21-alpine AS go-builder
WORKDIR /usr/src/app WORKDIR /usr/src/app
# 安装必要的构建工具 # 安装必要的构建工具
# RUN apk add --no-cache gcc musl-dev RUN apk add --no-cache gcc musl-dev
# 设置 GOPROXY 环境变量 # 设置 GOPROXY 环境变量
ENV GOPROXY=https://goproxy.cn,direct ENV GOPROXY=https://goproxy.cn,direct

14
main.go
View File

@ -74,6 +74,20 @@ func main() {
router.POST("/speech/synthesize", llmHandler.SynthesizeSpeech) router.POST("/speech/synthesize", llmHandler.SynthesizeSpeech)
router.GET("/stream-text", llmHandler.StreamText) router.GET("/stream-text", llmHandler.StreamText)
router.POST("/token", tokenHandler.GenerateToken) router.POST("/token", tokenHandler.GenerateToken)
// Define routes
router.GET("/", func(c *gin.Context) {
c.JSON(200, gin.H{
"status": "ok",
"message": "Service is healthy",
})
})
// Define routes
router.GET("/health", func(c *gin.Context) {
c.JSON(200, gin.H{
"status": "ok",
"message": "Service is healthy",
})
})
// Serve static files // Serve static files
router.Static("/static", "./static") router.Static("/static", "./static")