dto

package
v0.0.0-...-855ab51 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

* @Date: 2025-06-18 23:52:27 * @LastEditors: peng pgs1108pgs@gmail.com * @LastEditTime: 2025-07-03 23:16:08 * @FilePath: /thinking-map/server/internal/model/dto/auth.go

* @Date: 2025-06-18 23:59:38 * @LastEditors: peng pgs1108pgs@gmail.com * @LastEditTime: 2025-06-26 00:03:55 * @FilePath: /thinking-map/server/internal/model/dto/map.go

* @Date: 2025-06-19 00:02:51 * @LastEditors: peng pgs1108pgs@gmail.com * @LastEditTime: 2025-06-22 21:39:39 * @FilePath: /thinking-map/server/internal/model/dto/node.go

* @Date: 2025-06-18 22:28:50 * @LastEditors: peng pgs1108pgs@gmail.com * @LastEditTime: 2025-07-04 00:08:35 * @FilePath: /thinking-map/server/internal/model/dto/response.go

* @Date: 2025-06-19 00:09:56 * @LastEditors: peng pgs1108pgs@gmail.com * @LastEditTime: 2025-06-22 21:37:47 * @FilePath: /thinking-map/server/internal/model/dto/sse.go

Index

Constants

View Source
const (
	ConversationTypeDecomposition = "decomposition"
	ConversationTypeConclusion    = "conclusion"
)
View Source
const (
	ConnectionEstablishedEventType   = "connectionEstablished"
	NodeCreatedEventType             = "nodeCreated"
	NodeUpdatedEventType             = "nodeUpdated"
	NodeDeletedEventType             = "nodeDeleted"
	NodeDependenciesUpdatedEventType = "nodeDependenciesUpdated"
	ThinkingProgressEventType        = "thinkingProgress"
	MessageTextEventType             = "messageText"
	MessageConclusionEventType       = "messageConclusion"
	MessageThoughtEventType          = "messageThought"
	MessageNoticeEventType           = "messageNotice"
	MessageActionEventType           = "messageAction"
	MessagePlanEventType             = "messagePlan"
	MessageRagEventType              = "messageRag"
	ErrorEventType                   = "error"
	CustomEventType                  = "custom"
	ConclusionCompletedEventType     = "conclusionCompleted"
	DecompositionCompletedEventType  = "decompositionCompleted"
)

事件类型

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionChoice

type ActionChoice struct {
	Introduction string   `json:"introduction"`
	Actions      []string `json:"actions"`
}

用户选择消息

type ActionMsgResp

type ActionMsgResp []model.Action

type AnalyzeRequest

type AnalyzeRequest struct {
	NodeID  string          `json:"nodeID" binding:"required,uuid"`
	Context string          `json:"context" binding:"required,max=2000"`
	Options ThinkingOptions `json:"options" binding:"required"`
}

AnalyzeRequest represents the request body for starting problem analysis

type AuthData

type AuthData struct {
	UserID       string `json:"userID,omitempty"`
	Username     string `json:"username,omitempty"`
	Email        string `json:"email,omitempty"`
	FullName     string `json:"fullName,omitempty"`
	AccessToken  string `json:"accessToken,omitempty"`
	RefreshToken string `json:"refreshToken,omitempty"`
	ExpiresIn    int    `json:"expiresIn,omitempty"`
}

AuthData represents the data field in auth responses

type ConcludeRequest

type ConcludeRequest struct {
	NodeID        string   `json:"nodeID" binding:"required,uuid"`
	Evidence      []string `json:"evidence" binding:"required,min=1"`
	ReasoningType string   `json:"reasoningType" binding:"required,oneof=deductive inductive abductive"`
}

ConcludeRequest represents the request body for generating conclusions

type ConclusionCompletedEvent

type ConclusionCompletedEvent struct {
	NodeID string `json:"nodeID"`
	Mode   string `json:"mode"`   // generate | optimize
	Status string `json:"status"` // completed
}

type ConclusionRequest

type ConclusionRequest struct {
	NodeID      string `json:"nodeID" binding:"required,uuid"`
	Reference   string `json:"reference"`
	Instruction string `json:"instruction"`
}

type ConnectionEstablishedEvent

