v1

package
v0.0.0-...-0f488bb Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatReq

type ChatReq struct {
	g.Meta        `path:"/v1/chat" method:"post" tags:"rag"`
	ConvID        string  `json:"conv_id" v:"required"` // 会话id
	Question      string  `json:"question" v:"required"`
	KnowledgeName string  `json:"knowledge_name" v:"required"`
	TopK          int     `json:"top_k"` // 默认为5
	Score         float64 `json:"score"` // 默认为0.2
}

type ChatRes

type ChatRes struct {
	g.Meta     `mime:"application/json"`
	Answer     string             `json:"answer"`
	References []*schema.Document `json:"references"`
}

type ChatStreamReq

type ChatStreamReq struct {
	g.Meta        `path:"/v1/chat/stream" method:"post" tags:"rag"`
	ConvID        string  `json:"conv_id" v:"required"` // 会话id
	Question      string  `json:"question" v:"required"`
	KnowledgeName string  `json:"knowledge_name" v:"required"`
	TopK          int     `json:"top_k"` // 默认为5
	Score         float64 `json:"score"` // 默认为0.2
}

ChatStreamReq 流式输出请求

type ChatStreamRes

type ChatStreamRes struct {
	g.Meta `mime:"text/event-stream"`
}

ChatStreamRes 流式输出响应

type ChunkDeleteReq

type ChunkDeleteReq struct {
	g.Meta `path:"/v1/chunks" method:"delete" tags:"rag"`
	Id     int64 `p:"id" dc:"id" v:"required"`
}

type ChunkDeleteRes

type ChunkDeleteRes struct {
	g.Meta `mime:"application/json"`
}

type ChunksListReq

type ChunksListReq struct {
	g.Meta         `path:"/v1/chunks" method:"get" tags:"rag"`
	KnowledgeDocId int64 `p:"knowledge_doc_id" dc:"knowledge_doc_id" v:"required"`
	Page           int   `p:"page" dc:"page" v:"required|min:1" d:"1"`
	Size           int   `p:"size" dc:"size" v:"required|min:1|max:100" d:"10"`
}

type ChunksListRes

type ChunksListRes struct {
	g.Meta `mime:"application/json"`
	Data   []entity.KnowledgeChunks `json:"data"`
	Total  int                      `json:"total"`
	Page   int                      `json:"page"`
	Size   int                      `json:"size"`
}

type DocumentsDeleteReq

type DocumentsDeleteReq struct {
	g.Meta     `path:"/v1/documents" method:"delete" tags:"rag" summary:"Delete a document and its chunks"`
	DocumentId int64 `p:"document_id" dc:"document_id" v:"required"`
}

type DocumentsDeleteRes

type DocumentsDeleteRes struct {
	g.Meta `mime:"application/json"`
}

type DocumentsListReq

type DocumentsListReq struct {
	g.Meta        `path:"/v1/documents" method:"get" tags:"rag"`
	KnowledgeName string `p:"knowledge_name" dc:"knowledge_name" v:"required|length:3,50"`
	Page          int    `p:"page" dc:"page" v:"required|min:1" d:"1"`
	Size          int    `p:"size" dc:"size" v:"required|min:1|max:100" d:"10"`
}

type DocumentsListRes

type DocumentsListRes struct {
	g.Meta `mime:"application/json"`
	Data   []entity.KnowledgeDocuments `json:"data"`
	Total  int                         `json:"total"`
	Page   int                         `json:"page"`
	Size   int                         `json:"size"`
}

type IndexerReq

type IndexerReq struct {
	g.Meta        `path:"/v1/indexer" method:"post" mime:"multipart/form-data" tags:"rag"`
	File          *ghttp.UploadFile `p:"file" type:"file" dc:"如果是本地文件,则直接上传文件"`
	URL           string            `p:"url" dc:"如果是网络文件则直接输入url即可"`
	KnowledgeName string            `p:"knowledge_name" dc:"知识库名称" v:"required"`
}

type IndexerRes

type IndexerRes struct {
	g.Meta `mime:"application/json"`
	DocIDs []string `json:"doc_ids"`
}

type KBCreateReq

type KBCreateReq struct {
	g.Meta      `path:"/v1/kb" method:"post" tags:"kb" summary:"Create kb"`
	Name        string `v:"required|length:3,50" dc:"kb name"`
	Description string `v:"required|length:3,200" dc:"kb description"`
	Category    string `v:"length:3,50" dc:"kb category"`
}

type KBCreateRes

type KBCreateRes struct {
	Id int64 `json:"id" dc:"kb id"`
}

type KBDeleteReq

