Documentation
¶
Index ¶
- Variables
- type ActivateReq
- type AddGitIdentityReq
- type AddGroupImageReq
- type AddGroupModelReq
- type AddTeamAdminReq
- type AddTeamAdminResp
- type AddTeamGroupReq
- type AddTeamGroupUsersReq
- type AddTeamGroupUsersResp
- type AddTeamImageReq
- type AddTeamModelReq
- type AddTeamUserReq
- type AddTeamUserResp
- type ApplyPortReq
- type ArchiveOptions
- type Audit
- type AuditRepo
- type AuditUsecase
- type AuthRepository
- type BindRepository
- type BlobOptions
- type Branch
- type BranchInfo
- type BranchesOptions
- type ChangePasswordReq
- type ChangePasswordResp
- type CheckByConfigReq
- type CheckModelReq
- type CheckModelResp
- type CloseTerminalReq
- type Collaborator
- type CommitAdapter
- type CommitEntryAdapter
- type CommitUserAdapter
- type CreateAuditRequest
- type CreateCollaboratorItem
- type CreateGitBotReq
- type CreateGitTaskReq
- type CreateImageReq
- type CreateImageResp
- type CreateIssueCommentReq
- type CreateIssueReq
- type CreateModelReq
- type CreateModelResp
- type CreateNotifyChannelReq
- type CreateNotifySendLogReq
- type CreateProjectReq
- type CreateTaskReq
- type CreateVMReq
- type CreateWebhookOptions
- type CursorReq
- type DeleteGitIdentityReq
- type DeleteGroupImageReq
- type DeleteGroupModelReq
- type DeleteImageReq
- type DeleteModelConfigReq
- type DeleteTeamGroupReq
- type DeleteTeamGroupUserReq
- type DeleteTeamHostReq
- type DeleteTeamImageReq
- type DeleteTeamModelReq
- type DeleteVirtualMachineReq
- type EmailSender
- type FileChangeReq
- type FilePathReq
- type FileSaveReq
- type FireExpiredVMItem
- type GetAccountInfoReq
- type GetBlobResp
- type GetGitIdentityReq
- type GetGitLogsResp
- type GetProjectArchiveReq
- type GetProjectArchiveResp
- type GetProjectBlobReq
- type GetProjectLogsReq
- type GetProjectTreeReq
- type GetProviderModelListReq
- type GetProviderModelListResp
- type GetRepoArchiveResp
- type GetRepoTreeResp
- type GitBot
- type GitBotRepo
- type GitBotTask
- type GitBotUsecase
- type GitClienter
- type GitCommit
- type GitCommitEntry
- type GitCredentialInfo
- type GitIdentity
- type GitIdentityRepo
- type GitIdentityUsecase
- type GitRepository
- type GitTask
- type GitTaskRepo
- type GitTaskRepoInterface
- type GitTaskUsecase
- type GitUser
- type GroupImageListReq
- type GroupImageListResp
- type GroupModelListReq
- type GroupModelListResp
- type Host
- type HostListResp
- type HostRepo
- type HostUsecase
- type IDReq
- type Image
- type ImageRepo
- type ImageUsecase
- type InstallCommand
- type InstallReq
- type InternalHook
- type InviteLinkReq
- type InviteLinkToken
- type JoinGroupReq
- type JoinGroupResp
- type JoinTerminalReq
- type ListAuditsRequest
- type ListAuditsResponse
- type ListBranchesReq
- type ListCollaboratorsReq
- type ListCollaboratorsResp
- type ListGitBotResp
- type ListGitBotTaskReq
- type ListGitBotTaskResp
- type ListImageResp
- type ListIssueCommentsReq
- type ListIssueCommentsResp
- type ListIssuesReq
- type ListIssuesResp
- type ListModelResp
- type ListPortsReq
- type ListProjectResp
- type ListTaskResp
- type ListTeamGroupUsersReq
- type ListTeamGroupUsersResp
- type ListTeamGroupsReq
- type ListTeamGroupsResp
- type ListTeamHostsResp
- type ListTeamImagesResp
- type ListTeamModelsResp
- type LogsOptions
- type MemberListReq
- type MemberListResp
- type Model
- type ModelConfig
- type ModelHook
- type ModelRepo
- type ModelUsecase
- type NotifyChannel
- type NotifyChannelRepo
- type NotifyChannelUsecase
- type NotifyEvent
- type NotifyEventPayload
- type NotifySendLogRepo
- type NotifySubscriptionRepo
- type OAuthSiteConfig
- type OpenAIData
- type OpenAIError
- type OpenAIResp
- type Owner
- type PlatformUserInfo
- type PrivilegeChecker
- type Project
- type ProjectBlob
- type ProjectCommit
- type ProjectCommitEntry
- type ProjectCommitUser
- type ProjectHook
- type ProjectIssue
- type ProjectIssueComment
- type ProjectLogs
- type ProjectRepo
- type ProjectTask
- type ProjectTree
- type ProjectTreeEntry
- type ProjectUsecase
- type ProviderModelListItem
- type PublicHostRepo
- type PublicHostUsecase
- type PullRequest
- type RecyclePortReq
- type RedeemCaptchaReq
- type Repo
- type RepositoryOptions
- type ResetPasswordReq
- type ResetUserPasswordEmailReq
- type ResetUserPasswordReq
- type Resource
- type SendBindEmailVerificationReq
- type ShareGitBotReq
- type ShareTerminalReq
- type ShareTerminalResp
- type SharedTerminal
- type SiteResolver
- type SpeechRecognitionData
- type SpeechRecognitionEvent
- type Subject
- type Task
- type TaskChunkEntry
- type TaskControlReq
- type TaskExtraConfig
- type TaskHook
- type TaskListReq
- type TaskRepo
- type TaskRepoReq
- type TaskRoundsReq
- type TaskRoundsResp
- type TaskSession
- type TaskStats
- type TaskStream
- type TaskStreamReq
- type TaskUsecase
- type Team
- type TeamGroup
- type TeamGroupHost
- type TeamGroupImage
- type TeamGroupModel
- type TeamGroupUserRepo
- type TeamGroupUserUsecase
- type TeamHostRepo
- type TeamHostUsecase
- type TeamImage
- type TeamImageRepo
- type TeamImageUsecase
- type TeamInviteLinkResp
- type TeamLoginReq
- type TeamLoginResp
- type TeamLogoutResp
- type TeamMember
- type TeamMemberInfo
- type TeamMembersResp
- type TeamModel
- type TeamModelRepo
- type TeamModelUsecase
- type TeamUser
- type TeamUserInfo
- type TeamUserLoginResp
- type TeamUserStatusResp
- type Terminal
- type TerminalReq
- type TerminalSession
- type TreeEntry
- type TreeEntryAdapter
- type TreeOptions
- type UpdateGitBotReq
- type UpdateGitIdentityReq
- type UpdateHostReq
- type UpdateImageReq
- type UpdateIssueDocReq
- type UpdateIssueReq
- type UpdateModelReq
- type UpdateNotifyChannelReq
- type UpdateProjectReq
- type UpdateTeamGroupReq
- type UpdateTeamHostReq
- type UpdateTeamImageReq
- type UpdateTeamModelReq
- type UpdateTeamUserReq
- type UpdateTeamUserResp
- type UpdateUserReq
- type UpdateUserResp
- type UpdateVMReq
- type User
- type UserIdentity
- type UserRepo
- type UserUsecase
- type VMPort
- type VMResource
- type VMTerminalMessage
- type VMTerminalMessageType
- type VMTerminalResizeData
- type VMTerminalSuccess
- type VerifyBindEmailReq
- type VirtualMachine
- type VmExpireInfo
- type VmIdleInfo
- type WebhookOptions
Constants ¶
This section is empty.
Variables ¶
var ModelProviderBrandModelsList = map[consts.ModelProvider][]ProviderModelListItem{ consts.ModelProviderOpenAI: { {Model: "gpt-4o"}, }, consts.ModelProviderDeepSeek: { {Model: "deepseek-reasoner"}, {Model: "deepseek-chat"}, }, consts.ModelProviderMoonshot: { {Model: "moonshot-v1-auto"}, {Model: "moonshot-v1-8k"}, {Model: "moonshot-v1-32k"}, {Model: "moonshot-v1-128k"}, }, consts.ModelProviderAzureOpenAI: { {Model: "gpt-4"}, {Model: "gpt-4o"}, {Model: "gpt-4o-mini"}, {Model: "gpt-4o-nano"}, {Model: "gpt-4.1"}, {Model: "gpt-4.1-mini"}, {Model: "gpt-4.1-nano"}, {Model: "o1"}, {Model: "o1-mini"}, {Model: "o3"}, {Model: "o3-mini"}, {Model: "o4-mini"}, }, consts.ModelProviderVolcengine: { {Model: "doubao-seed-1.6-250615"}, {Model: "doubao-seed-1.6-flash-250615"}, {Model: "doubao-seed-1.6-thinking-250615"}, {Model: "doubao-1.5-thinking-vision-pro-250428"}, {Model: "deepseek-r1-250528"}, }, }
Functions ¶
This section is empty.
Types ¶
type ActivateReq ¶
type ActivateReq struct {
InviteCode string `json:"invite_code" validate:"required"`
InviterID string `json:"inviter_id,omitempty"`
}
ActivateReq 激活请求
type AddGitIdentityReq ¶
type AddGitIdentityReq struct {
Platform consts.GitPlatform `json:"platform" validate:"required"`
BaseURL string `json:"base_url" validate:"required"`
AccessToken string `json:"access_token" validate:"required"`
Username string `json:"username" validate:"required"`
Email string `json:"email" validate:"required"`
Remark string `json:"remark,omitempty"`
}
AddGitIdentityReq 添加 Git 身份认证请求
type AddGroupImageReq ¶
type AddGroupImageReq struct {
GroupID uuid.UUID `param:"group_id" validate:"required" json:"-" swaggerignore:"true"`
ImageID uuid.UUID `param:"image_id" validate:"required" json:"-" swaggerignore:"true"`
}
AddGroupImageReq 添加团队分组镜像请求
type AddGroupModelReq ¶
type AddGroupModelReq struct {
GroupID uuid.UUID `param:"group_id" validate:"required" json:"-" swaggerignore:"true"`
ModelID uuid.UUID `param:"model_id" validate:"required" json:"-" swaggerignore:"true"`
}
AddGroupModelReq 添加团队分组模型配置请求
type AddTeamAdminReq ¶
type AddTeamAdminReq struct {
Email string `json:"email" validate:"required,email"` // 邮箱
Name string `json:"name" validate:"required"` // 姓名
}
AddTeamAdminReq 创建团队管理员请求
type AddTeamAdminResp ¶
type AddTeamAdminResp struct {
User *TeamUser `json:"user"`
}
AddTeamAdminResp 创建团队管理员响应
type AddTeamGroupReq ¶
type AddTeamGroupReq struct {
Name string `json:"name" validate:"required"`
}
AddTeamGroupReq 创建团队分组请求
type AddTeamGroupUsersReq ¶
type AddTeamGroupUsersReq struct {
GroupID uuid.UUID `param:"group_id" validate:"required" json:"-" swaggerignore:"true"`
UserIDs []uuid.UUID `json:"user_ids" validate:"required"`
}
AddTeamGroupUsersReq 添加团队组成员请求
type AddTeamGroupUsersResp ¶
type AddTeamGroupUsersResp struct {
Users []*User `json:"users"`
}
AddTeamGroupUsersResp 添加团队组成员响应
type AddTeamImageReq ¶
type AddTeamImageReq struct {
Name string `json:"name" validate:"required"`
Remark string `json:"remark"`
GroupIDs []uuid.UUID `json:"group_ids" validate:"required"`
}
AddTeamImageReq 添加团队镜像请求
type AddTeamModelReq ¶
type AddTeamModelReq struct {
Provider string `json:"provider" validate:"required"`
APIKey string `json:"api_key" validate:"required"`
BaseURL string `json:"base_url" validate:"required"`
Model string `json:"model" validate:"required"`
Temperature float64 `json:"temperature"`
GroupIDs []uuid.UUID `json:"group_ids" validate:"required"`
InterfaceType consts.InterfaceType `json:"interface_type" validate:"required,oneof=openai_chat openai_responses anthropic"`
}
AddTeamModelReq 添加团队模型配置请求
type AddTeamUserReq ¶
type AddTeamUserReq struct {
Emails []string `json:"emails" validate:"required"` // 邮箱列表
GroupID uuid.UUID `json:"group_id" validate:"omitempty"` // 团队组ID
}
AddTeamUserReq 创建团队成员请求
type AddTeamUserResp ¶
type AddTeamUserResp struct {
Users []*TeamUser `json:"users"`
}
AddTeamUserResp 创建团队成员响应
type ApplyPortReq ¶
type ApplyPortReq struct {
ID string `json:"id" param:"id" validate:"required" swaggerignore:"true"`
HostID string `json:"host_id" param:"host_id" validate:"required" swaggerignore:"true"`
Port uint16 `json:"port" validate:"required,min=1,max=65535"`
WhiteList []string `json:"white_list" validate:"required,dive,ip"`
ForwardID string `json:"forward_id" validate:"omitempty"`
}
ApplyPortReq 申请端口请求
type ArchiveOptions ¶
type ArchiveOptions struct {
Token string
Owner string
Repo string
Ref string
InstallID int64
IsOAuth bool
}
ArchiveOptions 获取归档参数
type Audit ¶
type Audit struct {
ID uuid.UUID `json:"id"`
Operation string `json:"operation"`
SourceIP string `json:"source_ip"`
UserAgent string `json:"user_agent"`
Request string `json:"request"`
Response string `json:"response"`
CreatedAt time.Time `json:"created_at"`
User *User `json:"user"`
}
Audit 审计日志
type AuditRepo ¶
type AuditRepo interface {
CreateAudit(ctx context.Context, audit *Audit) error
ListAudits(ctx context.Context, teamUser *TeamUser, req *ListAuditsRequest) ([]*db.Audit, *db.Cursor, error)
}
AuditRepo 审计日志仓库接口
type AuditUsecase ¶
type AuditUsecase interface {
CreateAudit(ctx context.Context, audit *Audit) error
ListAudits(ctx context.Context, teamUser *TeamUser, req *ListAuditsRequest) (*ListAuditsResponse, error)
}
AuditUsecase 审计日志业务逻辑接口
type AuthRepository ¶
type AuthRepository struct {
FullName string `json:"full_name"`
URL string `json:"url"`
Description string `json:"description"`
}
AuthRepository 授权仓库信息
type BindRepository ¶
type BindRepository struct {
RepoID string
RepoName string
FullName string
RepoURL string
RepoDescription string
IsPrivate bool
Platform string
}
BindRepository 绑定仓库信息
type BlobOptions ¶
type BlobOptions struct {
Token string
Owner string
Repo string
Ref string
Path string
InstallID int64
IsOAuth bool
}
BlobOptions 获取文件内容参数
type BranchesOptions ¶
type BranchesOptions struct {
Token string
Owner string
Repo string
Page int
PerPage int
InstallID int64
IsOAuth bool
}
BranchesOptions 列出分支参数
type ChangePasswordReq ¶
type ChangePasswordReq struct {
CurrentPassword string `json:"current_password" validate:"omitempty"` // 当前密码
NewPassword string `json:"new_password" validate:"required,min=8,max=32"` // 新密码
}
ChangePasswordReq 修改密码请求
type ChangePasswordResp ¶
ChangePasswordResp 修改密码响应
type CheckByConfigReq ¶
type CheckByConfigReq struct {
Provider consts.ModelProvider `json:"provider" validate:"required"`
APIKey string `json:"api_key" validate:"required"`
BaseURL string `json:"base_url" validate:"required"`
Model string `json:"model" validate:"required"`
InterfaceType consts.InterfaceType `json:"interface_type,omitempty" validate:"omitempty,oneof=openai_chat openai_responses anthropic"`
}
CheckByConfigReq 检查模型健康状态请求(通过配置)
type CheckModelReq ¶
CheckModelReq 检查模型健康状态请求(通过ID)
type CheckModelResp ¶
CheckModelResp 检查模型健康状态响应
type CloseTerminalReq ¶
type CloseTerminalReq struct {
ID string `json:"id" query:"id" param:"id" validate:"required"`
TerminalID string `json:"terminal_id" param:"terminal_id" validate:"required"`
}
CloseTerminalReq 关闭终端请求
type Collaborator ¶
type Collaborator struct {
User
Permission consts.ProjectCollaboratorRole `json:"permission"`
}
Collaborator 协作者
func (*Collaborator) From ¶
func (c *Collaborator) From(src *db.ProjectCollaborator) *Collaborator
type CommitAdapter ¶
type CommitAdapter struct {
Author *CommitUserAdapter
Committer *CommitUserAdapter
Message string
ParentShas []string
Sha string
TreeSha string
}
CommitAdapter 提交信息适配结构体
type CommitEntryAdapter ¶
type CommitEntryAdapter struct {
Commit *CommitAdapter
}
CommitEntryAdapter 单条提交记录适配结构体
type CommitUserAdapter ¶
CommitUserAdapter 提交用户适配结构体
type CreateAuditRequest ¶
type CreateAuditRequest struct {
UserID uuid.UUID `json:"user_id" binding:"required"`
Operation string `json:"operation" binding:"required"`
SourceIP string `json:"source_ip" binding:"required"`
UserAgent string `json:"user_agent"`
Request string `json:"request"`
Response string `json:"response"`
}
CreateAuditRequest 创建审计日志请求
type CreateCollaboratorItem ¶
type CreateCollaboratorItem struct {
UserID uuid.UUID `json:"user_id"`
Permission consts.ProjectCollaboratorRole `json:"permission"`
}
CreateCollaboratorItem 创建协作者项
type CreateGitBotReq ¶
type CreateGitBotReq struct {
Platform consts.GitPlatform `json:"platform" validate:"required"`
Name string `json:"name"`
Token string `json:"token" validate:"required"`
HostID string `json:"host_id" validate:"required"`
}
CreateGitBotReq 创建 Git Bot 请求
type CreateGitTaskReq ¶
type CreateGitTaskReq struct {
HostID string `json:"host_id"`
ImageID uuid.UUID `json:"image_id"`
Subject Subject `json:"subject"`
Repo Repo `json:"repo"`
User User `json:"user"`
Platform consts.GitPlatform `json:"platform"`
Body string `json:"body"`
Time time.Time `json:"time"`
Prompt string `json:"prompt"`
PromptID string `json:"prompt_id"`
GithubInstallationID int64 `json:"github_installation_id"`
Env map[string]string `json:"env"`
Git taskflow.Git `json:"git"`
Bot *GitBot `json:"-"`
}
CreateGitTaskReq 创建 GitTask 请求
type CreateImageReq ¶
type CreateImageReq struct {
ImageName string `json:"image_name" validate:"required"`
Remark string `json:"remark,omitempty"`
IsDefault bool `json:"is_default,omitempty"`
}
CreateImageReq 创建镜像配置请求
type CreateImageResp ¶
CreateImageResp 创建镜像配置响应
type CreateIssueCommentReq ¶
type CreateIssueCommentReq struct {
ID uuid.UUID `param:"id" validate:"required" json:"-" swaggerignore:"true"`
IssueID uuid.UUID `param:"issue_id" validate:"required" json:"-" swaggerignore:"true"`
Comment string `json:"comment" validate:"required"`
ParentID *uuid.UUID `json:"parent_id,omitempty"`
}
CreateIssueCommentReq 创建问题评论请求
type CreateIssueReq ¶
type CreateIssueReq struct {
ID uuid.UUID `param:"id" validate:"required" json:"-" swaggerignore:"true"`
Title string `json:"title"`
RequirementDocument string `json:"requirement_document"`
AssigneeID *uuid.UUID `json:"assignee_id,omitempty"`
Priority consts.ProjectIssuePriority `json:"priority,omitempty"`
}
CreateIssueReq 创建问题请求
type CreateModelReq ¶
type CreateModelReq struct {
Provider string `json:"provider" validate:"required"`
APIKey string `json:"api_key" validate:"required"`
BaseURL string `json:"base_url" validate:"required"`
Model string `json:"model" validate:"required"`
Temperature float32 `json:"temperature"`
IsDefault bool `json:"is_default"`
InterfaceType consts.InterfaceType `json:"interface_type" validate:"required,oneof=openai_chat openai_responses anthropic"`
}
CreateModelReq 创建模型配置请求
type CreateModelResp ¶
CreateModelResp 创建模型配置响应
type CreateNotifyChannelReq ¶
type CreateNotifyChannelReq struct {
Name string `json:"name" validate:"required,max=64"`
Kind consts.NotifyChannelKind `json:"kind" validate:"required,oneof=dingtalk feishu wecom webhook"`
WebhookURL string `json:"webhook_url" validate:"required,url"`
Secret string `json:"secret,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
EventTypes []consts.NotifyEventType `json:"event_types" validate:"required,min=1"`
}
CreateNotifyChannelReq 创建通知渠道请求
type CreateNotifySendLogReq ¶
type CreateNotifySendLogReq struct {
SubscriptionID uuid.UUID `json:"subscription_id"`
ChannelID uuid.UUID `json:"channel_id"`
EventType consts.NotifyEventType `json:"event_type"`
EventRefID string `json:"event_ref_id"`
Status consts.NotifySendStatus `json:"status"`
Error string `json:"error"`
}
CreateNotifySendLogReq 创建通知发送日志请求
type CreateProjectReq ¶
type CreateProjectReq struct {
Name string `json:"name"`
Description string `json:"description"`
Platform consts.GitPlatform `json:"platform"`
RepoURL string `json:"repo_url"`
GitIdentityID uuid.UUID `json:"git_identity_id"`
ImageID uuid.UUID `json:"image_id,omitempty"`
EnvVariables map[string]any `json:"env_variables,omitempty"`
}
CreateProjectReq 创建项目请求
type CreateTaskReq ¶
type CreateTaskReq struct {
Content string `json:"content" validate:"required"`
HostID string `json:"host_id" validate:"required"`
ImageID uuid.UUID `json:"image_id" validate:"required"`
ModelID string `json:"model_id" validate:"required"`
GitIdentityID uuid.UUID `json:"git_identity_id" validate:"omitempty"`
RepoReq TaskRepoReq `json:"repo" validate:"required"`
CliName consts.CliName `json:"cli_name"`
Resource *VMResource `json:"resource" validate:"required"`
Extra TaskExtraConfig `json:"extra" validate:"omitempty"`
SystemPrompt string `json:"system_prompt"`
Type consts.TaskType `json:"task_type"`
SubType consts.TaskSubType `json:"sub_type"`
Now time.Time `json:"-"`
UsePublicHost bool `json:"-"`
}
CreateTaskReq 创建任务请求
type CreateVMReq ¶
type CreateVMReq struct {
HostID string `json:"host_id" validate:"required"`
Name string `json:"name" validate:"required"`
ImageID uuid.UUID `json:"image_id" validate:"required"`
ModelID string `json:"model_id" validate:"required"`
Life int64 `json:"life"`
Resource *Resource `json:"resource" validate:"required"`
InstallCodingAgents bool `json:"install_coding_agents,omitempty"`
RepoReq *TaskRepoReq `json:"repo,omitempty"`
GitIdentityID uuid.UUID `json:"git_identity_id"`
Now time.Time `json:"-"`
UsePublicHost bool `json:"-"`
}
CreateVMReq 创建虚拟机请求
type CreateWebhookOptions ¶
type CreateWebhookOptions struct {
Token string
RepoURL string
WebhookURL string
SecretToken string
Events []string
IsOAuth bool
}
CreateWebhookOptions 创建 Webhook 参数
type DeleteGitIdentityReq ¶
DeleteGitIdentityReq 删除 Git 身份认证请求
type DeleteGroupImageReq ¶
type DeleteGroupImageReq struct {
GroupID uuid.UUID `param:"group_id" validate:"required" json:"-" swaggerignore:"true"`
ImageID uuid.UUID `param:"image_id" validate:"required" json:"-" swaggerignore:"true"`
}
DeleteGroupImageReq 删除团队分组镜像请求
type DeleteGroupModelReq ¶
type DeleteGroupModelReq struct {
GroupID uuid.UUID `param:"group_id" validate:"required" json:"-" swaggerignore:"true"`
ModelID uuid.UUID `param:"model_id" validate:"required" json:"-" swaggerignore:"true"`
}
DeleteGroupModelReq 删除团队分组模型配置请求
type DeleteImageReq ¶
DeleteImageReq 删除镜像配置请求
type DeleteModelConfigReq ¶
DeleteModelConfigReq 删除模型配置请求
type DeleteTeamGroupReq ¶
type DeleteTeamGroupReq struct {
GroupID uuid.UUID `param:"group_id" validate:"required" json:"-" swaggerignore:"true"`
}
DeleteTeamGroupReq 删除团队分组请求
type DeleteTeamGroupUserReq ¶
type DeleteTeamGroupUserReq struct {
GroupID uuid.UUID `param:"group_id" validate:"required" json:"-" swaggerignore:"true"`
UserID uuid.UUID `param:"user_id" validate:"required" json:"-" swaggerignore:"true"`
}
DeleteTeamGroupUserReq 删除团队组成员请求
type DeleteTeamHostReq ¶
type DeleteTeamHostReq struct {
HostID string `param:"host_id" validate:"required" json:"-" swaggerignore:"true"`
}
DeleteTeamHostReq 删除团队宿主机请求
type DeleteTeamImageReq ¶
type DeleteTeamImageReq struct {
ImageID uuid.UUID `param:"image_id" validate:"required" json:"-" swaggerignore:"true"`
}
DeleteTeamImageReq 删除团队镜像请求
type DeleteTeamModelReq ¶
type DeleteTeamModelReq struct {
ModelID uuid.UUID `param:"model_id" validate:"required" json:"-" swaggerignore:"true"`
}
DeleteTeamModelReq 删除团队模型配置请求
type DeleteVirtualMachineReq ¶
type DeleteVirtualMachineReq struct {
ID string `json:"id" query:"id" param:"id" validate:"required"`
HostID string `json:"host_id" query:"host_id" param:"host_id" validate:"required"`
}
DeleteVirtualMachineReq 删除虚拟机请求
type EmailSender ¶
type EmailSender interface {
SendResetPasswordEmail(ctx context.Context, to, username, resetURL string) error
SendBindEmailVerification(ctx context.Context, to, username, verifyURL string) error
}
EmailSender 邮件发送接口
type FileChangeReq ¶
type FileChangeReq struct {
ID string `json:"id" query:"id" validate:"required"` // 虚拟机 id
Source string `json:"source" query:"source" validate:"required"` // 来源
Target string `json:"target" query:"target" validate:"required"` // 目标
}
FileChangeReq 文件变更请求(移动/复制)
type FilePathReq ¶
type FilePathReq struct {
ID string `json:"id" query:"id" validate:"required"` // 虚拟机 id
Path string `json:"path" query:"path" validate:"required"` // 文件/目录路径
}
FilePathReq 文件路径请求
type FileSaveReq ¶
type FileSaveReq struct {
ID string `json:"id" validate:"required"` // 虚拟机 id
Path string `json:"path" validate:"required"` // 文件路径
Content string `json:"content"` // 文件内容
}
FileSaveReq 文件保存请求
type FireExpiredVMItem ¶
FireExpiredVMItem 触发过期 VM 结果
type GetAccountInfoReq ¶
type GetAccountInfoReq struct {
Token string `param:"token" validate:"required"`
}
GetAccountInfoReq 通过 token 查询账户信息请求
type GetBlobResp ¶
GetBlobResp 获取单文件内容响应
type GetGitIdentityReq ¶
GetGitIdentityReq 获取 Git 身份认证详情请求
type GetGitLogsResp ¶
type GetGitLogsResp struct {
Count int
Entries []*GitCommitEntry
}
GetGitLogsResp 获取提交历史响应
type GetProjectArchiveReq ¶
type GetProjectArchiveReq struct {
ID uuid.UUID `param:"id" validate:"required" json:"-" swaggerignore:"true"`
Ref string `query:"ref" validate:"omitempty"`
}
GetProjectArchiveReq 获取项目压缩包请求
type GetProjectArchiveResp ¶
type GetProjectArchiveResp struct {
ContentLength int64
ContentType string
Reader io.ReadCloser
}
GetProjectArchiveResp 获取项目压缩包响应
type GetProjectBlobReq ¶
type GetProjectBlobReq struct {
ID uuid.UUID `param:"id" validate:"required" json:"-" swaggerignore:"true"`
Path string `query:"path" validate:"required"`
Ref string `query:"ref" validate:"omitempty"`
}
GetProjectBlobReq 获取项目文件内容请求
type GetProjectLogsReq ¶
type GetProjectLogsReq struct {
ID uuid.UUID `param:"id" validate:"required" json:"-" swaggerignore:"true"`
Ref string `query:"ref" validate:"omitempty"`
Path string `query:"path" validate:"omitempty"`
Limit int `query:"limit" validate:"omitempty"`
Offset int `query:"offset" validate:"omitempty"`
}
GetProjectLogsReq 获取项目提交历史请求
type GetProjectTreeReq ¶
type GetProjectTreeReq struct {
ID uuid.UUID `param:"id" validate:"required" json:"-" swaggerignore:"true"`
Recursive bool `query:"recursive" validate:"omitempty"`
Ref string `query:"ref" validate:"omitempty"`
Path string `query:"path" validate:"omitempty"`
}
GetProjectTreeReq 获取项目文件树请求
type GetProviderModelListReq ¶
type GetProviderModelListReq struct {
Provider consts.ModelProvider `` /* 166-byte string literal not displayed */
BaseURL string `json:"base_url" query:"base_url" validate:"required"`
APIKey string `json:"api_key" query:"api_key" validate:"required"`
APIHeader string `json:"api_header" query:"api_header"`
}
type GetProviderModelListResp ¶
type GetProviderModelListResp struct {
Models []ProviderModelListItem `json:"models"`
Error *OpenAIError `json:"error,omitempty"`
}
type GetRepoArchiveResp ¶
type GetRepoArchiveResp struct {
ContentLength int64
ContentType string
Reader io.ReadCloser
}
GetRepoArchiveResp 获取仓库压缩包响应
type GetRepoTreeResp ¶
GetRepoTreeResp 获取仓库文件树响应
type GitBot ¶
type GitBot struct {
ID uuid.UUID `json:"id"`
Platform consts.GitPlatform `json:"platform"`
Name string `json:"name"`
Token string `json:"token"`
SecretToken string `json:"secret_token"`
Host *Host `json:"host"`
WebhookURL string `json:"webhook_url"`
Users []*User `json:"users"`
CreatedAt int64 `json:"created_at"`
}
GitBot Git Bot 实体
type GitBotRepo ¶
type GitBotRepo interface {
GetByID(ctx context.Context, id uuid.UUID) (*db.GitBot, error)
GetInstallationID(ctx context.Context, botID uuid.UUID) (int64, error)
GetGitIdentityID(ctx context.Context, botID uuid.UUID) (uuid.UUID, error)
List(ctx context.Context, uid uuid.UUID) ([]*db.GitBot, error)
Create(ctx context.Context, uid uuid.UUID, req CreateGitBotReq) (*db.GitBot, error)
Update(ctx context.Context, uid uuid.UUID, req UpdateGitBotReq) (*db.GitBot, error)
Delete(ctx context.Context, uid, id uuid.UUID) error
ListTask(ctx context.Context, uid uuid.UUID, req ListGitBotTaskReq) ([]*db.GitBotTask, *db.PageInfo, error)
}
GitBotRepo GitBot 数据访问接口
type GitBotTask ¶
type GitBotTask struct {
ID uuid.UUID `json:"id"`
PullRequest PullRequest `json:"pull_request"`
Repo GitRepository `json:"repo"`
Status consts.TaskStatus `json:"status"`
Bot *GitBot `json:"bot"`
CreatedAt int64 `json:"created_at"`
}
GitBotTask Git Bot 任务实体
type GitBotUsecase ¶
type GitBotUsecase interface {
GetByID(ctx context.Context, id uuid.UUID) (*GitBot, error)
GetInstallationID(ctx context.Context, botID uuid.UUID) (int64, error)
GetAccessToken(ctx context.Context, botID uuid.UUID) (string, error)
List(ctx context.Context, uid uuid.UUID) (*ListGitBotResp, error)
Create(ctx context.Context, uid uuid.UUID, req CreateGitBotReq) (*GitBot, error)
Update(ctx context.Context, uid uuid.UUID, req UpdateGitBotReq) (*GitBot, error)
Delete(ctx context.Context, uid, id uuid.UUID) error
ListTask(ctx context.Context, uid uuid.UUID, req ListGitBotTaskReq) (*ListGitBotTaskResp, error)
}
GitBotUsecase GitBot 业务逻辑接口
type GitClienter ¶
type GitClienter interface {
// 认证
CheckPAT(ctx context.Context, token, repoURL string) (bool, *BindRepository, error)
UserInfo(ctx context.Context, token string) (*PlatformUserInfo, error)
Repositories(ctx context.Context, opts *RepositoryOptions) ([]AuthRepository, error)
// 仓库操作
Tree(ctx context.Context, opts *TreeOptions) (*GetRepoTreeResp, error)
Blob(ctx context.Context, opts *BlobOptions) (*GetBlobResp, error)
Logs(ctx context.Context, opts *LogsOptions) (*GetGitLogsResp, error)
Archive(ctx context.Context, opts *ArchiveOptions) (*GetRepoArchiveResp, error)
Branches(ctx context.Context, opts *BranchesOptions) ([]*BranchInfo, error)
// Webhook
DeleteWebhook(ctx context.Context, opts *WebhookOptions) error
CreateWebhook(ctx context.Context, opts *CreateWebhookOptions) error
}
GitClienter Git 平台统一客户端接口
type GitCommit ¶
type GitCommit struct {
Author *GitUser
Committer *GitUser
Message string
ParentShas []string
Sha string
TreeSha string
}
GitCommit 提交信息
type GitCredentialInfo ¶
type GitCredentialInfo struct {
UserID uuid.UUID
ProjectID uuid.UUID
GitIdentityID uuid.UUID
Platform consts.GitPlatform
GitUsername string
}
GitCredentialInfo git 凭证关联信息
type GitIdentity ¶
type GitIdentity struct {
ID uuid.UUID `json:"id"`
Platform consts.GitPlatform `json:"platform"`
BaseURL string `json:"base_url"`
AccessToken string `json:"access_token"`
Username string `json:"username"`
Email string `json:"email"`
Remark string `json:"remark"`
IsInstallationApp bool `json:"is_installation_app"`
AuthorizedRepositories []AuthRepository `json:"authorized_repositories"`
CreatedAt time.Time `json:"created_at"`
}
GitIdentity Git 身份认证
func (*GitIdentity) From ¶
func (g *GitIdentity) From(src *db.GitIdentity) *GitIdentity
From 从数据库模型转换为领域模型
type GitIdentityRepo ¶
type GitIdentityRepo interface {
Get(ctx context.Context, id uuid.UUID) (*db.GitIdentity, error)
GetByUserID(ctx context.Context, uid uuid.UUID, id uuid.UUID) (*db.GitIdentity, error)
List(ctx context.Context, uid uuid.UUID) ([]*db.GitIdentity, error)
Create(ctx context.Context, uid uuid.UUID, req *AddGitIdentityReq) (*db.GitIdentity, error)
Update(ctx context.Context, uid uuid.UUID, id uuid.UUID, req *UpdateGitIdentityReq) error
Delete(ctx context.Context, uid uuid.UUID, id uuid.UUID) error
CountProjectsByGitIdentityID(ctx context.Context, id uuid.UUID) (int, error)
}
GitIdentityRepo Git 身份认证数据仓库接口
type GitIdentityUsecase ¶
type GitIdentityUsecase interface {
List(ctx context.Context, uid uuid.UUID) ([]*GitIdentity, error)
Get(ctx context.Context, uid uuid.UUID, id uuid.UUID) (*GitIdentity, error)
Add(ctx context.Context, uid uuid.UUID, req *AddGitIdentityReq) (*GitIdentity, error)
Update(ctx context.Context, uid uuid.UUID, req *UpdateGitIdentityReq) error
Delete(ctx context.Context, uid uuid.UUID, id uuid.UUID) error
ListBranches(ctx context.Context, uid uuid.UUID, identityID uuid.UUID, repoFullName string, page, perPage int) ([]*Branch, error)
}
GitIdentityUsecase Git 身份认证业务逻辑接口
type GitRepository ¶
type GitRepository struct {
URL string `json:"url"`
RepoName string `json:"repo_name"`
Owner string `json:"owner"`
Platform consts.GitPlatform `json:"platform"`
}
GitRepository Git 仓库信息
type GitTask ¶
type GitTask struct {
ID uuid.UUID `json:"id"`
TaskID uuid.UUID `json:"task_id"`
SubjectURL string `json:"subject_url"`
PromptID string `json:"prompt_id"`
GithubInstallationID int64 `json:"github_installation_id"`
Platform consts.GitPlatform `json:"platform"`
Repo *GitTaskRepo `json:"repo,omitempty"`
}
GitTask git 任务(由内部项目通过 TaskHook 提供)
type GitTaskRepo ¶
type GitTaskRepo struct {
URL string `json:"url"`
Platform consts.GitPlatform `json:"platform"`
}
GitTaskRepo git 任务关联的仓库信息
type GitTaskRepoInterface ¶
type GitTaskRepoInterface interface {
Create(ctx context.Context, req CreateGitTaskReq, fn func(user *db.User, t *db.Task, m *db.Model, i *db.Image) (*taskflow.VirtualMachine, error)) (*db.Task, error)
}
GitTaskRepoInterface GitTask 数据访问接口
type GitTaskUsecase ¶
type GitTaskUsecase interface {
Create(ctx context.Context, req CreateGitTaskReq) (*GitTask, error)
}
GitTaskUsecase GitTask 业务逻辑接口
type GroupImageListReq ¶
type GroupImageListReq struct {
GroupID uuid.UUID `param:"group_id" validate:"required" json:"-" swaggerignore:"true"`
CursorReq
}
GroupImageListReq 获取团队分组镜像列表请求
type GroupImageListResp ¶
GroupImageListResp 获取团队分组镜像列表响应
type GroupModelListReq ¶
type GroupModelListReq struct {
GroupID uuid.UUID `param:"group_id" validate:"required" json:"-" swaggerignore:"true"`
CursorReq
}
GroupModelListReq 获取团队分组模型配置列表请求
type GroupModelListResp ¶
GroupModelListResp 获取团队分组模型配置列表响应
type Host ¶
type Host struct {
ID string `json:"id"`
Arch string `json:"arch"`
Cores int `json:"cores"`
OS string `json:"os"`
Status consts.HostStatus `json:"status"`
Memory uint64 `json:"memory"`
Name string `json:"name"`
ExternalIP string `json:"external_ip"`
Default bool `json:"default"`
Version string `json:"version"`
VirtualMachines []*VirtualMachine `json:"virtualmachines,omitempty"`
IsDefault bool `json:"is_default"`
Owner *Owner `json:"owner,omitempty"`
Groups []*TeamGroup `json:"groups,omitempty"`
Remark string `json:"remark,omitempty"`
Weight int `json:"weight"`
InternalID string `json:"-"`
}
Host 宿主机
type HostRepo ¶
type HostRepo interface {
List(ctx context.Context, uid uuid.UUID) ([]*db.Host, error)
GetHost(ctx context.Context, uid uuid.UUID, id string) (*Host, error)
GetByID(ctx context.Context, id string) (*db.Host, error)
GetVirtualMachine(ctx context.Context, id string) (*db.VirtualMachine, error)
GetVirtualMachineByEnvID(ctx context.Context, envID string) (*db.VirtualMachine, error)
GetVirtualMachineWithUser(ctx context.Context, uid uuid.UUID, id string) (*db.VirtualMachine, error)
CreateVirtualMachine(ctx context.Context, user *User, req *CreateVMReq, getRepoToken func(context.Context) (string, error), fn func(*db.Model, *db.Image) (*VirtualMachine, error)) (*VirtualMachine, error)
PastHourVirtualMachine(ctx context.Context) ([]*db.VirtualMachine, error)
AllCountDownVirtualMachine(ctx context.Context) ([]*db.VirtualMachine, error)
DeleteVirtualMachine(ctx context.Context, uid uuid.UUID, hostID, id string, fn func(*db.VirtualMachine) error) error
UpsertVirtualMachine(ctx context.Context, vm *taskflow.VirtualMachine) error
UpdateVirtualMachine(ctx context.Context, id string, fn func(*db.VirtualMachineUpdateOne) error) error
UpsertHost(ctx context.Context, h *taskflow.Host) error
DeleteHost(ctx context.Context, uid uuid.UUID, id string) error
UpdateHost(ctx context.Context, uid uuid.UUID, req *UpdateHostReq) error
UpdateVM(ctx context.Context, req UpdateVMReq, fn func(*db.VirtualMachine) error) (*db.VirtualMachine, int64, error)
GetGitCredentialByTask(ctx context.Context, taskID string) (*GitCredentialInfo, error)
}
HostRepo 主机数据访问接口
type HostUsecase ¶
type HostUsecase interface {
GetInstallCommand(ctx context.Context, user *User) (string, error)
InstallScript(ctx context.Context, token *InstallReq) (string, error)
List(ctx context.Context, uid uuid.UUID) (*HostListResp, error)
VMInfo(ctx context.Context, uid uuid.UUID, id string) (*VirtualMachine, error)
ConnectVMTerminal(ctx context.Context, uid uuid.UUID, req TerminalReq) (taskflow.Sheller, error)
TerminalList(ctx context.Context, id string) ([]*Terminal, error)
CloseTerminal(ctx context.Context, id, terminalID string) error
JoinTerminal(ctx context.Context, req *JoinTerminalReq) (taskflow.Sheller, *SharedTerminal, error)
WithVMPermission(ctx context.Context, uid uuid.UUID, id string, fn func(*VirtualMachine) error) error
CreateVM(ctx context.Context, user *User, req *CreateVMReq) (*VirtualMachine, error)
DeleteVM(ctx context.Context, uid uuid.UUID, hostID, vmID string) error
DeleteHost(ctx context.Context, uid uuid.UUID, id string) error
UpdateHost(ctx context.Context, uid uuid.UUID, req *UpdateHostReq) error
RefreshIdleTimers(ctx context.Context, vmID string) error
FireExpiredVM(ctx context.Context, fire bool) ([]FireExpiredVMItem, error)
UpdateVM(ctx context.Context, req UpdateVMReq) (*VirtualMachine, error)
ApplyPort(ctx context.Context, uid uuid.UUID, req *ApplyPortReq) (*VMPort, error)
RecyclePort(ctx context.Context, uid uuid.UUID, req *RecyclePortReq) error
ListPorts(ctx context.Context, uid uuid.UUID, vid string) ([]*VMPort, error)
}
HostUsecase 主机业务逻辑接口
type IDReq ¶
type IDReq[T any] struct { ID T `json:"id" query:"id" param:"id" validate:"required"` }
IDReq 通用 ID 请求
type Image ¶
type Image struct {
ID uuid.UUID `json:"id"`
Name string `json:"name"`
Remark string `json:"remark"`
IsDefault bool `json:"is_default"`
CreatedAt int64 `json:"created_at"`
Owner *Owner `json:"owner"`
}
Image 镜像配置信息
type ImageRepo ¶
type ImageRepo interface {
List(ctx context.Context, uid uuid.UUID, cursor CursorReq) ([]*db.Image, *db.Cursor, error)
Create(ctx context.Context, uid uuid.UUID, req *CreateImageReq) (*db.Image, error)
Delete(ctx context.Context, uid, id uuid.UUID) error
Update(ctx context.Context, uid, id uuid.UUID, req *UpdateImageReq) (*db.Image, error)
GetByID(ctx context.Context, id uuid.UUID, uid uuid.UUID) (*db.Image, error)
}
ImageRepo 镜像配置数据仓库接口
type ImageUsecase ¶
type ImageUsecase interface {
List(ctx context.Context, uid uuid.UUID, cursor CursorReq) (*ListImageResp, error)
Create(ctx context.Context, uid uuid.UUID, req *CreateImageReq) (*Image, error)
Delete(ctx context.Context, uid uuid.UUID, id uuid.UUID) error
Update(ctx context.Context, uid uuid.UUID, id uuid.UUID, req *UpdateImageReq) (*Image, error)
}
ImageUsecase 镜像配置业务逻辑接口
type InstallCommand ¶
type InstallCommand struct {
Command string `json:"command"`
}
InstallCommand 安装命令
type InstallReq ¶
type InstallReq struct {
Token string `json:"token" query:"token"`
}
InstallReq 安装请求
type InternalHook ¶
type InternalHook interface {
// OnAgentAuth agent 认证成功后获取关联的 TaskID
OnAgentAuth(ctx context.Context, vmID string) uuid.UUID
// OnVmReady VM 就绪回调(如任务状态转换)
OnVmReady(ctx context.Context, vmID string) error
// OnVmConditionFailed VM 条件失败回调(如任务状态转换)
OnVmConditionFailed(ctx context.Context, vmID string) error
}
InternalHook 内部 handler 回调接口(可选,内部项目通过 WithInternalHook 注入) 用于扩展 taskflow 回调端点中与 task 系统耦合的逻辑
type InviteLinkReq ¶
type InviteLinkReq struct {
GroupID uuid.UUID `param:"group_id" validate:"required" json:"-" swaggerignore:"true"` // 团队组ID
ExpireAt *time.Time `json:"expire_at" validate:"omitempty"` // 邀请链接过期时间
}
InviteLinkReq 生成邀请链接请求
type InviteLinkToken ¶
type InviteLinkToken struct {
TeamID uuid.UUID `json:"team_id"`
GroupID uuid.UUID `json:"group_id"`
}
InviteLinkToken 邀请链接令牌
type JoinGroupReq ¶
type JoinGroupReq struct {
InviteCode string `query:"invite_code" validate:"required"` // 邀请码
}
JoinGroupReq 用户加入团队分组请求
type JoinGroupResp ¶
JoinGroupResp 用户加入团队分组响应
type JoinTerminalReq ¶
type JoinTerminalReq struct {
TerminalID string `json:"terminal_id" query:"terminal_id"`
Password string `json:"password" query:"password"`
Col int `json:"col" query:"col"`
Row int `json:"row" query:"row"`
}
JoinTerminalReq 加入终端请求
type ListAuditsRequest ¶
type ListAuditsRequest struct {
UserID uuid.UUID `query:"user_id" json:"user_id,omitempty"`
Operation string `query:"operation" json:"operation,omitempty"`
SourceIP string `query:"source_ip" json:"source_ip,omitempty"`
UserAgent string `query:"user_agent" json:"user_agent,omitempty"`
Request string `query:"request" json:"request,omitempty"`
Response string `query:"response" json:"response,omitempty"`
CreatedAtStart time.Time `query:"created_at_start" json:"created_at_start"`
CreatedAtEnd time.Time `query:"created_at_end" json:"created_at_end"`
CursorReq
}
ListAuditsRequest 查询审计日志请求
type ListAuditsResponse ¶
ListAuditsResponse 查询审计日志响应
type ListBranchesReq ¶
type ListBranchesReq struct {
IdentityID uuid.UUID `param:"identity_id" validate:"required" json:"-" swaggerignore:"true"`
EscapedRepoFullName string `param:"escaped_repo_full_name" validate:"required" json:"-" swaggerignore:"true"`
Page int `query:"page" json:"-"`
PerPage int `query:"per_page" json:"-"`
}
ListBranchesReq 获取仓库分支列表请求
type ListCollaboratorsReq ¶
type ListCollaboratorsReq struct {
ID uuid.UUID `param:"id" validate:"required" json:"-" swaggerignore:"true"`
}
ListCollaboratorsReq 协作者列表请求
type ListCollaboratorsResp ¶
type ListCollaboratorsResp struct {
Collaborators []*Collaborator `json:"collaborators"`
}
ListCollaboratorsResp 协作者列表响应
type ListGitBotResp ¶
type ListGitBotResp struct {
Bots []*GitBot `json:"bots"`
}
ListGitBotResp Git Bot 列表响应
type ListGitBotTaskReq ¶
type ListGitBotTaskReq struct {
ID uuid.UUID `json:"id" query:"id" validate:"omitempty"`
Page int `json:"page" query:"page"`
Size int `json:"size" query:"size"`
}
ListGitBotTaskReq Git Bot 任务列表请求
type ListGitBotTaskResp ¶
type ListGitBotTaskResp struct {
Tasks []*GitBotTask `json:"tasks"`
Page int64 `json:"page"`
Size int64 `json:"size"`
Total int64 `json:"total"`
}
ListGitBotTaskResp Git Bot 任务列表响应
type ListImageResp ¶
ListImageResp 获取用户镜像配置列表响应
type ListIssueCommentsReq ¶
type ListIssueCommentsReq struct {
ID uuid.UUID `param:"id" validate:"required" json:"-" swaggerignore:"true"`
IssueID uuid.UUID `param:"issue_id" validate:"required" json:"-" swaggerignore:"true"`
CursorReq
}
ListIssueCommentsReq 问题评论列表请求
type ListIssueCommentsResp ¶
type ListIssueCommentsResp struct {
Comments []*ProjectIssueComment `json:"comments"`
Page *db.Cursor `json:"page"`
}
ListIssueCommentsResp 问题评论列表响应
type ListIssuesReq ¶
type ListIssuesReq struct {
ID uuid.UUID `param:"id" validate:"required" json:"-" swaggerignore:"true"`
CursorReq
}
ListIssuesReq 问题列表请求
type ListIssuesResp ¶
type ListIssuesResp struct {
Issues []*ProjectIssue `json:"issues"`
Page *db.Cursor `json:"page"`
}
ListIssuesResp 问题列表响应
type ListModelResp ¶
ListModelResp 获取用户模型配置列表响应
type ListPortsReq ¶
type ListProjectResp ¶
ListProjectResp 项目列表响应
type ListTaskResp ¶
type ListTaskResp struct {
Tasks []*ProjectTask `json:"tasks"`
PageInfo *db.PageInfo `json:"page_info,omitempty"`
}
ListTaskResp 任务列表响应
type ListTeamGroupUsersReq ¶
type ListTeamGroupUsersReq struct {
GroupID uuid.UUID `param:"group_id" validate:"required" json:"-" swaggerignore:"true"`
}
ListTeamGroupUsersReq 获取团队组成员列表请求
type ListTeamGroupUsersResp ¶
type ListTeamGroupUsersResp struct {
Users []*User `json:"users"`
}
ListTeamGroupUsersResp 获取团队组成员列表响应
type ListTeamGroupsResp ¶
type ListTeamGroupsResp struct {
Groups []*TeamGroup `json:"groups"`
}
ListTeamGroupsResp 获取团队分组列表响应
type ListTeamHostsResp ¶
type ListTeamHostsResp struct {
Hosts []*Host `json:"hosts"`
}
ListTeamHostsResp 团队宿主机列表响应
type ListTeamImagesResp ¶
type ListTeamImagesResp struct {
Images []*TeamImage `json:"images"`
}
ListTeamImagesResp 获取团队镜像列表响应
type ListTeamModelsResp ¶
type ListTeamModelsResp struct {
Models []*TeamModel `json:"models"`
}
ListTeamModelsResp 获取团队模型配置列表响应
type LogsOptions ¶
type LogsOptions struct {
Token string
Owner string
Repo string
Ref string
Path string
Limit int
Offset int
InstallID int64
IsOAuth bool
}
LogsOptions 获取提交历史参数
type MemberListReq ¶
type MemberListReq struct {
Role consts.TeamMemberRole `query:"role" validate:"omitempty"`
}
MemberListReq 获取团队成员列表请求
type MemberListResp ¶
type MemberListResp struct {
Members []*TeamMemberInfo `json:"members"`
MemberLimit int `json:"member_limit"`
}
MemberListResp 获取团队成员列表响应
type Model ¶
type Model struct {
ID uuid.UUID `json:"id"`
Provider string `json:"provider"`
APIKey string `json:"api_key,omitempty"`
BaseURL string `json:"base_url"`
Model string `json:"model"`
Temperature float64 `json:"temperature"`
IsDefault bool `json:"is_default"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
Owner *Owner `json:"owner,omitempty"`
InterfaceType consts.InterfaceType `json:"interface_type"`
IsFree bool `json:"is_free"`
AccessLevel string `json:"access_level"` // 访问级别 basic | pro
LastCheckAt int64 `json:"last_check_at"`
LastCheckSuccess bool `json:"last_check_success"`
LastCheckError string `json:"last_check_error"`
}
Model 模型配置
type ModelConfig ¶
type ModelConfig struct {
URL string `json:"url"`
Key string `json:"key"`
Name string `json:"name"`
}
ModelConfig 模型配置
type ModelHook ¶
type ModelHook interface {
ListPublic(ctx context.Context, uid uuid.UUID) ([]*Model, error)
ValidateAccess(ctx context.Context, uid uuid.UUID, modelID string) error
}
ModelHook 模型列表扩展接口(可选,内部项目通过 WithModelListHook 注入)
type ModelRepo ¶
type ModelRepo interface {
Get(ctx context.Context, uid, id uuid.UUID) (*db.Model, error)
List(ctx context.Context, uid uuid.UUID, cursor CursorReq) ([]*db.Model, *db.Cursor, error)
Create(ctx context.Context, uid uuid.UUID, req *CreateModelReq) (*db.Model, error)
Delete(ctx context.Context, uid, id uuid.UUID) error
Update(ctx context.Context, uid, id uuid.UUID, req *UpdateModelReq) error
UpdateCheckResult(ctx context.Context, id uuid.UUID, success bool, errMsg string) error
}
ModelRepo 模型配置数据仓库接口
type ModelUsecase ¶
type ModelUsecase interface {
List(ctx context.Context, uid uuid.UUID, cursor CursorReq) (*ListModelResp, error)
Create(ctx context.Context, uid uuid.UUID, req *CreateModelReq) (*Model, error)
Delete(ctx context.Context, uid uuid.UUID, id uuid.UUID) error
Update(ctx context.Context, uid, id uuid.UUID, req *UpdateModelReq) error
Check(ctx context.Context, uid, id uuid.UUID) (*CheckModelResp, error)
CheckByConfig(ctx context.Context, req *CheckByConfigReq) (*CheckModelResp, error)
GetProviderModelList(ctx context.Context, req *GetProviderModelListReq) (*GetProviderModelListResp, error)
}
ModelUsecase 模型配置业务逻辑接口
type NotifyChannel ¶
type NotifyChannel struct {
ID uuid.UUID `json:"id"`
OwnerID uuid.UUID `json:"owner_id"`
OwnerType consts.NotifyOwnerType `json:"owner_type"`
Name string `json:"name"`
Kind consts.NotifyChannelKind `json:"kind"`
WebhookURL string `json:"webhook_url"`
Enabled bool `json:"enabled"`
Scope string `json:"scope"`
EventTypes []consts.NotifyEventType `json:"event_types"`
CreatedAt int64 `json:"created_at"`
}
NotifyChannel 通知渠道
type NotifyChannelRepo ¶
type NotifyChannelRepo interface {
Create(ctx context.Context, ownerID uuid.UUID, ownerType consts.NotifyOwnerType, req *CreateNotifyChannelReq) (*db.NotifyChannel, error)
Update(ctx context.Context, id uuid.UUID, req *UpdateNotifyChannelReq) (*db.NotifyChannel, error)
Delete(ctx context.Context, id uuid.UUID) error
Get(ctx context.Context, id uuid.UUID) (*db.NotifyChannel, error)
ListByOwner(ctx context.Context, ownerID uuid.UUID, ownerType consts.NotifyOwnerType) ([]*db.NotifyChannel, error)
FindMatchingChannels(ctx context.Context, subjectUserID uuid.UUID, teamIDs []uuid.UUID, eventType consts.NotifyEventType) ([]*db.NotifyChannel, error)
}
NotifyChannelRepo 通知渠道数据访问接口
type NotifyChannelUsecase ¶
type NotifyChannelUsecase interface {
Create(ctx context.Context, ownerID uuid.UUID, ownerType consts.NotifyOwnerType, req *CreateNotifyChannelReq) (*NotifyChannel, error)
Update(ctx context.Context, ownerID uuid.UUID, id uuid.UUID, req *UpdateNotifyChannelReq) (*NotifyChannel, error)
Delete(ctx context.Context, ownerID uuid.UUID, id uuid.UUID) error
List(ctx context.Context, ownerID uuid.UUID, ownerType consts.NotifyOwnerType) ([]*NotifyChannel, error)
Test(ctx context.Context, ownerID uuid.UUID, id uuid.UUID) error
}
NotifyChannelUsecase 通知渠道业务逻辑接口
type NotifyEvent ¶
type NotifyEvent struct {
EventType consts.NotifyEventType `json:"event_type"`
SubjectUserID uuid.UUID `json:"subject_user_id"`
RefID string `json:"ref_id"`
OccurredAt time.Time `json:"occurred_at"`
Payload NotifyEventPayload `json:"payload"`
}
NotifyEvent 通知事件
type NotifyEventPayload ¶
type NotifyEventPayload struct {
TaskID string `json:"task_id,omitempty"`
TaskContent string `json:"task_content,omitempty"`
TaskStatus string `json:"task_status,omitempty"`
RepoURL string `json:"repo_url,omitempty"`
ModelName string `json:"model_name,omitempty"`
UserName string `json:"user_name,omitempty"`
TaskURL string `json:"task_url,omitempty"`
VMID string `json:"vm_id,omitempty"`
VMStatus string `json:"vm_status,omitempty"`
HostID string `json:"host_id,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
VMName string `json:"vm_name,omitempty"`
VMArch string `json:"vm_arch,omitempty"`
VMCores int `json:"vm_cores,omitempty"`
VMMemory int64 `json:"vm_memory,omitempty"`
VMOS string `json:"vm_os,omitempty"`
}
NotifyEventPayload 通知事件载荷
type NotifySendLogRepo ¶
type NotifySendLogRepo interface {
Create(ctx context.Context, log *CreateNotifySendLogReq) error
Exists(ctx context.Context, subscriptionID uuid.UUID, eventType consts.NotifyEventType, eventRefID string) (bool, error)
}
NotifySendLogRepo 通知发送日志数据访问接口
type NotifySubscriptionRepo ¶
type NotifySubscriptionRepo interface {
Upsert(ctx context.Context, channelID uuid.UUID, scope string, eventTypes []consts.NotifyEventType) (*db.NotifySubscription, error)
Delete(ctx context.Context, id uuid.UUID) error
ListByChannel(ctx context.Context, channelID uuid.UUID) ([]*db.NotifySubscription, error)
}
NotifySubscriptionRepo 通知订阅数据访问接口
type OAuthSiteConfig ¶
type OAuthSiteConfig struct {
ClientID string
ClientSecret string
RedirectURL string
Scope string
BaseURL string
}
OAuthSiteConfig OAuth 站点配置
type OpenAIData ¶
type OpenAIData struct {
ID string `json:"id"`
}
type OpenAIError ¶
type OpenAIResp ¶
type OpenAIResp struct {
Object string `json:"object"`
Data []*OpenAIData `json:"data"`
Error *OpenAIError `json:"error,omitempty"`
}
type Owner ¶
type Owner struct {
ID string `json:"id"`
Type consts.OwnerType `json:"type"`
Name string `json:"name"`
}
Owner 资源所有者
type PrivilegeChecker ¶
PrivilegeChecker 特权用户检查接口(可选,内部项目通过 WithPrivilegeChecker 注入)
type Project ¶
type Project struct {
ID uuid.UUID `json:"id"`
Name string `json:"name"`
RepoURL string `json:"repo_url"`
FullName string `json:"full_name"`
Description string `json:"description"`
Platform consts.GitPlatform `json:"platform"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
User *User `json:"user"`
Issues []*ProjectIssue `json:"issues"`
Collaborators []*Collaborator `json:"collaborators"`
ImageID uuid.UUID `json:"image_id"`
GitIdentityID uuid.UUID `json:"git_identity_id"`
EnvVariables map[string]any `json:"env_variables"`
Tasks []*ProjectTask `json:"tasks"`
AutoReviewEnabled bool `json:"auto_review_enabled"` // 是否开启自动审查
}
Project 项目
type ProjectBlob ¶
type ProjectBlob struct {
Content []byte `json:"content"`
IsBinary bool `json:"is_binary"`
Sha string `json:"sha"`
Size int `json:"size"`
}
ProjectBlob 项目文件内容
type ProjectCommit ¶
type ProjectCommit struct {
Author *ProjectCommitUser `json:"author"`
Committer *ProjectCommitUser `json:"committer"`
Message string `json:"message"`
ParentShas []string `json:"parent_shas"`
Sha string `json:"sha"`
TreeSha string `json:"tree_sha"`
}
ProjectCommit 提交信息
func (*ProjectCommit) From ¶
func (p *ProjectCommit) From(src *CommitAdapter) *ProjectCommit
type ProjectCommitEntry ¶
type ProjectCommitEntry struct {
Commit *ProjectCommit `json:"commit"`
}
ProjectCommitEntry 单条提交记录
func (*ProjectCommitEntry) From ¶
func (p *ProjectCommitEntry) From(src *CommitEntryAdapter) *ProjectCommitEntry
type ProjectCommitUser ¶
type ProjectCommitUser struct {
Email string `json:"email"`
Name string `json:"name"`
When int64 `json:"when"`
}
ProjectCommitUser 提交用户信息
func (*ProjectCommitUser) From ¶
func (p *ProjectCommitUser) From(src *CommitUserAdapter) *ProjectCommitUser
type ProjectHook ¶
type ProjectHook interface {
// GenerateIssueSummary 生成问题摘要
GenerateIssueSummary(ctx context.Context, issueID uuid.UUID) error
// GetInternalRepoToken 获取内部仓库 token
GetInternalRepoToken(ctx context.Context, userID uuid.UUID, projectID uuid.UUID) (string, error)
}
ProjectHook 项目模块回调接口(可选,内部项目通过 WithProjectHook 注入)
type ProjectIssue ¶
type ProjectIssue struct {
ID uuid.UUID `json:"id"`
Title string `json:"title"`
RequirementDocument string `json:"requirement_document"`
DesignDocument string `json:"design_document"`
Summary string `json:"summary"`
Status consts.ProjectIssueStatus `json:"status"`
Priority consts.ProjectIssuePriority `json:"priority"`
CreatedAt int64 `json:"created_at"`
User *User `json:"user"`
Assignee *User `json:"assignee"`
}
ProjectIssue 项目问题
func (*ProjectIssue) From ¶
func (p *ProjectIssue) From(src *db.ProjectIssue) *ProjectIssue
type ProjectIssueComment ¶
type ProjectIssueComment struct {
ID uuid.UUID `json:"id"`
Comment string `json:"comment"`
Parent *ProjectIssueComment `json:"parent"`
Replies []*ProjectIssueComment `json:"replies"`
Creator *User `json:"creator"`
CreatedAt int64 `json:"created_at"`
}
ProjectIssueComment 问题评论
func (*ProjectIssueComment) From ¶
func (p *ProjectIssueComment) From(src *db.ProjectIssueComment) *ProjectIssueComment
type ProjectLogs ¶
type ProjectLogs struct {
Count int `json:"count"`
Entries []*ProjectCommitEntry `json:"entries"`
}
ProjectLogs 项目提交日志
type ProjectRepo ¶
type ProjectRepo interface {
Get(ctx context.Context, uid, id uuid.UUID) (*db.Project, error)
GetByID(ctx context.Context, id uuid.UUID) (*db.Project, error)
List(ctx context.Context, uid uuid.UUID, cursor CursorReq) ([]*db.Project, *db.Cursor, error)
Create(ctx context.Context, uid uuid.UUID, req *CreateProjectReq) (*db.Project, error)
Update(ctx context.Context, user *User, req *UpdateProjectReq) (*db.Project, error)
Delete(ctx context.Context, uid, id uuid.UUID) error
ListIssues(ctx context.Context, uid uuid.UUID, req *ListIssuesReq) ([]*db.ProjectIssue, *db.Cursor, error)
CreateIssue(ctx context.Context, uid uuid.UUID, req *CreateIssueReq) (*db.ProjectIssue, error)
UpdateIssue(ctx context.Context, uid uuid.UUID, req *UpdateIssueReq) (*db.ProjectIssue, error)
UpdateIssueDoc(ctx context.Context, req *UpdateIssueDocReq) (*db.ProjectIssue, error)
GetIssue(ctx context.Context, uid uuid.UUID, projectID, issueID uuid.UUID) (*db.ProjectIssue, error)
UpdateIssueSummary(ctx context.Context, issueID uuid.UUID, summary string) error
ListCollaborators(ctx context.Context, uid uuid.UUID, req *ListCollaboratorsReq) ([]*db.ProjectCollaborator, error)
ListIssueComments(ctx context.Context, uid uuid.UUID, req *ListIssueCommentsReq) ([]*db.ProjectIssueComment, *db.Cursor, error)
CreateIssueComment(ctx context.Context, uid uuid.UUID, req *CreateIssueCommentReq) (*db.ProjectIssueComment, error)
HasReadWritePerm(ctx context.Context, uid uuid.UUID, projectID uuid.UUID) bool
GetProjectIDByTask(ctx context.Context, taskID string) (*db.Project, error)
GetIssueByTaskID(ctx context.Context, taskID string) (*db.ProjectIssue, error)
GetUserProjectPerm(ctx context.Context, uid uuid.UUID, projectID uuid.UUID) (consts.ProjectCollaboratorRole, error)
}
ProjectRepo 项目数据仓库接口
type ProjectTask ¶
type ProjectTask struct {
ID uuid.UUID `json:"id" validate:"required"`
Model *Model `json:"model,omitempty"`
Image *Image `json:"image,omitempty"`
Branch string `json:"branch,omitempty"`
CliName consts.CliName `json:"cli_name,omitempty"`
RepoURL string `json:"repo_url,omitempty"`
FullName string `json:"full_name,omitempty"`
RepoFilename string `json:"repo_filename,omitempty"`
Extra *TaskExtraConfig `json:"extra,omitempty"`
*Task
}
ProjectTask 项目任务
func (*ProjectTask) From ¶
func (pt *ProjectTask) From(src *db.ProjectTask) *ProjectTask
From 从数据库模型转换
type ProjectTreeEntry ¶
type ProjectTreeEntry struct {
Mode int `json:"mode"`
Name string `json:"name"`
Path string `json:"path"`
Sha string `json:"sha"`
Size int `json:"size"`
LastModifiedAt int64 `json:"last_modified_at"`
}
ProjectTreeEntry 项目文件树节点
func (*ProjectTreeEntry) From ¶
func (p *ProjectTreeEntry) From(src *TreeEntryAdapter) *ProjectTreeEntry
type ProjectUsecase ¶
type ProjectUsecase interface {
Get(ctx context.Context, uid, id uuid.UUID) (*Project, error)
List(ctx context.Context, uid uuid.UUID, cursor CursorReq) (*ListProjectResp, error)
Create(ctx context.Context, uid uuid.UUID, req *CreateProjectReq) (*Project, error)
Update(ctx context.Context, user *User, req *UpdateProjectReq) (*Project, error)
Delete(ctx context.Context, uid, id uuid.UUID) error
ListIssues(ctx context.Context, uid uuid.UUID, req *ListIssuesReq) (*ListIssuesResp, error)
CreateIssue(ctx context.Context, uid uuid.UUID, req *CreateIssueReq) (*ProjectIssue, error)
UpdateIssue(ctx context.Context, uid uuid.UUID, req *UpdateIssueReq) (*ProjectIssue, error)
UpdateIssueDoc(ctx context.Context, req *UpdateIssueDocReq) (*ProjectIssue, error)
ListCollaborators(ctx context.Context, uid uuid.UUID, req *ListCollaboratorsReq) (*ListCollaboratorsResp, error)
ListIssueComments(ctx context.Context, uid uuid.UUID, req *ListIssueCommentsReq) (*ListIssueCommentsResp, error)
CreateIssueComment(ctx context.Context, uid uuid.UUID, req *CreateIssueCommentReq) (*ProjectIssueComment, error)
GetProjectIDByTask(ctx context.Context, taskID string) (*Project, error)
GetIssueByTaskID(ctx context.Context, taskID string) (*ProjectIssue, error)
GetProjectTree(ctx context.Context, uid uuid.UUID, req *GetProjectTreeReq) (ProjectTree, error)
GetProjectBlob(ctx context.Context, uid uuid.UUID, req *GetProjectBlobReq) (*ProjectBlob, error)
GetProjectLogs(ctx context.Context, uid uuid.UUID, req *GetProjectLogsReq) (*ProjectLogs, error)
GetProjectArchive(ctx context.Context, uid uuid.UUID, req *GetProjectArchiveReq) (*GetProjectArchiveResp, error)
GetRepoToken(ctx context.Context, userID, projectID, gitIdentityID uuid.UUID, platform consts.GitPlatform) (string, error)
}
ProjectUsecase 项目业务逻辑接口
type ProviderModelListItem ¶
type ProviderModelListItem struct {
Model string `json:"model"`
}
type PublicHostRepo ¶
PublicHostRepo 公共主机数据访问接口
type PublicHostUsecase ¶
PublicHostUsecase 公共主机业务逻辑接口
type PullRequest ¶
PullRequest PR/MR 信息
type RecyclePortReq ¶
type RecyclePortReq struct {
ID string `json:"id" param:"id" validate:"required" swaggerignore:"true"`
HostID string `json:"host_id" param:"host_id" validate:"required" swaggerignore:"true"`
ForwardID string `json:"forward_id" validate:"required"`
}
RecyclePortReq 回收端口请求
type RedeemCaptchaReq ¶
type Repo ¶
type Repo struct {
ID string `json:"id"`
Name string `json:"name"`
FullName string `json:"fullname"`
URL string `json:"url"`
Desc string `json:"desc"`
Branch *string `json:"branch"`
IsPrivate bool `json:"is_private"`
}
Repo 仓库信息
type RepositoryOptions ¶
type ResetPasswordReq ¶
type ResetPasswordReq struct {
UserIDs []uuid.UUID `json:"user_ids" validate:"required"` // 用户ID列表
}
ResetPasswordReq 重置密码请求
type ResetUserPasswordEmailReq ¶
type ResetUserPasswordEmailReq struct {
Emails []string `json:"emails" validate:"required"`
CaptchaToken string `json:"captcha_token"`
}
ResetUserPasswordEmailReq 发送重置密码邮件请求
type ResetUserPasswordReq ¶
type ResetUserPasswordReq struct {
NewPassword string `json:"new_password" validate:"required,min=8,max=32"`
Token string `json:"token" validate:"required"`
}
ResetUserPasswordReq 修改密码请求
type SendBindEmailVerificationReq ¶
type SendBindEmailVerificationReq struct {
Email string `json:"email" validate:"required,email"` // 要绑定的邮箱地址
}
SendBindEmailVerificationReq 发送邮箱绑定验证邮件请求
type SiteResolver ¶
type SiteResolver interface {
// ResolveByHost 通过域名解析站点配置
ResolveByHost(ctx context.Context, host string) (*OAuthSiteConfig, error)
// ResolveBySiteID 通过站点 ID 解析站点配置
ResolveBySiteID(ctx context.Context, siteID uuid.UUID) (*OAuthSiteConfig, error)
}
SiteResolver 站点解析接口(可选,内部项目通过 WithSiteResolver 注入)
type SpeechRecognitionData ¶
type SpeechRecognitionData struct {
Type string `json:"type" example:"result"` // 数据类型: result, end, error
Text string `json:"text,omitempty" example:"你好"` // 识别文本 (仅result类型)
IsFinal bool `json:"is_final,omitempty" example:"false"` // 是否为最终结果 (仅result类型)
UserID string `json:"user_id,omitempty" example:"uuid"` // 用户ID (仅result类型)
Timestamp int64 `json:"timestamp,omitempty" example:"1640995200000"` // 时间戳 (仅result类型)
Error string `json:"error,omitempty" example:"识别失败"` // 错误信息 (仅error类型)
}
SpeechRecognitionData 语音识别事件数据
type SpeechRecognitionEvent ¶
type SpeechRecognitionEvent struct {
Event string `json:"event"` // 事件类型: recognition, end, error
Data SpeechRecognitionData `json:"data"` // 事件数据
}
SpeechRecognitionEvent 语音识别事件响应
type Subject ¶
type Subject struct {
ID string `json:"id"`
Type string `json:"type"`
Title string `json:"title"`
URL string `json:"url"`
Number int `json:"number"`
}
Subject 任务主题
type Task ¶
type Task struct {
ID uuid.UUID `json:"id"`
UserID uuid.UUID `json:"user_id"`
Type consts.TaskType `json:"type"`
SubType consts.TaskSubType `json:"sub_type"`
Content string `json:"content"`
Summary string `json:"summary"`
Status consts.TaskStatus `json:"status"`
VirtualMachine *VirtualMachine `json:"virtualmachine"`
CreatedAt int64 `json:"created_at"`
CompletedAt int64 `json:"completed_at"`
Model *Model `json:"model,omitempty"`
Image *Image `json:"image,omitempty"`
Branch string `json:"branch,omitempty"`
CliName consts.CliName `json:"cli_name,omitempty"`
RepoURL string `json:"repo_url,omitempty"`
FullName string `json:"full_name,omitempty"`
RepoFilename string `json:"repo_filename,omitempty"`
Extra *TaskExtraConfig `json:"extra,omitempty"`
Stats *TaskStats `json:"stats,omitempty"`
}
Task 任务
type TaskChunkEntry ¶
type TaskChunkEntry struct {
Data []byte `json:"data,omitempty"`
Event string `json:"event"`
Kind string `json:"kind"`
Timestamp int64 `json:"timestamp"`
Labels map[string]string `json:"labels,omitempty"`
}
TaskChunkEntry 原始日志条目(不聚合)
type TaskControlReq ¶
TaskControlReq 控制 WebSocket 请求
type TaskExtraConfig ¶
type TaskExtraConfig struct {
ProjectID uuid.UUID `json:"project_id" validate:"omitempty"`
IssueID uuid.UUID `json:"issue_id" validate:"omitempty"`
SkillIDs []string `json:"skill_ids" validate:"omitempty"`
}
TaskExtraConfig 任务额外配置
type TaskHook ¶
type TaskHook interface {
// GetSystemPrompt 获取任务系统提示词
GetSystemPrompt(ctx context.Context, taskType consts.TaskType, subType consts.TaskSubType) (string, error)
// OnTaskCreated 任务创建后回调
OnTaskCreated(ctx context.Context, task *ProjectTask) error
// GitTask 获取 git 任务详情
GitTask(ctx context.Context, id uuid.UUID) (*GitTask, error)
// GetMaxConcurrent 获取最大运行任务
GetMaxConcurrent(ctx context.Context, uid uuid.UUID) (int, error)
}
TaskHook 任务模块回调接口(可选,内部项目通过 WithTaskHook 注入) 用于扩展 task 模块中与 gittask/task_system_prompt 耦合的逻辑
type TaskListReq ¶
type TaskListReq struct {
ProjectID uuid.UUID `json:"project_id" query:"project_id" validate:"omitempty"`
QuickStart bool `json:"quick_start" query:"quick_start" validate:"omitempty"`
Status *string `json:"status" query:"status"` // 状态筛选,多值用逗号分开 pending,processing,error,finished
*web.Pagination
}
TaskListReq 任务列表请求
type TaskRepo ¶
type TaskRepo interface {
GetByID(ctx context.Context, id uuid.UUID) (*db.Task, error)
Stat(ctx context.Context, id uuid.UUID) (*TaskStats, error)
StatByIDs(ctx context.Context, ids []uuid.UUID) (map[uuid.UUID]*TaskStats, error)
Info(ctx context.Context, user *User, id uuid.UUID, isPrivileged bool) (*db.Task, error)
List(ctx context.Context, user *User, req TaskListReq) ([]*db.ProjectTask, *db.PageInfo, error)
Create(ctx context.Context, user *User, req CreateTaskReq, token string, fn func(*db.ProjectTask, *db.Model, *db.Image) (*taskflow.VirtualMachine, error)) (*db.ProjectTask, error)
Update(ctx context.Context, user *User, id uuid.UUID, fn func(up *db.TaskUpdateOne) error) error
Stop(ctx context.Context, user *User, id uuid.UUID, fn func(*db.Task) error) error
Delete(ctx context.Context, user *User, id uuid.UUID) error
}
TaskRepo 任务数据访问接口
type TaskRepoReq ¶
type TaskRepoReq struct {
RepoURL string `json:"repo_url"`
Branch string `json:"branch"`
RepoFilename string `json:"repo_filename"`
ZipURL string `json:"zip_url"`
}
TaskRepoReq 仓库请求
type TaskRoundsReq ¶
type TaskRoundsReq struct {
ID uuid.UUID `json:"id" query:"id" validate:"required"` // 任务 ID
Cursor string `json:"cursor" query:"cursor"` // 游标(时间戳 Unix ns,从此时间点往前查询)
Limit int `json:"limit" query:"limit"` // 返回的论次数(默认 2,上限 10)
}
TaskRoundsReq 查询任务历史论次请求(向前翻页)
type TaskRoundsResp ¶
type TaskRoundsResp struct {
Chunks []*TaskChunkEntry `json:"chunks"`
NextCursor string `json:"next_cursor,omitempty"` // 下一页游标(最早条目的时间戳 ns)
HasMore bool `json:"has_more"`
}
TaskRoundsResp 查询任务历史论次响应
type TaskSession ¶
type TaskSession struct {
Task *taskflow.CreateTaskReq `json:"task"`
User *User `json:"user"`
Platform consts.GitPlatform `json:"platform"`
ShowUrl string `json:"show_url"`
}
TaskSession tasker 状态机的 payload
type TaskStats ¶
type TaskStats struct {
InputTokens int64 `json:"input_tokens"`
OutputTokens int64 `json:"output_tokens"`
TotalTokens int64 `json:"total_tokens"`
LLMRequests int64 `json:"llm_requests"`
}
TaskStats 任务 token 用量统计
type TaskStream ¶
type TaskStream struct {
Type consts.TaskStreamType `json:"type"`
Data []byte `json:"data"`
Kind string `json:"kind"`
Timestamp int64 `json:"timestamp"`
}
TaskStream 任务 WebSocket 流消息
type TaskStreamReq ¶
type TaskStreamReq struct {
ID uuid.UUID `json:"id" query:"id" validate:"required"`
Mode string `json:"mode" query:"mode"` // new|attach,默认 new
}
TaskStreamReq 任务数据流请求
type TaskUsecase ¶
type TaskUsecase interface {
GetPublic(ctx context.Context, user *User, id uuid.UUID) (*Task, error)
Info(ctx context.Context, user *User, id uuid.UUID) (*Task, bool, error)
List(ctx context.Context, user *User, req TaskListReq) (*ListTaskResp, error)
Continue(ctx context.Context, user *User, id uuid.UUID, content string) error
Create(ctx context.Context, user *User, req CreateTaskReq) (*ProjectTask, error)
Stop(ctx context.Context, user *User, id uuid.UUID) error
Cancel(ctx context.Context, user *User, id uuid.UUID) error
AutoApprove(ctx context.Context, user *User, id uuid.UUID, approve bool) error
GitTask(ctx context.Context, id uuid.UUID) (*GitTask, error)
Delete(ctx context.Context, user *User, id uuid.UUID) error
}
TaskUsecase 任务业务逻辑接口
type TeamGroup ¶
type TeamGroup struct {
ID uuid.UUID `json:"id"`
Name string `json:"name"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
Users []*User `json:"users,omitempty"`
}
TeamGroup 团队分组信息
type TeamGroupHost ¶
type TeamGroupHost struct {
GroupID uuid.UUID `json:"group_id"`
CreatedAt int64 `json:"created_at"`
Host *Host `json:"host,omitempty"`
}
TeamGroupHost 团队分组宿主机信息
func (*TeamGroupHost) From ¶
func (t *TeamGroupHost) From(src *db.TeamGroupHost) *TeamGroupHost
From 从数据库模型转换
type TeamGroupImage ¶
type TeamGroupImage struct {
GroupID uuid.UUID `json:"group_id"`
CreatedAt int64 `json:"created_at"`
Image *Image `json:"image,omitempty"`
}
TeamGroupImage 团队分组镜像信息
func (*TeamGroupImage) From ¶
func (t *TeamGroupImage) From(src *db.TeamGroupImage) *TeamGroupImage
From 从数据库模型转换为领域模型
type TeamGroupModel ¶
type TeamGroupModel struct {
GroupID uuid.UUID `json:"group_id"`
CreatedAt int64 `json:"created_at"`
Model *Model `json:"model,omitempty"`
}
TeamGroupModel 团队分组模型配置信息
func (*TeamGroupModel) From ¶
func (t *TeamGroupModel) From(src *db.TeamGroupModel) *TeamGroupModel
From 从数据库模型转换为领域模型
type TeamGroupUserRepo ¶
type TeamGroupUserRepo interface {
List(ctx context.Context, teamID uuid.UUID) ([]*db.TeamGroup, error)
Get(ctx context.Context, groupID uuid.UUID) (*db.TeamGroup, error)
Create(ctx context.Context, teamID uuid.UUID, req *AddTeamGroupReq) (*db.TeamGroup, error)
CreateUsers(ctx context.Context, teamID uuid.UUID, req *AddTeamUserReq) ([]*db.User, error)
CreateAdmin(ctx context.Context, teamID uuid.UUID, req *AddTeamAdminReq) (*db.User, error)
Update(ctx context.Context, req *UpdateTeamGroupReq) (*db.TeamGroup, error)
Delete(ctx context.Context, teamID, groupID uuid.UUID) error
ListGroupUsers(ctx context.Context, groupID uuid.UUID) ([]*db.TeamGroupMember, error)
ModifyGroupUsers(ctx context.Context, groupID uuid.UUID, userIDs []uuid.UUID) ([]*db.TeamGroupMember, error)
DeleteGroupUser(ctx context.Context, groupID, userID uuid.UUID) error
Login(ctx context.Context, req *TeamLoginReq) (*db.User, error)
MemberList(ctx context.Context, teamID uuid.UUID, role consts.TeamMemberRole) ([]*db.TeamMember, error)
ChangePassword(ctx context.Context, userID uuid.UUID, currentPassword, newPassword string) error
GetTeam(ctx context.Context, teamID uuid.UUID) (*db.Team, error)
UpdateUser(ctx context.Context, userID uuid.UUID, req *UpdateTeamUserReq) (*db.User, error)
GetMembersByIDs(ctx context.Context, teamID uuid.UUID, userIDs []uuid.UUID) ([]*db.TeamMember, error)
GetMember(ctx context.Context, teamID, userID uuid.UUID) (*db.TeamMember, error)
InitTeam(ctx context.Context, email, name, password string) error
}
TeamGroupUserRepo 团队分组成员数据访问接口
type TeamGroupUserUsecase ¶
type TeamGroupUserUsecase interface {
List(ctx context.Context, teamUser *TeamUser) (*ListTeamGroupsResp, error)
Add(ctx context.Context, teamUser *TeamUser, req *AddTeamGroupReq) (*TeamGroup, error)
AddUser(ctx context.Context, teamUser *TeamUser, req *AddTeamUserReq) (*AddTeamUserResp, error)
AddAdmin(ctx context.Context, teamUser *TeamUser, req *AddTeamAdminReq) (*AddTeamAdminResp, error)
Update(ctx context.Context, req *UpdateTeamGroupReq) (*TeamGroup, error)
Delete(ctx context.Context, teamUser *TeamUser, req *DeleteTeamGroupReq) error
ListGroups(ctx context.Context, req *ListTeamGroupUsersReq) (*ListTeamGroupUsersResp, error)
ModifyGroups(ctx context.Context, req *AddTeamGroupUsersReq) (*AddTeamGroupUsersResp, error)
DeleteGroups(ctx context.Context, req *DeleteTeamGroupUserReq) error
Login(ctx context.Context, req *TeamLoginReq) (*User, error)
MemberList(ctx context.Context, teamUser *TeamUser, req *MemberListReq) (*MemberListResp, error)
ChangePassword(ctx context.Context, userID uuid.UUID, req *ChangePasswordReq) error
UpdateUser(ctx context.Context, req *UpdateTeamUserReq) (*UpdateTeamUserResp, error)
}
TeamGroupUserUsecase 团队分组成员业务逻辑接口
type TeamHostRepo ¶
type TeamHostRepo interface {
List(ctx context.Context, teamID uuid.UUID) ([]*db.Host, error)
Delete(ctx context.Context, teamUser *TeamUser, hostID string) error
UpsertHost(ctx context.Context, user *User, info *taskflow.Host) error
Update(ctx context.Context, teamUser *TeamUser, req *UpdateTeamHostReq) (*db.Host, error)
}
TeamHostRepo 团队宿主机数据访问接口
type TeamHostUsecase ¶
type TeamHostUsecase interface {
GetInstallCommand(ctx context.Context, teamUser *TeamUser) (string, error)
List(ctx context.Context, teamUser *TeamUser) (*ListTeamHostsResp, error)
Delete(ctx context.Context, teamUser *TeamUser, req *DeleteTeamHostReq) error
Update(ctx context.Context, teamUser *TeamUser, req *UpdateTeamHostReq) (*Host, error)
}
TeamHostUsecase 团队宿主机业务逻辑接口
type TeamImage ¶
type TeamImage struct {
ID uuid.UUID `json:"id"`
Name string `json:"name"`
Remark string `json:"remark"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
Groups []*TeamGroup `json:"groups"`
}
TeamImage 团队镜像信息
type TeamImageRepo ¶
type TeamImageRepo interface {
List(ctx context.Context, teamUser *TeamUser) ([]*db.Image, error)
Get(ctx context.Context, teamID, imageID uuid.UUID) (*db.Image, error)
Create(ctx context.Context, teamID, userID uuid.UUID, req *AddTeamImageReq) (*db.Image, error)
Update(ctx context.Context, teamID uuid.UUID, req *UpdateTeamImageReq) (*db.Image, error)
Delete(ctx context.Context, teamID, imageID uuid.UUID) error
}
TeamImageRepo 团队镜像数据访问接口
type TeamImageUsecase ¶
type TeamImageUsecase interface {
Add(ctx context.Context, teamUser *TeamUser, req *AddTeamImageReq) (*TeamImage, error)
List(ctx context.Context, teamUser *TeamUser) (*ListTeamImagesResp, error)
Update(ctx context.Context, teamUser *TeamUser, req *UpdateTeamImageReq) (*TeamImage, error)
Delete(ctx context.Context, teamUser *TeamUser, req *DeleteTeamImageReq) error
}
TeamImageUsecase 团队组镜像业务逻辑接口
type TeamInviteLinkResp ¶
type TeamInviteLinkResp struct {
InviteLink string `json:"invite_link"`
}
TeamInviteLinkResp 团队邀请链接响应
type TeamLoginReq ¶
type TeamLoginReq struct {
Email string `json:"email" validate:"required"` // 用户邮箱
Password string `json:"password" validate:"required"` // 用户密码(MD5加密后的值)
CaptchaToken string `json:"captcha_token"` // 验证码Token
}
TeamLoginReq 团队用户登录请求
type TeamLoginResp ¶
type TeamLoginResp struct {
Success bool `json:"success"`
Message string `json:"message"`
TeamUser
}
TeamLoginResp 团队用户登录响应
type TeamLogoutResp ¶
type TeamLogoutResp struct {
Message string `json:"message"`
}
TeamLogoutResp 团队用户登出响应
type TeamMember ¶
type TeamMember struct {
TeamID uuid.UUID `json:"team_id"`
UserID uuid.UUID `json:"user_id"`
TeamName string `json:"team_name"`
TeamRole consts.TeamMemberRole `json:"team_role"`
}
TeamMember 团队成员
func (*TeamMember) From ¶
func (t *TeamMember) From(src *db.TeamMember) *TeamMember
From 从数据库模型转换为领域模型
type TeamMemberInfo ¶
type TeamMemberInfo struct {
User *User `json:"user"`
Role consts.TeamMemberRole `json:"role"`
CreatedAt int64 `json:"created_at"`
LastActiveAt int64 `json:"last_active_at"`
}
TeamMemberInfo 团队成员信息
type TeamModel ¶
type TeamModel struct {
ID uuid.UUID `json:"id"`
Provider string `json:"provider"`
APIKey string `json:"api_key"`
BaseURL string `json:"base_url"`
Model string `json:"model"`
Temperature float64 `json:"temperature"`
InterfaceType consts.InterfaceType `json:"interface_type"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
Groups []*TeamGroup `json:"groups"`
LastCheckAt int64 `json:"last_check_at"`
LastCheckSuccess bool `json:"last_check_success"`
LastCheckError string `json:"last_check_error"`
}
TeamModel 团队模型配置信息
type TeamModelRepo ¶
type TeamModelRepo interface {
List(ctx context.Context, teamID uuid.UUID) ([]*db.Model, error)
Get(ctx context.Context, teamID, modelID uuid.UUID) (*db.Model, error)
Create(ctx context.Context, teamID, userID uuid.UUID, req *AddTeamModelReq) (*db.Model, error)
Update(ctx context.Context, teamID uuid.UUID, req *UpdateTeamModelReq) (*db.Model, error)
Delete(ctx context.Context, teamID, modelID uuid.UUID) error
UpdateCheckResult(ctx context.Context, id uuid.UUID, success bool, errMsg string) error
}
TeamModelRepo 团队模型配置数据访问接口
type TeamModelUsecase ¶
type TeamModelUsecase interface {
Add(ctx context.Context, teamUser *TeamUser, req *AddTeamModelReq) (*TeamModel, error)
List(ctx context.Context, teamUser *TeamUser) (*ListTeamModelsResp, error)
Update(ctx context.Context, teamUser *TeamUser, req *UpdateTeamModelReq) (*TeamModel, error)
Delete(ctx context.Context, teamUser *TeamUser, req *DeleteTeamModelReq) error
Check(ctx context.Context, teamUser *TeamUser, id uuid.UUID) (*CheckModelResp, error)
CheckByConfig(ctx context.Context, req *CheckByConfigReq) (*CheckModelResp, error)
}
TeamModelUsecase 团队模型配置业务逻辑接口
type TeamUserInfo ¶
type TeamUserInfo struct {
User *User `json:"user"`
Teams []*TeamMember `json:"teams"`
}
TeamUserInfo 用户团队信息
func (*TeamUserInfo) From ¶
func (t *TeamUserInfo) From(src *db.User) *TeamUserInfo
From 从数据库模型转换为领域模型
type TeamUserStatusResp ¶
TeamUserStatusResp 团队用户状态响应
type Terminal ¶
type Terminal struct {
ID string `json:"id"`
Title string `json:"title"`
ConnectedCount uint32 `json:"connected_count"`
CreatedAt int64 `json:"created_at"`
}
Terminal 终端信息
type TerminalReq ¶
type TerminalReq struct {
ID string `json:"id" query:"id" param:"id" validate:"required"`
TerminalID string `json:"terminal_id" query:"terminal_id"`
Exec string `json:"exec" query:"exec"`
Col int `json:"col" query:"col"`
Row int `json:"row" query:"row"`
EnvironmentID string `json:"-"`
HostID string `json:"-"`
VmID string `json:"-"`
}
TerminalReq 终端连接请求
type TerminalSession ¶
type TerminalSession struct {
ID string `json:"id"`
Type consts.TerminalType `json:"type"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
IsActive bool `json:"is_active"`
}
TerminalSession 终端会话信息
type TreeEntry ¶
type TreeEntry struct {
Mode int
Name string
Path string
Sha string
Size int
LastModifiedAt int64 // GitHub 特有,其他平台为 0
}
TreeEntry 文件树节点
type TreeEntryAdapter ¶
type TreeEntryAdapter struct {
Mode int
Name string
Path string
Sha string
Size int
LastModifiedAt int64
}
TreeEntryAdapter 文件树节点适配结构体
type TreeOptions ¶
type TreeOptions struct {
Token string
Owner string
Repo string
Ref string
Path string
Recursive bool
InstallID int64 // GitHub App 模式,其他平台忽略
IsOAuth bool // GitLab/Gitea OAuth 模式,其他平台忽略
}
TreeOptions 获取文件树参数
type UpdateGitBotReq ¶
type UpdateGitBotReq struct {
ID uuid.UUID `json:"id" validate:"required"`
Platform *consts.GitPlatform `json:"platform"`
HostID *string `json:"host_id"`
Name *string `json:"name"`
Token *string `json:"token"`
}
UpdateGitBotReq 更新 Git Bot 请求
type UpdateGitIdentityReq ¶
type UpdateGitIdentityReq struct {
ID uuid.UUID `param:"id" validate:"required" json:"-" swaggerignore:"true"`
Platform *consts.GitPlatform `json:"platform,omitempty"`
BaseURL *string `json:"base_url,omitempty"`
AccessToken *string `json:"access_token,omitempty"`
Username *string `json:"username,omitempty"`
Email *string `json:"email,omitempty"`
Remark *string `json:"remark,omitempty"`
OAuthRefreshToken *string `json:"-"` // 内部使用,OAuth 刷新 token
OAuthExpiresAt *time.Time `json:"-"` // 内部使用,OAuth 过期时间
}
UpdateGitIdentityReq 更新 Git 身份认证请求
type UpdateHostReq ¶
type UpdateHostReq struct {
ID string `param:"id" validate:"required" json:"-" swaggerignore:"true"`
IsDefault bool `json:"is_default,omitempty"`
Remark string `json:"remark,omitempty"`
Weight *int `json:"weight,omitempty" validate:"omitempty,min=1"`
}
UpdateHostReq 更新宿主机请求
type UpdateImageReq ¶
type UpdateImageReq struct {
ID uuid.UUID `param:"id" validate:"required" json:"-" swaggerignore:"true"`
ImageName *string `json:"image_name,omitempty"`
Remark *string `json:"remark,omitempty"`
IsDefault *bool `json:"is_default,omitempty"`
}
UpdateImageReq 更新镜像配置请求
type UpdateIssueDocReq ¶
type UpdateIssueDocReq struct {
IssueID uuid.UUID `json:"issue_id" validate:"required"`
RequirementDocument string `json:"requirement_document,omitempty"`
DesignDocument string `json:"design_document,omitempty"`
}
UpdateIssueDocReq 更新问题文档请求
type UpdateIssueReq ¶
type UpdateIssueReq struct {
ID uuid.UUID `param:"id" validate:"required" json:"-" swaggerignore:"true"`
IssueID uuid.UUID `param:"issue_id" validate:"required" json:"-" swaggerignore:"true"`
Title string `json:"title,omitempty"`
RequirementDocument string `json:"requirement_document,omitempty"`
DesignDocument string `json:"design_document,omitempty"`
Status consts.ProjectIssueStatus `json:"status,omitempty"`
AssigneeID *uuid.UUID `json:"assignee_id,omitempty"`
Priority consts.ProjectIssuePriority `json:"priority,omitempty"`
}
UpdateIssueReq 更新问题请求
type UpdateModelReq ¶
type UpdateModelReq struct {
ID uuid.UUID `param:"id" validate:"required" json:"-" swaggerignore:"true"`
Provider *string `json:"provider,omitempty"`
APIKey *string `json:"api_key,omitempty"`
BaseURL *string `json:"base_url,omitempty"`
Model *string `json:"model,omitempty"`
Temperature *float32 `json:"temperature,omitempty"`
IsDefault *bool `json:"is_default,omitempty"`
InterfaceType *consts.InterfaceType `json:"interface_type,omitempty" validate:"omitempty,oneof=openai_chat openai_responses anthropic"`
}
UpdateModelReq 更新模型配置请求
type UpdateNotifyChannelReq ¶
type UpdateNotifyChannelReq struct {
Name string `json:"name,omitempty"`
WebhookURL string `json:"webhook_url,omitempty"`
Secret string `json:"secret,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
EventTypes []consts.NotifyEventType `json:"event_types,omitempty"`
}
UpdateNotifyChannelReq 更新通知渠道请求
type UpdateProjectReq ¶
type UpdateProjectReq struct {
ID uuid.UUID `param:"id" validate:"required" json:"-" swaggerignore:"true"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Collaborator []*CreateCollaboratorItem `json:"collaborators,omitempty"`
ImageID uuid.UUID `json:"image_id,omitempty"`
EnvVariables map[string]any `json:"env_variables,omitempty"`
}
UpdateProjectReq 更新项目请求
type UpdateTeamGroupReq ¶
type UpdateTeamGroupReq struct {
GroupID uuid.UUID `param:"group_id" validate:"required" json:"-" swaggerignore:"true"`
Name string `json:"name" validate:"required"`
}
UpdateTeamGroupReq 更新团队分组请求
type UpdateTeamHostReq ¶
type UpdateTeamHostReq struct {
HostID string `param:"host_id" validate:"required" json:"-" swaggerignore:"true"`
GroupIDs []uuid.UUID `json:"group_ids" validate:"omitempty"`
Remark string `json:"remark,omitempty"`
}
UpdateTeamHostReq 更新团队宿主机请求
type UpdateTeamImageReq ¶
type UpdateTeamImageReq struct {
ImageID uuid.UUID `param:"image_id" validate:"required" json:"-" swaggerignore:"true"`
Name string `json:"name" validate:"omitempty"`
Remark string `json:"remark" validate:"omitempty"`
GroupIDs []uuid.UUID `json:"group_ids" validate:"omitempty"`
}
UpdateTeamImageReq 更新团队镜像请求
type UpdateTeamModelReq ¶
type UpdateTeamModelReq struct {
ModelID uuid.UUID `param:"model_id" validate:"required" json:"-" swaggerignore:"true"`
Provider string `json:"provider" validate:"omitempty"`
APIKey string `json:"api_key" validate:"omitempty"`
BaseURL string `json:"base_url" validate:"omitempty"`
Model string `json:"model" validate:"omitempty"`
Temperature float64 `json:"temperature" validate:"omitempty"`
GroupIDs []uuid.UUID `json:"group_ids" validate:"omitempty"`
InterfaceType consts.InterfaceType `json:"interface_type" validate:"omitempty,oneof=openai_chat openai_responses anthropic"`
}
UpdateTeamModelReq 更新团队模型配置请求
type UpdateTeamUserReq ¶
type UpdateTeamUserReq struct {
UserID uuid.UUID `param:"user_id" validate:"required" json:"-" swaggerignore:"true"`
IsBlocked *bool `json:"is_blocked" validate:"omitempty"`
}
UpdateTeamUserReq 更新团队用户信息请求
type UpdateTeamUserResp ¶
type UpdateTeamUserResp struct {
User *User `json:"user"`
}
UpdateTeamUserResp 更新团队用户信息响应
type UpdateUserReq ¶
type UpdateUserReq struct {
Name string `json:"name,omitempty" form:"name"`
AvatarURL string `json:"avatar_url,omitempty" form:"avatar_url"`
}
UpdateUserReq 更新用户信息请求
type UpdateUserResp ¶
type UpdateUserResp struct {
User *User `json:"user"`
Message string `json:"message"`
Success bool `json:"success"`
}
UpdateUserResp 更新用户信息响应
type UpdateVMReq ¶
type UpdateVMReq struct {
ID string `json:"id" validate:"required"`
HostID string `json:"host_id" validate:"required"`
Life int64 `json:"life" validate:"min=3600"`
UID uuid.UUID `json:"-"`
UserName string `json:"-"`
}
UpdateVMReq 更新虚拟机请求
type User ¶
type User struct {
ID uuid.UUID `json:"id"`
Name string `json:"name"`
AvatarURL string `json:"avatar_url"`
Email string `json:"email"`
Role consts.UserRole `json:"role"`
Status consts.UserStatus `json:"status"`
IsBlocked bool `json:"is_blocked"`
Token string `json:"token,omitempty"`
Identities []*UserIdentity `json:"identities"`
Team *Team `json:"team,omitempty"`
HasPassword bool `json:"has_password"`
}
type UserIdentity ¶
type UserIdentity struct {
ID uuid.UUID `json:"id"`
AvatarURL string `json:"avatar_url"`
Username string `json:"username"`
IdentityID string `json:"identity_id"`
Platform consts.UserPlatform `json:"platform"`
Email string `json:"email"`
}
func (*UserIdentity) From ¶
func (i *UserIdentity) From(src *db.UserIdentity) *UserIdentity
type UserRepo ¶
type UserRepo interface {
Get(ctx context.Context, uid uuid.UUID) (*db.User, error)
Update(ctx context.Context, uid uuid.UUID, name, avatarURL string) error
GetUserWithTeams(ctx context.Context, uid uuid.UUID) (*db.User, error)
PasswordLogin(ctx context.Context, req *TeamLoginReq) (*db.User, error)
ChangePassword(ctx context.Context, uid uuid.UUID, currentPassword, newPassword string, isReset bool) error
GetUserByEmail(ctx context.Context, emails []string) ([]*db.User, error)
SetEmail(ctx context.Context, userID uuid.UUID, email string) error
}
type UserUsecase ¶
type UserUsecase interface {
Get(ctx context.Context, uid uuid.UUID) (*User, error)
Update(ctx context.Context, uid uuid.UUID, avatarURL string, req UpdateUserReq) (*User, error)
GetUserWithTeams(ctx context.Context, userID uuid.UUID) (*TeamUserInfo, error)
PasswordLogin(ctx context.Context, req *TeamLoginReq) (*User, error)
ChangePassword(ctx context.Context, userID uuid.UUID, req *ChangePasswordReq, isReset bool) error
SendResetPasswordEmail(ctx context.Context, req *ResetUserPasswordEmailReq) error
GetUserByEmail(ctx context.Context, emails []string) ([]*User, error)
SendBindEmailVerification(ctx context.Context, userID uuid.UUID, req *SendBindEmailVerificationReq) error
VerifyBindEmail(ctx context.Context, token string) error
}
type VMPort ¶
type VMPort struct {
ForwardID *string `json:"forward_id,omitempty"`
Port uint16 `json:"port"`
PreviewURL *string `json:"preview_url,omitempty"`
Status consts.PortStatus `json:"status,omitempty"`
WhiteList []string `json:"white_list,omitempty"`
ErrorMessage string `json:"error_message,omitempty"`
Success *bool `json:"success,omitempty"`
}
VMPort 虚拟机端口
type VMResource ¶
type VMResource struct {
Core int `json:"core" validate:"omitempty" default:"1"`
Memory uint64 `json:"memory" validate:"omitempty" default:"1024"`
Life int64 `json:"life"`
}
VMResource 虚拟机资源配置
type VMTerminalMessage ¶
type VMTerminalMessage struct {
Type VMTerminalMessageType `json:"type"`
Data string `json:"data"`
}
VMTerminalMessage WebSocket 消息结构
type VMTerminalMessageType ¶
type VMTerminalMessageType string
VMTerminalMessageType WebSocket 消息类型
const ( VMTerminalMessageTypeData VMTerminalMessageType = "data" VMTerminalMessageTypeControl VMTerminalMessageType = "control" VMTerminalMessageTypeError VMTerminalMessageType = "error" VMTerminalMessageTypeResize VMTerminalMessageType = "resize" VMTerminalMessageTypePing VMTerminalMessageType = "ping" VMTerminalMessageTypePong VMTerminalMessageType = "pong" VMTerminalMessageTypeConnected VMTerminalMessageType = "connected" )
type VMTerminalResizeData ¶
VMTerminalResizeData 调整终端大小的数据
type VMTerminalSuccess ¶
type VMTerminalSuccess struct {
Username string `json:"username"`
Email string `json:"email"`
AvatarURL string `json:"avatar_url"`
}
VMTerminalSuccess 连接成功信息
type VerifyBindEmailReq ¶
type VerifyBindEmailReq struct {
Token string `query:"token" validate:"required"` // 验证 token
}
VerifyBindEmailReq 验证邮箱请求
type VirtualMachine ¶
type VirtualMachine struct {
ID string `json:"id"`
Hostname string `json:"hostname"`
OS string `json:"os"`
Cores int32 `json:"cores"`
Memory uint64 `json:"memory"`
Status taskflow.VirtualMachineStatus `json:"status"`
Name string `json:"name"`
LifeTimeSeconds int64 `json:"life_time_seconds"`
Host *Host `json:"host,omitempty"`
Version string `json:"version"`
CreatedAt int64 `json:"created_at"`
EnvironmentID string `json:"environment_id,omitempty"`
Owner *User `json:"owner,omitempty"`
Conditions []*etypes.Condition `json:"conditions"`
Ports []*VMPort `json:"ports,omitempty"`
}
VirtualMachine 虚拟机
func (*VirtualMachine) From ¶
func (v *VirtualMachine) From(vm *db.VirtualMachine) *VirtualMachine
From 从数据库模型转换
type VmExpireInfo ¶
type VmExpireInfo struct {
UID uuid.UUID `json:"uid"`
VmID string `json:"vm_id"`
HostID string `json:"host_id"`
EnvID string `json:"env_id"`
}
VmExpireInfo VM 过期信息(手动创建的 VM)
type VmIdleInfo ¶
type VmIdleInfo struct {
UID uuid.UUID `json:"uid"`
VmID string `json:"vm_id"`
HostID string `json:"host_id"`
EnvID string `json:"env_id"`
TaskID string `json:"task_id,omitempty"` // 关联的任务 ID,用于通知
Name string `json:"name,omitempty"` // 任务名称,用于通知内容
}
VmIdleInfo 空闲队列 payload(任务创建的 VM)