- Introduced new endpoints for retrieving chat details and mentions, enhancing the API's functionality. - Implemented handleChatDetail method to fetch details of a specific chat by ID, including error handling for missing parameters. - Added handleMentions method to retrieve mentions based on keywords, improving user interaction with chat content. - Updated existing GetChats method to support keyword filtering, allowing for more refined chat list retrieval. - Enhanced the DSL structure to include new methods for managing mentions and chat details, improving overall code organization and maintainability.
26 lines
1 KiB
Go
26 lines
1 KiB
Go
package conversation
|
|
|
|
// Setting the conversation config
|
|
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"`
|
|
}
|
|
|
|
// ChatInfo represents the chat information and its history
|
|
type ChatInfo struct {
|
|
Chat map[string]interface{} `json:"chat"`
|
|
History []map[string]interface{} `json:"history"`
|
|
}
|
|
|
|
// Conversation the store interface
|
|
type Conversation interface {
|
|
UpdateChatTitle(sid string, cid string, title string) error
|
|
GetChats(sid string, keywords ...string) ([]map[string]interface{}, error)
|
|
GetChat(sid string, cid string) (*ChatInfo, error)
|
|
GetHistory(sid string, cid string) ([]map[string]interface{}, error)
|
|
SaveHistory(sid string, messages []map[string]interface{}, cid string) error
|
|
GetRequest(sid string, rid string) ([]map[string]interface{}, error)
|
|
SaveRequest(sid string, rid string, cid string, messages []map[string]interface{}) error
|
|
}
|