Help us shape the future of Go! Take the 2026 Go Developer Survey

handler

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 49 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvTypeScript        = "script"        // 脚本工作区
	EnvTypeAnalysis      = "analysis"      // 分析(analysis 级)
	EnvTypeAnalysisNode  = "analysisNode"  // 分析节点
	EnvTypeProjectReport = "projectReport" // 项目报告
)

RuntimeEnvType 是与前端 llmEnv.type 约定的「业务上下文」枚举。

前端通过 setLLMEnv(id, type) 设置全局上下文,后端据此解析出:

  • SystemPromptVars:渲染 Profile 系统提示词模板所需的变量(如工作目录、脚本路径);
  • WorkingDir:Agent 执行时的工作目录。

这些枚举是前端与后端之间的契约,新增业务上下文时在此登记并同步前端 llm-env.ts。

Variables

This section is empty.

Functions

func GetDefaultIOSchame

func GetDefaultIOSchame() string

func GetInitScript

func GetInitScript(scriptType string) string

func NewNodeRequestParser added in v0.1.5

func NewNodeRequestParser(dataService interfaces.DataService, workflowService interfaces.WorkflowService) dagruntime.NodeRequestParser

NewNodeRequestParser 构造 dag 运行期需要的 request_param 解析器(注入 NodeDispatcher / NodeCompletionCoordinator 的 RuntimeEngine)。接口类型由 dag 包定义(consumer-side), 实现放在 handler 包,从而避免 dag -> handler 的循环依赖。

func RegisterOnlyOfficeRoutes

func RegisterOnlyOfficeRoutes(r *gin.Engine, proxyHandler *ProxyHandler)

func RegisterProjectDocsRoute

func RegisterProjectDocsRoute(r *gin.Engine, cfg *config.Config, projectService interfaces.ProjectService)

RegisterProjectDocsRoute registers the project docs entry route.

The only path parameter is a ProjectReport ID; the owning project id is resolved from the report and the docs are served from that report's doc source directory (see utils.GetProjectDocDir): - GET /docs/:reportid -> {projectDocBookDir}/index.html - GET /docs/:reportid/*filepath -> {projectDocBookDir}/*filepath

Types

type AISummaryHandler added in v0.1.2

type AISummaryHandler struct {
	// contains filtered or unexported fields
}

AISummaryHandler 处理 AI 摘要相关接口。

func NewAISummaryHandler added in v0.1.2

func NewAISummaryHandler(aiSummaryService interfaces.AISummaryService, projectService interfaces.ProjectService) *AISummaryHandler

func (*AISummaryHandler) CreateAISummary added in v0.1.2

func (h *AISummaryHandler) CreateAISummary(c *gin.Context)

CreateAISummary godoc @Summary 创建 AI 摘要 @Description 根据 OwnerID/OwnerType 创建摘要记录(可指定 Agent Profile),并异步触发 LLM 生成摘要 @Tags AI摘要 @Accept json @Produce json @Param request body createAISummaryRequest true "请求参数" @Success 200 {object} types.AISummary @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /ai-summary/create [post]

func (*AISummaryHandler) DeleteAISummary added in v0.1.2

func (h *AISummaryHandler) DeleteAISummary(c *gin.Context)

DeleteAISummary godoc @Summary 删除 AI 摘要 @Description 按摘要 ID 删除 AI 摘要记录 @Tags AI摘要 @Accept json @Produce json @Param request body idBody true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /ai-summary/delete [post]

func (*AISummaryHandler) GetAISummary added in v0.1.2

func (h *AISummaryHandler) GetAISummary(c *gin.Context)

GetAISummary godoc @Summary 获取 AI 摘要 @Description 按 ID 查询 AI 摘要详情 @Tags AI摘要 @Produce json @Param id query integer true "主键 ID" @Success 200 {object} types.AISummary @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /ai-summary/get [get]

func (*AISummaryHandler) GetAISummaryInput added in v0.1.2

func (h *AISummaryHandler) GetAISummaryInput(c *gin.Context)

GetAISummaryInput godoc @Summary 获取 AI 摘要的 LLM 输入信息 @Description 根据摘要 ID 解析生成该摘要时交给 LLM 的系统提示词、工作目录与原始内容 @Tags AI摘要 @Produce json @Param id query integer true "摘要 ID" @Success 200 {object} types.AISummaryInput @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /ai-summary/input [get]

func (*AISummaryHandler) ListAISummary added in v0.1.2

func (h *AISummaryHandler) ListAISummary(c *gin.Context)

ListAISummary godoc @Summary 按所属对象查询 AI 摘要列表 @Description 根据 OwnerID/OwnerType 查询 AI 摘要列表 @Tags AI摘要 @Produce json @Param owner_id query integer true "所属对象 ID" @Param owner_type query string true "所属对象类型:analysis 或 analysis_node" @Success 200 {array} types.AISummary @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /ai-summary/list [get]

func (*AISummaryHandler) PageAISummaryByActiveProject added in v0.1.5

func (h *AISummaryHandler) PageAISummaryByActiveProject(c *gin.Context)

PageAISummaryByActiveProject godoc @Summary 按当前用户激活项目分页查询 AI 摘要列表 @Description 解析当前登录用户的激活项目,分页返回该项目(project_id)下的 AI 摘要,不返回 content @Tags AI摘要 @Accept json @Produce json @Param request body handler.aiSummaryByProjectPageRequest true "分页请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /ai-summary/list-by-project-page [post]

func (*AISummaryHandler) RegenerateAISummary added in v0.1.2

func (h *AISummaryHandler) RegenerateAISummary(c *gin.Context)

RegenerateAISummary godoc @Summary 重新生成 AI 摘要 @Description 按摘要 ID 重置状态并异步重新触发 LLM 生成摘要 @Tags AI摘要 @Accept json @Produce json @Param request body idBody true "请求参数" @Success 200 {object} types.AISummary @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /ai-summary/regenerate [post]

func (*AISummaryHandler) UpdateAISummary added in v0.1.4

func (h *AISummaryHandler) UpdateAISummary(c *gin.Context)

UpdateAISummary godoc @Summary 更新 AI 摘要 @Description 按摘要 ID 更新标题、内容与 Agent Profile,字段不传则保持原值 @Tags AI摘要 @Accept json @Produce json @Param request body updateAISummaryRequest true "请求参数" @Success 200 {object} types.AISummary @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /ai-summary/update [post]

type AgentHandler added in v0.1.2

type AgentHandler struct {
	// contains filtered or unexported fields
}

AgentHandler 处理 Agent 任务与权限相关接口。

职责边界(对应 design.md):

  • HTTP 是 command(创建任务 / 批准 / 拒绝);
  • WS 是 notification(通过 AgentService.Subscribe 把事件推送给创建任务的用户);
  • AgentService / Repository 是真正的 state。

func NewAgentHandler added in v0.1.2

func NewAgentHandler(svc *agent.AgentService, conv *agent.ConversationService, hub *realtime.Hub, runtimeCtx *RuntimeContextResolver, skills *skill.Registry, skillStore *skill.Store) *AgentHandler

NewAgentHandler 创建 AgentHandler。

func (*AgentHandler) AnswerQuestion added in v0.1.5

func (h *AgentHandler) AnswerQuestion(c *gin.Context)

AnswerQuestion godoc @Summary 提交用户对提问的作答 @Tags Agent @Accept json @Produce json @Param request body handler.questionAnswerBody true "作答内容" @Success 200 {object} gin.H @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 409 {object} errors.AppError @Security Bearer @Router /agent/question/answer [post]

func (*AgentHandler) ApprovePermission added in v0.1.2

func (h *AgentHandler) ApprovePermission(c *gin.Context)

ApprovePermission godoc @Summary 批准权限请求 @Tags Agent @Accept json @Produce json @Param request body permissionIDBody true "权限 ID" @Success 200 {object} gin.H @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 409 {object} errors.AppError @Security Bearer @Router /agent/permission/approve [post]

func (*AgentHandler) CancelTask added in v0.1.2

func (h *AgentHandler) CancelTask(c *gin.Context)

CancelTask godoc @Summary 取消 Agent 任务 @Tags Agent @Accept json @Produce json @Param request body taskIDBody true "任务 ID" @Success 200 {object} gin.H @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Security Bearer @Router /agent/task/cancel [post]

func (*AgentHandler) Chat added in v0.1.2

func (h *AgentHandler) Chat(c *gin.Context)

Chat godoc @Summary 多轮对话 @Description 发送一条消息:新建会话或续接已有会话;返回本轮任务 ID,实时内容走 WS 推送 @Tags Agent @Accept json @Produce json @Param request body handler.chatRequest true "请求参数" @Success 200 {object} gin.H @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Security Bearer @Router /agent/chat [post]

func (*AgentHandler) CreateTask added in v0.1.2

func (h *AgentHandler) CreateTask(c *gin.Context)

CreateTask godoc @Summary 创建 Agent 任务 @Description 创建任务、订阅事件流到 WS,并异步启动执行 @Tags Agent @Accept json @Produce json @Param request body agent.Request true "请求参数" @Success 200 {object} agent.Task @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /agent/task/create [post]

func (*AgentHandler) DeleteMemory added in v0.1.2

func (h *AgentHandler) DeleteMemory(c *gin.Context)

DeleteMemory godoc @Summary 删除记忆 @Tags Agent @Accept json @Produce json @Param request body taskIDBody true "记忆 ID" @Success 200 {object} gin.H @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Security Bearer @Router /agent/memory/delete [post]

func (*AgentHandler) DeleteProfile added in v0.1.2

func (h *AgentHandler) DeleteProfile(c *gin.Context)

DeleteProfile godoc @Summary 删除 Agent Profile @Description 仅能删除当前用户的自定义 Profile;内置 Profile 不可删除 @Tags Agent @Accept json @Produce json @Param request body taskIDBody true "Profile ID" @Success 200 {object} gin.H @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Security Bearer @Router /agent/profile/delete [post]

func (*AgentHandler) DeleteSkill added in v0.1.5

func (h *AgentHandler) DeleteSkill(c *gin.Context)

DeleteSkill godoc @Summary 删除 Agent 技能 @Description 删除 $BaseDir/.skills 下的技能目录并从内存注册表移除;仅允许删除用户技能目录内的技能 @Tags Agent @Accept json @Produce json @Param request body taskIDBody true "技能名" @Success 200 {object} gin.H @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Security Bearer @Router /agent/skill/delete [post]

func (*AgentHandler) DenyPermission added in v0.1.2

func (h *AgentHandler) DenyPermission(c *gin.Context)

DenyPermission godoc @Summary 拒绝权限请求 @Tags Agent @Accept json @Produce json @Param request body permissionIDBody true "权限 ID" @Success 200 {object} gin.H @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 409 {object} errors.AppError @Security Bearer @Router /agent/permission/deny [post]

func (*AgentHandler) DescribeEnv added in v0.1.2

func (h *AgentHandler) DescribeEnv(c *gin.Context)

DescribeEnv godoc @Summary 解析当前对话的业务上下文 @Description 根据 env{id,type} 返回人类可读的上下文名称与工作目录,供前端展示当前对话环境 @Tags Agent @Accept json @Produce json @Param request body handler.describeEnvRequest true "业务上下文" @Success 200 {object} RuntimeContextInfo @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /agent/env/describe [post]

func (*AgentHandler) GetConversation added in v0.1.2

func (h *AgentHandler) GetConversation(c *gin.Context)

GetConversation godoc @Summary 获取会话(含完整历史消息) @Tags Agent @Produce json @Param id query string true "会话 ID" @Success 200 {object} agent.Conversation @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Security Bearer @Router /agent/conversation/get [get]

func (*AgentHandler) GetMemory added in v0.1.2

func (h *AgentHandler) GetMemory(c *gin.Context)

GetMemory godoc @Summary 获取单条记忆 @Tags Agent @Produce json @Param id query string true "记忆 ID" @Success 200 {object} agent.Memory @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Security Bearer @Router /agent/memory/get [get]

func (*AgentHandler) GetPendingPermissions added in v0.1.2

func (h *AgentHandler) GetPendingPermissions(c *gin.Context)

GetPendingPermissions godoc @Summary 获取任务待确认权限 @Tags Agent @Produce json @Param task_id query string true "任务 ID" @Success 200 {array} agent.PermissionRequest @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Security Bearer @Router /agent/task/permissions [get]

func (*AgentHandler) GetPendingQuestions added in v0.1.5

func (h *AgentHandler) GetPendingQuestions(c *gin.Context)

GetPendingQuestions godoc @Summary 获取任务待作答提问 @Tags Agent @Produce json @Param task_id query string true "任务 ID" @Success 200 {array} agent.QuestionRequest @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Security Bearer @Router /agent/task/questions [get]

func (*AgentHandler) GetProfile added in v0.1.5

func (h *AgentHandler) GetProfile(c *gin.Context)

GetProfile godoc @Summary 查看单个 Agent Profile @Description 按 ID 返回单个 Profile:内置 Profile 全局共享(任意用户可读),自定义 Profile 仅限其所属用户 @Tags Agent @Produce json @Param id query string true "Profile ID" @Success 200 {object} agent.Profile @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Security Bearer @Router /agent/profile/get [get]

func (*AgentHandler) GetSkill added in v0.1.5

func (h *AgentHandler) GetSkill(c *gin.Context)

GetSkill godoc @Summary 查看单个 Agent 技能 @Description 按名称返回单个技能(含指令正文),供前端编辑回填 @Tags Agent @Produce json @Param id query string true "技能名" @Success 200 {object} skill.Skill @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Security Bearer @Router /agent/skill/get [get]

func (*AgentHandler) GetTask added in v0.1.2

func (h *AgentHandler) GetTask(c *gin.Context)

GetTask godoc @Summary 获取 Agent 任务 @Tags Agent @Produce json @Param id query string true "任务 ID" @Success 200 {object} agent.Task @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Security Bearer @Router /agent/task/get [get]

func (*AgentHandler) GetTaskEvents added in v0.1.2

func (h *AgentHandler) GetTaskEvents(c *gin.Context)

GetTaskEvents godoc @Summary 增量拉取任务事件 @Description 返回 sequence 大于 after 的事件;浏览器刷新后用此接口恢复历史 @Tags Agent @Produce json @Param task_id query string true "任务 ID" @Param after query int false "上次收到的最大 sequence" @Success 200 {array} agent.AgentEvent @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Security Bearer @Router /agent/task/events [get]

func (*AgentHandler) GetTaskRequest added in v0.1.3

func (h *AgentHandler) GetTaskRequest(c *gin.Context)

GetTaskRequest godoc @Summary 获取任务实际发送给 LLM 的请求内容 @Description 按任务 ID 加载任务,应用 Agent Profile(系统提示词合并、技能选择、记忆/项目上下文注入),返回最终 Request @Tags Agent @Produce json @Param id query string true "任务 ID" @Success 200 {object} agent.Request @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Security Bearer @Router /agent/task/request [get]

func (*AgentHandler) ListProfiles added in v0.1.2

func (h *AgentHandler) ListProfiles(c *gin.Context)

ListProfiles godoc @Summary 查看 Agent Profile @Description 返回内置与当前用户自定义的全部 Profile(合并视图),包含系统提示词、技能与上下文注入开关 @Tags Agent @Produce json @Success 200 {array} agent.Profile @Failure 401 {object} errors.AppError @Security Bearer @Router /agent/profile/list [get]

func (*AgentHandler) ListSkills added in v0.1.2

func (h *AgentHandler) ListSkills(c *gin.Context)

ListSkills godoc @Summary 查看 Agent 技能 @Description 返回当前可用的全部技能(内置 + 用户自定义),包含名称、描述与 SKILL.md 路径 @Tags Agent @Produce json @Success 200 {array} skill.Skill @Failure 401 {object} errors.AppError @Security Bearer @Router /agent/skill/list [get]

func (*AgentHandler) PageConversations added in v0.1.2

func (h *AgentHandler) PageConversations(c *gin.Context)

