mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
refactor(core): migrate channel identity and binding across app
Align channel identity and bind flow across backend and app-facing layers, including generated swagger artifacts and package lock updates while excluding docs content changes.
This commit is contained in:
@@ -409,12 +409,12 @@ func (s *Service) Get(ctx context.Context, memoryID string) (MemoryItem, error)
|
||||
|
||||
func (s *Service) GetAll(ctx context.Context, req GetAllRequest) (SearchResponse, error) {
|
||||
filters := map[string]any{}
|
||||
for k, v := range req.Filters {
|
||||
filters[k] = v
|
||||
}
|
||||
if req.BotID != "" {
|
||||
filters["botId"] = req.BotID
|
||||
}
|
||||
if req.SessionID != "" {
|
||||
filters["sessionId"] = req.SessionID
|
||||
}
|
||||
if req.RunID != "" {
|
||||
filters["runId"] = req.RunID
|
||||
}
|
||||
@@ -445,12 +445,12 @@ func (s *Service) Delete(ctx context.Context, memoryID string) (DeleteResponse,
|
||||
|
||||
func (s *Service) DeleteAll(ctx context.Context, req DeleteAllRequest) (DeleteResponse, error) {
|
||||
filters := map[string]any{}
|
||||
for k, v := range req.Filters {
|
||||
filters[k] = v
|
||||
}
|
||||
if req.BotID != "" {
|
||||
filters["botId"] = req.BotID
|
||||
}
|
||||
if req.SessionID != "" {
|
||||
filters["sessionId"] = req.SessionID
|
||||
}
|
||||
if req.RunID != "" {
|
||||
filters["runId"] = req.RunID
|
||||
}
|
||||
@@ -756,9 +756,6 @@ func buildFilters(req AddRequest) map[string]any {
|
||||
if req.BotID != "" {
|
||||
filters["botId"] = req.BotID
|
||||
}
|
||||
if req.SessionID != "" {
|
||||
filters["sessionId"] = req.SessionID
|
||||
}
|
||||
if req.RunID != "" {
|
||||
filters["runId"] = req.RunID
|
||||
}
|
||||
@@ -773,9 +770,6 @@ func buildSearchFilters(req SearchRequest) map[string]any {
|
||||
if req.BotID != "" {
|
||||
filters["botId"] = req.BotID
|
||||
}
|
||||
if req.SessionID != "" {
|
||||
filters["sessionId"] = req.SessionID
|
||||
}
|
||||
if req.RunID != "" {
|
||||
filters["runId"] = req.RunID
|
||||
}
|
||||
@@ -790,9 +784,6 @@ func buildEmbedFilters(req EmbedUpsertRequest) map[string]any {
|
||||
if req.BotID != "" {
|
||||
filters["botId"] = req.BotID
|
||||
}
|
||||
if req.SessionID != "" {
|
||||
filters["sessionId"] = req.SessionID
|
||||
}
|
||||
if req.RunID != "" {
|
||||
filters["runId"] = req.RunID
|
||||
}
|
||||
@@ -883,9 +874,6 @@ func payloadToMemoryItem(id string, payload map[string]any) MemoryItem {
|
||||
if v, ok := payload["botId"].(string); ok {
|
||||
item.BotID = v
|
||||
}
|
||||
if v, ok := payload["sessionId"].(string); ok {
|
||||
item.SessionID = v
|
||||
}
|
||||
if v, ok := payload["runId"].(string); ok {
|
||||
item.RunID = v
|
||||
}
|
||||
|
||||
+49
-53
@@ -15,28 +15,26 @@ type Message struct {
|
||||
}
|
||||
|
||||
type AddRequest struct {
|
||||
Message string `json:"message,omitempty"`
|
||||
Messages []Message `json:"messages,omitempty"`
|
||||
BotID string `json:"bot_id,omitempty"`
|
||||
SessionID string `json:"session_id,omitempty"`
|
||||
AgentID string `json:"agent_id,omitempty"`
|
||||
RunID string `json:"run_id,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Messages []Message `json:"messages,omitempty"`
|
||||
BotID string `json:"bot_id,omitempty"`
|
||||
AgentID string `json:"agent_id,omitempty"`
|
||||
RunID string `json:"run_id,omitempty"`
|
||||
Metadata map[string]any `json:"metadata,omitempty"`
|
||||
Filters map[string]any `json:"filters,omitempty"`
|
||||
Infer *bool `json:"infer,omitempty"`
|
||||
EmbeddingEnabled *bool `json:"embedding_enabled,omitempty"`
|
||||
Infer *bool `json:"infer,omitempty"`
|
||||
EmbeddingEnabled *bool `json:"embedding_enabled,omitempty"`
|
||||
}
|
||||
|
||||
type SearchRequest struct {
|
||||
Query string `json:"query"`
|
||||
BotID string `json:"bot_id,omitempty"`
|
||||
SessionID string `json:"session_id,omitempty"`
|
||||
AgentID string `json:"agent_id,omitempty"`
|
||||
RunID string `json:"run_id,omitempty"`
|
||||
Limit int `json:"limit,omitempty"`
|
||||
Query string `json:"query"`
|
||||
BotID string `json:"bot_id,omitempty"`
|
||||
AgentID string `json:"agent_id,omitempty"`
|
||||
RunID string `json:"run_id,omitempty"`
|
||||
Limit int `json:"limit,omitempty"`
|
||||
Filters map[string]any `json:"filters,omitempty"`
|
||||
Sources []string `json:"sources,omitempty"`
|
||||
EmbeddingEnabled *bool `json:"embedding_enabled,omitempty"`
|
||||
Sources []string `json:"sources,omitempty"`
|
||||
EmbeddingEnabled *bool `json:"embedding_enabled,omitempty"`
|
||||
}
|
||||
|
||||
type UpdateRequest struct {
|
||||
@@ -46,18 +44,18 @@ type UpdateRequest struct {
|
||||
}
|
||||
|
||||
type GetAllRequest struct {
|
||||
BotID string `json:"bot_id,omitempty"`
|
||||
SessionID string `json:"session_id,omitempty"`
|
||||
AgentID string `json:"agent_id,omitempty"`
|
||||
RunID string `json:"run_id,omitempty"`
|
||||
Limit int `json:"limit,omitempty"`
|
||||
BotID string `json:"bot_id,omitempty"`
|
||||
AgentID string `json:"agent_id,omitempty"`
|
||||
RunID string `json:"run_id,omitempty"`
|
||||
Limit int `json:"limit,omitempty"`
|
||||
Filters map[string]any `json:"filters,omitempty"`
|
||||
}
|
||||
|
||||
type DeleteAllRequest struct {
|
||||
BotID string `json:"bot_id,omitempty"`
|
||||
SessionID string `json:"session_id,omitempty"`
|
||||
AgentID string `json:"agent_id,omitempty"`
|
||||
RunID string `json:"run_id,omitempty"`
|
||||
BotID string `json:"bot_id,omitempty"`
|
||||
AgentID string `json:"agent_id,omitempty"`
|
||||
RunID string `json:"run_id,omitempty"`
|
||||
Filters map[string]any `json:"filters,omitempty"`
|
||||
}
|
||||
|
||||
type EmbedInput struct {
|
||||
@@ -67,17 +65,16 @@ type EmbedInput struct {
|
||||
}
|
||||
|
||||
type EmbedUpsertRequest struct {
|
||||
Type string `json:"type"`
|
||||
Provider string `json:"provider,omitempty"`
|
||||
Model string `json:"model,omitempty"`
|
||||
Input EmbedInput `json:"input"`
|
||||
Source string `json:"source,omitempty"`
|
||||
BotID string `json:"bot_id,omitempty"`
|
||||
SessionID string `json:"session_id,omitempty"`
|
||||
AgentID string `json:"agent_id,omitempty"`
|
||||
RunID string `json:"run_id,omitempty"`
|
||||
Metadata map[string]any `json:"metadata,omitempty"`
|
||||
Filters map[string]any `json:"filters,omitempty"`
|
||||
Type string `json:"type"`
|
||||
Provider string `json:"provider,omitempty"`
|
||||
Model string `json:"model,omitempty"`
|
||||
Input EmbedInput `json:"input"`
|
||||
Source string `json:"source,omitempty"`
|
||||
BotID string `json:"bot_id,omitempty"`
|
||||
AgentID string `json:"agent_id,omitempty"`
|
||||
RunID string `json:"run_id,omitempty"`
|
||||
Metadata map[string]any `json:"metadata,omitempty"`
|
||||
Filters map[string]any `json:"filters,omitempty"`
|
||||
}
|
||||
|
||||
type EmbedUpsertResponse struct {
|
||||
@@ -88,17 +85,16 @@ type EmbedUpsertResponse struct {
|
||||
}
|
||||
|
||||
type MemoryItem struct {
|
||||
ID string `json:"id"`
|
||||
Memory string `json:"memory"`
|
||||
Hash string `json:"hash,omitempty"`
|
||||
CreatedAt string `json:"createdAt,omitempty"`
|
||||
UpdatedAt string `json:"updatedAt,omitempty"`
|
||||
Score float64 `json:"score,omitempty"`
|
||||
ID string `json:"id"`
|
||||
Memory string `json:"memory"`
|
||||
Hash string `json:"hash,omitempty"`
|
||||
CreatedAt string `json:"createdAt,omitempty"`
|
||||
UpdatedAt string `json:"updatedAt,omitempty"`
|
||||
Score float64 `json:"score,omitempty"`
|
||||
Metadata map[string]any `json:"metadata,omitempty"`
|
||||
BotID string `json:"botId,omitempty"`
|
||||
SessionID string `json:"sessionId,omitempty"`
|
||||
AgentID string `json:"agentId,omitempty"`
|
||||
RunID string `json:"runId,omitempty"`
|
||||
BotID string `json:"botId,omitempty"`
|
||||
AgentID string `json:"agentId,omitempty"`
|
||||
RunID string `json:"runId,omitempty"`
|
||||
}
|
||||
|
||||
type SearchResponse struct {
|
||||
@@ -111,7 +107,7 @@ type DeleteResponse struct {
|
||||
}
|
||||
|
||||
type ExtractRequest struct {
|
||||
Messages []Message `json:"messages"`
|
||||
Messages []Message `json:"messages"`
|
||||
Filters map[string]any `json:"filters,omitempty"`
|
||||
Metadata map[string]any `json:"metadata,omitempty"`
|
||||
}
|
||||
@@ -121,16 +117,16 @@ type ExtractResponse struct {
|
||||
}
|
||||
|
||||
type CandidateMemory struct {
|
||||
ID string `json:"id"`
|
||||
Memory string `json:"memory"`
|
||||
ID string `json:"id"`
|
||||
Memory string `json:"memory"`
|
||||
Metadata map[string]any `json:"metadata,omitempty"`
|
||||
}
|
||||
|
||||
type DecideRequest struct {
|
||||
Facts []string `json:"facts"`
|
||||
Candidates []CandidateMemory `json:"candidates"`
|
||||
Filters map[string]any `json:"filters,omitempty"`
|
||||
Metadata map[string]any `json:"metadata,omitempty"`
|
||||
Facts []string `json:"facts"`
|
||||
Candidates []CandidateMemory `json:"candidates"`
|
||||
Filters map[string]any `json:"filters,omitempty"`
|
||||
Metadata map[string]any `json:"metadata,omitempty"`
|
||||
}
|
||||
|
||||
type DecisionAction struct {
|
||||
|
||||
Reference in New Issue
Block a user