type ConnectionEstablishedEvent struct {
	SessionID string `json:"sessionID"`
	ClientID  string `json:"clientID"`
	Message   string `json:"message"`
}

type ConversationRequest

type ConversationRequest struct {
	NodeID  string `json:"nodeID" binding:"required,uuid"`
	Message string `json:"message" binding:"required,max=1000"`
	Context string `json:"context" binding:"required,oneof=decompose conclude"`
}

ConversationRequest represents the request body for conversation interaction

type ConversationResponse

type ConversationResponse struct {
	MessageID string    `json:"messageID"`
	Content   string    `json:"content"`
	Role      string    `json:"role"`
	CreatedAt time.Time `json:"createdAt"`
}

ConversationResponse represents the response for conversation messages

type CreateMapRequest

type CreateMapRequest struct {
	Title       string            `json:"title" binding:"required,max=256"`
	Problem     string            `json:"problem" binding:"required,max=1000"`
	ProblemType string            `json:"problemType" binding:"max=50"`
	Target      string            `json:"target" binding:"max=1000"`
	KeyPoints   model.KeyPoints   `json:"keyPoints"`
	Constraints model.Constraints `json:"constraints"`
}

CreateMapRequest represents the request body for creating a mind map

type CreateMessageRequest

type CreateMessageRequest struct {
	ID          string               `json:"ID"`
	ParentID    string               `json:"parentID" binding:"omitempty,uuid"`
	UserID      string               `json:"userID" binding:"omitempty,uuid"`
	MessageType model.MsgType        `json:"messageType" binding:"required,oneof=text rag notice action"`
	Role        schema.RoleType      `json:"role" binding:"required,oneof=system assistant user"`
	Content     model.MessageContent `json:"content" binding:"required"`
	Metadata    interface{}          `json:"metadata"`
}

CreateMessageRequest represents the request body for creating a message

type CreateNodeRequest

type CreateNodeRequest struct {
	MapID    string         `json:"MapID" binding:"required,uuid"`
	ParentID string         `json:"parentID" binding:"required,uuid"`
	NodeType string         `json:"nodeType" binding:"required"`
	Question string         `json:"question" binding:"required,max=500"`
	Target   string         `json:"target" binding:"max=500"`
	Position model.Position `json:"position" binding:"required"`
}

CreateNodeRequest represents the request body for creating a node

type DecomposeRequest

type DecomposeRequest struct {
	NodeID            string `json:"nodeID" binding:"required,uuid"`
	DecomposeStrategy string `json:"decomposeStrategy" binding:"required,oneof=breadth_first depth_first"`
	MaxDepth          int    `json:"maxDepth" binding:"required,min=1,max=5"`
}

DecomposeRequest represents the request body for starting problem decomposition

type DecompositionCompletedEvent

type DecompositionCompletedEvent struct {
	NodeID string `json:"nodeID"`
	Mode   string `json:"mode"`   // analyze | decompose
	Status string `json:"status"` // completed
}

type DecompositionRequest

type DecompositionRequest struct {
	NodeID        string `json:"nodeID" binding:"required,uuid"`
	IsDecomposed  bool   `json:"isDecomposed"`
	Clarification string `json:"clarification"`
}

DecompositionRequest represents the request for intent recognition

type DecompositionResponse

type DecompositionResponse struct {
	IntentType   string   `json:"intentType"`   // decompose, conclude, explore, clarify
	Confidence   float64  `json:"confidence"`   // 0-1之间的置信度
	Reasoning    string   `json:"reasoning"`    // 识别理由
	Suggestion   string   `json:"suggestion"`   // 处理建议
	NextAction   string   `json:"nextAction"`   // 下一步行动
	RequiredInfo []string `json:"requiredInfo"` // 需要的额外信息
}

DecompositionResponse represents the response from intent recognition

type ErrorData

type ErrorData struct {
	Field string `json:"field,omitempty"`
	Error string `json:"error,omitempty"`
}

ErrorData represents the error details in error responses

type ErrorEvent

type ErrorEvent struct {
	NodeID       string `json:"nodeID"`
	ErrorCode    string `json:"errorCode"`
	ErrorMessage string `json:"errorMessage"`
}

ErrorEvent represents the error event

type ExecutableNodesResponse