PageConversations godoc @Summary 分页查询当前用户的会话 @Tags Agent @Accept json @Produce json @Param request body handler.conversationPageRequest true "分页请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Security Bearer @Router /agent/conversation/page [post]

func (*AgentHandler) PageEvents added in v0.1.2

func (h *AgentHandler) PageEvents(c *gin.Context)

PageEvents godoc @Summary 分页查询任务事件 @Tags Agent @Accept json @Produce json @Param request body handler.agentEventPageRequest true "分页请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Security Bearer @Router /agent/event/page [post]

func (*AgentHandler) PageMemory added in v0.1.2

func (h *AgentHandler) PageMemory(c *gin.Context)

PageMemory godoc @Summary 分页查询当前用户的记忆 @Tags Agent @Accept json @Produce json @Param request body handler.agentMemoryPageRequest true "分页请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Security Bearer @Router /agent/memory/page [post]

func (*AgentHandler) PagePermissions added in v0.1.2

func (h *AgentHandler) PagePermissions(c *gin.Context)

PagePermissions godoc @Summary 分页查询权限请求 @Tags Agent @Accept json @Produce json @Param request body handler.agentPermissionPageRequest true "分页请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Security Bearer @Router /agent/permission/page [post]

func (*AgentHandler) PageQuestions added in v0.1.5

func (h *AgentHandler) PageQuestions(c *gin.Context)

PageQuestions godoc @Summary 分页查询提问请求 @Tags Agent @Accept json @Produce json @Param request body handler.agentQuestionPageRequest true "分页请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Security Bearer @Router /agent/question/page [post]

func (*AgentHandler) PageTasks added in v0.1.2

func (h *AgentHandler) PageTasks(c *gin.Context)

PageTasks godoc @Summary 分页查询 Agent 任务 @Tags Agent @Accept json @Produce json @Param request body handler.agentTaskPageRequest true "分页请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Security Bearer @Router /agent/task/page [post]

func (*AgentHandler) ProjectContext added in v0.1.2

func (h *AgentHandler) ProjectContext(c *gin.Context)

ProjectContext godoc @Summary 查看当前用户的项目上下文 @Description 返回当前用户激活项目下已注入 Agent 系统提示词的项目上下文文本块(如已完成的分析节点) @Tags Agent @Produce json @Success 200 {object} gin.H @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /agent/project-context [get]

func (*AgentHandler) RetrieveMemory added in v0.1.2

func (h *AgentHandler) RetrieveMemory(c *gin.Context)

RetrieveMemory godoc @Summary 检索当前用户的相关记忆 @Tags Agent @Accept json @Produce json @Param request body handler.memoryRetrieveRequest true "检索参数" @Success 200 {array} agent.Memory @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Security Bearer @Router /agent/memory/retrieve [post]

func (*AgentHandler) SaveMemory added in v0.1.2

func (h *AgentHandler) SaveMemory(c *gin.Context)

SaveMemory godoc @Summary 创建或更新记忆 @Description ID 为空时新建,否则更新;UserID 由当前登录用户注入 @Tags Agent @Accept json @Produce json @Param request body handler.memorySaveRequest true "记忆内容" @Success 200 {object} agent.Memory @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /agent/memory/save [post]

func (*AgentHandler) SaveProfile added in v0.1.2

func (h *AgentHandler) SaveProfile(c *gin.Context)

SaveProfile godoc @Summary 创建或更新 Agent Profile @Description ID 为空时新建,否则更新;UserID 由当前登录用户注入,自定义 Profile 仅能管理自己的,内置 Profile 可编辑(不可删除) @Tags Agent @Accept json @Produce json @Param request body handler.profileSaveRequest true "Profile 内容" @Success 200 {object} agent.Profile @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /agent/profile/save [post]

func (*AgentHandler) SaveSkill added in v0.1.5

func (h *AgentHandler) SaveSkill(c *gin.Context)

SaveSkill godoc @Summary 创建或更新 Agent 技能 @Description 把技能写回 $BaseDir/.skills/<name>/SKILL.md 并热更新内存注册表,程序运行中即时生效 @Tags Agent @Accept json @Produce json @Param request body handler.skillSaveRequest true "技能内容" @Success 200 {object} skill.Skill @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /agent/skill/save [post]

type AnalysisHandler

type AnalysisHandler struct {
	// contains filtered or unexported fields
}

func NewAnalysisHandler

func NewAnalysisHandler(
	analysisService interfaces.AnalysisService,
	projectService interfaces.ProjectService,
	projectRepo interfaces.ProjectRepository,
	workflowService interfaces.WorkflowService,
	dataService interfaces.DataService,
	containerService interfaces.ContainerService,
	analysisRepo interfaces.AnalysisRepository,
	schedulers *scheduler.Registry,
	nodeOrchestrator interfaces.NodeOrchestrator,
	preparer prepare.NodeRuntimePreparer,
	aiSummaryRepo interfaces.AISummaryRepository,
	cfg *config.Config,
) *AnalysisHandler

func (*AnalysisHandler) AnalysisNodeLogs

func (h *AnalysisHandler) AnalysisNodeLogs(c *gin.Context)

func (*AnalysisHandler) AnalysisNodeParams

func (h *AnalysisHandler) AnalysisNodeParams(c *gin.Context)

func (*AnalysisHandler) DeleteAnalysis

func (h *AnalysisHandler) DeleteAnalysis(c *gin.Context)

DeleteAnalysis godoc @Summary 删除分析任务 @Description 按 analysisId 删除分析任务,同时清理关联的 analysis_nodes、analysis_edges、container_instances 及工作目录 @Tags 分析 @Produce json @Param analysisId path string true "分析 ID" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /analysis/delete/{analysisId} [post]

func (*AnalysisHandler) DeleteAnalysisNode

func (h *AnalysisHandler) DeleteAnalysisNode(c *gin.Context)

DeleteAnalysisNode godoc @Summary 删除分析节点 @Description 按 analysisNodeId 删除分析节点记录 @Tags 分析 @Produce json @Param analysisNodeId path string true "分析节点 ID" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /analysis/node/delete/{analysisNodeId} [post]

func (*AnalysisHandler) EditNodeParams

func (h *AnalysisHandler) EditNodeParams(c *gin.Context)

EditNodeParams godoc @Summary 编辑分析节点参数 @Description 依次查询 AnalysisNode、Analysis、Workflow(dag_definition)、Module(io_schema) 后组装 formJson @Tags 分析 @Produce json @Param analysisNodeId path string true "分析节点 ID" @Success 200 {object} handler.EditNodeParamsResponse @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /analysis/edit-node-params/{analysisNodeId} [post]

func (*AnalysisHandler) EditParamsV2

func (h *AnalysisHandler) EditParamsV2(c *gin.Context)

EditParamsV2 godoc @Summary 编辑分析参数(V2) @Description 查询 analysis 基础信息,并按 workflowId 复用工作流表单逻辑返回 formJson 与 analysis_result @Tags 分析 @Produce json @Param analysisId path string true "分析 ID" @Success 200 {object} handler.EditParamsV2Response @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /analysis/edit-params-v2/{analysisId} [post]

func (*AnalysisHandler) GetAnalysisNode

func (h *AnalysisHandler) GetAnalysisNode(c *gin.Context) *types.AnalysisNode

func (*AnalysisHandler) ListAnalysisTree

func (h *AnalysisHandler) ListAnalysisTree(c *gin.Context)

ListAnalysisTree godoc @Summary 分析树列表 @Description 兼容 Python /list-analysis-tree,按 workflow(relation) 分组返回分析树,子节点 key 使用 analysis_id @Tags 分析 @Accept json @Produce json @Param request body handler.listAnalysisTreeRequest true "查询参数" @Success 200 {array} handler.listAnalysisTreeParent @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /list-analysis-tree [post]

func (*AnalysisHandler) PageAnalysisByProject

func (h *AnalysisHandler) PageAnalysisByProject(c *gin.Context)

PageAnalysisByProject godoc @Summary 按当前项目分页查询分析任务 @Description 默认按当前用户 active project 的 project_id 过滤,支持可选 query 条件 @Tags 分析 @Accept json @Produce json @Param request body handler.analysisByProjectPageRequest true "分页请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /analysis/list-by-project-page [post]

func (*AnalysisHandler) PageAnalysisNodeByProject

func (h *AnalysisHandler) PageAnalysisNodeByProject(c *gin.Context)

PageAnalysisNodeByProject godoc @Summary 按当前项目分页查询分析节点 @Description 默认按当前用户 active project 的 project_id 过滤,支持可选 script_id @Tags 分析 @Accept json @Produce json @Param request body handler.analysisNodeByProjectPageRequest true "分页请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /analysis/node/list-by-project-page [post]

func (*AnalysisHandler) ParseParams

func (h *AnalysisHandler) ParseParams(c *gin.Context)

func (*AnalysisHandler) PublishProjectReportItemToDoc added in v0.1.5

func (h *AnalysisHandler) PublishProjectReportItemToDoc(c *gin.Context)

PublishProjectReportItemToDoc 是单条目发布入口(POST /project-report-item/:itemId/publish-to-doc)。 它按 ProjectReportItem 的 OwnerType 解析出 OwnerID,并将对应内容发布到该条目所属 ProjectReport 的文档目录(见 utils.GetProjectDocDir)。

支持的 OwnerType:

  • analysis → 发布 Analysis 及其节点输出
  • analysis_node → 发布单个 AnalysisNode 输出
  • ai_summary → 发布 AI 摘要(同时拷贝其所属对象的输出目录以引用图片)

func (*AnalysisHandler) PublishProjectReportToDoc added in v0.1.2

func (h *AnalysisHandler) PublishProjectReportToDoc(c *gin.Context)

PublishProjectReportToDoc 遍历报告下所有 ProjectReportItem 并逐个发布到报告文档目录 (POST /project-report/:reportId/publish-to-doc)。

func (*AnalysisHandler) RunAnalysisNode

func (h *AnalysisHandler) RunAnalysisNode(c *gin.Context)

func (*AnalysisHandler) RunAnalysisNodeByScriptID

func (h *AnalysisHandler) RunAnalysisNodeByScriptID(c *gin.Context)

RunAnalysisNodeByScriptID 批量运行 script 下所有 creation_source=standalone 的 analysis node

func (*AnalysisHandler) RunAnalysisNodeWithID

func (h *AnalysisHandler) RunAnalysisNodeWithID(ctx context.Context, analsyisNodeId int64) error

func (*AnalysisHandler) RuntimeSnapshot added in v0.1.4

func (h *AnalysisHandler) RuntimeSnapshot(c *gin.Context)

RuntimeSnapshot godoc @Summary 分析运行时快照 @Description 兼容 Python POST /analysis-runtime/snapshot,返回节点状态分布、完成度、运行信息以及分析状态 @Tags 分析 @Accept json @Produce json @Param request body handler.runtimeSnapshotRequest true "查询参数" @Success 200 {object} handler.runtimeSnapshotResponse @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /analysis-runtime/snapshot [post]

func (*AnalysisHandler) SaveAnalysisController

func (h *AnalysisHandler) SaveAnalysisController(c *gin.Context)

SaveAnalysisController is the single submit/save entry for every DAG scheduler.

The scheduler is chosen per request through the orchestration registry (dag/scheduler.Registry) and persisted in analysis.scheduler_mode, so this one endpoint replaces the former controller / controllerV2 / controllerV3 trio. The resolved scheduler also decides whether the compiled graph is persisted at save time (static graph) or materialized at runtime.

func (*AnalysisHandler) SaveAnalysisNodeControllerWithScript

func (h *AnalysisHandler) SaveAnalysisNodeControllerWithScript(c *gin.Context)

func (*AnalysisHandler) StopAnalysis

func (h *AnalysisHandler) StopAnalysis(c *gin.Context)

func (*AnalysisHandler) StopAnalysisNode

func (h *AnalysisHandler) StopAnalysisNode(c *gin.Context)

func (*AnalysisHandler) ToggleAnalysisReport

func (h *AnalysisHandler) ToggleAnalysisReport(c *gin.Context)

ToggleAnalysisReport godoc @Summary 切换分析任务的 is_report 状态 @Description 按 analysisId 切换 is_report 字段的 true/false 值 @Tags 分析 @Produce json @Param analysisId path string true "分析 ID" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /analysis/toggle-report/{analysisId} [post]

func (*AnalysisHandler) VisualizationNodeFile

func (h *AnalysisHandler) VisualizationNodeFile(c *gin.Context)

VisualizationNodeFile godoc @Summary 分析节点结果文件可视化 @Description 查询 AnalysisNode 并补充容器模板与镜像信息,同时返回 output_dir 下可视化资源列表 @Tags 分析 @Produce json @Param analysisNodeId path string true "分析节点 ID" @Success 200 {object} handler.VisualizationNodeFileResponse @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /analysis/visualization-node-file/{analysisNodeId} [get]

func (*AnalysisHandler) VisualizationNodeTree

func (h *AnalysisHandler) VisualizationNodeTree(c *gin.Context)

VisualizationNodeTree godoc @Summary 分析节点树可视化 @Description 按 workflow dag_definition 的脚本节点分组,返回 analysis nodes 树结构 @Tags 分析 @Produce json @Param analysisId path string true "分析 ID" @Success 200 {object} handler.VisualizationNodeTreeResponse @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /analysis/visualization-node-tree/{analysisId} [get]

type AuthHandler

type AuthHandler struct {
	// contains filtered or unexported fields
}

AuthHandler implements HTTP request handlers for user authentication Provides functionality for user registration, login, logout, and token management through the REST API endpoints

func NewAuthHandler

func NewAuthHandler(configInfo *config.Config,
	userService interfaces.UserService,
	projectService interfaces.ProjectService,
	agentService *agent.AgentService) *AuthHandler

func (*AuthHandler) ChangePassword

func (h *AuthHandler) ChangePassword(c *gin.Context)

ChangePassword godoc @Summary 修改密码 @Description 修改当前用户的登录密码 @Tags 认证 @Accept json @Produce json @Param request body object{old_password=string,new_password=string} true "密码修改请求" @Success 200 {object} map[string]interface{} "修改成功" @Failure 400 {object} errors.AppError "请求参数错误" @Security Bearer @Router /auth/change-password [post]

func (*AuthHandler) GetCurrentUser

func (h *AuthHandler) GetCurrentUser(c *gin.Context)

GetCurrentUser godoc @Summary 获取当前用户信息 @Description 获取当前登录用户的详细信息 @Tags 认证 @Accept json @Produce json @Success 200 {object} map[string]interface{} "用户信息" @Failure 401 {object} errors.AppError "未授权" @Security Bearer @Router /auth/me [get]

func (*AuthHandler) Login

func (h *AuthHandler) Login(c *gin.Context)

Login godoc @Summary 用户登录 @Description 用户登录并获取访问令牌 @Tags 认证 @Accept json @Produce json @Param request body types.LoginRequest true "登录请求参数" @Success 200 {object} types.LoginResponse @Failure 401 {object} errors.AppError "认证失败" @Router /auth/login [post]

func (*AuthHandler) Logout

func (h *AuthHandler) Logout(c *gin.Context)

Logout godoc @Summary 用户登出 @Description 撤销当前访问令牌并登出 @Tags 认证 @Accept json @Produce json @Success 200 {object} map[string]interface{} "登出成功" @Failure 400 {object} errors.AppError "请求参数错误" @Security Bearer @Router /auth/logout [post]

func (*AuthHandler) RefreshToken

func (h *AuthHandler) RefreshToken(c *gin.Context)

RefreshToken godoc @Summary 刷新令牌 @Description 使用刷新令牌获取新的访问令牌 @Tags 认证 @Accept json @Produce json @Param request body object{refreshToken=string} true "刷新令牌" @Success 200 {object} map[string]interface{} "新令牌" @Failure 401 {object} errors.AppError "令牌无效" @Router /auth/refresh [post]

func (*AuthHandler) Register

func (h *AuthHandler) Register(c *gin.Context)

