33Handles conversation memory, Bedrock queries, and responding back to Slack
44"""
55
6- import decimal
76import re
87import time
98import traceback
@@ -235,6 +234,7 @@ def _create_citation(citation: dict[str, str], feedback_data: dict, response_tex
235234
236235 # Buttons can only be 75 characters long, truncate to be safe
237236 button_text = f"[{ source_number } ] { title } "
237+ button_value = {** feedback_data , "source_number" : source_number , "title" : title , "body" : body , "score" : score }
238238 button = {
239239 "type" : "button" ,
240240 "text" : {
@@ -243,7 +243,7 @@ def _create_citation(citation: dict[str, str], feedback_data: dict, response_tex
243243 },
244244 "action_id" : f"cite_{ source_number } " ,
245245 "value" : json .dumps (
246- { ** feedback_data , "source_number" : source_number , "title" : title , "body" : body , "score" : decimal ( score )} ,
246+ button_value ,
247247 separators = ("," , ":" ),
248248 ),
249249 }
@@ -252,6 +252,7 @@ def _create_citation(citation: dict[str, str], feedback_data: dict, response_tex
252252 # Update inline citations to remove "cit_" prefix
253253 response_text = response_text .replace (f"[cit_{ source_number } ]" , f"[{ source_number } ]" )
254254
255+ logger .info ("Created citation" , extra = button_value )
255256 return {"action_buttons" : action_buttons , "response_text" : response_text }
256257
257258
0 commit comments