type ExecutableNodesResponse struct {
	NodeIDs         []string `json:"nodeIDs"`
	SuggestedNodeID string   `json:"suggestedNodeID,omitempty"`
}

ExecutableNodesResponse represents the response for executable nodes

type LoginRequest

type LoginRequest struct {
	Email    string `json:"email" binding:"required,email"`
	Password string `json:"password" binding:"required"`
}

LoginRequest represents the request body for user login

type MapListQuery

type MapListQuery struct {
	Page        int    `form:"page" binding:"required,min=1"`
	Limit       int    `form:"limit" binding:"required,min=1,max=100"`
	Status      string `form:"status"`
	ProblemType string `form:"problemType"`
	DateRange   string `form:"dateRange"` // this-week, last-week, this-month, all-time
	Search      string `form:"search"`
}

MapListQuery represents the query parameters for listing mind maps

type MapListResponse

type MapListResponse struct {
	Total int           `json:"total"`
	Page  int           `json:"page"`
	Limit int           `json:"limit"`
	Items []MapResponse `json:"items"`
}

MapListResponse represents the paginated list of mind maps

type MapResponse

type MapResponse struct {
	ID          string            `json:"id"`
	Status      string            `json:"status"`
	Title       string            `json:"title"`
	Problem     string            `json:"problem"`
	ProblemType string            `json:"problemType"`
	Target      string            `json:"target"`
	KeyPoints   model.KeyPoints   `json:"keyPoints"`
	Constraints model.Constraints `json:"constraints"`
	Conclusion  string            `json:"conclusion"`
	Progress    float64           `json:"progress"`
	Metadata    model.JSONB       `json:"metadata"`
	CreatedAt   time.Time         `json:"createdAt"`
	UpdatedAt   time.Time         `json:"updatedAt"`
}

MapResponse represents the mind map data in responses

func ToMapResponse

func ToMapResponse(m *model.ThinkingMap) MapResponse

ToMapResponse converts a model.ThinkingMap to a MapResponse

type MessageActionEvent

type MessageActionEvent struct {
	NodeID    string         `json:"nodeID"`
	MessageID string         `json:"messageID"`
	Actions   []model.Action `json:"actions"`
}

type MessageContent

type MessageContent struct {
	Text      string           `json:"text,omitempty"`
	Thought   string           `json:"thought,omitempty"`
	RagRecord *model.RAGRecord `json:"rag,omitempty"`
	Notice    *model.Notice    `json:"notice,omitempty"`
	Action    []model.Action   `json:"action,omitempty"`
	Plan      *model.Plan      `json:"plan,omitempty"`
}

func (MessageContent) String

func (m MessageContent) String() string

String()

type MessageListResponse

type MessageListResponse struct {
	Total int               `json:"total"`
	Page  int               `json:"page"`
	Limit int               `json:"limit"`
	Items []MessageResponse `json:"items"`
}

MessageListResponse represents the paginated list of messages

type MessageNoticeEvent

type MessageNoticeEvent struct {
	NodeID    string       `json:"nodeID"`
	MessageID string       `json:"messageID"`
	Notice    model.Notice `json:"notice"`
}

type MessagePlanEvent

type MessagePlanEvent struct {
	NodeID    string              `json:"nodeID"`
	MessageID string              `json:"messageID"`
	Plan      multiagent.TaskPlan `json:"plan"`
	IsEnd     bool                `json:"isEnd"`
}

type MessageRagEvent

type MessageRagEvent struct {
	NodeID    string          `json:"nodeID"`
	MessageID string          `json:"messageID"`
	RagRecord model.RAGRecord `json:"ragRecord"`
}

type MessageResponse

type MessageResponse struct {
	ID             string          `json:"id"`
	ParentID       string          `json:"parentID"`
	ConversationID string          `json:"conversationID"`
	MessageType    model.MsgType   `json:"messageType"`
	Role           schema.RoleType `json:"role"`
	Content        MessageContent  `json:"content"`
	Metadata       interface{}     `json:"metadata"`
	CreatedAt      time.Time       `json:"createdAt"`
	UpdatedAt      time.Time       `json:"updatedAt"`
}

MessageResponse represents the message data in responses

func ToMessageResponse

func ToMessageResponse(m *model.Message, rag *model.RAGRecord) MessageResponse