Register godoc @Summary 用户注册 @Description 注册新用户账号 @Tags 认证 @Accept json @Produce json @Param request body types.RegisterRequest true "注册请求参数" @Success 201 {object} types.RegisterResponse @Failure 400 {object} errors.AppError "请求参数错误" @Failure 403 {object} errors.AppError "注册功能已禁用" @Router /auth/register [post]

func (*AuthHandler) UpdateAgentConfig added in v0.1.4

func (h *AuthHandler) UpdateAgentConfig(c *gin.Context)

UpdateAgentConfig godoc @Summary 更新当前用户的 Agent 配置 @Description 修改当前登录用户的 Agent 配置(Profile + 权限策略) @Tags 认证 @Accept json @Produce json @Param request body object{profile=string,permissions=object} true "Agent 配置" @Success 200 {object} map[string]interface{} "更新成功" @Failure 400 {object} errors.AppError "请求参数错误" @Security Bearer @Router /auth/agent-config [post]

func (*AuthHandler) UpdateProfile added in v0.1.2

func (h *AuthHandler) UpdateProfile(c *gin.Context)

UpdateProfile godoc @Summary 更新当前用户的 Agent Profile @Description 修改当前登录用户选中的 AgentProfile(仅允许修改自己的 Profile 选择) @Tags 认证 @Accept json @Produce json @Param request body object{profile=string} true "Agent Profile 名称" @Success 200 {object} map[string]interface{} "更新成功" @Failure 400 {object} errors.AppError "请求参数错误" @Security Bearer @Router /auth/profile [post]

func (*AuthHandler) ValidateToken

func (h *AuthHandler) ValidateToken(c *gin.Context)

ValidateToken godoc @Summary 验证令牌 @Description 验证访问令牌是否有效 @Tags 认证 @Accept json @Produce json @Success 200 {object} map[string]interface{} "令牌有效" @Failure 401 {object} errors.AppError "令牌无效" @Security Bearer @Router /auth/validate [get]

type ConfigHandler added in v0.1.4

type ConfigHandler struct {
	// contains filtered or unexported fields
}

ConfigHandler 提供 config.yml 的可视化读写能力。

接口是「配置段无关」的:GET 返回所有已注册配置段的当前生效值用于表单回填, POST 按 section 名写入。新增配置段只需在 config 包注册,无需新增接口。

func NewConfigHandler added in v0.1.4

func NewConfigHandler(cfg *config.Config) *ConfigHandler

func (*ConfigHandler) GetConfigFile added in v0.1.4

func (h *ConfigHandler) GetConfigFile(c *gin.Context)

GetConfigFile godoc @Summary 获取 config.yml 配置 @Description 返回 config.yml 的路径、文件是否存在,以及所有可编辑配置段的当前生效值(用于表单回填) @Tags 系统配置 @Produce json @Success 200 {object} configFileResponse @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /config/file/get [get]

func (*ConfigHandler) UpdateConfigSection added in v0.1.4

func (h *ConfigHandler) UpdateConfigSection(c *gin.Context)

UpdateConfigSection godoc @Summary 更新一个配置段 @Description 按 section 把配置写入 config.yml(文件不存在则创建),其余配置段保持不变 @Tags 系统配置 @Accept json @Produce json @Param request body updateConfigSectionRequest true "配置段内容" @Success 200 {object} updateConfigSectionResponse @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /config/file/section/update [post]

type ContainerHandler

type ContainerHandler struct {
	// contains filtered or unexported fields
}

func NewContainerHandler

func NewContainerHandler(containerService interfaces.ContainerService,
	projectService interfaces.ProjectService,
	analysisService interfaces.AnalysisService, workflowService interfaces.WorkflowService,
	containerManager *manager.ContainerManager,
	cfg *config.Config) *ContainerHandler

func (*ContainerHandler) CreateAppSession

func (h *ContainerHandler) CreateAppSession(c *gin.Context)

CreateAppSession godoc @Summary 创建应用会话 @Description 输入 ContainerTemplateID + 当前用户 + ProjectID 创建 AppSession,并通过 ContainerManager 创建并绑定容器 @Tags 容器管理 @Accept json @Produce json @Param request body appSessionCreateRequest true "请求参数" @Success 200 {object} types.AppSession @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/app-session/create [post]

func (*ContainerHandler) CreateAppSessionByAnalysisNode

func (h *ContainerHandler) CreateAppSessionByAnalysisNode(c *gin.Context)

CreateAppSessionByAnalysisNode godoc @Summary 通过分析节点创建应用会话 @Description 依据 analysis_node_id 查询 AnalysisNode/Analysis/Module,自动推导 ProjectID、ContainerTemplateID、WorkspacePath 并创建 AppSession @Tags 容器管理 @Accept json @Produce json @Param request body appSessionCreateByAnalysisNodeRequest true "请求参数" @Success 200 {object} types.AppSession @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/app-session/create-by-analysis-node [post]

func (*ContainerHandler) CreateContainerImage

func (h *ContainerHandler) CreateContainerImage(c *gin.Context)

CreateContainerImage godoc @Summary 创建容器镜像 @Description 创建 ContainerImage 记录 @Tags 容器管理 @Accept json @Produce json @Param request body types.ContainerImage true "请求参数" @Success 200 {object} types.ContainerImage @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/image/create [post]

func (*ContainerHandler) CreateContainerTemplate

func (h *ContainerHandler) CreateContainerTemplate(c *gin.Context)

CreateContainerTemplate godoc @Summary 创建容器模板 @Description 创建对外容器模板(ContainerTemplate = 共享运行配置 ContainerTemplateSpec × 镜像绑定 ContainerTemplateDefinition)。 @Description spec_id 为空:用请求体里的运行配置字段新建配置,再建第一条绑定; @Description spec_id 非空:复用该配置,只在它下面新增一个 image_id 绑定(同一套配置挂多个镜像)。 @Description 返回组装后的读模型,含 spec_id / image_id / image。 @Tags 容器管理 @Accept json @Produce json @Param request body types.ContainerTemplate true "请求参数" @Success 200 {object} types.ContainerTemplate @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/template/create [post]

func (*ContainerHandler) CreateContainerTemplateSpec added in v0.1.4

func (h *ContainerHandler) CreateContainerTemplateSpec(c *gin.Context)

CreateContainerTemplateSpec godoc @Summary 创建容器运行配置 @Description 新增一条共享运行配置(ContainerTemplateSpec,表 go_container_template_spec)。 @Tags 容器管理 @Accept json @Produce json @Param request body types.ContainerTemplateSpec true "请求参数" @Success 200 {object} types.ContainerTemplateSpec @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/template-spec/create [post]

func (*ContainerHandler) DeleteAppSession

func (h *ContainerHandler) DeleteAppSession(c *gin.Context)

DeleteAppSession godoc @Summary 删除应用会话 @Description 通过 ContainerManager 删除绑定容器,并删除 AppSession @Tags 容器管理 @Accept json @Produce json @Param request body appSessionIDBody true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/app-session/delete [post]

func (*ContainerHandler) DeleteContainerImage

func (h *ContainerHandler) DeleteContainerImage(c *gin.Context)

DeleteContainerImage godoc @Summary 删除容器镜像 @Description 按 ID 删除 ContainerImage 记录;仍被容器模板(配置 × 镜像 绑定行)引用时返回 409 并给出引用清单。 @Tags 容器管理 @Accept json @Produce json @Param request body idBody true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 409 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/image/delete [post]

func (*ContainerHandler) DeleteContainerTemplate

func (h *ContainerHandler) DeleteContainerTemplate(c *gin.Context)

DeleteContainerTemplate godoc @Summary 删除容器模板 @Description 按绑定行 ID(ContainerTemplateDefinition.ID)删除该镜像绑定; @Description 当这张绑定所属的共享运行配置已无任何其他镜像绑定时,一并清理该配置。 @Tags 容器管理 @Accept json @Produce json @Param request body idBody true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/template/delete [post]

func (*ContainerHandler) DeleteContainerTemplateSpec added in v0.1.4

func (h *ContainerHandler) DeleteContainerTemplateSpec(c *gin.Context)

DeleteContainerTemplateSpec godoc @Summary 删除容器运行配置 @Description 按主键删除 ContainerTemplateSpec;仍被绑定行引用时返回 409。 @Tags 容器管理 @Accept json @Produce json @Param request body idBody true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 409 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/template-spec/delete [post]

func (*ContainerHandler) DescribeContainerInstance added in v0.1.4

func (h *ContainerHandler) DescribeContainerInstance(c *gin.Context)

DescribeContainerInstance godoc @Summary 容器实例详情 @Description 按 ContainerInstance ID 从运行时获取 inspect/describe 详情(兼容 docker 与 k8s) @Tags 容器管理 @Produce json @Param id query int64 true "容器实例 ID" @Success 200 {object} containerruntime.RuntimeDescription @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/instance/describe [get]

func (*ContainerHandler) ExportContainerTemplate added in v0.1.4

func (h *ContainerHandler) ExportContainerTemplate(c *gin.Context)

ExportContainerTemplate godoc @Summary 导出容器模板 @Description 按 ContainerTemplate 导出为 JSON 字符串,ImageID 转为内嵌 ContainerImage 对象,均不含时间字段 @Tags 容器管理 @Accept json @Produce json @Param request body types.ContainerTemplate true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/template/export [post]

func (*ContainerHandler) GetAppSession

func (h *ContainerHandler) GetAppSession(c *gin.Context)

GetAppSession godoc @Summary 获取应用会话 @Description 按 ID 查询当前用户的 AppSession 详情 @Tags 容器管理 @Produce json @Param id query integer true "主键 ID" @Success 200 {object} types.AppSession @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/app-session/get [get]

func (*ContainerHandler) GetContainerImage

func (h *ContainerHandler) GetContainerImage(c *gin.Context)

GetContainerImage godoc @Summary 获取容器镜像 @Description 按 ID 查询 ContainerImage 详情 @Tags 容器管理 @Produce json @Param id query integer true "主键 ID" @Success 200 {object} types.ContainerImage @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/image/get [get]

func (*ContainerHandler) GetContainerTemplate

func (h *ContainerHandler) GetContainerTemplate(c *gin.Context)

GetContainerTemplate godoc @Summary 获取容器模板 @Description 按 ID 查询 ContainerTemplate 详情 @Tags 容器管理 @Produce json @Param id query integer true "主键 ID" @Success 200 {object} types.ContainerTemplate @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/template/get [get]

func (*ContainerHandler) GetContainerTemplateSpec added in v0.1.4

func (h *ContainerHandler) GetContainerTemplateSpec(c *gin.Context)

GetContainerTemplateSpec godoc @Summary 获取容器运行配置 @Description 按 ID 查询 ContainerTemplateSpec 详情 @Tags 容器管理 @Produce json @Param id query integer true "主键 ID" @Success 200 {object} types.ContainerTemplateSpec @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/template-spec/get [get]

func (*ContainerHandler) GetQueueStatus

func (h *ContainerHandler) GetQueueStatus(c *gin.Context)

GetQueueStatus godoc @Summary 容器队列状态 @Description 返回队列的运行中/等待中/最大并发/最大排队数量 @Tags 容器管理 @Produce json @Success 200 {object} map[string]interface{} @Failure 401 {object} errors.AppError @Security Bearer @Router /container/queue/status [get]

func (*ContainerHandler) ImportContainerTemplate added in v0.1.4

func (h *ContainerHandler) ImportContainerTemplate(c *gin.Context)

ImportContainerTemplate godoc @Summary 导入容器模板 @Description 按导出结构导入 ContainerTemplate,ImageID 转为内嵌 ContainerImage 对象,均不含时间字段 @Tags 容器管理 @Accept json @Produce json @Param request body types.ContainerTemplateExport true "请求参数" @Success 200 {object} types.ContainerTemplateExport @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/template/import [post]

func (*ContainerHandler) ListAppSession

func (h *ContainerHandler) ListAppSession(c *gin.Context)

ListAppSession godoc @Summary 应用会话列表 @Description 查询当前用户的 AppSession 列表 @Tags 容器管理 @Produce json @Success 200 {array} types.AppSession @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/app-session/list [get]

func (*ContainerHandler) ListContainerImage

func (h *ContainerHandler) ListContainerImage(c *gin.Context)

ListContainerImage godoc @Summary 容器镜像列表 @Description 查询 ContainerImage 列表,每项带 usage(引用数 + 引用的模板绑定行) @Tags 容器管理 @Produce json @Success 200 {array} types.ContainerImageItem @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/image/list [get]

func (*ContainerHandler) ListContainerTemplate

func (h *ContainerHandler) ListContainerTemplate(c *gin.Context)

ListContainerTemplate godoc @Summary 容器模板列表 @Description 查询 ContainerTemplate 列表 @Tags 容器管理 @Produce json @Success 200 {array} types.ContainerTemplate @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/template/list [get]

func (*ContainerHandler) ListContainerTemplateBySpec added in v0.1.4

func (h *ContainerHandler) ListContainerTemplateBySpec(c *gin.Context)

ListContainerTemplateBySpec godoc @Summary 按共享配置列出容器模板 @Description 列出同一套 ContainerTemplateSpec 下绑定不同镜像的所有对外模板(一个配置 × 多个镜像) @Tags 容器管理 @Accept json @Produce json @Param request body containerTemplateListBySpecRequest true "请求参数" @Success 200 {array} types.ContainerTemplate @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/template/list-by-spec [post]

func (*ContainerHandler) ListContainerTemplateSpec added in v0.1.4

func (h *ContainerHandler) ListContainerTemplateSpec(c *gin.Context)

ListContainerTemplateSpec godoc @Summary 容器运行配置列表 @Description 查询全部 ContainerTemplateSpec @Tags 容器管理 @Produce json @Success 200 {array} types.ContainerTemplateSpec @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/template-spec/list [get]

func (*ContainerHandler) ListRuntimeMonitoringSnapshot

func (h *ContainerHandler) ListRuntimeMonitoringSnapshot(c *gin.Context)

ListRuntimeMonitoringSnapshot godoc @Summary 运行时监控快照 @Description 返回全局运行时监控表快照(runtime_id 与引用计数) @Tags 容器管理 @Produce json @Success 200 {object} map[string]interface{} @Failure 401 {object} errors.AppError @Security Bearer @Router /container/runtime/monitoring/list [get]

func (*ContainerHandler) PageAppSession

func (h *ContainerHandler) PageAppSession(c *gin.Context)

PageAppSession godoc @Summary 分页查询应用会话 @Description 按当前用户分页查询 AppSession 列表 @Tags 容器管理 @Accept json @Produce json @Param request body appSessionPageRequest true "分页请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/app-session/list-by-page [post]

func (*ContainerHandler) PageContainerImage

func (h *ContainerHandler) PageContainerImage(c *gin.Context)

PageContainerImage godoc @Summary 分页查询容器镜像 @Description 分页查询 ContainerImage 列表,每项带 usage(引用数 + 引用的模板绑定行) @Tags 容器管理 @Accept json @Produce json @Param request body containerImagePageRequest true "分页请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/image/list-by-page [post]

func (*ContainerHandler) PageContainerInstance

func (h *ContainerHandler) PageContainerInstance(c *gin.Context)

PageContainerInstance godoc @Summary 分页查询容器实例 @Description 分页查询 ContainerInstance 列表 @Tags 容器管理 @Accept json @Produce json @Param request body containerInstancePageRequest true "分页请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/instance/list-by-page [post]

func (*ContainerHandler) PageContainerTemplate

func (h *ContainerHandler) PageContainerTemplate(c *gin.Context)

PageContainerTemplate godoc @Summary 分页查询容器模板 @Description 分页查询 ContainerTemplate 列表 @Tags 容器管理 @Accept json @Produce json @Param request body containerTemplatePageRequest true "分页请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/template/list-by-page [post]

func (*ContainerHandler) PageContainerTemplateSpec added in v0.1.4

func (h *ContainerHandler) PageContainerTemplateSpec(c *gin.Context)

PageContainerTemplateSpec godoc @Summary 分页查询容器运行配置 @Description 分页查询 ContainerTemplateSpec 列表 @Tags 容器管理 @Accept json @Produce json @Param request body containerTemplateSpecPageRequest true "分页请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/template-spec/list-by-page [post]

