Documentation
¶
Index ¶
- Constants
- func AuthenticateUser(username, password string) (string, error)
- func CreateConversation(userID int64, title, model, apiKey string) (*models.CreateConversationResp, error)
- func DeleteUserConversation(userID int64, conversationID int64) error
- func GetConversationHistory(conversationID int64) (*models.ConversationHistory, error)
- func GetUserConversations(userID int64) ([]models.ConversationSummary, error)
- func RegisterUser(username, password string) error
- func StreamSendMessage(c *gin.Context, conversationID int64, message string) error
- type RAGService
- func (s *RAGService) Close()
- func (s *RAGService) CreateKnowledgeBase(uid, kbName, embeddingModel string) (*models.CreateKnowledgeBaseResponse, error)
- func (s *RAGService) DeleteDocument(uid, kbID, docID string) (*models.DeleteDocumentResponse, error)
- func (s *RAGService) DeleteKnowledgeBase(uid, kbID string) (*models.DeleteKnowledgeBaseResponse, error)
- func (s *RAGService) GenerateRagPrompt(kbID, query string, topK int) (string, error)
- func (s *RAGService) ListDocuments(kbID string) (*models.ListDocumentsResponse, error)
- func (s *RAGService) ListEmbeddingModels() (*models.ListEmbeddingModelsResponse, error)
- func (s *RAGService) ListKnowledgeBases(uid string) (*models.ListKnowledgeBasesResponse, error)
- func (s *RAGService) RetrieveInfo(kbID, query string, topK int) (*models.RetrieveResponse, error)
- func (s *RAGService) UploadDocument(uid, kbID, docName string, fileContent []byte, fileType string) (*models.UploadDocumentResponse, error)
Constants ¶
View Source
const (
DefaultTopK = 5
)
默认配置
Variables ¶
This section is empty.
Functions ¶
func AuthenticateUser ¶
func CreateConversation ¶
func CreateConversation(userID int64, title, model, apiKey string) (*models.CreateConversationResp, error)
CreateConversation 创建新的会话
func DeleteUserConversation ¶
DeleteUserConversation 删除指定的用户对话
func GetConversationHistory ¶
func GetConversationHistory(conversationID int64) (*models.ConversationHistory, error)
GetConversationHistory 获取完整的会话历史
func GetUserConversations ¶
func GetUserConversations(userID int64) ([]models.ConversationSummary, error)
GetUserConversations 查询用户的所有对话
func RegisterUser ¶
Types ¶
type RAGService ¶
type RAGService struct {
// contains filtered or unexported fields
}
RAGService 提供 RAG 相关功能
func (*RAGService) CreateKnowledgeBase ¶
func (s *RAGService) CreateKnowledgeBase(uid, kbName, embeddingModel string) (*models.CreateKnowledgeBaseResponse, error)
CreateKnowledgeBase 创建知识库
func (*RAGService) DeleteDocument ¶
func (s *RAGService) DeleteDocument(uid, kbID, docID string) (*models.DeleteDocumentResponse, error)
DeleteDocument 删除文档
func (*RAGService) DeleteKnowledgeBase ¶
func (s *RAGService) DeleteKnowledgeBase(uid, kbID string) (*models.DeleteKnowledgeBaseResponse, error)
DeleteKnowledgeBase 删除知识库
func (*RAGService) GenerateRagPrompt ¶
func (s *RAGService) GenerateRagPrompt(kbID, query string, topK int) (string, error)
GenerateRagPrompt 生成基于知识库的对话提示
func (*RAGService) ListDocuments ¶
func (s *RAGService) ListDocuments(kbID string) (*models.ListDocumentsResponse, error)
ListDocuments 获取知识库中的文档列表
func (*RAGService) ListEmbeddingModels ¶
func (s *RAGService) ListEmbeddingModels() (*models.ListEmbeddingModelsResponse, error)
ListEmbeddingModels 获取支持的嵌入模型列表
func (*RAGService) ListKnowledgeBases ¶
func (s *RAGService) ListKnowledgeBases(uid string) (*models.ListKnowledgeBasesResponse, error)
ListKnowledgeBases 获取用户的知识库列表
func (*RAGService) RetrieveInfo ¶
func (s *RAGService) RetrieveInfo(kbID, query string, topK int) (*models.RetrieveResponse, error)
RetrieveInfo 从知识库检索信息
func (*RAGService) UploadDocument ¶
func (s *RAGService) UploadDocument(uid, kbID, docName string, fileContent []byte, fileType string) (*models.UploadDocumentResponse, error)
UploadDocument 上传文档
Click to show internal directories.
Click to hide internal directories.