Spaces:
Sleeping
Sleeping
Commit ·
5d9deaa
1
Parent(s): 13d9cb9
Trigger verbosity check on Add More click; fix disabled button styling
Browse files1703 unmodified lines170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411703 unmodified linesif 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 += 1st.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 categories_entered and has_other_category and not has_other_category(categories_entered):st.warning(1703 unmodified lines17041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341703 unmodified linesif cat_value.strip():categories_entered.append(cat_value.strip())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).passst.session_state.category_count += 1st.rerun()if categories_entered and has_other_category and not has_other_category(categories_entered):st.warning(
177 unmodified lines178179180181182183177 unmodified linestransform: translateY(1px) !important;}.stButton > button[kind="primary"],.stFormSubmitButton > button[kind="primary"] {background: var(--teal) !important;177 unmodified lines178179180181182183184185186187188189190191192193194195196197198177 unmodified linestransform: translateY(1px) !important;}/* Disabled state — keep dark surface, dim the text (overrides Streamlitdefault 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