ToMessageResponse 将 model.Message 转为 dto.MessageResponse

type MessageStatus

type MessageStatus struct {
	ID        string     `json:"id"`
	Status    string     `json:"status"` // active, deleted, archived
	CreatedAt time.Time  `json:"createdAt"`
	UpdatedAt time.Time  `json:"updatedAt"`
	DeletedAt *time.Time `json:"deletedAt,omitempty"`
}

MessageStatus 消息状态

type MessageTextEvent

type MessageTextEvent struct {
	NodeID    string `json:"nodeID"`
	MessageID string `json:"messageID"`
	Message   string `json:"message"`
	Mode      string `json:"mode"`
}

MsgTextEvent represents the text event

type MessageThoughtEvent

type MessageThoughtEvent struct {
	NodeID    string `json:"nodeID"`
	MessageID string `json:"messageID"`
	Message   string `json:"message"`
	Mode      string `json:"mode"`
}

MsgThoughtEvent represents the thought event

type NodeCreatedEvent

type NodeCreatedEvent struct {
	NodeID   string         `json:"nodeID"`
	ParentID string         `json:"parentID"`
	NodeType string         `json:"nodeType"`
	Question string         `json:"question"`
	Target   string         `json:"target"`
	Position model.Position `json:"position"`
}

NodeCreatedEvent represents the node creation event

type NodeDeletedEvent

type NodeDeletedEvent struct {
	NodeID   string `json:"nodeID"`
	Question string `json:"question"`
}

NodeDeletedEvent represents the node deletion event

type NodeDependenciesUpdatedEvent

type NodeDependenciesUpdatedEvent struct {
	NodeID string `json:"nodeID"`
	// Op           string   `json:"op"`           // add or remove
	Dependencies []string `json:"dependencies"` // 依赖节点ID列表
}

NodeDependenciesUpdatedEvent represents the node dependencies update event

type NodeListResponse

type NodeListResponse struct {
	Nodes []NodeResponse `json:"nodes"`
}

NodeListResponse represents the list of nodes in a map

type NodeResponse

type NodeResponse struct {
	ID            string                 `json:"id"`
	NodeID        string                 `json:"nodeID"`
	MapID         string                 `json:"mapID,omitempty"`
	ParentID      string                 `json:"parentID"`
	NodeType      string                 `json:"nodeType"`
	Question      string                 `json:"question"`
	Target        string                 `json:"target"`
	Context       model.DependentContext `json:"context"`
	Decomposition model.Decomposition    `json:"decomposition"`
	Conclusion    model.Conclusion       `json:"conclusion"`
	Status        string                 `json:"status"`
	Position      model.Position         `json:"position"`
	Metadata      interface{}            `json:"metadata"`
	Dependencies  model.Dependencies     `json:"dependencies"`
	CreatedAt     time.Time              `json:"createdAt"`
	UpdatedAt     time.Time              `json:"updatedAt"`
}

NodeResponse represents the node data in responses

func ToNodeResponse

func ToNodeResponse(n *model.ThinkingNode) NodeResponse

modelToNodeResponse 将model.ThinkingNode转为dto.NodeResponse

type NodeUpdatedEvent

type NodeUpdatedEvent struct {
	NodeID  string                 `json:"nodeID"`
	Mode    string                 `json:"mode"` // 更新模式:repeace/append
	Updates map[string]interface{} `json:"updates"`
}

NodeUpdatedEvent represents the node update event

type PaginationResponse

type PaginationResponse struct {
	Total    int64       `json:"total"`
	Page     int         `json:"page"`
	PageSize int         `json:"pageSize"`
	Data     interface{} `json:"data"`
}

分页响应

type RegisterRequest

type RegisterRequest struct {
	Username string `json:"username" binding:"min=3,max=32"`
	Email    string `json:"email" binding:"required,email"`
	Password string `json:"password" binding:"required,min=6,max=64"`
	FullName string `json:"fullName" binding:"required,max=100"`
}

RegisterRequest represents the request body for user registration

type ResetConclusionRequest

type ResetConclusionRequest struct {
	NodeID string `json:"nodeID" binding:"required,uuid"`
}

type Response

type Response struct {
	Code      int         `json:"code"`
	Message   string      `json:"message"`
	Data      interface{} `json:"data,omitempty"`
	Timestamp time.Time   `json:"timestamp"`
	RequestID string      `json:"requestID"`
}

