linxinhua commited on
Commit
f0e53d6
·
verified ·
1 Parent(s): 154cce1

Fix auto-restart watchdog strptime: log filenames now include _<sessioncode> suffix; parse only the YYYYMMDD_HHMMSS prefix so idle check succeeds.

Browse files
Files changed (2) hide show
  1. README.md +49 -12
  2. app.py +3 -1
README.md CHANGED
@@ -1,12 +1,49 @@
1
- ---
2
- title: C
3
- emoji: 📚
4
- colorFrom: gray
5
- colorTo: blue
6
- sdk: gradio
7
- sdk_version: 6.11.0
8
- python_version: '3.14'
9
- app_file: app.py
10
- pinned: false
11
- short_description: LaLaLab
12
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: v5 · AI Ethics HOT — No-AI Control
3
+ emoji: 📚
4
+ colorFrom: gray
5
+ colorTo: blue
6
+ sdk: gradio
7
+ sdk_version: 6.11.0
8
+ python_version: "3.14"
9
+ app_file: app.py
10
+ pinned: false
11
+ short_description: "v4 · No-AI control — read case-discussion chapters"
12
+ ---
13
+
14
+ # v5 · AI Ethics HOT — No-AI Control (Reading Condition)
15
+
16
+ Research-instrument app for the No-AI control arm of an RCT on critical-thinking transfer.
17
+
18
+ The participant:
19
+ 1. Reads an AI ethics case.
20
+ 2. Writes an initial 150-250 word argument.
21
+ 3. Reads from a set of 9 short chapters that walk through the case from different angles. Chapters are browsable in any order. Reading time ~20-30 min if read fully; participants can skim.
22
+ 4. Ends the session.
23
+
24
+ There is no chat. No LLM is called. The chapters are the same body of substantive content the AI bot conditions (Socratic / Explanatory) draw from — only the *delivery modality* differs across the three conditions, which is the experimental IV.
25
+
26
+ ## Configuration
27
+
28
+ Runtime is controlled by Space Secrets:
29
+
30
+ | Secret | Purpose |
31
+ |---|---|
32
+ | `API_KEY` | OpenAI API key (used at submit-confirm to generate the per-session essay; same generator as the bot conditions) |
33
+ | `HF_access` | HF token with write scope (logger uploads to `AE-Talk-bot/log`) |
34
+ | `RUN_MODE` | `test` / `pilot` / `prod` — picks the dataset bucket: `HOT/no_ai/<RUN_MODE>/` |
35
+
36
+ ## Logs
37
+
38
+ Every session writes one JSON to `AE-Talk-bot/log/v5-HOT/no_ai/<RUN_MODE>/<session_id>.json`
39
+ containing the participant's submitted argument and a `nav_events` list (which
40
+ chapters were opened and in what order). The schema is identical to the
41
+ Socratic / Explanatory Spaces (Schema 1.0) except `turns` is empty and
42
+ `nav_events` carries the interaction record.
43
+
44
+ ## Architecture
45
+
46
+ - `app.py` — Gradio UI: chatbot panel for case + chapter display, vertical TOC button column, disabled chat input row, action buttons
47
+ - `core/` — config loading, HF logger (with `add_nav_event` method), content sync
48
+ - `content/case_1.md` — case prompt (same as other Spaces)
49
+ - `content/chapters/` — 9 chapters (auto-mirrored from `AI_Ethic_HOT_chatbot/shared_content/` SSOT)
app.py CHANGED
@@ -2500,7 +2500,9 @@ def _start_auto_restart():
2500
  )
2501
  if log_files:
2502
  latest = log_files[-1].rsplit("/", 1)[-1].removesuffix(".json")
2503
- latest_dt = datetime.strptime(latest, "%Y%m%d_%H%M%S").replace(tzinfo=AEST)
 
 
2504
  idle_h = (now - latest_dt).total_seconds() / 3600
2505
  src = f"latest log {latest}"
2506
  else:
 
2500
  )
2501
  if log_files:
2502
  latest = log_files[-1].rsplit("/", 1)[-1].removesuffix(".json")
2503
+ # Filenames are "<YYYYMMDD>_<HHMMSS>_<session_code>" — strptime the timestamp only.
2504
+ ts = "_".join(latest.split("_")[:2])
2505
+ latest_dt = datetime.strptime(ts, "%Y%m%d_%H%M%S").replace(tzinfo=AEST)
2506
  idle_h = (now - latest_dt).total_seconds() / 3600
2507
  src = f"latest log {latest}"
2508
  else: