Skip to content

Commit

Permalink
feat: add incoming information into sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
Yeuoly committed Oct 16, 2024
1 parent 1a78a5a commit 59226d3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
14 changes: 3 additions & 11 deletions internal/core/plugin_daemon/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,10 @@ func getBasicPluginAccessMap(
user_id string,
access_type access_types.PluginAccessType,
action access_types.PluginAccessAction,
conversation_id *string,
message_id *string,
app_id *string,
endpoint_id *string,
) map[string]any {
return map[string]any{
"user_id": user_id,
"type": access_type,
"action": action,
"conversation_id": conversation_id,
"message_id": message_id,
"app_id": app_id,
"endpoint_id": endpoint_id,
"user_id": user_id,
"type": access_type,
"action": action,
}
}
4 changes: 0 additions & 4 deletions internal/core/plugin_daemon/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,6 @@ func getInvokePluginMap(
session.UserID,
session.InvokeFrom,
session.Action,
session.ConversationID,
session.MessageID,
session.AppID,
session.EndpointID,
)
for k, v := range parser.StructToMap(request) {
req[k] = v
Expand Down
10 changes: 7 additions & 3 deletions internal/core/session_manager/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,13 @@ const (

func (s *Session) Message(event PLUGIN_IN_STREAM_EVENT, data any) []byte {
return parser.MarshalJsonBytes(map[string]any{
"session_id": s.ID,
"event": event,
"data": data,
"session_id": s.ID,
"conversation_id": s.ConversationID,
"message_id": s.MessageID,
"app_id": s.AppID,
"endpoint_id": s.EndpointID,
"event": event,
"data": data,
})
}

Expand Down

0 comments on commit 59226d3

Please sign in to comment.