func (*ContainerHandler) PageOutboxEvent

func (h *ContainerHandler) PageOutboxEvent(c *gin.Context)

PageOutboxEvent godoc @Summary 分页查询事件出箱 @Description 分页查询 OutboxEvent 列表 @Tags 容器管理 @Accept json @Produce json @Param request body outboxEventPageRequest true "分页请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/outbox/list-by-page [post]

func (*ContainerHandler) RecreateAppSessionContainer

func (h *ContainerHandler) RecreateAppSessionContainer(c *gin.Context)

RecreateAppSessionContainer godoc @Summary 重建应用会话容器 @Description 不创建 AppSession,删除并重新创建 AppSession 对应的容器实例 @Tags 容器管理 @Accept json @Produce json @Param request body appSessionIDBody true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/app-session/recreate-container [post]

func (*ContainerHandler) StartAppSession

func (h *ContainerHandler) StartAppSession(c *gin.Context)

StartAppSession godoc @Summary 启动应用会话 @Description 通过 ContainerManager 启动 AppSession 绑定容器 @Tags 容器管理 @Accept json @Produce json @Param request body appSessionIDBody true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/app-session/start [post]

func (*ContainerHandler) StopAppSession

func (h *ContainerHandler) StopAppSession(c *gin.Context)

StopAppSession godoc @Summary 停止应用会话 @Description 通过 ContainerManager 停止 AppSession 绑定容器 @Tags 容器管理 @Accept json @Produce json @Param request body appSessionIDBody true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/app-session/stop [post]

func (*ContainerHandler) UpdateContainerImage

func (h *ContainerHandler) UpdateContainerImage(c *gin.Context)

UpdateContainerImage godoc @Summary 更新容器镜像 @Description 按 ID 更新 ContainerImage 记录 @Tags 容器管理 @Accept json @Produce json @Param request body types.ContainerImage true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/image/update [post]

func (*ContainerHandler) UpdateContainerTemplate

func (h *ContainerHandler) UpdateContainerTemplate(c *gin.Context)

UpdateContainerTemplate godoc @Summary 更新容器模板 @Description 按绑定行 ID(ContainerTemplateDefinition.ID)更新:请求体里的运行配置字段写入绑行指向的 ContainerTemplateSpec, @Description image_id 与包目录字段写入绑定行本体。返回组装后的读模型。 @Tags 容器管理 @Accept json @Produce json @Param request body types.ContainerTemplate true "请求参数" @Success 200 {object} types.ContainerTemplate @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/template/update [post]

func (*ContainerHandler) UpdateContainerTemplateSpec added in v0.1.4

func (h *ContainerHandler) UpdateContainerTemplateSpec(c *gin.Context)

UpdateContainerTemplateSpec godoc @Summary 更新容器运行配置 @Description 按主键更新 ContainerTemplateSpec(不影响绑定行)。 @Tags 容器管理 @Accept json @Produce json @Param request body types.ContainerTemplateSpec true "请求参数" @Success 200 {object} types.ContainerTemplateSpec @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /container/template-spec/update [post]

type DataHandler

type DataHandler struct {
	// contains filtered or unexported fields
}

func NewDataHandler

func NewDataHandler(dataService interfaces.DataService, projectService interfaces.ProjectService) *DataHandler

func (*DataHandler) AddFileToDataset

func (h *DataHandler) AddFileToDataset(c *gin.Context)

AddFileToDataset godoc @Summary 按路径添加文件到数据集 @Description 根据 BaseDir + path 检查文件是否存在,创建 File 记录并关联到 Dataset @Tags 数据管理 @Accept json @Produce json @Param request body types.AddFileToDatasetRequest true "请求参数" @Success 200 {object} types.AddFileToDatasetResponse @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/dataset-file/add-file [post]

func (*DataHandler) CreateAssay added in v0.1.5

func (h *DataHandler) CreateAssay(c *gin.Context)

CreateAssay godoc @Summary 创建 Assay @Description 创建 Assay 记录 @Tags 数据管理 @Accept json @Produce json @Param request body types.Assay true "请求参数" @Success 200 {object} types.Assay @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/assay/create [post]

func (*DataHandler) CreateDataset

func (h *DataHandler) CreateDataset(c *gin.Context)

CreateDataset godoc @Summary 创建数据集 @Description 在当前用户激活的项目下创建 Dataset 记录,并自动建立 ProjectDataset 关联;主键由服务端生成 @Tags 数据管理 @Accept json @Produce json @Param request body types.CreateDatasetRequest true "请求参数" @Success 200 {object} types.Dataset @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/dataset/create [post]

func (*DataHandler) CreateDatasetAssay added in v0.1.5

func (h *DataHandler) CreateDatasetAssay(c *gin.Context)

CreateDatasetAssay godoc @Summary 创建数据集-Assay 映射 @Description 创建 DatasetAssay 记录(数据集直接与 Assay 关联) @Tags 数据管理 @Accept json @Produce json @Param request body types.DatasetAssay true "请求参数" @Success 200 {object} types.DatasetAssay @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/dataset-assay/create [post]

func (*DataHandler) CreateDatasetFile

func (h *DataHandler) CreateDatasetFile(c *gin.Context)

CreateDatasetFile godoc @Summary 创建数据集-文件映射 @Description 创建 DatasetFile 记录 @Tags 数据管理 @Accept json @Produce json @Param request body types.DatasetFile true "请求参数" @Success 200 {object} types.DatasetFile @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/dataset-file/create [post]

func (*DataHandler) CreateFile

func (h *DataHandler) CreateFile(c *gin.Context)

CreateFile godoc @Summary 创建文件 @Description 创建 File 记录 @Tags 数据管理 @Accept json @Produce json @Param request body types.File true "请求参数" @Success 200 {object} types.File @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/file/create [post]

func (*DataHandler) CreateProjectDataset

func (h *DataHandler) CreateProjectDataset(c *gin.Context)

CreateProjectDataset godoc @Summary 创建项目-数据集映射 @Description 创建 ProjectDataset 记录 @Tags 数据管理 @Accept json @Produce json @Param request body types.ProjectDataset true "请求参数" @Success 200 {object} types.ProjectDataset @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/project-dataset/create [post]

func (*DataHandler) DeleteAssay added in v0.1.5

func (h *DataHandler) DeleteAssay(c *gin.Context)

DeleteAssay godoc @Summary 删除 Assay @Description 按 ID 删除 Assay,并手动清理关联映射关系 @Tags 数据管理 @Accept json @Produce json @Param request body idBody true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/assay/delete [post]

func (*DataHandler) DeleteDataset

func (h *DataHandler) DeleteDataset(c *gin.Context)

DeleteDataset godoc @Summary 删除数据集 @Description 按 ID 删除 Dataset,并手动清理关联映射关系 @Tags 数据管理 @Accept json @Produce json @Param request body idBody true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/dataset/delete [post]

func (*DataHandler) DeleteDatasetAssay added in v0.1.5

func (h *DataHandler) DeleteDatasetAssay(c *gin.Context)

DeleteDatasetAssay godoc @Summary 删除数据集-Assay 映射 @Description 按 ID 删除 DatasetAssay 记录 @Tags 数据管理 @Accept json @Produce json @Param request body idBody true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/dataset-assay/delete [post]

func (*DataHandler) DeleteDatasetFile

func (h *DataHandler) DeleteDatasetFile(c *gin.Context)

DeleteDatasetFile godoc @Summary 删除数据集-文件映射 @Description 按 ID 删除 DatasetFile 记录 @Tags 数据管理 @Accept json @Produce json @Param request body idBody true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/dataset-file/delete [post]

func (*DataHandler) DeleteFile

func (h *DataHandler) DeleteFile(c *gin.Context)

DeleteFile godoc @Summary 删除文件 @Description 按 ID 删除 File,并手动清理关联映射关系 @Tags 数据管理 @Accept json @Produce json @Param request body idBody true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/file/delete [post]

func (*DataHandler) DeleteProjectDataset

func (h *DataHandler) DeleteProjectDataset(c *gin.Context)

DeleteProjectDataset godoc @Summary 删除项目-数据集映射 @Description 按 ID 删除 ProjectDataset 记录 @Tags 数据管理 @Accept json @Produce json @Param request body idBody true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/project-dataset/delete [post]

func (*DataHandler) EnsureDatasetDir added in v0.1.4

func (h *DataHandler) EnsureDatasetDir(c *gin.Context)

EnsureDatasetDir godoc @Summary 创建数据集目录 @Description 校验 Dataset 存在后,基于当前用户激活的项目创建数据集目录(目录已存在则直接返回) @Tags 数据管理 @Accept json @Produce json @Param request body idBody true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/dataset/ensure-dir [post]

func (*DataHandler) GetAssay added in v0.1.5

func (h *DataHandler) GetAssay(c *gin.Context)

GetAssay godoc @Summary 获取 Assay @Description 按 ID 查询 Assay 详情 @Tags 数据管理 @Produce json @Param id query integer true "主键 ID" @Success 200 {object} types.Assay @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/assay/get [get]

func (*DataHandler) GetDataset

func (h *DataHandler) GetDataset(c *gin.Context)

GetDataset godoc @Summary 获取数据集 @Description 按 ID 查询 Dataset 详情 @Tags 数据管理 @Produce json @Param id query integer true "主键 ID" @Success 200 {object} types.Dataset @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/dataset/get [get]

func (*DataHandler) GetDatasetAssay added in v0.1.5

func (h *DataHandler) GetDatasetAssay(c *gin.Context)

GetDatasetAssay godoc @Summary 获取数据集-Assay 映射 @Description 按 ID 查询 DatasetAssay 详情 @Tags 数据管理 @Produce json @Param id query integer true "主键 ID" @Success 200 {object} types.DatasetAssay @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/dataset-assay/get [get]

func (*DataHandler) GetDatasetAssayByAssayID added in v0.1.5

func (h *DataHandler) GetDatasetAssayByAssayID(c *gin.Context)

GetDatasetAssayByAssayID godoc @Summary 按 Assay 查询数据集映射 @Description 返回 Assay 绑定的 DatasetAssay;尚未绑定任何数据集时返回 null @Tags 数据管理 @Produce json @Param assay_id query integer true "Assay 主键 ID" @Success 200 {object} types.DatasetAssay @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/dataset-assay/get-by-assay [get]

func (*DataHandler) GetDatasetFile

func (h *DataHandler) GetDatasetFile(c *gin.Context)

GetDatasetFile godoc @Summary 获取数据集-文件映射 @Description 按 ID 查询 DatasetFile 详情 @Tags 数据管理 @Produce json @Param id query integer true "主键 ID" @Success 200 {object} types.DatasetFile @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/dataset-file/get [get]

func (*DataHandler) GetFile

func (h *DataHandler) GetFile(c *gin.Context)

GetFile godoc @Summary 获取文件 @Description 按 ID 查询 File 详情 @Tags 数据管理 @Produce json @Param id query integer true "主键 ID" @Success 200 {object} types.File @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/file/get [get]

func (*DataHandler) GetFileColumns added in v0.1.5

func (h *DataHandler) GetFileColumns(c *gin.Context)

GetFileColumns godoc @Summary 获取文件列名 @Description 按文件 ID 读取其列名:tsv/csv 返回扁平的列数组,Excel 返回按 sheet 名分组的列 @Tags 数据管理 @Produce json @Param id query integer true "文件主键 ID" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/file/columns [get]

func (*DataHandler) GetProjectDataset

func (h *DataHandler) GetProjectDataset(c *gin.Context)

GetProjectDataset godoc @Summary 获取项目-数据集映射 @Description 按 ID 查询 ProjectDataset 详情 @Tags 数据管理 @Produce json @Param id query integer true "主键 ID" @Success 200 {object} types.ProjectDataset @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/project-dataset/get [get]

func (*DataHandler) ImportAssayTSV added in v0.1.5

func (h *DataHandler) ImportAssayTSV(c *gin.Context)

ImportAssayTSV godoc @Summary 通过 TSV 导入 Assay/File @Description 解析 TSV 文本(表头为列名),按 dataset+sample_name+assay_role、assay+文件列 逐级 upsert;未映射的列作为 File 列(FileKey=列名) @Tags 数据管理 @Accept json @Produce json @Param request body types.ImportAssayTSVRequest true "请求参数" @Success 200 {object} types.ImportAssayTSVResult @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/import/assay-tsv [post]

func (*DataHandler) ListAssay added in v0.1.5

func (h *DataHandler) ListAssay(c *gin.Context)

ListAssay godoc @Summary Assay 列表 @Description 查询 Assay 列表 @Tags 数据管理 @Produce json @Success 200 {array} types.Assay @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/assay/list [get]

func (*DataHandler) ListAssayByProjectID added in v0.1.5

func (h *DataHandler) ListAssayByProjectID(c *gin.Context)

ListAssayByProjectID godoc @Summary 按当前激活项目查询 Assay 列表 @Description 查询当前用户激活项目下所有样本的 Assay @Tags 数据管理 @Produce json @Success 200 {array} types.AssayWithDatasetInfo @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/assay/list-by-project [get]

func (*DataHandler) ListDataset

func (h *DataHandler) ListDataset(c *gin.Context)

ListDataset godoc @Summary 数据集列表 @Description 查询 Dataset 列表 @Tags 数据管理 @Produce json @Success 200 {array} types.Dataset @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/dataset/list [get]

func (*DataHandler) ListDatasetAssay added in v0.1.5

func (h *DataHandler) ListDatasetAssay(c *gin.Context)

ListDatasetAssay godoc @Summary 数据集-Assay 映射列表 @Description 查询 DatasetAssay 列表 @Tags 数据管理 @Produce json @Success 200 {array} types.DatasetAssay @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/dataset-assay/list [get]

func (*DataHandler) ListDatasetByProjectID added in v0.1.5

func (h *DataHandler) ListDatasetByProjectID(c *gin.Context)

ListDatasetByProjectID godoc @Summary 按项目查询数据集列表 @Description 根据当前用户激活的项目查询关联的所有 Dataset @Tags 数据管理 @Produce json @Success 200 {array} types.Dataset @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/dataset/list-by-project [get]

func (*DataHandler) ListDatasetFile

func (h *DataHandler) ListDatasetFile(c *gin.Context)

ListDatasetFile godoc @Summary 数据集-文件映射列表 @Description 查询 DatasetFile 列表 @Tags 数据管理 @Produce json @Success 200 {array} types.DatasetFile @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/dataset-file/list [get]

func (*DataHandler) ListFile

func (h *DataHandler) ListFile(c *gin.Context)

ListFile godoc @Summary 文件列表 @Description 查询 File 列表 @Tags 数据管理 @Produce json @Success 200 {array} types.File @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/file/list [get]

func (*DataHandler) ListFileByAnalysisNodeID added in v0.1.5

func (h *DataHandler) ListFileByAnalysisNodeID(c *gin.Context)

ListFileByAnalysisNodeID godoc @Summary 按分析节点查询文件列表 @Description 返回某个分析节点(analysis_nodes)产出的全部文件,通过 go_file.analysis_node_id 关联(无文件时返回空数组) @Tags 数据管理 @Produce json @Param analysis_node_id query integer true "分析节点主键 ID" @Success 200 {array} types.File @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/file/list-by-analysis-node [get]

func (*DataHandler) ListFileByAssayID added in v0.1.5

func (h *DataHandler) ListFileByAssayID(c *gin.Context)

ListFileByAssayID godoc @Summary 按 Assay 查询文件列表 @Description 返回某个 Assay 所拥有的全部文件(无文件时返回空数组) @Tags 数据管理 @Produce json @Param assay_id query integer true "Assay 主键 ID" @Success 200 {array} types.File @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/file/list-by-assay [get]

func (*DataHandler) ListFileByProjectID

func (h *DataHandler) ListFileByProjectID(c *gin.Context)

