Gregory-L commited on
Commit
2673d16
·
verified ·
1 Parent(s): a709b7a

fix: session key store name collided with SessionState.keys(); hidden header buttons

Browse files
app/draiml/state.py CHANGED
@@ -16,6 +16,7 @@ async def evidence_index() -> rag.EvidenceIndex | None:
16
  _index = await rag.load()
17
  except Exception as e: # offline, Hub hiccup — consultation still works without evidence
18
  st.warning(f"Evidence index unavailable ({e}); answering without citations.")
 
19
  return None
20
  return _index
21
 
@@ -25,7 +26,7 @@ def init():
25
  ss.setdefault("history", [])
26
  ss.setdefault("engine", "hf")
27
  ss.setdefault("model", "openai/gpt-oss-120b")
28
- ss.setdefault("keys", {})
29
  ss.setdefault("custom_url", "http://localhost:11434/v1")
30
  ss.setdefault("second_on", False)
31
  ss.setdefault("model2", "Qwen/Qwen3-235B-A22B-Instruct-2507")
@@ -34,5 +35,5 @@ def init():
34
  def key_for(engine: str) -> str | None:
35
  ss = st.session_state
36
  if engine == "hf":
37
- return ss.keys.get("hf") or ss.get("hf_token") or None
38
- return ss.keys.get(engine) or None
 
16
  _index = await rag.load()
17
  except Exception as e: # offline, Hub hiccup — consultation still works without evidence
18
  st.warning(f"Evidence index unavailable ({e}); answering without citations.")
19
+ st.exception(e)
20
  return None
21
  return _index
22
 
 
26
  ss.setdefault("history", [])
27
  ss.setdefault("engine", "hf")
28
  ss.setdefault("model", "openai/gpt-oss-120b")
29
+ ss.setdefault("api_keys", {})
30
  ss.setdefault("custom_url", "http://localhost:11434/v1")
31
  ss.setdefault("second_on", False)
32
  ss.setdefault("model2", "Qwen/Qwen3-235B-A22B-Instruct-2507")
 
35
  def key_for(engine: str) -> str | None:
36
  ss = st.session_state
37
  if engine == "hf":
38
+ return ss.api_keys.get("hf") or ss.get("hf_token") or None
39
+ return ss.api_keys.get(engine) or None
app/manifest.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "build": "9c4a70772809",
3
  "requirements": [],
4
  "files": [
5
  "app.py",
 
1
  {
2
+ "build": "4cc1e9e219d5",
3
  "requirements": [],
4
  "files": [
5
  "app.py",
app/views/consult.py CHANGED
@@ -45,9 +45,9 @@ with st.sidebar:
45
  ss.custom_url = st.text_input("Base URL (OpenAI-compatible /v1)", ss.custom_url)
46
  ss.model = model_picker("Model", ss.engine, ss.model, "model_pick")
47
  if not (ss.engine == "hf" and ss.get("hf_oauth")):
48
- k = st.text_input(ep.key_label, value=ss.keys.get(ss.engine, ""), type="password", help=ep.key_help)
49
- if k != ss.keys.get(ss.engine, ""):
50
- ss.keys[ss.engine] = k.strip()
51
  if ss.engine == "hf" and not k:
52
  st.caption("…or use **Sign in with Hugging Face** in the top bar.")
53
  if ss.engine == "custom":
 
45
  ss.custom_url = st.text_input("Base URL (OpenAI-compatible /v1)", ss.custom_url)
46
  ss.model = model_picker("Model", ss.engine, ss.model, "model_pick")
47
  if not (ss.engine == "hf" and ss.get("hf_oauth")):
48
+ k = st.text_input(ep.key_label, value=ss.api_keys.get(ss.engine, ""), type="password", help=ep.key_help)
49
+ if k != ss.api_keys.get(ss.engine, ""):
50
+ ss.api_keys[ss.engine] = k.strip()
51
  if ss.engine == "hf" and not k:
52
  st.caption("…or use **Sign in with Hugging Face** in the top bar.")
53
  if ss.engine == "custom":
index.html CHANGED
@@ -32,6 +32,7 @@
32
  .brand small { font-weight: 500; color: var(--muted); font-size: 0.8rem; }
33
  .spacer { flex: 1; }
34
  .who { color: var(--muted); font-size: 0.9rem; }
 
35
  button.hf { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface);
36
  color: var(--ink); border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 0.9rem; cursor: pointer; }
37
  button.hf.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
 
32
  .brand small { font-weight: 500; color: var(--muted); font-size: 0.8rem; }
33
  .spacer { flex: 1; }
34
  .who { color: var(--muted); font-size: 0.9rem; }
35
+ [hidden] { display: none !important; }
36
  button.hf { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface);
37
  color: var(--ink); border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 0.9rem; cursor: pointer; }
38
  button.hf.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }