-
Notifications
You must be signed in to change notification settings - Fork 664
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #812 from trheyi/main
Refactor Neo (60%)
- Loading branch information
Showing
15 changed files
with
2,472 additions
and
377 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,59 @@ | ||
package conversation | ||
|
||
// Mongo conversation | ||
// Mongo represents a MongoDB-based conversation storage | ||
type Mongo struct{} | ||
|
||
// NewMongo create a new conversation | ||
// NewMongo creates a new MongoDB conversation storage | ||
func NewMongo() *Mongo { | ||
return &Mongo{} | ||
} | ||
|
||
// UpdateChatTitle update the chat title | ||
func (conv *Mongo) UpdateChatTitle(sid string, cid string, title string) error { | ||
return nil | ||
// GetChats retrieves a list of chats | ||
func (m *Mongo) GetChats(sid string, filter ChatFilter) (*ChatGroupResponse, error) { | ||
return &ChatGroupResponse{}, nil | ||
} | ||
|
||
// GetChats get the chat list | ||
func (conv *Mongo) GetChats(sid string, filter ChatFilter) (*ChatGroupResponse, error) { | ||
return &ChatGroupResponse{ | ||
Groups: []ChatGroup{}, | ||
Page: filter.Page, | ||
PageSize: filter.PageSize, | ||
Total: 0, | ||
LastPage: 1, | ||
}, nil | ||
// GetChat retrieves a single chat's information | ||
func (m *Mongo) GetChat(sid string, cid string) (*ChatInfo, error) { | ||
return &ChatInfo{}, nil | ||
} | ||
|
||
// GetHistory get the history | ||
func (conv *Mongo) GetHistory(sid string, cid string) ([]map[string]interface{}, error) { | ||
// GetHistory retrieves chat history | ||
func (m *Mongo) GetHistory(sid string, cid string) ([]map[string]interface{}, error) { | ||
return []map[string]interface{}{}, nil | ||
} | ||
|
||
// SaveHistory save the history | ||
func (conv *Mongo) SaveHistory(sid string, messages []map[string]interface{}, cid string) error { | ||
// SaveHistory saves chat history | ||
func (m *Mongo) SaveHistory(sid string, messages []map[string]interface{}, cid string, context map[string]interface{}) error { | ||
return nil | ||
} | ||
|
||
// DeleteChat deletes a single chat | ||
func (m *Mongo) DeleteChat(sid string, cid string) error { | ||
return nil | ||
} | ||
|
||
// GetRequest get the request | ||
func (conv *Mongo) GetRequest(sid string, rid string) ([]map[string]interface{}, error) { | ||
return nil, nil | ||
// DeleteAllChats deletes all chats | ||
func (m *Mongo) DeleteAllChats(sid string) error { | ||
return nil | ||
} | ||
|
||
// SaveRequest save the request | ||
func (conv *Mongo) SaveRequest(sid string, rid string, cid string, messages []map[string]interface{}) error { | ||
// UpdateChatTitle updates chat title | ||
func (m *Mongo) UpdateChatTitle(sid string, cid string, title string) error { | ||
return nil | ||
} | ||
|
||
// GetChat get the chat info and its history | ||
func (conv *Mongo) GetChat(sid string, cid string) (*ChatInfo, error) { | ||
return nil, nil | ||
// SaveAssistant saves assistant information | ||
func (m *Mongo) SaveAssistant(assistant map[string]interface{}) (interface{}, error) { | ||
return assistant["assistant_id"], nil | ||
} | ||
|
||
// DeleteChat deletes a specific chat and its history | ||
func (conv *Mongo) DeleteChat(sid string, cid string) error { | ||
// DeleteAssistant deletes an assistant | ||
func (m *Mongo) DeleteAssistant(assistantID string) error { | ||
return nil | ||
} | ||
|
||
// DeleteAllChats deletes all chats and their histories for a user | ||
func (conv *Mongo) DeleteAllChats(sid string) error { | ||
return nil | ||
// GetAssistants retrieves a list of assistants | ||
func (m *Mongo) GetAssistants(filter AssistantFilter) (*AssistantResponse, error) { | ||
return &AssistantResponse{}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,59 @@ | ||
package conversation | ||
|
||
// Redis conversation | ||
// Redis represents a Redis-based conversation storage | ||
type Redis struct{} | ||
|
||
// NewRedis create a new conversation | ||
// NewRedis creates a new Redis conversation storage | ||
func NewRedis() *Redis { | ||
return &Redis{} | ||
} | ||
|
||
// UpdateChatTitle update the chat title | ||
func (conv *Redis) UpdateChatTitle(sid string, cid string, title string) error { | ||
return nil | ||
// GetChats retrieves a list of chats | ||
func (r *Redis) GetChats(sid string, filter ChatFilter) (*ChatGroupResponse, error) { | ||
return &ChatGroupResponse{}, nil | ||
} | ||
|
||
// GetChats get the chat list | ||
func (conv *Redis) GetChats(sid string, filter ChatFilter) (*ChatGroupResponse, error) { | ||
return &ChatGroupResponse{ | ||
Groups: []ChatGroup{}, | ||
Page: filter.Page, | ||
PageSize: filter.PageSize, | ||
Total: 0, | ||
LastPage: 1, | ||
}, nil | ||
// GetChat retrieves a single chat's information | ||
func (r *Redis) GetChat(sid string, cid string) (*ChatInfo, error) { | ||
return &ChatInfo{}, nil | ||
} | ||
|
||
// GetHistory get the history | ||
func (conv *Redis) GetHistory(sid string, cid string) ([]map[string]interface{}, error) { | ||
// GetHistory retrieves chat history | ||
func (r *Redis) GetHistory(sid string, cid string) ([]map[string]interface{}, error) { | ||
return []map[string]interface{}{}, nil | ||
} | ||
|
||
// SaveHistory save the history | ||
func (conv *Redis) SaveHistory(sid string, messages []map[string]interface{}, cid string) error { | ||
// SaveHistory saves chat history | ||
func (r *Redis) SaveHistory(sid string, messages []map[string]interface{}, cid string, context map[string]interface{}) error { | ||
return nil | ||
} | ||
|
||
// DeleteChat deletes a single chat | ||
func (r *Redis) DeleteChat(sid string, cid string) error { | ||
return nil | ||
} | ||
|
||
// GetRequest get the request | ||
func (conv *Redis) GetRequest(sid string, rid string) ([]map[string]interface{}, error) { | ||
return nil, nil | ||
// DeleteAllChats deletes all chats | ||
func (r *Redis) DeleteAllChats(sid string) error { | ||
return nil | ||
} | ||
|
||
// SaveRequest save the request | ||
func (conv *Redis) SaveRequest(sid string, rid string, cid string, messages []map[string]interface{}) error { | ||
// UpdateChatTitle updates chat title | ||
func (r *Redis) UpdateChatTitle(sid string, cid string, title string) error { | ||
return nil | ||
} | ||
|
||
// GetChat get the chat info and its history | ||
func (conv *Redis) GetChat(sid string, cid string) (*ChatInfo, error) { | ||
return nil, nil | ||
// SaveAssistant saves assistant information | ||
func (r *Redis) SaveAssistant(assistant map[string]interface{}) (interface{}, error) { | ||
return assistant["assistant_id"], nil | ||
} | ||
|
||
// DeleteChat deletes a specific chat and its history | ||
func (conv *Redis) DeleteChat(sid string, cid string) error { | ||
// DeleteAssistant deletes an assistant | ||
func (r *Redis) DeleteAssistant(assistantID string) error { | ||
return nil | ||
} | ||
|
||
// DeleteAllChats deletes all chats and their histories for a user | ||
func (conv *Redis) DeleteAllChats(sid string) error { | ||
return nil | ||
// GetAssistants retrieves a list of assistants | ||
func (r *Redis) GetAssistants(filter AssistantFilter) (*AssistantResponse, error) { | ||
return &AssistantResponse{}, nil | ||
} |
Oops, something went wrong.