ListFileByProjectID godoc @Summary 按项目查询文件列表 @Description 根据 project_id 查询关联的所有文件;支持按 go_file.role 过滤 @Tags 数据管理 @Produce json @Param project_id query string true "项目业务ID" @Param role query []string false "角色过滤,可多选;不传默认查询全部" collectionFormat(multi) @Success 200 {array} types.FileWithDatasetInfo @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/file/list-by-project [get]

func (*DataHandler) ListFileByProjectIDGroupByRole

func (h *DataHandler) ListFileByProjectIDGroupByRole(c *gin.Context)

ListFileByProjectIDGroupByRole godoc @Summary 按项目查询文件列表并按角色分组 @Description 根据 project_id 查询关联文件,并按 role 分组 @Tags 数据管理 @Produce json @Param project_id query string true "项目业务ID" @Success 200 {object} map[string][]types.FileWithDatasetInfo @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/file/list-by-project-group [get]

func (*DataHandler) ListProjectDataset

func (h *DataHandler) ListProjectDataset(c *gin.Context)

ListProjectDataset godoc @Summary 项目-数据集映射列表 @Description 查询 ProjectDataset 列表 @Tags 数据管理 @Produce json @Success 200 {array} types.ProjectDataset @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/project-dataset/list [get]

func (*DataHandler) PageAssayByProjectID added in v0.1.5

func (h *DataHandler) PageAssayByProjectID(c *gin.Context)

PageAssayByProjectID godoc @Summary 按项目分页查询 Assay @Description 根据 project_id 分页查询其下的 Assay,并返回所属 dataset 等信息 @Tags 数据管理 @Accept json @Produce json @Param request body assayByProjectPageRequest true "分页请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/assay/list-by-project-page [post]

func (*DataHandler) PageDatasetByProjectID

func (h *DataHandler) PageDatasetByProjectID(c *gin.Context)

PageDatasetByProjectID godoc @Summary 按项目分页查询数据集 @Description 根据当前用户激活的项目分页查询关联的 Dataset 列表 @Tags 数据管理 @Accept json @Produce json @Param request body datasetByProjectPageRequest true "分页请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/dataset/list-by-project-page [post]

func (*DataHandler) PageFileByProjectID

func (h *DataHandler) PageFileByProjectID(c *gin.Context)

PageFileByProjectID godoc @Summary 按项目分页查询文件 @Description 根据 project_id 分页查询项目下关联文件,并返回 role、dataset_name、dataset_id 等信息 @Tags 数据管理 @Accept json @Produce json @Param request body projectFilePageRequest true "分页请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/file/list-by-project-page [post]

func (*DataHandler) PageFileByProjectIDViaAnalysisNode added in v0.1.5

func (h *DataHandler) PageFileByProjectIDViaAnalysisNode(c *gin.Context)

PageFileByProjectIDViaAnalysisNode godoc @Summary 按当前激活项目分页查询分析节点产出的文件 @Description 根据当前用户激活的项目分页查询由分析节点(analysis_nodes)产出的文件,通过 go_file.analysis_node_id 关联 @Tags 数据管理 @Accept json @Produce json @Param request body types.Pagination true "分页请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/file/list-by-project-analysis-node-page [post]

func (*DataHandler) UpdateAssay added in v0.1.5

func (h *DataHandler) UpdateAssay(c *gin.Context)

UpdateAssay godoc @Summary 更新 Assay @Description 按 ID 更新 Assay 记录 @Tags 数据管理 @Accept json @Produce json @Param request body types.Assay true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/assay/update [post]

func (*DataHandler) UpdateDataset

func (h *DataHandler) UpdateDataset(c *gin.Context)

UpdateDataset godoc @Summary 更新数据集 @Description 按 ID 更新 Dataset 记录,ID 由请求显式指定,其余字段为业务字段 @Tags 数据管理 @Accept json @Produce json @Param request body types.UpdateDatasetRequest true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/dataset/update [post]

func (*DataHandler) UpdateDatasetAssay added in v0.1.5

func (h *DataHandler) UpdateDatasetAssay(c *gin.Context)

UpdateDatasetAssay godoc @Summary 更新数据集-Assay 映射 @Description 按 ID 更新 DatasetAssay 记录 @Tags 数据管理 @Accept json @Produce json @Param request body types.DatasetAssay true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/dataset-assay/update [post]

func (*DataHandler) UpdateFile

func (h *DataHandler) UpdateFile(c *gin.Context)

UpdateFile godoc @Summary 更新文件 @Description 按 ID 更新 File 记录 @Tags 数据管理 @Accept json @Produce json @Param request body types.File true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/file/update [post]

func (*DataHandler) UpdateProjectDataset

func (h *DataHandler) UpdateProjectDataset(c *gin.Context)

UpdateProjectDataset godoc @Summary 更新项目-数据集映射 @Description 按 ID 更新 ProjectDataset 记录 @Tags 数据管理 @Accept json @Produce json @Param request body types.ProjectDataset true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/project-dataset/update [post]

func (*DataHandler) UploadFileToDataset added in v0.1.5

func (h *DataHandler) UploadFileToDataset(c *gin.Context)

UploadFileToDataset godoc @Summary 上传本地文件到数据集 @Description 接收 multipart 表单(dataset_id / role / file),把文件保存到数据集工作目录,创建 File 记录并关联到 Dataset @Tags 数据管理 @Accept mpfd @Produce json @Param dataset_id formData integer true "数据集ID" @Param role formData string false "文件角色(go_file.role),默认 DEFAULT" @Param file_name formData string false "展示文件名,默认使用上传文件原名" @Param file formData file true "上传的文件" @Success 200 {object} types.AddFileToDatasetResponse @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /data/dataset-file/upload [post]

type EditNodeParamsResponse

type EditNodeParamsResponse struct {
	AnalysisName   string                 `json:"analysis_name"`
	IsReport       bool                   `json:"is_report"`
	CacheType      int                    `json:"cache_type"`
	AnalysisID     int64                  `json:"analysis_id,string"`
	AnalysisNodeID string                 `json:"analysis_node_id"`
	Status         string                 `json:"status"`
	ServerStatus   string                 `json:"server_status"`
	RequestParam   map[string]interface{} `json:"request_param"`
	AnalysisResult map[string]interface{} `json:"analysis_result"`
	FormJSON       []interface{}          `json:"formJson"`
}

type EditParamsV2Response

type EditParamsV2Response struct {
	AnalysisName   string                 `json:"analysis_name"`
	IsReport       bool                   `json:"is_report"`
	CacheType      int                    `json:"cache_type"`
	AnalysisID     string                 `json:"analysis_id"`
	Status         string                 `json:"status"`
	ServerStatus   string                 `json:"server_status"`
	RequestParam   map[string]interface{} `json:"request_param"`
	AnalysisResult map[string]interface{} `json:"analysis_result"`
	FormJSON       []interface{}          `json:"formJson"`
}

type FileHandler

type FileHandler struct {
	// contains filtered or unexported fields
}

func NewFileHandler

func NewFileHandler(cfg *config.Config, projectService interfaces.ProjectService) *FileHandler

func (*FileHandler) CreateDir

func (h *FileHandler) CreateDir(c *gin.Context)

func (*FileHandler) CreateFile

func (h *FileHandler) CreateFile(c *gin.Context)

func (*FileHandler) Delete

func (h *FileHandler) Delete(c *gin.Context)

func (*FileHandler) Download

func (h *FileHandler) Download(c *gin.Context)

func (*FileHandler) ListProjectDir

func (h *FileHandler) ListProjectDir(c *gin.Context)

func (*FileHandler) Move

func (h *FileHandler) Move(c *gin.Context)

func (*FileHandler) Search

func (h *FileHandler) Search(c *gin.Context)

func (*FileHandler) Upload

func (h *FileHandler) Upload(c *gin.Context)

type GitHandler added in v0.1.5

type GitHandler struct {
	// contains filtered or unexported fields
}

GitHandler 暴露组件目录(脚本/工作流本地工作区仓库)的 git 能力。

目前有「查看本地变化 diff」与「撤回单个文件的未提交改动」两组接口(script / workflow), 后续的 git 操作(提交历史 git log、单文件 diff 等)都在本 handler 里扩展: 目录定位复用下方 resolveXxxTarget,读操作复用 internal/utils 里的 git 能力, 不在 WorkflowHandler 里继续堆 git 相关逻辑。

目录布局的推导与 GetScriptById / GetWorkflowById 完全一致:

本地目录 = utils.GetScriptFileDir / utils.GetWorkflowFileDir(baseDir, project.ProjectID, <uuid>)
store 目录 = utils.GetWorkflowOrScriptStoreDir(baseDir, store.PathName)(未发布时为空)

注意这里用的是 project.project_id(字符串)而非 script/workflow 的 ProjectID(int64 外键)。

func NewGitHandler added in v0.1.5

func NewGitHandler(workflowService interfaces.WorkflowService,
	projectService interfaces.ProjectService,
	storeService interfaces.StoreService,
	cfg *config.Config) *GitHandler

func (*GitHandler) GetScriptDiff added in v0.1.5

func (h *GitHandler) GetScriptDiff(c *gin.Context)

GetScriptDiff godoc @Summary 获取脚本本地变化 diff @Description 按脚本主键定位脚本目录(本地 git 仓库),返回工作区相对 HEAD 的未提交改动(含未跟踪文件)以及本地相对 store 的未发布提交差异;非 git 仓库时 initialized 为 false 且无变化 @Tags Git @Produce json @Param scriptId path string true "脚本主键 ID" @Success 200 {object} handler.gitDiffResponse @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /script/{scriptId}/git-diff [get]

func (*GitHandler) GetWorkflowDiff added in v0.1.5

func (h *GitHandler) GetWorkflowDiff(c *gin.Context)

GetWorkflowDiff godoc @Summary 获取工作流本地变化 diff @Description 按工作流主键定位 workflow 目录(本地 git 仓库),返回工作区相对 HEAD 的未提交改动(含未跟踪文件)以及本地相对 store 的未发布提交差异;非 git 仓库时 initialized 为 false 且无变化 @Tags Git @Produce json @Param workflowId path string true "工作流主键 ID" @Success 200 {object} handler.gitDiffResponse @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /workflow/{workflowId}/git-diff [get]

func (*GitHandler) RevertScriptFile added in v0.1.5

func (h *GitHandler) RevertScriptFile(c *gin.Context)

RevertScriptFile godoc @Summary 撤回脚本单个文件的未提交改动 @Description 按脚本主键定位脚本目录,把指定文件恢复为本地 HEAD 版本(等同于 git checkout HEAD -- <path>);文件为工作区新增时删除该文件。仅影响该文件,不产生提交 @Tags Git @Accept json @Produce json @Param scriptId path string true "脚本主键 ID" @Param body body handler.gitRevertFileRequest true "相对仓库根目录的文件路径" @Success 200 {object} handler.gitRevertFileResponse @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 409 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /script/{scriptId}/git-revert-file [post]

func (*GitHandler) RevertWorkflowFile added in v0.1.5

func (h *GitHandler) RevertWorkflowFile(c *gin.Context)

RevertWorkflowFile godoc @Summary 撤回工作流单个文件的未提交改动 @Description 按工作流主键定位 workflow 目录,把指定文件恢复为本地 HEAD 版本(等同于 git checkout HEAD -- <path>);文件为工作区新增时删除该文件。仅影响该文件,不产生提交 @Tags Git @Accept json @Produce json @Param workflowId path string true "工作流主键 ID" @Param body body handler.gitRevertFileRequest true "相对仓库根目录的文件路径" @Success 200 {object} handler.gitRevertFileResponse @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 409 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /workflow/{workflowId}/git-revert-file [post]

type LLMHandler deprecated

type LLMHandler struct {
	// contains filtered or unexported fields
}

LLMHandler 是早期基于 Copilot SDK 的 LLM 桥接实现。

Deprecated: 已被 AgentHandler(/agent/chat + AgentService/ConversationService)取代, 保留仅为兼容历史调用方;系统提示词现由 AgentService 依据 AgentProfile 模板渲染, 本桥接不再负责拼装,请勿在新功能中继续使用。

func NewLLMHandler deprecated

func NewLLMHandler(hub *realtime.Hub, cfg *config.Config, projectSvc interfaces.ProjectService,
	llmSvc interfaces.LLMService,
	workflowSvc interfaces.WorkflowService,
	analsyisSvc interfaces.AnalysisService,
	nodeOrchestrator interfaces.NodeOrchestrator,
	agentClient *agent.Client,
	runtimeCtx *RuntimeContextResolver,
) *LLMHandler

NewLLMHandler 创建 LLMHandler。

Deprecated: 参见 LLMHandler 的弃用说明。

func (*LLMHandler) CreateLLMConversation

func (h *LLMHandler) CreateLLMConversation(c *gin.Context)

func (*LLMHandler) CreateLLMSession

func (h *LLMHandler) CreateLLMSession(c *gin.Context)

func (*LLMHandler) DeleteLLMConversation

func (h *LLMHandler) DeleteLLMConversation(c *gin.Context)

func (*LLMHandler) DeleteLLMSession

func (h *LLMHandler) DeleteLLMSession(c *gin.Context)

func (*LLMHandler) GetLLMConversation

func (h *LLMHandler) GetLLMConversation(c *gin.Context)

func (*LLMHandler) GetLLMSession

func (h *LLMHandler) GetLLMSession(c *gin.Context)

func (*LLMHandler) ListLLMConversation

func (h *LLMHandler) ListLLMConversation(c *gin.Context)

func (*LLMHandler) ListLLMSession

func (h *LLMHandler) ListLLMSession(c *gin.Context)

func (*LLMHandler) UpdateLLMConversation

func (h *LLMHandler) UpdateLLMConversation(c *gin.Context)

func (*LLMHandler) UpdateLLMSession

func (h *LLMHandler) UpdateLLMSession(c *gin.Context)

type ProjectHandler

type ProjectHandler struct {
	// contains filtered or unexported fields
}

func NewProjectHandler

func NewProjectHandler(projectService interfaces.ProjectService, cfg *config.Config) *ProjectHandler

func (*ProjectHandler) ActivateProject

func (h *ProjectHandler) ActivateProject(c *gin.Context)

ActivateProject godoc @Summary 激活当前用户项目 @Description 按项目ID激活当前用户的项目,并将该用户其他项目全部置为未激活 @Tags 项目 @Accept json @Produce json @Param request body activateProjectRequest true "请求参数" @Success 200 {object} map[string]string "激活成功" @Failure 400 {object} errors.AppError "参数错误" @Failure 401 {object} errors.AppError "未认证" @Failure 404 {object} errors.AppError "项目未关联当前用户" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /project/activate-project [post]

func (*ProjectHandler) AddLiterature added in v0.1.2

func (h *ProjectHandler) AddLiterature(c *gin.Context)

AddLiterature godoc @Summary 为激活项目添加文献 @Description 创建一条参考文献记录并绑定到当前用户激活项目,全文按 content_source 存储(默认写入文件) @Tags 项目 @Accept json @Produce json @Param request body addLiteratureRequest true "请求参数" @Success 200 {object} types.Literature "创建成功" @Failure 400 {object} errors.AppError "参数错误" @Failure 401 {object} errors.AppError "未认证" @Failure 404 {object} errors.AppError "未找到激活项目" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /project/add-literature [post]

func (*ProjectHandler) AddProjectReport

func (h *ProjectHandler) AddProjectReport(c *gin.Context)

AddProjectReport godoc @Summary 添加项目报告 @Description 向指定项目添加报告记录 @Tags 项目 @Accept json @Produce json @Param request body addProjectReportRequest true "请求参数" @Success 200 {object} types.ProjectReport "创建成功" @Failure 400 {object} errors.AppError "参数错误" @Failure 401 {object} errors.AppError "未认证" @Failure 404 {object} errors.AppError "项目未关联当前用户" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /project/add-project-report [post]

func (*ProjectHandler) AddProjectReportItem added in v0.1.5

func (h *ProjectHandler) AddProjectReportItem(c *gin.Context)

