deepwiki

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultRepo is the default repository for SeaTunnel documentation.
	// DefaultRepo 是 SeaTunnel 文档的默认仓库。
	DefaultRepo = "apache/seatunnel"

	// DeepWikiBaseURL is the base URL for DeepWiki.
	// DeepWikiBaseURL 是 DeepWiki 的基础 URL。
	DeepWikiBaseURL = "https://deepwiki.com"

	// MCPServerURL is the URL for the DeepWiki MCP server (if running locally).
	// MCPServerURL 是 DeepWiki MCP 服务器的 URL(如果本地运行)。
	MCPServerURL = "http://localhost:3000/mcp"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DeepWikiError

type DeepWikiError struct {
	URL    string `json:"url"`
	Reason string `json:"reason"`
}

DeepWikiError represents an error for a specific page. DeepWikiError 表示特定页面的错误。

type DeepWikiPage

type DeepWikiPage struct {
	Path     string `json:"path"`
	Markdown string `json:"markdown"`
}

DeepWikiPage represents a single page in pages mode. DeepWikiPage 表示 pages 模式下的单个页面。

type DeepWikiRequest

type DeepWikiRequest struct {
	// URL is the repository URL or path (e.g., "apache/seatunnel")
	// URL 是仓库地址或路径(如 "apache/seatunnel")
	URL string `json:"url" binding:"required"`

	// Mode is the output mode: "aggregate" (single document) or "pages" (structured)
	// Mode 是输出模式:"aggregate"(单文档)或 "pages"(结构化)
	Mode string `json:"mode,omitempty"`

	// MaxDepth is the maximum depth of pages to crawl (default: 1)
	// MaxDepth 是爬取页面的最大深度(默认:1)
	MaxDepth int `json:"max_depth,omitempty"`

	// Query is an optional search query to filter results
	// Query 是可选的搜索查询,用于过滤结果
	Query string `json:"query,omitempty"`
}

DeepWikiRequest represents a request to fetch DeepWiki documentation. DeepWikiRequest 表示获取 DeepWiki 文档的请求。

type DeepWikiResponse

type DeepWikiResponse struct {
	// Status is the response status: "ok", "partial", or "error"
	// Status 是响应状态:"ok"、"partial" 或 "error"
	Status string `json:"status"`

	// Data contains the markdown content (aggregate mode) or page array (pages mode)
	// Data 包含 markdown 内容(aggregate 模式)或页面数组(pages 模式)
	Data interface{} `json:"data,omitempty"`

	// TotalPages is the number of pages fetched
	// TotalPages 是获取的页面数量
	TotalPages int `json:"total_pages,omitempty"`

	// TotalBytes is the total size of fetched content
	// TotalBytes 是获取内容的总大小
	TotalBytes int `json:"total_bytes,omitempty"`

	// ElapsedMs is the time taken in milliseconds
	// ElapsedMs 是耗时(毫秒)
	ElapsedMs int `json:"elapsed_ms,omitempty"`

	// Errors contains any errors encountered during fetching
	// Errors 包含获取过程中遇到的错误
	Errors []DeepWikiError `json:"errors,omitempty"`

	// Code is the error code (only present on error)
	// Code 是错误代码(仅在错误时存在)
	Code string `json:"code,omitempty"`

	// Message is the error message (only present on error)
	// Message 是错误消息(仅在错误时存在)
	Message string `json:"message,omitempty"`
}

DeepWikiResponse represents the response from DeepWiki. DeepWikiResponse 表示 DeepWiki 的响应。

type Handler

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

Handler handles DeepWiki HTTP requests. Handler 处理 DeepWiki HTTP 请求。

func NewHandler

func NewHandler(service *Service) *Handler

NewHandler creates a new DeepWiki handler. NewHandler 创建新的 DeepWiki 处理器。

func (*Handler) FetchDocs

func (h *Handler) FetchDocs(c *gin.Context)

