Spaces:
Sleeping
Sleeping
Commit ·
5d9deaa
1
Parent(s): 13d9cb9
Trigger verbosity check on Add More click; fix disabled button styling
Browse files1703 unmodified lines1704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341703 unmodified lines if cat_value.strip(): categories_entered.append(cat_value.strip())
add_col, check_col = st.columns(2) with add_col: if st.session_state.category_count < MAX_CATEGORIES: if st.button("+ Add More", use_container_width=True): st.session_state.category_count += 1 st.rerun() with check_col: if st.button( "Check categories", use_container_width=True, disabled=not categories_entered, help="Use the selected model to flag categories that lack a description or example (1 API call).", ): actual_api_key, provider = get_api_key(model, model_tier, api_key) if not actual_api_key: st.error(f"{provider} API key not configured") else: with st.spinner("Checking categories…"): try: verbosity_result = catllm.check_category_verbosity( categories_entered, api_key=actual_api_key, user_model=model, model_source=get_model_source(model), ) st.session_state.verbosity_check = { 'categories': list(categories_entered), 'result': verbosity_result, } except Exception as e: st.error(f"Verbosity check failed: {e}") st.rerun() if st.session_state.category_count < MAX_CATEGORIES: if st.button("+ Add More", use_container_width=True): # Run a verbosity check on what's been entered so far so the # user gets feedback as they iteratively build their categories. if categories_entered: actual_api_key, provider = get_api_key(model, model_tier, api_key) if actual_api_key: with st.spinner("Checking categories…"): try: verbosity_result = catllm.check_category_verbosity( categories_entered, api_key=actual_api_key, user_model=model, model_source=get_model_source(model), ) st.session_state.verbosity_check = { 'categories': list(categories_entered), 'result': verbosity_result, } except Exception: # Don't block the user from adding a category if the # verbosity check fails (e.g., transient API error). pass st.session_state.category_count += 1 st.rerun()
if categories_entered and has_other_category and not has_other_category(categories_entered): st.warning(177 unmodified lines178179180181182183184185186187188189190191192193194195196197198177 unmodified lines transform: translateY(1px) !important;}
/* Disabled state — keep dark surface, dim the text (overrides Streamlit default white-on-white that's unreadable in dark mode). */.stButton > button:disabled,.stDownloadButton > button:disabled,.stFormSubmitButton > button:disabled,.stButton > button[disabled],.stDownloadButton > button[disabled],.stFormSubmitButton > button[disabled] { background: var(--bg-2) !important; color: var(--text-3) !important; border-color: var(--hairline) !important; box-shadow: none !important; cursor: not-allowed !important;}
.stButton > button[kind="primary"],.stFormSubmitButton > button[kind="primary"] { background: var(--teal) !important;app.py+25-32
theme.py+15