AddProjectReportItem godoc @Summary 添加报告条目 @Description 向指定报告添加条目。OwnerType 为 analysis/analysis_node/ai_summary 时需提供 OwnerID;OwnerType 为 custom(章节占位/自定义内容)时只需提供 title。parent_id 为 0 时挂到根节点。 @Tags 项目 @Accept json @Produce json @Param request body addProjectReportItemRequest true "请求参数" @Success 200 {object} projectReportItemDTO "创建成功" @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /project/add-project-report-item [post]

func (*ProjectHandler) AddProjectToUser

func (h *ProjectHandler) AddProjectToUser(c *gin.Context)

AddProjectToUser godoc @Summary 按用户ID关联用户与项目 @Description 将指定用户与指定项目关联(写入 user_project 中间表),用户ID由请求传入 @Tags 项目 @Accept json @Produce json @Param request body addProjectToUserRequest true "请求参数" @Success 200 {object} map[string]string "关联成功" @Failure 400 {object} errors.AppError "参数错误或已存在关联" @Failure 401 {object} errors.AppError "未认证" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /project/add-project-to-user [post]

func (*ProjectHandler) AddUserProject

func (h *ProjectHandler) AddUserProject(c *gin.Context)

AddUserProject godoc @Summary 通过分享码关联用户与项目 @Description 根据分享码查找项目,并将当前登录用户与该项目关联(写入 user_project 中间表) @Tags 项目 @Accept json @Produce json @Param request body addUserProjectRequest true "请求参数" @Success 200 {object} map[string]string "关联成功" @Failure 400 {object} errors.AppError "参数错误、分享码无效或已存在关联" @Failure 401 {object} errors.AppError "未认证" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /project/add-user-project [post]

func (*ProjectHandler) BindLiterature added in v0.1.2

func (h *ProjectHandler) BindLiterature(c *gin.Context)

BindLiterature godoc @Summary 绑定文献到激活项目 @Description 将已存在的文献绑定到当前用户激活项目(写入 project_literature 中间表) @Tags 项目 @Accept json @Produce json @Param request body bindLiteratureRequest true "请求参数" @Success 200 {object} map[string]string "绑定成功" @Failure 400 {object} errors.AppError "参数错误或已绑定" @Failure 401 {object} errors.AppError "未认证" @Failure 404 {object} errors.AppError "文献或激活项目不存在" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /project/bind-literature [post]

func (*ProjectHandler) CreateProject

func (h *ProjectHandler) CreateProject(c *gin.Context)

CreateProject godoc @Summary 为当前用户创建项目 @Description 创建一个新项目并将其关联到当前登录用户,同时将该用户其他项目置为非激活 @Tags 项目 @Accept json @Produce json @Param request body createProjectRequest true "请求参数" @Success 200 {object} projectListItem "创建成功" @Failure 400 {object} errors.AppError "参数错误" @Failure 401 {object} errors.AppError "未认证" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /project/create-project [post]

func (*ProjectHandler) DeleteLiterature added in v0.1.2

func (h *ProjectHandler) DeleteLiterature(c *gin.Context)

DeleteLiterature godoc @Summary 删除文献 @Description 按文献ID删除文献记录、全文文件及其所有项目关联 @Tags 项目 @Accept json @Produce json @Param request body deleteLiteratureRequest true "请求参数" @Success 200 {object} map[string]string "删除成功" @Failure 400 {object} errors.AppError "参数错误" @Failure 401 {object} errors.AppError "未认证" @Failure 404 {object} errors.AppError "文献不存在或未绑定当前激活项目" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /project/delete-literature [post]

func (*ProjectHandler) DeleteProjectReport

func (h *ProjectHandler) DeleteProjectReport(c *gin.Context)

DeleteProjectReport godoc @Summary 删除项目报告 @Description 按报告ID删除指定项目下的报告 @Tags 项目 @Accept json @Produce json @Param request body deleteProjectReportRequest true "请求参数" @Success 200 {object} map[string]string "删除成功" @Failure 400 {object} errors.AppError "参数错误" @Failure 401 {object} errors.AppError "未认证" @Failure 404 {object} errors.AppError "项目或报告不存在" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /project/delete-project-report [post]

func (*ProjectHandler) DeleteProjectReportItem added in v0.1.5

func (h *ProjectHandler) DeleteProjectReportItem(c *gin.Context)

DeleteProjectReportItem godoc @Summary 删除报告条目 @Description 删除指定报告条目(含其所有子孙条目) @Tags 项目 @Accept json @Produce json @Param request body deleteProjectReportItemRequest true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /project/delete-project-report-item [post]

func (*ProjectHandler) DeleteUserProject

func (h *ProjectHandler) DeleteUserProject(c *gin.Context)

DeleteUserProject godoc @Summary 删除用户与项目关联 @Description 根据当前登录用户与项目ID删除 user_project 中间表记录,仅当该关联为非激活状态时允许删除 @Tags 项目 @Accept json @Produce json @Param request body deleteUserProjectRequest true "请求参数" @Success 200 {object} map[string]string "删除成功" @Failure 400 {object} errors.AppError "参数错误或关联仍为激活状态" @Failure 404 {object} errors.AppError "关联不存在" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /project/delete-user-project [post]

func (*ProjectHandler) GetActiveProject

func (h *ProjectHandler) GetActiveProject(c *gin.Context)

GetActiveProject godoc @Summary 获取当前用户激活项目 @Description 返回当前登录用户唯一激活的项目 @Tags 项目 @Produce json @Success 200 {object} projectListItem "激活项目" @Failure 401 {object} errors.AppError "未认证" @Failure 404 {object} errors.AppError "未找到激活项目" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /project/active-project [get]

func (*ProjectHandler) GetLiteratureDetail added in v0.1.2

func (h *ProjectHandler) GetLiteratureDetail(c *gin.Context)

GetLiteratureDetail godoc @Summary 查询文献详情 @Description 根据 id 查询文献详情(包含全文 content) @Tags 项目 @Produce json @Param id query int64 true "文献ID" @Success 200 {object} literatureDetailItem "文献详情" @Failure 400 {object} errors.AppError "参数错误" @Failure 401 {object} errors.AppError "未认证" @Failure 404 {object} errors.AppError "文献不存在或未绑定当前激活项目" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /project/literature-detail [get]

func (*ProjectHandler) GetProjectReportContent added in v0.1.5

func (h *ProjectHandler) GetProjectReportContent(c *gin.Context)

GetProjectReportContent godoc @Summary 查询报告聚合内容 @Description 汇总报告下所有条目并拼接成正文,返回报告标题与正文 @Tags 项目 @Produce json @Param report_id query int64 true "报告ID" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /project/project-report-content [get]

func (*ProjectHandler) GetProjectReportDetail

func (h *ProjectHandler) GetProjectReportDetail(c *gin.Context)

GetProjectReportDetail godoc @Summary 查询项目报告详情 @Description 根据 id 查询报告详情(包含 content) @Tags 项目 @Produce json @Param id query int64 true "报告ID" @Success 200 {object} projectReportDetailItem "报告详情" @Failure 400 {object} errors.AppError "参数错误" @Failure 401 {object} errors.AppError "未认证" @Failure 404 {object} errors.AppError "项目未关联当前用户" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /project/project-report-detail [get]

func (*ProjectHandler) GetProjectReportHTML added in v0.1.5

func (h *ProjectHandler) GetProjectReportHTML(c *gin.Context)

GetProjectReportHTML godoc @Summary 导出报告为 HTML @Description 将当前用户报告聚合为独立 HTML 文档;inline_images=true 时图片以 base64 内嵌(自包含),false 时保留原始 URL @Tags 项目 @Produce html @Param report_id query int64 true "报告ID" @Param inline_images query bool false "是否内嵌图片(默认 true)" @Success 200 {string} string "HTML 文档" @Failure 400 {object} errors.AppError "参数错误" @Failure 401 {object} errors.AppError "未认证" @Failure 404 {object} errors.AppError "报告不存在" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /project/project-report-html [get]

func (*ProjectHandler) GetProjectReportItemContent added in v0.1.5

func (h *ProjectHandler) GetProjectReportItemContent(c *gin.Context)

GetProjectReportItemContent godoc @Summary 查询报告条目 markdown 内容 @Description 入参为 ProjectReportItem ID,返回该条目解析后的 markdown 内容 @Tags 项目 @Produce json @Param id query int64 true "条目ID" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /project/project-report-item-content [get]

func (*ProjectHandler) GetProjectReportItemDetail added in v0.1.5

func (h *ProjectHandler) GetProjectReportItemDetail(c *gin.Context)

GetProjectReportItemDetail godoc @Summary 查询报告条目详情 @Description 根据 id 查询条目详情,File 类型会返回文件内容 @Tags 项目 @Produce json @Param id query int64 true "条目ID" @Success 200 {object} projectReportItemDTO @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /project/project-report-item-detail [get]

func (*ProjectHandler) ListLiterature added in v0.1.2

func (h *ProjectHandler) ListLiterature(c *gin.Context)

ListLiterature godoc @Summary 查询激活项目文献列表 @Description 查询当前用户激活项目绑定的文献列表,不返回 content 字段 @Tags 项目 @Produce json @Success 200 {array} literatureListItem "文献列表" @Failure 401 {object} errors.AppError "未认证" @Failure 404 {object} errors.AppError "未找到激活项目" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /project/list-literature [get]

func (*ProjectHandler) ListProject

func (h *ProjectHandler) ListProject(c *gin.Context)

ListProject godoc @Summary 获取当前用户的项目列表 @Description 返回与当前登录用户关联的所有项目(通过 user_project 关系表过滤) @Tags 项目 @Produce json @Success 200 {array} projectListItem "项目列表" @Failure 401 {object} errors.AppError "未认证" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /project/list-project [get]

func (*ProjectHandler) ListProjectReport

func (h *ProjectHandler) ListProjectReport(c *gin.Context)

ListProjectReport godoc @Summary 查询项目报告列表 @Description 查询当前用户激活项目的报告列表,不返回 content 字段,按 sort_order、created_at 升序排序 @Tags 项目 @Produce json @Success 200 {array} projectReportListItem "报告列表" @Failure 401 {object} errors.AppError "未认证" @Failure 404 {object} errors.AppError "未找到激活项目" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /project/list-project-report [get]

func (*ProjectHandler) ListProjectReportItem added in v0.1.5

func (h *ProjectHandler) ListProjectReportItem(c *gin.Context)

ListProjectReportItem godoc @Summary 查询报告条目树 @Description 查询指定报告下的所有条目,并按其 parent_id 组装成树返回 @Tags 项目 @Produce json @Param report_id query int64 true "报告ID" @Success 200 {array} projectReportItemNode @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /project/list-project-report-item [get]

func (*ProjectHandler) PageLiterature added in v0.1.2

func (h *ProjectHandler) PageLiterature(c *gin.Context)

PageLiterature godoc @Summary 分页查询激活项目文献列表 @Description 按当前用户激活项目分页查询文献列表,不返回 content 字段 @Tags 项目 @Accept json @Produce json @Param request body handler.literaturePageRequest true "分页请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /project/list-literature-page [post]

func (*ProjectHandler) PageLiteraturePool added in v0.1.2

func (h *ProjectHandler) PageLiteraturePool(c *gin.Context)

PageLiteraturePool godoc @Summary 分页查询文献池 @Description 分页查询所有文献并标记是否已绑定当前用户激活项目,用于绑定文献选择 @Tags 项目 @Accept json @Produce json @Param request body handler.literaturePageRequest true "分页请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /project/list-literature-pool-page [post]

func (*ProjectHandler) PageProjectReport

func (h *ProjectHandler) PageProjectReport(c *gin.Context)

PageProjectReport godoc @Summary 分页查询项目报告列表 @Description 按当前用户激活项目分页查询报告列表,不返回 content 字段,按 sort_order 降序、created_at 升序排序 @Tags 项目 @Accept json @Produce json @Param request body handler.projectReportPageRequest true "分页请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /project/list-project-report-page [post]

func (*ProjectHandler) ReorderProjectReportItem added in v0.1.5

func (h *ProjectHandler) ReorderProjectReportItem(c *gin.Context)

ReorderProjectReportItem godoc @Summary 重排报告条目树 @Description 按前端拖拽结果批量更新条目的 parent_id 与 sort_order,实现树形结构的移动与排序 @Tags 项目 @Accept json @Produce json @Param request body reorderProjectReportItemRequest true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /project/reorder-project-report-item [post]

func (*ProjectHandler) UnbindLiterature added in v0.1.2

func (h *ProjectHandler) UnbindLiterature(c *gin.Context)

UnbindLiterature godoc @Summary 移除激活项目中的文献 @Description 删除当前用户激活项目与文献的关联(仅删除 project_literature 中间表记录) @Tags 项目 @Accept json @Produce json @Param request body unbindLiteratureRequest true "请求参数" @Success 200 {object} map[string]string "移除成功" @Failure 400 {object} errors.AppError "参数错误" @Failure 401 {object} errors.AppError "未认证" @Failure 404 {object} errors.AppError "关联不存在" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /project/unbind-literature [post]

func (*ProjectHandler) UpdateLiterature added in v0.1.2

func (h *ProjectHandler) UpdateLiterature(c *gin.Context)

UpdateLiterature godoc @Summary 更新文献 @Description 按文献ID更新标题、全文内容与存储方式 @Tags 项目 @Accept json @Produce json @Param request body updateLiteratureRequest true "请求参数" @Success 200 {object} map[string]string "更新成功" @Failure 400 {object} errors.AppError "参数错误" @Failure 401 {object} errors.AppError "未认证" @Failure 404 {object} errors.AppError "文献不存在或未绑定当前激活项目" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /project/update-literature [post]

func (*ProjectHandler) UpdateProjectReport

func (h *ProjectHandler) UpdateProjectReport(c *gin.Context)

UpdateProjectReport godoc @Summary 更新项目报告 @Description 按报告ID更新指定项目下的报告 @Tags 项目 @Accept json @Produce json @Param request body updateProjectReportRequest true "请求参数" @Success 200 {object} map[string]string "更新成功" @Failure 400 {object} errors.AppError "参数错误" @Failure 401 {object} errors.AppError "未认证" @Failure 404 {object} errors.AppError "项目或报告不存在" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /project/update-project-report [post]

func (*ProjectHandler) UpdateProjectReportItem added in v0.1.5

func (h *ProjectHandler) UpdateProjectReportItem(c *gin.Context)

UpdateProjectReportItem godoc @Summary 更新报告条目 @Description 更新条目的排序、父节点或 owner 绑定 @Tags 项目 @Accept json @Produce json @Param request body updateProjectReportItemRequest true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /project/update-project-report-item [post]

func (*ProjectHandler) UpdateProjectSharing

func (h *ProjectHandler) UpdateProjectSharing(c *gin.Context)

UpdateProjectSharing godoc @Summary 开启或关闭项目分享 @Description 开启分享时生成分享码并返回;关闭分享时清空分享码 @Tags 项目 @Accept json @Produce json @Param request body updateProjectSharingRequest true "请求参数" @Success 200 {object} map[string]interface{} "分享状态与分享码" @Failure 400 {object} errors.AppError "参数错误" @Failure 401 {object} errors.AppError "未认证" @Failure 404 {object} errors.AppError "项目未关联当前用户" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /project/update-project-sharing [post]

type ProxyHandler

type ProxyHandler struct {
	// contains filtered or unexported fields
}

func NewProxyHandler

func NewProxyHandler(cfg *config.Config, resolver route.PathRouteResolver) (*ProxyHandler, error)

func (*ProxyHandler) AppSessionProxy

func (h *ProxyHandler) AppSessionProxy(c *gin.Context)

func (*ProxyHandler) BraveAPIProxy

func (h *ProxyHandler) BraveAPIProxy(c *gin.Context)

func (*ProxyHandler) ContainerProxy

func (h *ProxyHandler) ContainerProxy(c *gin.Context)

func (*ProxyHandler) FallbackProxy

func (h *ProxyHandler) FallbackProxy(c *gin.Context)

func (*ProxyHandler) OnlyOfficeProxy

func (h *ProxyHandler) OnlyOfficeProxy(c *gin.Context)