FetchDocs godoc @Summary Fetch documentation from DeepWiki @Description Fetch documentation from DeepWiki for a specific repository @Tags DeepWiki @Accept json @Produce json @Param request body DeepWikiRequest true "Fetch request" @Success 200 {object} Response{data=DeepWikiResponse} @Failure 400 {object} Response @Failure 500 {object} Response @Router /api/v1/deepwiki/fetch [post]

func (*Handler) GetDocs

func (h *Handler) GetDocs(c *gin.Context)

GetDocs godoc @Summary Get SeaTunnel documentation from DeepWiki @Description Fetch SeaTunnel documentation from DeepWiki @Tags DeepWiki @Accept json @Produce json @Success 200 {object} Response{data=DeepWikiResponse} @Failure 500 {object} Response @Router /api/v1/deepwiki/docs [get]

func (*Handler) Search

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

Search godoc @Summary Search SeaTunnel documentation @Description Search SeaTunnel documentation in DeepWiki @Tags DeepWiki @Accept json @Produce json @Param request body SearchRequest true "Search request" @Success 200 {object} Response{data=SearchResponse} @Failure 400 {object} Response @Failure 500 {object} Response @Router /api/v1/deepwiki/search [post]

type MCPRequest

type MCPRequest struct {
	ID     string            `json:"id"`
	Action string            `json:"action"`
	Params map[string]string `json:"params"`
}

MCPRequest represents a request to the MCP server. MCPRequest 表示发送到 MCP 服务器的请求。

type Response

type Response struct {
	Data     interface{} `json:"data,omitempty"`
	ErrorMsg string      `json:"error,omitempty"`
}

Response is the standard API response. Response 是标准 API 响应。

type SearchRequest

type SearchRequest struct {
	// Query is the search query
	// Query 是搜索查询
	Query string `json:"query" binding:"required"`

	// Repo is the repository to search (default: "apache/seatunnel")
	// Repo 是要搜索的仓库(默认:"apache/seatunnel")
	Repo string `json:"repo,omitempty"`
}

SearchRequest represents a search request for DeepWiki. SearchRequest 表示 DeepWiki 的搜索请求。

type SearchResponse

type SearchResponse struct {
	// Query is the original search query
	// Query 是原始搜索查询
	Query string `json:"query"`

	// Results contains the search results
	// Results 包含搜索结果
	Results string `json:"results"`

	// Source indicates the data source
	// Source 表示数据来源
	Source string `json:"source"`
}

SearchResponse represents the search response. SearchResponse 表示搜索响应。

type Service

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

Service provides DeepWiki documentation services. Service 提供 DeepWiki 文档服务。

func NewService

func NewService(config ServiceConfig) *Service

NewService creates a new DeepWiki service. NewService 创建新的 DeepWiki 服务。

func (*Service) FetchDocs

func (s *Service) FetchDocs(ctx context.Context, req *DeepWikiRequest) (*DeepWikiResponse, error)

FetchDocs fetches documentation from DeepWiki. FetchDocs 从 DeepWiki 获取文档。

func (*Service) GetSeaTunnelDocs

func (s *Service) GetSeaTunnelDocs(ctx context.Context) (*DeepWikiResponse, error)

GetSeaTunnelDocs fetches SeaTunnel documentation. GetSeaTunnelDocs 获取 SeaTunnel 文档。

func (*Service) Search

func (s *Service) Search(ctx context.Context, req *SearchRequest) (*SearchResponse, error)

Search searches for documentation in DeepWiki. Search 在 DeepWiki 中搜索文档。

type ServiceConfig

type ServiceConfig struct {
	// MCPServerURL is the URL of the MCP server (optional)
	// MCPServerURL 是 MCP 服务器的 URL(可选)
	MCPServerURL string

	// UseMCP indicates whether to use MCP server or direct HTTP
	// UseMCP 表示是否使用 MCP 服务器或直接 HTTP
	UseMCP bool

	// Timeout is the HTTP client timeout
	// Timeout 是 HTTP 客户端超时时间
	Timeout time.Duration
}

ServiceConfig contains configuration for the DeepWiki service. ServiceConfig 包含 DeepWiki 服务的配置。

Jump to

Keyboard shortcuts

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