saw-go/proto/kbase.go

53 lines
2.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package proto
type KnowledgeBaseReq struct {
ID uint `json:"id" form:"id"` // 知识库ID
UUID string `json:"uuid" form:"uuid"` // 知识库UUID
Name string `json:"name" form:"name"` // 知识库名称
Description string `json:"description" form:"description"` // 知识库描述
FileIDS string `json:"file_ids" form:"file_ids"` // 文件ID列表逗号分隔
}
type KnowledgeBaseServerResponse struct {
QuerySelect KnowledgeBaseServerResponseSelect `json:"query_select"` //查询结果
KnowledgeBase KBase `json:"knowledge_base"` //知识库信息
IMContext IMParamContext `json:"im_context"` //消息上下文
}
// KBase 定义与 TypeScript 接口对应的 Go 结构体
type KBase struct {
ID uint `json:"ID"`
Name string `json:"Name"`
Description string `json:"Description"`
UUID string `json:"UUID"`
SessionID uint `json:"SessionID"`
CreatedAt string `json:"CreatedAt"`
UpdatedAt string `json:"UpdatedAt"`
DeletedAt string `json:"DeletedAt"`
AuthID int `json:"AuthID"`
FileNameList string `json:"FileNameList"`
FileIDs string `json:"FileIDs"`
}
// 知识库向量查询返回结果Response 定义 JSON 数据对应的结构体
type KnowledgeBaseServerResponseSelect struct {
IDs [][]string `json:"ids"`
Embeddings interface{} `json:"embeddings"`
Documents [][]string `json:"documents"`
URIs interface{} `json:"uris"`
Included []string `json:"included"`
Data interface{} `json:"data"`
Metadatas [][]Metadata `json:"metadatas"`
Distances [][]float64 `json:"distances"`
}
// Metadata 定义元数据结构体
type Metadata struct {
Source string `json:"source"`
}
type KnowledgeBaseServerRequest struct {
IMContext IMParamContext `json:"im_context"` //消息上下文
KnowledgeBase KBase `json:"knowledge_base"` //知识库信息
}