type PublishScriptRequest

type PublishScriptRequest struct {
	ScriptID int64 `json:"script_id,string"`
	// Url      string `json:"url"`
	// Version  string `json:"version"`
	Message string `json:"message"`
}

type PublishWorkflowRequest

type PublishWorkflowRequest struct {
	WorkflowID int64 `json:"workflow_id,string"`
	// Url        string `json:"url"`
	// Version    string `json:"version"`
	Message string `json:"message"`
}

type RealtimeHandler

type RealtimeHandler struct {
	// contains filtered or unexported fields
}

func NewRealtimeHandler

func NewRealtimeHandler(hub *realtime.Hub, cfg *config.Config) *RealtimeHandler

func (*RealtimeHandler) Connect

func (h *RealtimeHandler) Connect(c *gin.Context)

func (*RealtimeHandler) ConnectSSE

func (h *RealtimeHandler) ConnectSSE(c *gin.Context)

func (*RealtimeHandler) ConnectWS

func (h *RealtimeHandler) ConnectWS(c *gin.Context)

func (*RealtimeHandler) Push

func (h *RealtimeHandler) Push(c *gin.Context)

func (*RealtimeHandler) Stats

func (h *RealtimeHandler) Stats(c *gin.Context)

type RunAnalysisNodeToolParams

type RunAnalysisNodeToolParams struct {
	AnalysisNodeID string `json:"analysis_node_id" jsonschema:"The analysis node ID to run, as a string to preserve precision"`
	TimeoutSeconds int    `json:"timeout_seconds" jsonschema:"Timeout seconds waiting for completion (default 600)"`
}

RunAnalysisNodeToolParams is the input for the run_analysis_node LLM tool.

type RunAnalysisNodeToolResult

type RunAnalysisNodeToolResult struct {
	AnalysisNodeID int64  `json:"analysis_node_id"`
	Status         string `json:"status"`
	Log            string `json:"log"`
	Success        bool   `json:"success"`
	Error          string `json:"error,omitempty"`
}

RunAnalysisNodeToolResult is the output returned to the LLM after the node finishes.

type RuntimeContext added in v0.1.2

type RuntimeContext struct {
	Type  string // 归一化后的业务类型(为空表示默认工作区)
	Label string // 人类可读的上下文名称(如节点名 / 报告标题),用于前端展示
	// SystemPromptVars 是渲染 Profile 系统提示词模板(pongo2)所需的变量。
	//
	// 例如 workspace_directory / script_file_path / output_directory / output_file 等;
	// AgentService 用它与 Profile.SystemPrompt 模板合成真正的系统提示词。
	SystemPromptVars map[string]any
	WorkingDir       string // Agent 执行工作目录
}

RuntimeContext 是解析后的运行时上下文。

type RuntimeContextInfo added in v0.1.2

type RuntimeContextInfo struct {
	Type         string         `json:"type"`                        // 归一化后的业务类型(空表示默认工作区)
	Label        string         `json:"label"`                       // 人类可读的名称
	WorkingDir   string         `json:"working_dir"`                 // 工作目录
	SystemPrompt string         `json:"system_prompt,omitempty"`     // 用当前用户 Profile 模板渲染后的真实系统提示词
	Vars         map[string]any `json:"vars,omitempty"`              // 渲染系统提示词模板所用的变量
	ProfileName  string         `json:"profile_name,omitempty"`      // 用于渲染系统提示词的 Profile 名称
	ProfileID    int64          `json:"profile_id,omitempty,string"` // 用于渲染系统提示词的 Profile ID
}

RuntimeContextInfo 是用于前端展示的轻量上下文描述。

type RuntimeContextResolver added in v0.1.2

type RuntimeContextResolver struct {
	// contains filtered or unexported fields
}

RuntimeContextResolver 把「业务 env(type,id) → 系统提示词 + 工作目录」的解析逻辑 从具体 Handler 中抽离出来,供 LLM 桥接(LLMHandler)与 Agent 会话(AgentHandler) 两套调用链路复用,避免重复实现导致的行为漂移。

func NewRuntimeContextResolver added in v0.1.2

func NewRuntimeContextResolver(
	cfg *config.Config,
	projectSvc interfaces.ProjectService,
	workflowSvc interfaces.WorkflowService,
	analysisSvc interfaces.AnalysisService,
	agentSvc *agent.AgentService,
) *RuntimeContextResolver

NewRuntimeContextResolver 创建运行时上下文解析器。

func (*RuntimeContextResolver) Describe added in v0.1.2

func (r *RuntimeContextResolver) Describe(ctx context.Context, userID string, profileID int64, env map[string]any) (*RuntimeContextInfo, error)

Describe 解析 env 并返回用于前端展示的上下文描述。

与 Resolve 共享同一套解析逻辑:先用 env 解析出 SystemPromptVars,再按当前用户选中的 Profile(profileID)解析其系统提示词模板,用变量渲染出真正的系统提示词。

func (*RuntimeContextResolver) Resolve added in v0.1.2

func (r *RuntimeContextResolver) Resolve(ctx context.Context, userID string, env map[string]any) (*RuntimeContext, error)

Resolve 根据 env 解析出系统提示词模板变量与工作目录。

它不再返回拼装好的系统提示词,而是返回 SystemPromptVars;真正的系统提示词由 AgentService 依据 Profile 模板渲染(见 applyProfile / RenderSystemPrompt)。

env 为 nil 或 type 为空时,回退到当前用户激活项目的默认工作目录。

type SettingHandler

type SettingHandler struct {
	// contains filtered or unexported fields
}

func NewSettingHandler

func NewSettingHandler(cfg *config.Config) *SettingHandler

func (*SettingHandler) GetSetting

func (h *SettingHandler) GetSetting(c *gin.Context)

GetSetting godoc @Summary 获取系统设置 @Description 返回当前系统配置的容器运行时 @Tags 系统设置 @Produce json @Success 200 {object} getSettingResponse @Security Bearer @Router /setting/get-setting [get]

type SheetHandler

type SheetHandler struct {
	// contains filtered or unexported fields
}

func NewSheetHandler

func NewSheetHandler(sheetService interfaces.SheetFileService, dataService interfaces.DataService) *SheetHandler

func (*SheetHandler) ReadWorkbook

func (h *SheetHandler) ReadWorkbook(c *gin.Context)

ReadWorkbook godoc @Summary 读取本地工作簿 @Description 从本地文件读取工作簿并转换为 Univer 可用结构。当前优先支持 xlsx,csv/tsv 将在后续版本支持。 @Tags 表格 @Produce json @Param file_path query string true "本地文件路径(相对路径以 sheets 目录为根)" @Param format query string false "文件格式,可选:xlsx" @Success 200 {object} interfaces.WorkbookReadResult @Failure 400 {object} apperrors.AppError @Failure 401 {object} apperrors.AppError @Failure 404 {object} apperrors.AppError @Failure 500 {object} apperrors.AppError @Security Bearer @Router /sheet/workbook [get]

func (*SheetHandler) ReadWorkbookByFileID

func (h *SheetHandler) ReadWorkbookByFileID(c *gin.Context)

ReadWorkbookByFileID godoc @Summary 根据文件ID读取工作簿 @Description 根据 go_file 主键 ID 查找文件 path,由 path 后缀推断读取格式(前端无需传递 format),再读取工作簿并转换为 Univer 可用结构。结果中附带文件信息;不支持的格式返回“页面不支持预览”。 @Tags 表格 @Produce json @Param id query integer true "文件主键 ID" @Success 200 {object} interfaces.WorkbookReadResult @Failure 400 {object} apperrors.AppError @Failure 401 {object} apperrors.AppError @Failure 404 {object} apperrors.AppError @Failure 500 {object} apperrors.AppError @Security Bearer @Router /sheet/workbook/by-file-id [get]

func (*SheetHandler) WriteWorkbook

func (h *SheetHandler) WriteWorkbook(c *gin.Context)

WriteWorkbook godoc @Summary 保存工作簿到本地 @Description 将 Univer 工作簿结构写入本地文件。当前优先支持 xlsx,csv/tsv 将在后续版本支持。 @Tags 表格 @Accept json @Produce json @Param request body writeWorkbookRequest true "请求参数" @Success 200 {object} interfaces.WorkbookWriteResult @Failure 400 {object} apperrors.AppError @Failure 401 {object} apperrors.AppError @Failure 500 {object} apperrors.AppError @Security Bearer @Router /sheet/workbook/save [post]

func (*SheetHandler) WriteWorkbookByFileID

func (h *SheetHandler) WriteWorkbookByFileID(c *gin.Context)

WriteWorkbookByFileID godoc @Summary 根据文件ID保存工作簿 @Description 根据 go_file 主键 ID 查找文件 path,再将 Univer 工作簿结构写入本地文件。 @Tags 表格 @Accept json @Produce json @Param request body writeWorkbookByFileIDRequest true "请求参数" @Success 200 {object} interfaces.WorkbookWriteResult @Failure 400 {object} apperrors.AppError @Failure 401 {object} apperrors.AppError @Failure 404 {object} apperrors.AppError @Failure 500 {object} apperrors.AppError @Security Bearer @Router /sheet/workbook/save/by-file-id [post]

type StoreHandler

type StoreHandler struct {
	// contains filtered or unexported fields
}

func NewStoreHandler

func NewStoreHandler(storeService interfaces.StoreService, cfg *config.Config) *StoreHandler

func (*StoreHandler) CreateStore

func (h *StoreHandler) CreateStore(c *gin.Context)

func (*StoreHandler) DeleteStore

func (h *StoreHandler) DeleteStore(c *gin.Context)

func (*StoreHandler) DownloadStore

func (h *StoreHandler) DownloadStore(c *gin.Context)

func (*StoreHandler) GetStore

func (h *StoreHandler) GetStore(c *gin.Context)

func (*StoreHandler) GetStoreByStoreID

func (h *StoreHandler) GetStoreByStoreID(c *gin.Context)

func (*StoreHandler) GetStoreImage added in v0.1.4

func (h *StoreHandler) GetStoreImage(c *gin.Context)

GetStoreImage godoc @Summary 获取商店封面图片流 @Description 根据 int64 主键读取商店封面,位置固定为 {base_dir}/store/{path_name}/{store_type}/{img}; @Description 文件不存在或路径非法时返回内置占位图(200 + image/svg+xml)。 @Tags 商店 @Produce image/svg+xml @Param storeId path int64 true "商店主键 ID(int64)" @Success 200 {file} binary "图片流或占位图" @Failure 400 {object} errors.AppError "参数错误" @Failure 401 {object} errors.AppError "未认证" @Failure 404 {object} errors.AppError "商店不存在" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /store/{storeId}/image [get]

func (*StoreHandler) ListStore

func (h *StoreHandler) ListStore(c *gin.Context)

func (*StoreHandler) PageStore

func (h *StoreHandler) PageStore(c *gin.Context)

func (*StoreHandler) PublishStoreRemote added in v0.1.5

func (h *StoreHandler) PublishStoreRemote(c *gin.Context)

PublishStoreRemote 把 store 发布到远程仓库(github / gitee 等,可配置多个)。

做三件事:

  • 校验 store_id / url(url 复用下载侧的 git 地址校验,必须是 <owner>/<repo> 形态);
  • 打开 store 裸仓库,把 url 写成 remote(按主机名命名 github / gitee / gitlab ..., 同名冲突时追加序号),同一个 url 已配置过则跳过添加;
  • 把 store 裸仓库的当前分支推送到该 remote(force 覆盖远端同名分支),并返回仓库当前的 remote 列表与本次推送结果,便于前端刷新展示。

之所以写 git remote 而不是数据库列:地址只有一份真实来源(仓库配置), 数据库副本极易与实际仓库状态漂移;store 表已删除 url 列。

已配置过的 url(added=false)也会继续执行 push —— 「改了组件再发布一次」正是主路径。 推送凭据走 utils.ResolveGitAuth 的零配置约定(https 地址里的用户名密码、ssh-agent、 $GIT_SSH_KEY 指定的私钥或 ~/.ssh 下的默认私钥), 认证失败等底层错误以 500 + details 返回。

func (*StoreHandler) ReDownloadStore

func (h *StoreHandler) ReDownloadStore(c *gin.Context)

func (*StoreHandler) UpdateStore

func (h *StoreHandler) UpdateStore(c *gin.Context)

type UploadHandler

type UploadHandler struct {
	// contains filtered or unexported fields
}

func NewUploadHandler

func NewUploadHandler(cfg *config.Config) *UploadHandler

func (*UploadHandler) UploadImage

func (h *UploadHandler) UploadImage(c *gin.Context)

UploadImage handles image file upload for project report markdown. @Summary 上传项目报告图片 @Description 上传图片并返回可直接用于 Markdown 的图片 URL @Tags 项目 @Accept mpfd @Produce json @Param file formData file true "图片文件" @Success 200 {object} map[string]interface{} "上传成功" @Failure 400 {object} appErrors.AppError "参数错误" @Failure 500 {object} appErrors.AppError "服务器错误" @Security Bearer @Router /project/upload-image [post]

type VisualizationNodeFileResponse

type VisualizationNodeFileResponse struct {
	Node         map[string]interface{}      `json:"node"`
	Result       VisualizationResultResponse `json:"result"`
	Status       string                      `json:"status"`
	ServerStatus string                      `json:"server_status"`
	UrlPrefix    string                      `json:"url_prefix"`
	Summaries    []*types.AISummary          `json:"summaries"`
}

type VisualizationNodeTreeItem

type VisualizationNodeTreeItem struct {
	ScriptID   string                `json:"script_id,string"`
	ScriptName string                `json:"script_name"`
	Children   []*types.AnalysisNode `json:"children"`
}

type VisualizationNodeTreeResponse

type VisualizationNodeTreeResponse struct {
	AnalysisID   string                      `json:"analysis_id"`
	AnalysisName string                      `json:"analysis_name"`
	RelationID   string                      `json:"workflow_id"`
	Result       []VisualizationNodeTreeItem `json:"result"`
}

type VisualizationResultResponse

type VisualizationResultResponse struct {
	Images      []map[string]interface{} `json:"images"`
	Tables      []map[string]interface{} `json:"tables"`
	HTMLs       []map[string]interface{} `json:"htmls"`
	OutputFiles []map[string]interface{} `json:"output_files"`
	CacheFiles  []map[string]interface{} `json:"cache_files"`
}

type WeatherParams

type WeatherParams struct {
	City string `json:"city" jsonschema:"The city name"`
}

Define the parameter type

type WeatherResult

type WeatherResult struct {
	City        string `json:"city"`
	Temperature string `json:"temperature"`
	Condition   string `json:"condition"`
}

Define the return type

type WorkflowFormJSONResponse

type WorkflowFormJSONResponse struct {
	Type     string        `json:"type"`
	FormJSON []interface{} `json:"formJson"`
}

type WorkflowFormResponse

type WorkflowFormResponse struct {
	Type           string                 `json:"type"`
	FormJSON       []interface{}          `json:"formJson"`
	AnalysisResult map[string]interface{} `json:"analysis_result"`
}

type WorkflowHandler

type WorkflowHandler struct {
	// contains filtered or unexported fields
}

func NewWorkflowHandler

func NewWorkflowHandler(workflowService interfaces.WorkflowService,
	containerService interfaces.ContainerService,
	dataService interfaces.DataService,
	projectService interfaces.ProjectService,
	storeService interfaces.StoreService,
	exportCodecs *exportcodec.Registry,
	cfg *config.Config) *WorkflowHandler

func (*WorkflowHandler) DeleteScript

func (h *WorkflowHandler) DeleteScript(c *gin.Context)

DeleteScript godoc @Summary 删除脚本组件 @Description 按 scriptId 删除脚本;如果该脚本下存在 analysis_node 记录,或被某 workflow 的 dag_definition 引用,则拒绝删除 @Tags 工作流 @Produce json @Param scriptId path string true "脚本主键 ID" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 409 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /script/delete/{scriptId} [post]

func (*WorkflowHandler) DeleteWorkflow

