Documentation ¶
Index ¶
- Constants
- Variables
- func GetEmbedding(ctx context.Context, text string) (vec qas.Vector, err error)
- func InitDB() error
- func LoadPreset() (doc aigc.Preset, err error)
- func NewOpenAIClient() *openai.Client
- func SgtDB(args ...string) *pgx.DB
- type ChatLogSpec
- type Conversation
- type DocumentSpec
- type ExportArg
- type MatchSpec
- type ModelSpec
- type PageSpec
- type QaStore
- type RedisClient
- type Storage
- type StringsDiff
- type TextSearchSpec
- type Wrap
Constants ¶
View Source
const ( Separator = "\n* " AnswerStop = " END" )
Variables ¶
View Source
var ( ErrNoRows = pgx.ErrNoRows ErrNotFound = pgx.ErrNotFound ErrEmptyKey = pgx.ErrEmptyKey ContextWithColumns = pgx.ContextWithColumns ColumnsFromContext = pgx.ColumnsFromContext ContextWithRelation = pgx.ContextWithRelation RelationFromContext = pgx.RelationFromContext RegisterModel = pgx.RegisterModel )
vars nolint
View Source
var (
ErrEmptyParam = errors.New("empty param")
)
Functions ¶
func LoadPreset ¶
func NewOpenAIClient ¶
func NewOpenAIClient() *openai.Client
Types ¶
type ChatLogSpec ¶
type ChatLogSpec struct { PageSpec ModelSpec // 会话ID ChatID string `extensions:"x-order=A" form:"csid" json:"csid"` }
func (*ChatLogSpec) Sift ¶
func (spec *ChatLogSpec) Sift(q *ormQuery) *ormQuery
type Conversation ¶
type Conversation interface { GetID() string GetOID() oid.OID AddHistory(ctx context.Context, item *aigc.HistoryItem) error ListHistory(ctx context.Context) (aigc.HistoryItems, error) ClearHistory(ctx context.Context) error }
func NewConversation ¶
func NewConversation(id any) Conversation
type DocumentSpec ¶
type DocumentSpec struct { PageSpec ModelSpec // 主标题 Title string `extensions:"x-order=A" form:"title" json:"title"` // 小节标题 Heading string `extensions:"x-order=B" form:"heading" json:"heading"` // 内容 Content string `extensions:"x-order=C" form:"content" json:"content"` }
func (*DocumentSpec) CanSort ¶
func (spec *DocumentSpec) CanSort(k string) bool
func (*DocumentSpec) Sift ¶
func (spec *DocumentSpec) Sift(q *ormQuery) *ormQuery
type ExportArg ¶
type ExportArg struct { Spec *DocumentSpec Out io.Writer Format string // csv,jsonl }
type QaStore ¶
type QaStore interface { ListDocument(ctx context.Context, spec *DocumentSpec) (data qas.Documents, total int, err error) GetDocument(ctx context.Context, id string) (obj *qas.Document, err error) CreateDocument(ctx context.Context, in qas.DocumentBasic) (obj *qas.Document, err error) UpdateDocument(ctx context.Context, id string, in qas.DocumentSet) error DeleteDocument(ctx context.Context, id string) error CreatePrompt(ctx context.Context, in qas.PromptBasic) (obj *qas.Prompt, err error) UpdatePrompt(ctx context.Context, id string, in qas.PromptSet) error DeletePrompt(ctx context.Context, id string) error CreateChatLog(ctx context.Context, in qas.ChatLogBasic) (obj *qas.ChatLog, err error) GetChatLog(ctx context.Context, id string) (obj *qas.ChatLog, err error) ListChatLog(ctx context.Context, spec *ChatLogSpec) (data qas.ChatLogs, total int, err error) DeleteChatLog(ctx context.Context, id string) error // contains filtered or unexported methods }
type RedisClient ¶
type RedisClient = redis.UniversalClient
type StringsDiff ¶
type StringsDiff = pgx.StringsDiff
type TextSearchSpec ¶
type TextSearchSpec = pgx.TextSearchSpec
Click to show internal directories.
Click to hide internal directories.