- Updated the assistant management functions to utilize a unified response structure, replacing the previous 'Items' field with 'Data' for consistency across the API. - Refactored the handling of assistant mentions and details to streamline data processing, improving code readability and maintainability. - Enhanced the AssistantResponse type to include pagination fields directly, facilitating better management of assistant data retrieval. - Implemented new methods for adding, saving, deleting, and searching assistants, ensuring robust functionality across different storage backends. - Updated tests to reflect changes in the assistant management logic and response structure, ensuring comprehensive coverage and reliability.
84 lines
2.2 KiB
Go
84 lines
2.2 KiB
Go
package conversation
|
|
|
|
// Weaviate Database conversation
|
|
type Weaviate struct{}
|
|
|
|
// NewWeaviate create a new conversation
|
|
func NewWeaviate() *Weaviate {
|
|
return &Weaviate{}
|
|
}
|
|
|
|
// UpdateChatTitle update the chat title
|
|
func (conv *Weaviate) UpdateChatTitle(sid string, cid string, title string) error {
|
|
return nil
|
|
}
|
|
|
|
// GetChats get the chat list
|
|
func (conv *Weaviate) GetChats(sid string, filter ChatFilter) (*ChatGroupResponse, error) {
|
|
return &ChatGroupResponse{
|
|
Groups: []ChatGroup{},
|
|
Page: filter.Page,
|
|
PageSize: filter.PageSize,
|
|
Total: 0,
|
|
LastPage: 1,
|
|
}, nil
|
|
}
|
|
|
|
// GetHistory get the history
|
|
func (conv *Weaviate) GetHistory(sid string, cid string) ([]map[string]interface{}, error) {
|
|
return []map[string]interface{}{}, nil
|
|
}
|
|
|
|
// SaveHistory save the history
|
|
func (conv *Weaviate) SaveHistory(sid string, messages []map[string]interface{}, cid string, context map[string]interface{}) error {
|
|
return nil
|
|
}
|
|
|
|
// GetRequest get the request
|
|
func (conv *Weaviate) GetRequest(sid string, rid string) ([]map[string]interface{}, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
// SaveRequest save the request
|
|
func (conv *Weaviate) SaveRequest(sid string, rid string, cid string, messages []map[string]interface{}) error {
|
|
return nil
|
|
}
|
|
|
|
// GetChat get the chat info and its history
|
|
func (conv *Weaviate) GetChat(sid string, cid string) (*ChatInfo, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
// DeleteChat deletes a specific chat and its history
|
|
func (conv *Weaviate) DeleteChat(sid string, cid string) error {
|
|
return nil
|
|
}
|
|
|
|
// DeleteAllChats deletes all chats and their histories for a user
|
|
func (conv *Weaviate) DeleteAllChats(sid string) error {
|
|
return nil
|
|
}
|
|
|
|
// SaveAssistant creates or updates an assistant
|
|
func (conv *Weaviate) SaveAssistant(assistant map[string]interface{}) error {
|
|
return nil
|
|
}
|
|
|
|
// DeleteAssistant deletes an assistant by assistant_id
|
|
func (conv *Weaviate) DeleteAssistant(assistantID string) error {
|
|
return nil
|
|
}
|
|
|
|
// GetAssistants retrieves assistants with pagination and tag filtering
|
|
func (conv *Weaviate) GetAssistants(filter AssistantFilter) (*AssistantResponse, error) {
|
|
return &AssistantResponse{
|
|
|
|
Data: []map[string]interface{}{},
|
|
Page: filter.Page,
|
|
PageSize: filter.PageSize,
|
|
PageCnt: 0,
|
|
Next: 0,
|
|
Prev: 0,
|
|
Total: 0,
|
|
}, nil
|
|
}
|