Documentation ¶
Index ¶
- func Map[T, U any](data []T, f func(T) U) []U
- type Conversation
- type DbAdapter
- func (adapter *DbAdapter) CreateNewConversation(userId int, conversationName string) error
- func (adapter *DbAdapter) GetContextForQuery(conversationId int, context int) ([]core.Query, error)
- func (adapter *DbAdapter) GetConversationByUser(userId int) ([]core.Conversation, error)
- func (adapter *DbAdapter) GetOrCreateUser(email string, name string) (core.User, error)
- func (adapter *DbAdapter) GetQueriesByConversation(conversationId int) ([]core.Query, error)
- func (adapter *DbAdapter) GetTemplatesByUserId(userId int) ([]core.Template, error)
- func (adapter *DbAdapter) GetUserById(userId int) (core.User, error)
- func (adapter *DbAdapter) RunMigrations()
- func (adapter *DbAdapter) StoreQueryForConversation(conversationId int, query string, response []byte, context int) error
- func (adapter *DbAdapter) StoreTemplate(templateName string, userId int, parts []string, params []string) error
- type InvalidData
- type JSON
- type Query
- type Template
- type TemplateProperties
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Conversation ¶
type Conversation struct { ID uint CreatedAt time.Time UpdatedAt time.Time Name string UserID uint User User }
func (*Conversation) ToCoreConversation ¶
func (conversation *Conversation) ToCoreConversation() core.Conversation
ToCoreConversation mapper to convert db model conversation to core.Conversation
type DbAdapter ¶
type DbAdapter struct {
// contains filtered or unexported fields
}
func GetDbAdapter ¶
func (*DbAdapter) CreateNewConversation ¶
func (*DbAdapter) GetContextForQuery ¶
func (*DbAdapter) GetConversationByUser ¶
func (adapter *DbAdapter) GetConversationByUser(userId int) ([]core.Conversation, error)
GetConversationByUser function to get conversation based on user and return it after mapping it to core conversation using ToCoreConversation function and also fetch only last 20 conversations based on CreatedAt field
func (*DbAdapter) GetOrCreateUser ¶
func (*DbAdapter) GetQueriesByConversation ¶
GetQueriesByConversation function to get query based on ConversationID and return list after mapping it to core message model using ToCoreQuery function. Only fetch last 20 messages based on CreatedAt field
func (*DbAdapter) GetTemplatesByUserId ¶
func (*DbAdapter) GetUserById ¶
func (*DbAdapter) RunMigrations ¶
func (adapter *DbAdapter) RunMigrations()
func (*DbAdapter) StoreQueryForConversation ¶
type InvalidData ¶
type InvalidData struct {
// contains filtered or unexported fields
}
func (InvalidData) Error ¶
func (error InvalidData) Error() string
type JSON ¶
type JSON json.RawMessage
type Query ¶
type Query struct { ID uint CreatedAt time.Time UpdatedAt time.Time Query string `gorm:"not null"` Context int32 `gorm:"default:0"` ConversationID uint Response JSON `gorm:"type:jsonb;default:'{}'"` Conversation Conversation }
func (*Query) ToCoreQuery ¶
ToCoreQuery mapper to convert db model conversation to core.Query
type TemplateProperties ¶
Click to show internal directories.
Click to hide internal directories.