mirror of
https://github.com/we-promise/sure.git
synced 2026-04-22 21:44:11 +00:00
Track Langfuse sessions and users (#174)
This commit is contained in:
@@ -67,7 +67,9 @@ class Assistant::Responder
|
||||
functions: function_tool_caller.function_definitions,
|
||||
function_results: function_results,
|
||||
streamer: streamer,
|
||||
previous_response_id: previous_response_id
|
||||
previous_response_id: previous_response_id,
|
||||
session_id: chat_session_id,
|
||||
user_identifier: chat_user_identifier
|
||||
)
|
||||
|
||||
unless response.success?
|
||||
@@ -84,4 +86,18 @@ class Assistant::Responder
|
||||
def listeners
|
||||
@listeners ||= Hash.new { |h, k| h[k] = [] }
|
||||
end
|
||||
|
||||
def chat_session_id
|
||||
chat&.id&.to_s
|
||||
end
|
||||
|
||||
def chat_user_identifier
|
||||
return unless chat&.user_id
|
||||
|
||||
::Digest::SHA256.hexdigest(chat.user_id.to_s)
|
||||
end
|
||||
|
||||
def chat
|
||||
@chat ||= message.chat
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user