Spaces:
Sleeping
Sleeping
Commit ·
5d9deaa
1
Parent(s): 13d9cb9
Trigger verbosity check on Add More click; fix disabled button styling
Browse files
app.py
CHANGED
|
@@ -1704,38 +1704,31 @@ with col_input:
|
|
| 1704 |
if cat_value.strip():
|
| 1705 |
categories_entered.append(cat_value.strip())
|
| 1706 |
|
| 1707 |
-
|
| 1708 |
-
|
| 1709 |
-
|
| 1710 |
-
|
| 1711 |
-
|
| 1712 |
-
|
| 1713 |
-
|
| 1714 |
-
|
| 1715 |
-
|
| 1716 |
-
|
| 1717 |
-
|
| 1718 |
-
|
| 1719 |
-
|
| 1720 |
-
|
| 1721 |
-
|
| 1722 |
-
|
| 1723 |
-
|
| 1724 |
-
|
| 1725 |
-
|
| 1726 |
-
|
| 1727 |
-
|
| 1728 |
-
|
| 1729 |
-
|
| 1730 |
-
|
| 1731 |
-
|
| 1732 |
-
st.session_state.verbosity_check = {
|
| 1733 |
-
'categories': list(categories_entered),
|
| 1734 |
-
'result': verbosity_result,
|
| 1735 |
-
}
|
| 1736 |
-
except Exception as e:
|
| 1737 |
-
st.error(f"Verbosity check failed: {e}")
|
| 1738 |
-
st.rerun()
|
| 1739 |
|
| 1740 |
if categories_entered and has_other_category and not has_other_category(categories_entered):
|
| 1741 |
st.warning(
|
|
|
|
| 1704 |
if cat_value.strip():
|
| 1705 |
categories_entered.append(cat_value.strip())
|
| 1706 |
|
| 1707 |
+
if st.session_state.category_count < MAX_CATEGORIES:
|
| 1708 |
+
if st.button("+ Add More", use_container_width=True):
|
| 1709 |
+
# Run a verbosity check on what's been entered so far so the
|
| 1710 |
+
# user gets feedback as they iteratively build their categories.
|
| 1711 |
+
if categories_entered:
|
| 1712 |
+
actual_api_key, provider = get_api_key(model, model_tier, api_key)
|
| 1713 |
+
if actual_api_key:
|
| 1714 |
+
with st.spinner("Checking categories…"):
|
| 1715 |
+
try:
|
| 1716 |
+
verbosity_result = catllm.check_category_verbosity(
|
| 1717 |
+
categories_entered,
|
| 1718 |
+
api_key=actual_api_key,
|
| 1719 |
+
user_model=model,
|
| 1720 |
+
model_source=get_model_source(model),
|
| 1721 |
+
)
|
| 1722 |
+
st.session_state.verbosity_check = {
|
| 1723 |
+
'categories': list(categories_entered),
|
| 1724 |
+
'result': verbosity_result,
|
| 1725 |
+
}
|
| 1726 |
+
except Exception:
|
| 1727 |
+
# Don't block the user from adding a category if the
|
| 1728 |
+
# verbosity check fails (e.g., transient API error).
|
| 1729 |
+
pass
|
| 1730 |
+
st.session_state.category_count += 1
|
| 1731 |
+
st.rerun()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1732 |
|
| 1733 |
if categories_entered and has_other_category and not has_other_category(categories_entered):
|
| 1734 |
st.warning(
|
theme.py
CHANGED
|
@@ -178,6 +178,21 @@ html, body,
|
|
| 178 |
transform: translateY(1px) !important;
|
| 179 |
}
|
| 180 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
.stButton > button[kind="primary"],
|
| 182 |
.stFormSubmitButton > button[kind="primary"] {
|
| 183 |
background: var(--teal) !important;
|
|
|
|
| 178 |
transform: translateY(1px) !important;
|
| 179 |
}
|
| 180 |
|
| 181 |
+
/* Disabled state — keep dark surface, dim the text (overrides Streamlit
|
| 182 |
+
default white-on-white that's unreadable in dark mode). */
|
| 183 |
+
.stButton > button:disabled,
|
| 184 |
+
.stDownloadButton > button:disabled,
|
| 185 |
+
.stFormSubmitButton > button:disabled,
|
| 186 |
+
.stButton > button[disabled],
|
| 187 |
+
.stDownloadButton > button[disabled],
|
| 188 |
+
.stFormSubmitButton > button[disabled] {
|
| 189 |
+
background: var(--bg-2) !important;
|
| 190 |
+
color: var(--text-3) !important;
|
| 191 |
+
border-color: var(--hairline) !important;
|
| 192 |
+
box-shadow: none !important;
|
| 193 |
+
cursor: not-allowed !important;
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
.stButton > button[kind="primary"],
|
| 197 |
.stFormSubmitButton > button[kind="primary"] {
|
| 198 |
background: var(--teal) !important;
|