Skip to content

Commit

Permalink
only show thinking when not in a conversation
Browse files Browse the repository at this point in the history
  • Loading branch information
ianmacartney committed Aug 14, 2023
1 parent 529e588 commit 8833c10
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/Player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type { Player as PlayerState, Pose } from '../../convex/schema';
import { Character } from './Character';

const SpeechDurationMs = 2000;
const SpokeRecentlyMs = 5_000;

export type SelectPlayer = (playerState: PlayerState) => void;

Expand Down Expand Up @@ -47,7 +48,10 @@ export const Player = ({
isMoving={
playerState.motion.type === 'walking' && playerState.motion.targetEndTs >= time.current
}
isThinking={playerState.thinking}
isThinking={
playerState.thinking &&
(playerState.lastChat?.message.ts ?? 0) < time.current - SpokeRecentlyMs
}
isSpeaking={
playerState.lastChat?.message.type === 'responded' &&
(playerState.lastChat.message.ts ?? 0) > time.current - SpeechDurationMs
Expand Down

0 comments on commit 8833c10

Please sign in to comment.