func (h *WorkflowHandler) DeleteWorkflow(c *gin.Context)

DeleteWorkflow godoc @Summary 删除工作流 @Description 按 workflowId 删除工作流;如果该 workflow 下存在 analysis 记录则拒绝删除 @Tags 工作流 @Produce json @Param workflowId path string true "工作流 ID" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 409 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /workflow/delete/{workflowId} [post]

func (*WorkflowHandler) FindScript

func (h *WorkflowHandler) FindScript(c *gin.Context)

FindScript godoc @Summary 查询组件 @Description 查询 script:按主键 ID 查询并附带容器模板名称 @Tags 工作流 @Produce json @Param id path string true "Script 主键 ID" @Success 200 {object} map[string]any @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /find-script/{id} [get]

func (*WorkflowHandler) GenerateWorkflowJSON

func (h *WorkflowHandler) GenerateWorkflowJSON(c *gin.Context)

GenerateWorkflowJSON godoc @Summary 生成工作流 JSON @Description 根据 workflowId 读取工作流、脚本与 ContainerTemplateID,导出可落盘的 workflow.json @Tags 工作流 @Produce json @Param workflowId path string true "工作流 ID" @Success 200 {object} handler.WorkflowJSONExportResponse @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /workflow/{workflowId}/generate-workflow-json [post]

func (*WorkflowHandler) GetFromJSONByWorlflow

func (h *WorkflowHandler) GetFromJSONByWorlflow(c *gin.Context)

GetFromJSONByRelationID godoc @Summary 获取工作流表单配置 @Description 根据 workflowId 解析工作流 DAG,聚合输入/参数/formJson 配置 @Tags 工作流 @Produce json @Param workflowId path string true "工作流 ID" @Success 200 {object} handler.WorkflowFormJSONResponse @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /workflow/tools/get-from-json/{workflowId} [get]

func (*WorkflowHandler) GetScriptById

func (h *WorkflowHandler) GetScriptById(c *gin.Context)

GetScriptById godoc @Summary 根据 ID 获取脚本 @Description 根据主键 scriptId 查询脚本详情,附带 StoreVersion @Tags 工作流 @Produce json @Param scriptId path string true "脚本主键 ID" @Success 200 {object} types.ScriptVersion @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /script/{scriptId} [get]

func (*WorkflowHandler) GetScriptContent

func (h *WorkflowHandler) GetScriptContent(c *gin.Context)

GetScriptContent godoc @Summary 获取脚本文件内容 @Description 基于 scriptId 查询脚本主文件,返回绝对路径 path 与文件内容 content(内容从脚本目录磁盘文件读取) @Tags 工作流 @Produce json @Param scriptId path string true "脚本主键 ID" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /script/{scriptId}/content [get]

func (*WorkflowHandler) GetScriptForm

func (h *WorkflowHandler) GetScriptForm(c *gin.Context)

func (*WorkflowHandler) GetScriptImage added in v0.1.4

func (h *WorkflowHandler) GetScriptImage(c *gin.Context)

GetScriptImage godoc @Summary 获取脚本组件封面图片流 @Description 根据 int64 主键读取脚本目录下的封面图片;图片不存在时返回内置占位图(200 + image/svg+xml)。 @Tags 工作流 @Produce image/svg+xml @Param scriptId path int64 true "脚本主键 ID(int64)" @Success 200 {file} binary "图片流或占位图" @Failure 400 {object} errors.AppError "参数错误" @Failure 401 {object} errors.AppError "未认证" @Failure 404 {object} errors.AppError "脚本不存在" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /script/{scriptId}/image [get]

func (*WorkflowHandler) GetScriptReadme added in v0.1.5

func (h *WorkflowHandler) GetScriptReadme(c *gin.Context)

GetScriptReadme godoc @Summary 获取脚本 README @Description 读取脚本目录(GetScriptFileDir)下的 README.md;文件不存在时返回空 content @Tags 工作流 @Produce json @Param scriptId path string true "脚本主键 ID" @Success 200 {object} handler.readmeResponse @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /script/{scriptId}/readme [get]

func (*WorkflowHandler) GetWorkflowById

func (h *WorkflowHandler) GetWorkflowById(c *gin.Context)

func (*WorkflowHandler) GetWorkflowForm

func (h *WorkflowHandler) GetWorkflowForm(c *gin.Context)

GetWorkflowForm godoc @Summary 获取工作流表单与分析数据 @Description 基于 workflowId 返回 formJson,并按 input_type 自动补充 analysis_result(sample 与按 role 分组的文件) @Tags 工作流 @Produce json @Param workflowId path string true "工作流 ID" @Success 200 {object} handler.WorkflowFormResponse @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /workflow/{workflowId}/form [get]

func (*WorkflowHandler) GetWorkflowImage added in v0.1.4

func (h *WorkflowHandler) GetWorkflowImage(c *gin.Context)

GetWorkflowImage godoc @Summary 获取工作流封面图片流 @Description 根据 int64 主键读取 workflow 目录下的封面图片;图片不存在时返回内置占位图(200 + image/svg+xml)。 @Tags 工作流 @Produce image/svg+xml @Param workflowId path int64 true "工作流主键 ID(int64)" @Success 200 {file} binary "图片流或占位图" @Failure 400 {object} errors.AppError "参数错误" @Failure 401 {object} errors.AppError "未认证" @Failure 404 {object} errors.AppError "工作流不存在" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /workflow/{workflowId}/image [get]

func (*WorkflowHandler) GetWorkflowReadme added in v0.1.5

func (h *WorkflowHandler) GetWorkflowReadme(c *gin.Context)

GetWorkflowReadme godoc @Summary 获取工作流 README @Description 读取工作流目录(GetWorkflowFileDir)下的 README.md;文件不存在时返回空 content @Tags 工作流 @Produce json @Param workflowId path string true "工作流主键 ID" @Success 200 {object} handler.readmeResponse @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /workflow/{workflowId}/readme [get]

func (*WorkflowHandler) GetWorkflowVis

func (h *WorkflowHandler) GetWorkflowVis(c *gin.Context)

GetWorkflowVis godoc @Summary 获取工作流可视化 DAG @Description 根据 workflowId 返回 DAG 可视化结构(包含 nodes/edges,并补充 script 视图字段) @Tags 工作流 @Produce json @Param workflowId path string true "工作流 ID" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /tools/get-workflow-vis/{workflowId} [get]

func (*WorkflowHandler) InstallScript

func (h *WorkflowHandler) InstallScript(c *gin.Context)

func (*WorkflowHandler) InstallWorkflow

func (h *WorkflowHandler) InstallWorkflow(c *gin.Context)

func (*WorkflowHandler) PageScript

func (h *WorkflowHandler) PageScript(c *gin.Context)

PageScript godoc @Summary 分页查询脚本组件 @Description 分页查询 script,支持 query 条件过滤与排序;后续扩展字段仅需新增 query 字段并补充仓储过滤逻辑 @Tags 工作流 @Accept json @Produce json @Param request body handler.pageScriptRequest true "分页请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /workflow/page-script [post]

func (*WorkflowHandler) PageWorkflow

func (h *WorkflowHandler) PageWorkflow(c *gin.Context)

PageWorkflow godoc @Summary 分页查询工作流 @Description 分页查询 workflow,支持 query 条件过滤与排序;后续扩展字段仅需新增 query 字段并补充仓储过滤逻辑 @Tags 工作流 @Accept json @Produce json @Param request body handler.pageWorkflowRequest true "分页请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /workflow/page-workflow [post]

func (*WorkflowHandler) PublishScript

func (h *WorkflowHandler) PublishScript(c *gin.Context)

func (*WorkflowHandler) PublishWorkflow

func (h *WorkflowHandler) PublishWorkflow(c *gin.Context)

func (*WorkflowHandler) SaveScript

func (h *WorkflowHandler) SaveScript(c *gin.Context)

SaveScript godoc @Summary 保存脚本组件 @Description 保存 script 组件:当请求包含 id 时更新记录,否则创建新记录;更新时以数据库已有记录为基准,只覆盖请求中有值的字段(未提交的 store_id/url/message 等保持原值);同时把 io_schema、脚本主文件与 script.json 写入脚本目录(script.json 只落盘、不提交 git)。生成导出文件并提交版本由 POST /workflow/save-script-files(SaveScriptFiles)负责 @Tags 工作流 @Accept json @Produce json @Param request body handler.createScriptRequest true "请求参数" @Success 200 {object} types.Script @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /workflow/save-script [post]

func (*WorkflowHandler) SaveScriptContent added in v0.1.5

func (h *WorkflowHandler) SaveScriptContent(c *gin.Context)

SaveScriptContent godoc @Summary 保存脚本文件内容 @Description 按 scriptId 覆盖写入脚本主文件(文件名由 script_type 决定),随后重新生成 script.json 并提交脚本目录改动(与 SaveScript 共用导出 Codec) @Tags 工作流 @Accept json @Produce json @Param scriptId path string true "脚本主键 ID" @Param request body handler.saveScriptContentRequest true "请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /script/{scriptId}/content [post]

func (*WorkflowHandler) SaveScriptFiles added in v0.1.5

func (h *WorkflowHandler) SaveScriptFiles(c *gin.Context)

SaveScriptFiles godoc @Summary 生成脚本导出文件并提交 @Description 按主键重新生成 script.json 落盘到脚本目录,并把脚本目录的本地改动提交为一个 git commit(本地目录不存在则初始化);commit_message 可选,为空时使用默认文案 save script &lt;scriptID&gt; @Tags 工作流 @Accept json @Produce json @Param request body handler.saveScriptFilesRequest true "请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /workflow/save-script-files [post]

func (*WorkflowHandler) SaveScriptReadme added in v0.1.5

func (h *WorkflowHandler) SaveScriptReadme(c *gin.Context)

SaveScriptReadme godoc @Summary 保存脚本 README @Description 覆盖写入脚本目录(GetScriptFileDir)下的 README.md,并提交该目录的 git 改动 @Tags 工作流 @Accept json @Produce json @Param scriptId path string true "脚本主键 ID" @Param request body handler.saveReadmeRequest true "请求参数" @Success 200 {object} handler.readmeResponse @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /script/{scriptId}/readme [post]

func (*WorkflowHandler) SaveWorkflow

func (h *WorkflowHandler) SaveWorkflow(c *gin.Context)

SaveWorkflow godoc @Summary 保存工作流 @Description 保存 workflow 组件:当请求包含 id 时更新记录,否则创建新记录;更新时以数据库已有记录为基准,只覆盖请求中有值的字段(未提交的 store_id/url/message 等保持原值);同时把 workflow.json(含脚本目录快照)写入 workflow 目录(只落盘、不提交 git)。生成导出文件并提交版本由 POST /workflow/save-workflow-files(SaveWorkflowFiles)负责 @Tags 工作流 @Accept json @Produce json @Param request body handler.createWorkflowRequest true "请求参数" @Success 200 {object} types.Workflow @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /workflow/save-workflow [post]

func (*WorkflowHandler) SaveWorkflowDag added in v0.1.4

func (h *WorkflowHandler) SaveWorkflowDag(c *gin.Context)

SaveWorkflowDag godoc @Summary 保存工作流 DAG 定义 @Description 按 id 仅更新 workflow 的 dag_definition 字段;workflow_id 为 workflow 表 int64 主键,name/tags/store_id 等其他字段保持不变 @Tags 工作流 @Accept json @Produce json @Param request body handler.saveWorkflowDagRequest true "请求参数" @Success 200 {object} map[string]string @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /workflow/save-workflow-dag [post]

func (*WorkflowHandler) SaveWorkflowFiles added in v0.1.5

func (h *WorkflowHandler) SaveWorkflowFiles(c *gin.Context)

SaveWorkflowFiles godoc @Summary 生成工作流导出文件并提交 @Description 按主键重新生成 workflow.json(含引用的脚本目录快照)落盘到 workflow 目录,并把该目录的本地改动提交为一个 git commit(本地目录不存在则初始化);commit_message 可选,为空时使用默认文案 save workflow &lt;workflowID&gt; @Tags 工作流 @Accept json @Produce json @Param request body handler.saveWorkflowFilesRequest true "请求参数" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /workflow/save-workflow-files [post]

func (*WorkflowHandler) SaveWorkflowReadme added in v0.1.5

func (h *WorkflowHandler) SaveWorkflowReadme(c *gin.Context)

SaveWorkflowReadme godoc @Summary 保存工作流 README @Description 覆盖写入工作流目录(GetWorkflowFileDir)下的 README.md,并提交该目录的 git 改动 @Tags 工作流 @Accept json @Produce json @Param workflowId path string true "工作流主键 ID" @Param request body handler.saveReadmeRequest true "请求参数" @Success 200 {object} handler.readmeResponse @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /workflow/{workflowId}/readme [post]

func (*WorkflowHandler) ScriptToNode added in v0.1.4

func (h *WorkflowHandler) ScriptToNode(c *gin.Context)

ScriptToNode godoc @Summary 获取添加到节点的 script 数据 @Description 参考 python 版 /tools/script-to-node/{component_id}/{relation_id}:根据 scriptId 与 workflowId 生成带唯一 node_id 的 script 节点,供前端画布 addNode 使用 @Tags 工作流 @Produce json @Param scriptId query int64 true "Script 主键 ID" @Param workflowId query int64 true "工作流主键 ID" @Success 200 {object} map[string]interface{} @Failure 400 {object} errors.AppError @Failure 401 {object} errors.AppError @Failure 404 {object} errors.AppError @Failure 500 {object} errors.AppError @Security Bearer @Router /workflow/script-to-node [get]

func (*WorkflowHandler) UploadScriptImage added in v0.1.4

func (h *WorkflowHandler) UploadScriptImage(c *gin.Context)

UploadScriptImage godoc @Summary 上传脚本组件封面 @Description multipart/form-data 上传(字段名 file)。保存到脚本目录下的 image.<原图后缀>, @Description 并把纯文件名写入 pipeline_components.img。scriptId 为 int64 主键。 @Tags 工作流 @Accept mpfd @Produce json @Param scriptId path int64 true "脚本主键 ID(int64)" @Param file formData file true "图片文件" @Success 200 {object} map[string]interface{} "上传成功,返回 url/img/name" @Failure 400 {object} errors.AppError "参数错误" @Failure 401 {object} errors.AppError "未认证" @Failure 404 {object} errors.AppError "脚本或项目不存在" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /script/{scriptId}/image [post]

func (*WorkflowHandler) UploadWorkflowImage added in v0.1.4

func (h *WorkflowHandler) UploadWorkflowImage(c *gin.Context)

UploadWorkflowImage godoc @Summary 上传工作流封面 @Description multipart/form-data 上传(字段名 file)。保存到 workflow 目录下的 image.<原图后缀>, @Description 并把纯文件名写入 pipeline_components_relation.img。workflowId 为 int64 主键。 @Tags 工作流 @Accept mpfd @Produce json @Param workflowId path int64 true "工作流主键 ID(int64)" @Param file formData file true "图片文件" @Success 200 {object} map[string]interface{} "上传成功,返回 url/img/name" @Failure 400 {object} errors.AppError "参数错误" @Failure 401 {object} errors.AppError "未认证" @Failure 404 {object} errors.AppError "工作流或项目不存在" @Failure 500 {object} errors.AppError "服务器错误" @Security Bearer @Router /workflow/{workflowId}/image [post]

type WorkflowJSONExportResponse

type WorkflowJSONExportResponse struct {
	Path       string           `json:"path"`
	WorkflowID string           `json:"workflow_id"`
	Workflow   map[string]any   `json:"workflow"`
	Scripts    []map[string]any `json:"scripts"`
	// ContainerTemplateSpecs / ContainerTemplateDefinitions / ContainerImages 都是按主键去重后的
	// 导出列表:绑定行通过 spec_id 引用运行配置、通过 image_id 引用镜像。
	ContainerTemplateSpecs       []map[string]any `json:"container_template_specs"`
	ContainerTemplateDefinitions []map[string]any `json:"container_template_definitions"`
	ContainerImages              []map[string]any `json:"container_images"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL