models

package
v0.0.0-...-15e837a Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2025 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AskReq

type AskReq struct {
	Message string `json:"message" binding:"required"`
}

type Config

type Config struct {
	Server struct {
		Port string `mapstructure:"port"`
	} `mapstructure:"server"`

	Redis struct {
		Address  string `mapstructure:"address"`
		Password string `mapstructure:"password"`
		DB       int    `mapstructure:"db"`
	} `mapstructure:"redis"`

	SQLite struct {
		Path            string `mapstructure:"path"`
		MaxOpenConns    int    `mapstructure:"max_open_conns"`
		MaxIdleConns    int    `mapstructure:"max_idle_conns"`
		ConnMaxLifetime int    `mapstructure:"conn_max_lifetime"` // 秒
	} `mapstructure:"sqlite"`

	JWT struct {
		Secret string `mapstructure:"secret"`
	} `mapstructure:"jwt"`

	RAG struct {
		ServiceAddr string `mapstructure:"service_addr"`
	} `mapstructure:"rag"`
}

type Conversation

type Conversation struct {
	ID          int64     `json:"conversation_id"`
	Title       string    `json:"title"`
	Model       string    `json:"model"`
	ApiKey      string    `json:"api_key"`
	Messages    []Message `json:"messages"`
	CreatedTime int64     `json:"created_time"` // Unix 时间戳
}

type ConversationHistory

type ConversationHistory struct {
	ID       int64     `json:"conversation_id"`
	Title    string    `json:"title"`
	Model    string    `json:"model"`
	Messages []Message `json:"messages"`
}

type ConversationReq

type ConversationReq struct {
	Model string `json:"model" binding:"required"`
	Title string `json:"title" binding:"required"`
}

type ConversationSummary

type ConversationSummary struct {
	ID          int64  `json:"conversation_id"`
	Title       string `json:"title"`
	CreatedTime int64  `json:"created_time"`
}

type CreateConversationReq

type CreateConversationReq struct {
	Model  string `json:"model" binding:"required"`
	Title  string `json:"title" binding:"required"`
	ApiKey string `json:"api_key" binding:"required"`
}

type CreateConversationResp

type CreateConversationResp struct {
	ID          int64  `json:"conversation_id"`
	Title       string `json:"title"`
	Model       string `json:"model"`
	ApiKey      string `json:"api_key"`
	CreatedTime int64  `json:"created_time"` // Unix 时间戳
}

type CreateKnowledgeBaseRequest

type CreateKnowledgeBaseRequest struct {
	Name           string `json:"kb_name" binding:"required"`
	EmbeddingModel string `json:"embedding_model,omitempty"`
}

CreateKnowledgeBaseRequest 创建知识库请求

type CreateKnowledgeBaseResponse

type CreateKnowledgeBaseResponse struct {
	Success bool   `json:"success"`
	KBID    string `json:"kb_id"`
	Message string `json:"message"`
}

CreateKnowledgeBaseResponse 创建知识库响应

type DeleteDocumentResponse

type DeleteDocumentResponse struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
}

DeleteDocumentResponse 删除文档响应

type DeleteKnowledgeBaseResponse

type DeleteKnowledgeBaseResponse struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
}

DeleteKnowledgeBaseResponse 删除知识库响应

type Document

type Document struct {
	ID       string `json:"doc_id"`
	KBID     string `json:"kb_id"`
	Name     string `json:"doc_name"`
	FileType string `json:"file_type"`
}

Document 文档模型

type KnowledgeBase

type KnowledgeBase struct {
	ID             string `json:"kb_id"`
	Name           string `json:"kb_name"`
	EmbeddingModel string `json:"embedding_model,omitempty"`
}

KnowledgeBase 知识库模型

type ListDocumentsResponse

type ListDocumentsResponse struct {
	Success bool       `json:"success"`
	Docs    []Document `json:"docs"`
	Message string     `json:"message"`
}

ListDocumentsResponse 文档列表响应

type ListEmbeddingModelsResponse

type ListEmbeddingModelsResponse struct {
	Success bool     `json:"success"`
	Models  []string `json:"models"`
	Message string   `json:"message"`
}

ListEmbeddingModelsResponse 嵌入模型列表响应

type ListKnowledgeBasesResponse

type ListKnowledgeBasesResponse struct {
	Success bool            `json:"success"`
	KBs     []KnowledgeBase `json:"kbs"`
	Message string          `json:"message"`
}

ListKnowledgeBasesResponse 知识库列表响应

type Message

type Message struct {
	Role      string `json:"role"`
	Content   string `json:"content"`
	MessageID int32  `json:"message_id"`
}

type RagChatRequest

type RagChatRequest struct {
	ConversationID int64  `json:"conversation_id" binding:"required"`
	KBID           string `json:"kb_id" binding:"required"`
	Message        string `json:"message" binding:"required"`
	TopK           int    `json:"top_k,omitempty"`
}

RagChatRequest 基于知识库的对话请求

type RetrieveRequest

type RetrieveRequest struct {
	KBID  string `json:"kb_id" binding:"required"`
	Query string `json:"query" binding:"required"`
	TopK  int    `json:"top_k,omitempty"`
}

RetrieveRequest 检索请求

type RetrieveResponse

type RetrieveResponse struct {
	Success bool             `json:"success"`
	Results []RetrieveResult `json:"results"`
	Message string           `json:"message"`
}

RetrieveResponse 检索响应

type RetrieveResult

type RetrieveResult struct {
	Content string  `json:"content"`
	Score   float32 `json:"score"`
	DocID   string  `json:"doc_id"`
	DocName string  `json:"doc_name"`
}

RetrieveResult 检索结果模型

type SSEChoice

type SSEChoice struct {
	Delta SSEDelta `json:"delta"`
}

type SSEDelta

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

SSEDelta 定义结构体以匹配 JSON 数据格式

type SSEResponse

type SSEResponse struct {
	Choices []SSEChoice `json:"choices"`
}

type UploadDocumentResponse

type UploadDocumentResponse struct {
	Success bool   `json:"success"`
	DocID   string `json:"doc_id"`
	Message string `json:"message"`
}

UploadDocumentResponse 上传文档响应

type User

type User struct {
	ID       int64  `json:"id"`
	Username string `json:"username"`
	Password string `json:"password"`
}

Jump to

Keyboard shortcuts

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