prompts-core

This commit is contained in:
2026-05-12 13:59:15 +08:00
parent 9080d2cebe
commit b179fab2a1
34 changed files with 3892 additions and 0 deletions

38
main.go Normal file
View File

@@ -0,0 +1,38 @@
package main
import (
"context"
"os"
"os/signal"
"syscall"
"prompts-core/controller"
"gitea.com/red-future/common/http"
"gitea.com/red-future/common/jaeger"
_ "gitea.com/red-future/common/swagger"
_ "github.com/gogf/gf/contrib/drivers/pgsql/v2"
_ "github.com/gogf/gf/contrib/nosql/redis/v2"
"github.com/gogf/gf/v2/frame/g"
)
func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
defer jaeger.ShutDown(ctx)
// 注册路由
http.RouteRegister([]interface{}{
controller.Prompt,
controller.Session,
})
// 监听退出信号,确保 Ctrl+C 能完整退出并关闭 http server
quit := make(chan os.Signal, 1)
signal.Notify(quit, os.Interrupt, syscall.SIGTERM)
<-quit
g.Log().Infof(ctx, "[main] 收到退出信号,开始优雅退出...")
cancel()
_ = http.Httpserver.Shutdown()
}