通用响应

type SaveConclusionRequest

type SaveConclusionRequest struct {
	Content string `json:"content"`
}

type TaskResponse

type TaskResponse struct {
	TaskID        string `json:"taskID"`
	NodeID        string `json:"nodeID"`
	Status        string `json:"status"`
	EstimatedTime int    `json:"estimatedTime"`
}

TaskResponse represents the response for async tasks

type TestEventRequest

type TestEventRequest struct {
	EventType string                 `json:"eventType" binding:"required,oneof=nodeCreated nodeUpdated thinkingProgress error custom"`
	Data      map[string]interface{} `json:"data" binding:"required"`
	Delay     int                    `json:"delay" binding:"min=0,max=10000"` // 延迟发送时间(毫秒)
}

TestEventRequest represents the request for testing SSE events

type TestEventResponse

type TestEventResponse struct {
	EventID   string    `json:"eventID"`
	EventType string    `json:"eventType"`
	SentAt    time.Time `json:"sentAt"`
	Message   string    `json:"message"`
}

TestEventResponse represents the response for testing SSE events

type ThinkingOptions

type ThinkingOptions struct {
	Model       string  `json:"model" binding:"required,oneof=gpt-4 gpt-3.5-turbo"`
	Temperature float64 `json:"temperature" binding:"required,min=0,max=1"`
}

ThinkingOptions represents the options for AI thinking process

type ThinkingProgressEvent

type ThinkingProgressEvent struct {
	NodeID   string `json:"nodeID"`
	Stage    string `json:"stage"`
	Progress int    `json:"progress"`
	Message  string `json:"message"`
}

ThinkingProgressEvent represents the thinking progress event

type TokenInfoDTO

type TokenInfoDTO struct {
	UserID      string    `json:"userID"`
	Username    string    `json:"username"`
	AccessToken string    `json:"accessToken"`
	ExpiresAt   time.Time `json:"expiresAt"`
}

TokenInfoDTO 用于返回 token 信息 与 model.TokenInfo 字段保持一致

type UnderstandingRequest

type UnderstandingRequest struct {
	ParentMsgID   string `json:"parentMsgID"`
	Problem       string `json:"problem"`
	ProblemType   string `json:"problemType"`
	Supplementary string `json:"supplementary"`
}

type UnderstandingResponse

type UnderstandingResponse struct {
	Title       string   `json:"title"`
	Problem     string   `json:"problem"`
	ProblemType string   `json:"problemType"`
	Goal        string   `json:"goal"`
	KeyPoints   []string `json:"keyPoints"`
	Constraints []string `json:"constraints"`
	Suggestion  string   `json:"suggestion"`
}

type UpdateMapRequest

type UpdateMapRequest struct {
	Status      int               `json:"status" binding:"oneof=0 1 2"`
	Title       string            `json:"title" binding:"max=256"`
	Problem     string            `json:"problem" binding:"max=1000"`
	ProblemType string            `json:"problemType" binding:"max=50"`
	Target      string            `json:"target" binding:"max=1000"`
	KeyPoints   model.KeyPoints   `json:"keyPoints"`
	Constraints model.Constraints `json:"constraints"`
	Conclusion  string            `json:"conclusion" binding:"max=1000"`
}

UpdateMapRequest represents the request body for updating a mind map

type UpdateMessageRequest

type UpdateMessageRequest struct {
	ID          string               `json:"id" binding:"required,uuid"`
	MessageType model.MsgType        `json:"messageType" binding:"omitempty,oneof=text rag notice action"`
	Content     model.MessageContent `json:"content" binding:"omitempty"`
	Metadata    interface{}          `json:"metadata"`
}

UpdateMessageRequest represents the request body for updating a message

type UpdateNodeContextRequest

type UpdateNodeContextRequest struct {
	Context model.DependentContext `json:"context"`
}

type UpdateNodeRequest

type UpdateNodeRequest struct {
	Question string         `json:"question" binding:"max=500"`
	Target   string         `json:"target" binding:"max=500"`
	Position model.Position `json:"position"`
}

UpdateNodeRequest represents the request body for updating a node

Jump to

Keyboard shortcuts

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