Spaces:
Sleeping
Sleeping
Deploy Anti-Hallucination Chat
Browse files- .pytest_cache/v/cache/nodeids +1 -0
- ui/chat.py +15 -14
.pytest_cache/v/cache/nodeids
CHANGED
|
@@ -13,6 +13,7 @@
|
|
| 13 |
"tests/test_audit.py::test_user_judge_scopes_to_current_original_message_not_prior_hi",
|
| 14 |
"tests/test_background.py::test_audit_one_message_publishes_partials",
|
| 15 |
"tests/test_background.py::test_schedule_trivial_audit_completes",
|
|
|
|
| 16 |
"tests/test_evidence.py::test_default_query_carries_message_premises_when_planner_skips_claim",
|
| 17 |
"tests/test_evidence.py::test_fact_check_claims_uses_search_agent",
|
| 18 |
"tests/test_evidence.py::test_fact_check_skips_supported_common_knowledge",
|
|
|
|
| 13 |
"tests/test_audit.py::test_user_judge_scopes_to_current_original_message_not_prior_hi",
|
| 14 |
"tests/test_background.py::test_audit_one_message_publishes_partials",
|
| 15 |
"tests/test_background.py::test_schedule_trivial_audit_completes",
|
| 16 |
+
"tests/test_conversation_table.py::test_hide_audit_keeps_original_conversation_column",
|
| 17 |
"tests/test_evidence.py::test_default_query_carries_message_premises_when_planner_skips_claim",
|
| 18 |
"tests/test_evidence.py::test_fact_check_claims_uses_search_agent",
|
| 19 |
"tests/test_evidence.py::test_fact_check_skips_supported_common_knowledge",
|
ui/chat.py
CHANGED
|
@@ -38,6 +38,10 @@ _COMPOSER_CSS = """
|
|
| 38 |
border-radius: 0.75rem;
|
| 39 |
min-height: 2.75rem;
|
| 40 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
</style>
|
| 42 |
"""
|
| 43 |
|
|
@@ -133,8 +137,8 @@ def _finalize_partial_assistant() -> None:
|
|
| 133 |
def _render_composer() -> str | None:
|
| 134 |
"""Message input + check toggle, pinned to the viewport bottom.
|
| 135 |
|
| 136 |
-
While a
|
| 137 |
-
|
| 138 |
"""
|
| 139 |
st.markdown(_COMPOSER_CSS, unsafe_allow_html=True)
|
| 140 |
with st.bottom:
|
|
@@ -142,15 +146,15 @@ def _render_composer() -> str | None:
|
|
| 142 |
with input_col:
|
| 143 |
prompt = st.chat_input("Message…", key="ah_chat_input")
|
| 144 |
with check_col:
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
st.empty()
|
| 148 |
-
elif st.button(
|
| 149 |
_check_button_label(),
|
| 150 |
type="primary",
|
| 151 |
key="ah_hallucination_check",
|
| 152 |
use_container_width=True,
|
| 153 |
-
|
|
|
|
|
|
|
| 154 |
_toggle_audit_view()
|
| 155 |
return prompt
|
| 156 |
|
|
@@ -159,16 +163,16 @@ def _render_composer() -> str | None:
|
|
| 159 |
def _audit_refresh_fragment() -> None:
|
| 160 |
"""Always-mounted fragment so run_every never targets a missing id.
|
| 161 |
|
| 162 |
-
|
|
|
|
|
|
|
| 163 |
"""
|
| 164 |
active = _sync_background()
|
| 165 |
-
if not st.session_state.show_audit_view:
|
| 166 |
-
return
|
| 167 |
if st.session_state.get("streaming_now"):
|
| 168 |
return
|
| 169 |
|
| 170 |
_render_turn_table()
|
| 171 |
-
if active or _audits_active():
|
| 172 |
st.caption("⏳ Audit stream updating…")
|
| 173 |
|
| 174 |
|
|
@@ -274,6 +278,3 @@ def run_chat() -> None:
|
|
| 274 |
)
|
| 275 |
st.rerun()
|
| 276 |
return
|
| 277 |
-
|
| 278 |
-
if not st.session_state.show_audit_view:
|
| 279 |
-
_render_turn_table()
|
|
|
|
| 38 |
border-radius: 0.75rem;
|
| 39 |
min-height: 2.75rem;
|
| 40 |
}
|
| 41 |
+
[data-testid="stBottomBlockContainer"] [data-testid="column"]:last-child button:disabled {
|
| 42 |
+
opacity: 0.55;
|
| 43 |
+
cursor: not-allowed;
|
| 44 |
+
}
|
| 45 |
</style>
|
| 46 |
"""
|
| 47 |
|
|
|
|
| 137 |
def _render_composer() -> str | None:
|
| 138 |
"""Message input + check toggle, pinned to the viewport bottom.
|
| 139 |
|
| 140 |
+
While a reply is streaming, keep the check button visible but disabled so
|
| 141 |
+
it cannot interrupt generation or vanish from the layout.
|
| 142 |
"""
|
| 143 |
st.markdown(_COMPOSER_CSS, unsafe_allow_html=True)
|
| 144 |
with st.bottom:
|
|
|
|
| 146 |
with input_col:
|
| 147 |
prompt = st.chat_input("Message…", key="ah_chat_input")
|
| 148 |
with check_col:
|
| 149 |
+
streaming = bool(prompt) or bool(st.session_state.get("streaming_now"))
|
| 150 |
+
clicked = st.button(
|
|
|
|
|
|
|
| 151 |
_check_button_label(),
|
| 152 |
type="primary",
|
| 153 |
key="ah_hallucination_check",
|
| 154 |
use_container_width=True,
|
| 155 |
+
disabled=streaming,
|
| 156 |
+
)
|
| 157 |
+
if clicked and not streaming:
|
| 158 |
_toggle_audit_view()
|
| 159 |
return prompt
|
| 160 |
|
|
|
|
| 163 |
def _audit_refresh_fragment() -> None:
|
| 164 |
"""Always-mounted fragment so run_every never targets a missing id.
|
| 165 |
|
| 166 |
+
Always renders the conversation table. ``show_audit_view`` only controls
|
| 167 |
+
whether claims / reasoning columns are included — hiding audit must leave
|
| 168 |
+
the original chat column visible.
|
| 169 |
"""
|
| 170 |
active = _sync_background()
|
|
|
|
|
|
|
| 171 |
if st.session_state.get("streaming_now"):
|
| 172 |
return
|
| 173 |
|
| 174 |
_render_turn_table()
|
| 175 |
+
if st.session_state.show_audit_view and (active or _audits_active()):
|
| 176 |
st.caption("⏳ Audit stream updating…")
|
| 177 |
|
| 178 |
|
|
|
|
| 278 |
)
|
| 279 |
st.rerun()
|
| 280 |
return
|
|
|
|
|
|
|
|
|