2026-06-23 09:54:27 +00:00
|
|
|
// Code generated by goctl. DO NOT EDIT.
|
|
|
|
|
// goctl 1.10.1
|
|
|
|
|
|
|
|
|
|
package handler
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
|
|
ai "haixun-backend/internal/handler/ai"
|
|
|
|
|
auth "haixun-backend/internal/handler/auth"
|
|
|
|
|
job "haixun-backend/internal/handler/job"
|
|
|
|
|
member "haixun-backend/internal/handler/member"
|
|
|
|
|
normal "haixun-backend/internal/handler/normal"
|
|
|
|
|
permission "haixun-backend/internal/handler/permission"
|
2026-06-23 16:55:10 +00:00
|
|
|
persona "haixun-backend/internal/handler/persona"
|
2026-06-23 09:54:27 +00:00
|
|
|
setting "haixun-backend/internal/handler/setting"
|
2026-06-23 16:55:10 +00:00
|
|
|
threadsaccount "haixun-backend/internal/handler/threads_account"
|
2026-06-23 09:54:27 +00:00
|
|
|
"haixun-backend/internal/svc"
|
|
|
|
|
|
|
|
|
|
"github.com/zeromicro/go-zero/rest"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
2026-06-23 16:55:10 +00:00
|
|
|
server.AddRoutes(
|
|
|
|
|
[]rest.Route{
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/workers/jobs/claim",
|
|
|
|
|
Handler: job.ClaimWorkerJobHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/workers/jobs/:id/heartbeat",
|
|
|
|
|
Handler: job.RefreshWorkerJobLockHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/workers/jobs/:id/cancel-check",
|
|
|
|
|
Handler: job.CheckWorkerJobCancelHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/workers/jobs/:id/cancel-ack",
|
|
|
|
|
Handler: job.AckWorkerJobCancelHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/workers/jobs/:id/progress",
|
|
|
|
|
Handler: job.UpdateWorkerJobProgressHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/workers/jobs/:id/complete",
|
|
|
|
|
Handler: job.CompleteWorkerJobHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/workers/jobs/:id/fail",
|
|
|
|
|
Handler: job.FailWorkerJobHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPatch,
|
|
|
|
|
Path: "/workers/personas/:id/style-profile",
|
|
|
|
|
Handler: job.StorePersonaStyleProfileFromWorkerHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/workers/threads-accounts/:id/session",
|
|
|
|
|
Handler: job.GetWorkerThreadsAccountSessionHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/workers/jobs/:id/analyze-style-8d",
|
|
|
|
|
Handler: job.AnalyzeStyle8DFromWorkerHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
rest.WithPrefix("/api/v1/internal"),
|
|
|
|
|
)
|
|
|
|
|
|
2026-06-23 09:54:27 +00:00
|
|
|
server.AddRoutes(
|
|
|
|
|
[]rest.Route{
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodGet,
|
|
|
|
|
Path: "/providers",
|
|
|
|
|
Handler: ai.ListAiProvidersHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
rest.WithPrefix("/api/v1/ai"),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
server.AddRoutes(
|
|
|
|
|
rest.WithMiddlewares(
|
|
|
|
|
[]rest.Middleware{serverCtx.MemberAuth},
|
|
|
|
|
[]rest.Route{
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/chat",
|
|
|
|
|
Handler: ai.ChatHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/chat/stream",
|
|
|
|
|
Handler: ai.ChatStreamHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/providers/:provider/models",
|
|
|
|
|
Handler: ai.ListAiProviderModelsHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
}...,
|
|
|
|
|
),
|
|
|
|
|
rest.WithPrefix("/api/v1/ai"),
|
|
|
|
|
)
|
|
|
|
|
|
2026-06-23 16:55:10 +00:00
|
|
|
server.AddRoutes(
|
|
|
|
|
rest.WithMiddlewares(
|
|
|
|
|
[]rest.Middleware{serverCtx.AuthJWT},
|
|
|
|
|
[]rest.Route{
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/islander/chat/stream",
|
|
|
|
|
Handler: ai.IslanderChatStreamHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
}...,
|
|
|
|
|
),
|
|
|
|
|
rest.WithPrefix("/api/v1/ai"),
|
|
|
|
|
)
|
|
|
|
|
|
2026-06-23 09:54:27 +00:00
|
|
|
server.AddRoutes(
|
|
|
|
|
[]rest.Route{
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/login",
|
|
|
|
|
Handler: auth.LoginHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/refresh",
|
|
|
|
|
Handler: auth.RefreshHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/register",
|
|
|
|
|
Handler: auth.RegisterHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
rest.WithPrefix("/api/v1/auth"),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
server.AddRoutes(
|
|
|
|
|
rest.WithMiddlewares(
|
|
|
|
|
[]rest.Middleware{serverCtx.AuthJWT},
|
|
|
|
|
[]rest.Route{
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/logout",
|
|
|
|
|
Handler: auth.LogoutHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
}...,
|
|
|
|
|
),
|
|
|
|
|
rest.WithPrefix("/api/v1/auth"),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
server.AddRoutes(
|
|
|
|
|
rest.WithMiddlewares(
|
|
|
|
|
[]rest.Middleware{serverCtx.AuthJWT},
|
|
|
|
|
[]rest.Route{
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodGet,
|
|
|
|
|
Path: "/job/schedules",
|
|
|
|
|
Handler: job.ListJobSchedulesHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/job/schedules",
|
|
|
|
|
Handler: job.CreateJobScheduleHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPut,
|
|
|
|
|
Path: "/job/schedules/:id",
|
|
|
|
|
Handler: job.UpdateJobScheduleHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/job/schedules/:id/disable",
|
|
|
|
|
Handler: job.DisableJobScheduleHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/job/schedules/:id/enable",
|
|
|
|
|
Handler: job.EnableJobScheduleHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodGet,
|
|
|
|
|
Path: "/job/templates",
|
|
|
|
|
Handler: job.ListJobTemplatesHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodGet,
|
|
|
|
|
Path: "/job/templates/:type",
|
|
|
|
|
Handler: job.GetJobTemplateHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPut,
|
|
|
|
|
Path: "/job/templates/:type",
|
|
|
|
|
Handler: job.UpsertJobTemplateHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/jobs",
|
|
|
|
|
Handler: job.CreateJobHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodGet,
|
|
|
|
|
Path: "/jobs",
|
|
|
|
|
Handler: job.ListJobsHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodGet,
|
|
|
|
|
Path: "/jobs/:id",
|
|
|
|
|
Handler: job.GetJobHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/jobs/:id/cancel",
|
|
|
|
|
Handler: job.CancelJobHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodGet,
|
|
|
|
|
Path: "/jobs/:id/events",
|
|
|
|
|
Handler: job.ListJobEventsHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/jobs/:id/retry",
|
|
|
|
|
Handler: job.RetryJobHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
}...,
|
|
|
|
|
),
|
|
|
|
|
rest.WithPrefix("/api/v1"),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
server.AddRoutes(
|
|
|
|
|
rest.WithMiddlewares(
|
|
|
|
|
[]rest.Middleware{serverCtx.AuthJWT},
|
|
|
|
|
[]rest.Route{
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodGet,
|
|
|
|
|
Path: "/me",
|
|
|
|
|
Handler: member.GetMemberMeHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPatch,
|
|
|
|
|
Path: "/me",
|
|
|
|
|
Handler: member.UpdateMemberMeHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
}...,
|
|
|
|
|
),
|
|
|
|
|
rest.WithPrefix("/api/v1/members"),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
server.AddRoutes(
|
|
|
|
|
[]rest.Route{
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodGet,
|
|
|
|
|
Path: "/health",
|
|
|
|
|
Handler: normal.HealthHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
rest.WithPrefix("/api/v1"),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
server.AddRoutes(
|
|
|
|
|
rest.WithMiddlewares(
|
|
|
|
|
[]rest.Middleware{serverCtx.AuthJWT},
|
|
|
|
|
[]rest.Route{
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodGet,
|
|
|
|
|
Path: "/catalog",
|
|
|
|
|
Handler: permission.GetPermissionCatalogHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodGet,
|
|
|
|
|
Path: "/me",
|
|
|
|
|
Handler: permission.GetMePermissionsHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
}...,
|
|
|
|
|
),
|
|
|
|
|
rest.WithPrefix("/api/v1/permissions"),
|
|
|
|
|
)
|
|
|
|
|
|
2026-06-23 16:55:10 +00:00
|
|
|
server.AddRoutes(
|
|
|
|
|
rest.WithMiddlewares(
|
|
|
|
|
[]rest.Middleware{serverCtx.AuthJWT},
|
|
|
|
|
[]rest.Route{
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodGet,
|
|
|
|
|
Path: "/",
|
|
|
|
|
Handler: persona.ListPersonasHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/",
|
|
|
|
|
Handler: persona.CreatePersonaHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodGet,
|
|
|
|
|
Path: "/:id",
|
|
|
|
|
Handler: persona.GetPersonaHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPatch,
|
|
|
|
|
Path: "/:id",
|
|
|
|
|
Handler: persona.UpdatePersonaHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodDelete,
|
|
|
|
|
Path: "/:id",
|
|
|
|
|
Handler: persona.DeletePersonaHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/:id/style-analysis",
|
|
|
|
|
Handler: persona.StartPersonaStyleAnalysisHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
}...,
|
|
|
|
|
),
|
|
|
|
|
rest.WithPrefix("/api/v1/personas"),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
server.AddRoutes(
|
|
|
|
|
rest.WithMiddlewares(
|
|
|
|
|
[]rest.Middleware{serverCtx.AuthJWT},
|
|
|
|
|
[]rest.Route{
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodGet,
|
|
|
|
|
Path: "/",
|
|
|
|
|
Handler: threadsaccount.ListThreadsAccountsHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/",
|
|
|
|
|
Handler: threadsaccount.CreateThreadsAccountHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodGet,
|
|
|
|
|
Path: "/:id",
|
|
|
|
|
Handler: threadsaccount.GetThreadsAccountHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPatch,
|
|
|
|
|
Path: "/:id",
|
|
|
|
|
Handler: threadsaccount.UpdateThreadsAccountHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/:id/activate",
|
|
|
|
|
Handler: threadsaccount.ActivateThreadsAccountHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodGet,
|
|
|
|
|
Path: "/:id/connection",
|
|
|
|
|
Handler: threadsaccount.GetThreadsAccountConnectionHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPatch,
|
|
|
|
|
Path: "/:id/connection",
|
|
|
|
|
Handler: threadsaccount.UpdateThreadsAccountConnectionHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPost,
|
|
|
|
|
Path: "/:id/session/import",
|
|
|
|
|
Handler: threadsaccount.ImportThreadsAccountSessionHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodGet,
|
|
|
|
|
Path: "/:id/ai-settings",
|
|
|
|
|
Handler: threadsaccount.GetThreadsAccountAiSettingsHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPut,
|
|
|
|
|
Path: "/:id/ai-settings",
|
|
|
|
|
Handler: threadsaccount.UpdateThreadsAccountAiSettingsHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
}...,
|
|
|
|
|
),
|
|
|
|
|
rest.WithPrefix("/api/v1/threads-accounts"),
|
|
|
|
|
)
|
|
|
|
|
|
2026-06-23 09:54:27 +00:00
|
|
|
server.AddRoutes(
|
|
|
|
|
rest.WithMiddlewares(
|
|
|
|
|
[]rest.Middleware{serverCtx.AuthJWT},
|
|
|
|
|
[]rest.Route{
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodGet,
|
|
|
|
|
Path: "/:scope/:scope_id",
|
|
|
|
|
Handler: setting.ListSettingsHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodGet,
|
|
|
|
|
Path: "/:scope/:scope_id/:key",
|
|
|
|
|
Handler: setting.GetSettingHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodPut,
|
|
|
|
|
Path: "/:scope/:scope_id/:key",
|
|
|
|
|
Handler: setting.UpsertSettingHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
Method: http.MethodDelete,
|
|
|
|
|
Path: "/:scope/:scope_id/:key",
|
|
|
|
|
Handler: setting.DeleteSettingHandler(serverCtx),
|
|
|
|
|
},
|
|
|
|
|
}...,
|
|
|
|
|
),
|
|
|
|
|
rest.WithPrefix("/api/v1/settings"),
|
|
|
|
|
)
|
|
|
|
|
}
|