yao/neo/conversation/weaviate.go
Max 94f3ddb158 Enhance assistant management and JSON field handling in Neo API
- Updated SaveAssistant and processAssistantAdd methods to return assistant IDs, improving response consistency.
- Implemented logic to handle JSON fields as both strings and native types, ensuring proper storage and retrieval of assistant attributes.
- Refactored tests to cover various JSON field formats, including string, native types, and nil values, enhancing test coverage and reliability.
- Improved the assistant management structure to support mixed JSON formats, ensuring robust functionality across different storage backends.
2024-12-29 17:14:01 +08:00

59 lines
1.7 KiB
Go

package conversation
// Weaviate represents a Weaviate-based conversation storage
type Weaviate struct{}
// NewWeaviate creates a new Weaviate conversation storage
func NewWeaviate() *Weaviate {
return &Weaviate{}
}
// GetChats retrieves a list of chats
func (w *Weaviate) GetChats(sid string, filter ChatFilter) (*ChatGroupResponse, error) {
return &ChatGroupResponse{}, nil
}
// GetChat retrieves a single chat's information
func (w *Weaviate) GetChat(sid string, cid string) (*ChatInfo, error) {
return &ChatInfo{}, nil
}
// GetHistory retrieves chat history
func (w *Weaviate) GetHistory(sid string, cid string) ([]map[string]interface{}, error) {
return []map[string]interface{}{}, nil
}
// SaveHistory saves chat history
func (w *Weaviate) SaveHistory(sid string, messages []map[string]interface{}, cid string, context map[string]interface{}) error {
return nil
}
// DeleteChat deletes a single chat
func (w *Weaviate) DeleteChat(sid string, cid string) error {
return nil
}
// DeleteAllChats deletes all chats
func (w *Weaviate) DeleteAllChats(sid string) error {
return nil
}
// UpdateChatTitle updates chat title
func (w *Weaviate) UpdateChatTitle(sid string, cid string, title string) error {
return nil
}
// SaveAssistant saves assistant information
func (w *Weaviate) SaveAssistant(assistant map[string]interface{}) (interface{}, error) {
return assistant["assistant_id"], nil
}
// DeleteAssistant deletes an assistant
func (w *Weaviate) DeleteAssistant(assistantID string) error {
return nil
}
// GetAssistants retrieves a list of assistants
func (w *Weaviate) GetAssistants(filter AssistantFilter) (*AssistantResponse, error) {
return &AssistantResponse{}, nil
}