Documentation
¶
Index ¶
- func Map[T, U any](data []T, f func(T) U) []U
- type AccessTokenData
- type AuthService
- type ChatGptService
- func (srv *ChatGptService) CreateNewConversation(userId int, conversationName string) ([]Conversation, error)
- func (srv *ChatGptService) GenerateAccessToken(token string) (AccessTokenData, error)
- func (c *ChatGptService) GetConversationsForUser(userId int) ([]Conversation, error)
- func (srv *ChatGptService) GetQueriesForConversation(conversationId int) ([]Query, error)
- func (s *ChatGptService) GetTemplates(userId int) ([]Template, error)
- func (s *ChatGptService) GetUserDetails(userId int) (User, error)
- func (srv *ChatGptService) QueryLLM(query string, conversationId int, isContext bool) ([]Query, error)
- func (s *ChatGptService) StoreTemplate(userId int, templateName string, parts []string, params []string) ([]Template, error)
- func (s *ChatGptService) VerifyAccessToken(token string) (User, error)
- type ChatRequest
- type ChatResponse
- type Conversation
- type DbService
- type GoogleUserInfo
- type InvalidAuthToken
- type LLMPrompt
- type LLMResponse
- type LLMService
- type Query
- type Service
- type Template
- type UnauthorizedError
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccessTokenData ¶
type AccessTokenData struct {
Token string `json:"token"`
}
type AuthService ¶
type ChatGptService ¶
type ChatGptService struct {
// contains filtered or unexported fields
}
func GetNewService ¶
func GetNewService(dbService DbService, authService AuthService, llmService LLMService) *ChatGptService
func (*ChatGptService) CreateNewConversation ¶
func (srv *ChatGptService) CreateNewConversation(userId int, conversationName string) ([]Conversation, error)
func (*ChatGptService) GenerateAccessToken ¶
func (srv *ChatGptService) GenerateAccessToken(token string) (AccessTokenData, error)
func (*ChatGptService) GetConversationsForUser ¶
func (c *ChatGptService) GetConversationsForUser(userId int) ([]Conversation, error)
Generate GetConversationsForUser function. It is a function over ChatGptStruct It takes userid as the parameter and fetches conversation using GetConversationByUser function of dbService present in struct
func (*ChatGptService) GetQueriesForConversation ¶
func (srv *ChatGptService) GetQueriesForConversation(conversationId int) ([]Query, error)
func (*ChatGptService) GetTemplates ¶
func (s *ChatGptService) GetTemplates(userId int) ([]Template, error)
func (*ChatGptService) GetUserDetails ¶
func (s *ChatGptService) GetUserDetails(userId int) (User, error)
func (*ChatGptService) StoreTemplate ¶
func (*ChatGptService) VerifyAccessToken ¶
func (s *ChatGptService) VerifyAccessToken(token string) (User, error)
type ChatResponse ¶
type ChatResponse struct {
Response string `json:"response"`
}
define the response structure
type Conversation ¶
type DbService ¶
type DbService interface { GetOrCreateUser(email string, name string) (User, error) GetUserById(userId int) (User, error) GetConversationByUser(userId int) ([]Conversation, error) GetQueriesByConversation(conversationId int) ([]Query, error) CreateNewConversation(userId int, conversationName string) error StoreQueryForConversation(conversationID int, query string, response []byte, context int) error GetContextForQuery(conversationId int, maxContext int) ([]Query, error) GetTemplatesByUserId(userId int) ([]Template, error) StoreTemplate(templateName string, userId int, parts []string, params []string) error }
type GoogleUserInfo ¶
type InvalidAuthToken ¶
type InvalidAuthToken struct {
Issue string
}
func (InvalidAuthToken) Error ¶
func (i InvalidAuthToken) Error() string
type LLMResponse ¶
type LLMService ¶
type Service ¶
type Service interface { QueryLLM(query string, conversationId int, isContext bool) ([]Query, error) GenerateAccessToken(token string) (AccessTokenData, error) VerifyAccessToken(token string) (User, error) GetUserDetails(userId int) (User, error) GetConversationsForUser(userId int) ([]Conversation, error) GetQueriesForConversation(conversationId int) ([]Query, error) CreateNewConversation(userId int, conversationName string) ([]Conversation, error) GetTemplates(userId int) ([]Template, error) StoreTemplate(userId int, templateName string, parts []string, params []string) ([]Template, error) }
type UnauthorizedError ¶
type UnauthorizedError struct { }
func (UnauthorizedError) Error ¶
func (e UnauthorizedError) Error() string
Click to show internal directories.
Click to hide internal directories.