Skip to content

Commit e55054c

Browse files
committed
fix: Resolve UnboundLocalError for is_validator_count_question
- Renamed local variable from is_validator_count_question to is_validator_count_query - This fixes the conflict where the imported function and local variable had the same name - Python was treating it as a local variable before assignment, causing UnboundLocalError Fixes: cannot access local variable 'is_validator_count_question' where it is not associated with a value
1 parent dcd8023 commit e55054c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

backend/api/routers/chat_router.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ async def chat_with_rag(request: Request, chat_request: ChatRequest):
464464

465465
# CRITICAL: Detect validator count questions for special handling
466466
# We will force-inject manifest and use lower similarity threshold, NOT hardcode
467-
is_validator_count_question = is_validator_count_question(chat_request.message)
467+
is_validator_count_query = is_validator_count_question(chat_request.message)
468468

469469
# EXTERNAL DATA LAYER: Check for external data queries (weather, news, etc.)
470470
# This bypasses RAG and fetches real-time data from external APIs
@@ -985,7 +985,7 @@ def get_language_name(lang_code: str) -> str:
985985
chat_request=chat_request,
986986
rag_retrieval=rag_retrieval,
987987
is_origin_query=is_origin_query,
988-
is_validator_count_question=is_validator_count_question,
988+
is_validator_count_question=is_validator_count_query,
989989
is_stillme_query=is_stillme_query,
990990
is_news_article_query=is_news_article_query,
991991
is_philosophical=is_philosophical,
@@ -3021,7 +3021,7 @@ def estimate_tokens(text: str) -> int:
30213021
chat_request=chat_request,
30223022
context=context,
30233023
is_philosophical=is_philosophical,
3024-
is_validator_count_question=is_validator_count_question,
3024+
is_validator_count_question=is_validator_count_query,
30253025
is_origin_query=is_origin_query,
30263026
is_stillme_query=is_stillme_query,
30273027
detected_lang_name=detected_lang_name,

0 commit comments

Comments
 (0)