conversation

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conversation

type Conversation interface {
	GetHistory(sid string) ([]map[string]interface{}, error)
	SaveHistory(sid string, messages []map[string]interface{}) error
	GetRequest(sid string, rid string) ([]map[string]interface{}, error)
	SaveRequest(sid string, rid string, cid string, messages []map[string]interface{}) error
}

Conversation the store interface

type Mongo

type Mongo struct{}

Mongo conversation

func NewMongo

func NewMongo() *Mongo

NewMongo create a new conversation

func (*Mongo) GetHistory

func (conv *Mongo) GetHistory(sid string) ([]map[string]interface{}, error)

GetHistory get the history

func (*Mongo) GetRequest

func (conv *Mongo) GetRequest(sid string, rid string) ([]map[string]interface{}, error)

GetRequest get the request

func (*Mongo) SaveHistory

func (conv *Mongo) SaveHistory(sid string, messages []map[string]interface{}) error

SaveHistory save the history

func (*Mongo) SaveRequest

func (conv *Mongo) SaveRequest(sid string, rid string, cid string, messages []map[string]interface{}) error

SaveRequest save the request

type Redis

type Redis struct{}

Redis conversation

func NewRedis

func NewRedis() *Redis

NewRedis create a new conversation

func (*Redis) GetHistory

func (conv *Redis) GetHistory(sid string) ([]map[string]interface{}, error)

GetHistory get the history

func (*Redis) GetRequest

func (conv *Redis) GetRequest(sid string, rid string) ([]map[string]interface{}, error)

GetRequest get the request

func (*Redis) SaveHistory

func (conv *Redis) SaveHistory(sid string, messages []map[string]interface{}) error

SaveHistory save the history

func (*Redis) SaveRequest

func (conv *Redis) SaveRequest(sid string, rid string, cid string, messages []map[string]interface{}) error

SaveRequest save the request

type Setting

type Setting struct {
	Connector string `json:"connector,omitempty"`
	Table     string `json:"table,omitempty"`
	MaxSize   int    `json:"max_size,omitempty" yaml:"max_size,omitempty"`
	TTL       int    `json:"ttl,omitempty" yaml:"ttl,omitempty"`
}

Setting the conversation config

type Weaviate

type Weaviate struct{}

Weaviate Database conversation

func NewWeaviate

func NewWeaviate() *Weaviate

NewWeaviate create a new conversation

func (*Weaviate) GetHistory

func (conv *Weaviate) GetHistory(sid string) ([]map[string]interface{}, error)

GetHistory get the history

func (*Weaviate) GetRequest

func (conv *Weaviate) GetRequest(sid string, rid string) ([]map[string]interface{}, error)

GetRequest get the request

func (*Weaviate) SaveHistory

func (conv *Weaviate) SaveHistory(sid string, messages []map[string]interface{}) error

SaveHistory save the history

func (*Weaviate) SaveRequest

func (conv *Weaviate) SaveRequest(sid string, rid string, cid string, messages []map[string]interface{}) error

SaveRequest save the request

type Xun

type Xun struct {
	// contains filtered or unexported fields
}

Xun Database conversation

func NewXun

func NewXun(setting Setting) (*Xun, error)

NewXun create a new conversation

func (*Xun) GetHistory

func (conv *Xun) GetHistory(sid string) ([]map[string]interface{}, error)

GetHistory get the history

func (*Xun) GetRequest

func (conv *Xun) GetRequest(sid string, rid string) ([]map[string]interface{}, error)

GetRequest get the request history

func (*Xun) Init

func (conv *Xun) Init() error

Init init the conversation

func (*Xun) SaveHistory

func (conv *Xun) SaveHistory(sid string, messages []map[string]interface{}) error

SaveHistory save the history

func (*Xun) SaveRequest

func (conv *Xun) SaveRequest(sid string, rid string, cid string, messages []map[string]interface{}) error

SaveRequest save the request history

Jump to

Keyboard shortcuts

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