Skip to content

Commit afe9dcf

Browse files
committed
Allow multiple entries per user when text feedback
1 parent 66d5f67 commit afe9dcf

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

packages/slackBotFunction/app/slack/slack_events.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def process_async_slack_event(slack_event_data):
126126
)
127127
return
128128

129-
# Reformulate query for better RAG retrieval using Claude
129+
# Reformulate query for better RAG retrieval
130130
reformulated_query = reformulate_query(logger, user_query)
131131

132132
# Check if we have an existing Bedrock conversation session
@@ -249,11 +249,16 @@ def store_feedback(
249249
if not message_ts:
250250
message_ts = get_latest_message_ts(conversation_key)
251251

252-
if message_ts:
253-
# Per-message feedback with deduplication
252+
if message_ts and feedback_type in ["positive", "negative"]:
253+
# Per-message feedback with deduplication for button votes only
254254
pk = f"{FEEDBACK_PREFIX_KEY}{conversation_key}#{message_ts}"
255255
sk = f"{USER_PREFIX}{user_id}"
256256
condition = "attribute_not_exists(pk) AND attribute_not_exists(sk)" # Prevent double-voting
257+
elif message_ts:
258+
# Text feedback allows multiple entries per user
259+
pk = f"{FEEDBACK_PREFIX_KEY}{conversation_key}#{message_ts}"
260+
sk = f"{USER_PREFIX}{user_id}{NOTE_SUFFIX}{now}"
261+
condition = None
257262
else:
258263
# Fallback for conversation-level feedback
259264
pk = f"{FEEDBACK_PREFIX_KEY}{conversation_key}"

0 commit comments

Comments
 (0)