Skip to content

Commit 0fe5ee7

Browse files
committed
Fix some hardcoded Sarah
1 parent 57e1dc4 commit 0fe5ee7

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

experiment/components/ChatPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export default function ChatPanel({ onNewMessage }: ChatPanelProps) {
125125
}
126126
}, [messages.length, setMessages, scenario.chat.initialMessages]);
127127

128-
// Proactive follow-up timer: if user hasn't sent a message after FOLLOWUP_DELAY_MS, Sarah sends a nudge
128+
// Proactive follow-up timer: if user hasn't sent a message after FOLLOWUP_DELAY_MS, colleague sends a nudge
129129
useEffect(() => {
130130
// Check if user has sent any real messages (beyond the initial empty one)
131131
const userHasSentMessage = messages.some(

experiment/components/study/TaskPage.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,22 @@ import AIPanel from '@/components/AIPanel';
88
import ChatPanel from '@/components/ChatPanel';
99
import WritingArea from '@/components/WritingArea';
1010
import { log } from '@/lib/logging';
11-
import { letterToCondition } from '@/lib/studyConfig';
11+
import { letterToCondition, getScenario } from '@/lib/studyConfig';
1212

1313
export default function TaskPage() {
1414
const searchParams = useSearchParams();
1515
const writingAreaRef = useRef<WritingAreaRef>(null);
1616
const username = searchParams.get('username') || '';
1717
const conditionCode = (searchParams.get('condition') || 'n') as keyof typeof letterToCondition; // TODO: don't default!
1818
const condition = letterToCondition[conditionCode];
19+
const scenarioId = searchParams.get('scenario') || undefined;
20+
const scenario = getScenario(scenarioId);
1921

2022
// Collapsible chat state
2123
const [isChatOpen, setIsChatOpen] = useState(false);
2224
const [hasUnread, setHasUnread] = useState(false);
2325

24-
// Auto-expand chat after a short delay so participants see Sarah's messages
26+
// Auto-expand chat after a short delay so participants see the colleague's messages
2527
useEffect(() => {
2628
const delayTime = 1000; // 1 second
2729
const timer = setTimeout(() => {
@@ -88,7 +90,7 @@ export default function TaskPage() {
8890
{isChatOpen ? (
8991
<>
9092
<div className="flex items-center gap-2 font-semibold text-gray-700 text-sm">
91-
<span>Chat with Sarah</span>
93+
<span>Chat with {scenario.colleague.firstName}</span>
9294
</div>
9395
<button
9496
type="button"
@@ -109,10 +111,10 @@ export default function TaskPage() {
109111
setIsChatOpen(true);
110112
}}
111113
className="flex-1 flex items-center justify-between hover:bg-gray-50 -mx-4 px-4 h-full cursor-pointer rounded-t-lg"
112-
aria-label="Open chat with Sarah"
114+
aria-label={`Open chat with ${scenario.colleague.firstName}`}
113115
>
114116
<div className="flex items-center gap-2 font-semibold text-gray-700 text-sm">
115-
<span>Chat with Sarah</span>
117+
<span>Chat with {scenario.colleague.firstName}</span>
116118
{hasUnread && (
117119
<span className="flex h-5 w-5 items-center justify-center rounded-full bg-red-500 text-[10px] font-bold text-white shadow-sm">
118120
1

experiment/lib/messageTiming.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
22
* Calculate realistic timing for message delays based on message length.
33
*
4-
* Thinking/Reading: Sarah takes time proportional to what the user wrote (40-80 chars/sec)
5-
* Typing: Sarah types her response proportional to what she's typing (40-80 chars/sec)
4+
* Thinking/Reading: colleague takes time proportional to what the user wrote (40-80 chars/sec)
5+
* Typing: colleague types her response proportional to what she's typing (40-80 chars/sec)
66
* Both use ±300ms variation
77
*/
88

0 commit comments

Comments
 (0)