Skip to content

Commit 5e5fc04

Browse files
dcschreiberclaude
andcommitted
feat: pass is_sefaria_staff to lc-chatbot widget
Compute is_sefaria_staff from existing is_moderator and _email fields and pass it as the is-staff attribute on the lc-chatbot web component for Braintrust trace tagging. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4085672 commit 5e5fc04

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

reader/views.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,12 +355,14 @@ def base_props(request):
355355
chatbot_version = chatbot_version if is_int(chatbot_version) else None
356356

357357
# Chatbot props (passed through base_props for ReaderApp)
358+
is_sefaria_staff = user_data["is_moderator"] or user_data["_email"].endswith("@sefaria.org")
358359
chatbot_data = {
359360
"chatbot_user_token": None,
360361
"chatbot_enabled": False,
361362
"chatbot_api_base_url": CHATBOT_API_BASE_URL,
362363
"chatbot_version": chatbot_version,
363364
"chatbot_origin": f"sefaria-{os.getenv('SENTRY_ENVIRONMENT', 'local')}",
365+
"chatbot_is_sefaria_staff": is_sefaria_staff,
364366
'chatbot_max_input_chars': remoteConfigCache.get(CHATBOT_MAX_INPUT_CHARS, default=500),
365367
'chatbot_welcome_messages': get_chatbot_welcome_messages(),
366368
}

static/js/ReaderApp.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2459,6 +2459,7 @@ toggleSignUpModal(modalContentKind = SignUpModalKind.Default) {
24592459
api-base-url={chatBotApiBaseUrl}
24602460
origin={this.props.chatbot_origin}
24612461
is-moderator={this.props.is_moderator || undefined}
2462+
is-staff={this.props.chatbot_is_sefaria_staff || undefined}
24622463
default-open="false"
24632464
placement="right"
24642465
mode="floating" //this simply defines the initial mode which can be toggled by the user

0 commit comments

Comments
 (0)