type KBDeleteReq struct {
	g.Meta `path:"/v1/kb/{id}" method:"delete" tags:"kb" summary:"Delete kb"`
	Id     int64 `v:"required" dc:"kb id"`
}

type KBDeleteRes

type KBDeleteRes struct{}

type KBGetListReq

type KBGetListReq struct {
	g.Meta   `path:"/v1/kb" method:"get" tags:"kb" summary:"Get kbs"`
	Name     *string `v:"length:3,50" dc:"kb name"`
	Status   *Status `v:"in:1,2" dc:"kb age"`
	Category *string `v:"length:3,50" dc:"kb category"`
}

type KBGetListRes

type KBGetListRes struct {
	List []*entity.KnowledgeBase `json:"list" dc:"kb list"`
}

type KBGetOneReq

type KBGetOneReq struct {
	g.Meta `path:"/v1/kb/{id}" method:"get" tags:"kb" summary:"Get one kb"`
	Id     int64 `v:"required" dc:"kb id"`
}

type KBGetOneRes

type KBGetOneRes struct {
	*entity.KnowledgeBase `dc:"kb"`
}

type KBUpdateReq

type KBUpdateReq struct {
	g.Meta      `path:"/v1/kb/{id}" method:"put" tags:"kb" summary:"Update kb"`
	Id          int64   `v:"required" dc:"kb id"`
	Name        *string `v:"length:3,50" dc:"kb name"`
	Description *string `v:"length:3,200" dc:"kb description"`
	Category    *string `v:"length:3,50" dc:"kb category"`
	Status      *Status `v:"in:1,2" dc:"kb status"`
}

type KBUpdateRes

type KBUpdateRes struct{}

type Metadata

type Metadata struct {
	Path        string `json:"path"`
	Description string `json:"description"`
}

type Record

type Record struct {
	Metadata *Metadata `json:"metadata"`
	Score    float64   `json:"score"`
	Title    string    `json:"title"`
	Content  string    `json:"content"`
}

type RetrievalSetting

type RetrievalSetting struct {
	TopK           int     `json:"top_k"`
	ScoreThreshold float64 `json:"score_threshold"`
}

type RetrieverDifyReq

type RetrieverDifyReq struct {
	g.Meta           `path:"/v1/dify/retrieval" method:"post" tags:"rag" no_wrap_resp:"true"`
	KnowledgeID      string            `json:"knowledge_id" v:"required"`
	Query            string            `json:"query" v:"required"`
	RetrievalSetting *RetrievalSetting `json:"retrieval_setting" v:"required"`
}

type RetrieverDifyRes

type RetrieverDifyRes struct {
	g.Meta  `mime:"application/json"`
	Records []*Record `json:"records"`
}

type RetrieverReq

type RetrieverReq struct {
	g.Meta        `path:"/v1/retriever" method:"post" tags:"rag"`
	Question      string  `json:"question" v:"required"`
	TopK          int     `json:"top_k"` // 默认为5
	Score         float64 `json:"score"` // 默认为0.2
	KnowledgeName string  `json:"knowledge_name" v:"required"`
}

type RetrieverRes

type RetrieverRes struct {
	g.Meta   `mime:"application/json"`
	Document []*schema.Document `json:"document"`
}

type Status

type Status int

Status marks kb status.

const (
	StatusPending  Status = 0
	StatusIndexing Status = 1
	StatusActive   Status = 2
	StatusFailed   Status = 3
)
const (
	StatusOK       Status = 1
	StatusDisabled Status = 2
)

type UpdateChunkContentReq

type UpdateChunkContentReq struct {
	g.Meta  `path:"/v1/chunks_content" method:"put" tags:"rag"`
	Id      int64  `p:"id" dc:"id" v:"required"`
	Content string `p:"content" dc:"content" v:"required"`
}

type UpdateChunkContentRes

type UpdateChunkContentRes struct {
	g.Meta `mime:"application/json"`
}

type UpdateChunkReq

type UpdateChunkReq struct {
	g.Meta `path:"/v1/chunks" method:"put" tags:"rag"`
	Ids    []int64 `p:"ids" dc:"ids" v:"required"`
	Status int     `p:"status" dc:"status" v:"required|in:0,1"`
}

type UpdateChunkRes

type UpdateChunkRes struct {
	g.Meta `mime:"application/json"`
}

type WebSearchReq

type WebSearchReq struct {
	g.Meta   `path:"/v1/websearch" method:"post" tags:"rag"`
	Question string `json:"question" v:"required"`
	TopK     int    `json:"top_k"` // 默认为5
}

type WebSearchRes

type WebSearchRes struct {
	g.Meta   `mime:"application/json"`
	Document []*schema.Document `json:"document"`
}

Jump to

Keyboard shortcuts

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