RayMelius Claude Sonnet 4.6 commited on
Commit
64eea99
Β·
1 Parent(s): ccac7ac

Fix back view: show whenever movingUp, not just during walk anim

Browse files

Remove scripted conversation fallbacks β€” LLM-only conversations

- drawPerson: change `if (walkAnim && movingUp)` to `if (movingUp)` so
the back view persists as the agent's facing direction, matching how
horizontal facing is maintained when standing still
- conversation.py: revert scripted starters/replies; if LLM is
unavailable initiate_conversation returns None and continue_conversation
ends the exchange β€” no canned dialogue

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (2) hide show
  1. src/soci/actions/conversation.py +5 -21
  2. web/index.html +2 -2
src/soci/actions/conversation.py CHANGED
@@ -3,7 +3,6 @@
3
  from __future__ import annotations
4
 
5
  import logging
6
- import random
7
  from dataclasses import dataclass, field
8
  from typing import Optional, TYPE_CHECKING
9
 
@@ -115,17 +114,9 @@ async def initiate_conversation(
115
  max_tokens=512,
116
  )
117
 
118
- # LLM unavailable β€” use scripted fallback so conversations still animate in the UI
119
  if not result:
120
- starters = [
121
- {"message": f"Hey {target.name}, how's it going?", "topic": "greeting", "inner_thought": "Making small talk."},
122
- {"message": f"Oh, {target.name}! Didn't expect to run into you here.", "topic": "chance meeting", "inner_thought": "Good to see a familiar face."},
123
- {"message": "What have you been up to lately?", "topic": "small talk", "inner_thought": "Curious about their day."},
124
- {"message": "Lovely weather today, isn't it?", "topic": "weather", "inner_thought": "Breaking the ice."},
125
- {"message": f"Hi {target.name}! Have you heard any news lately?", "topic": "news", "inner_thought": "Looking for something to talk about."},
126
- {"message": "I was just thinking about grabbing something to eat. You?", "topic": "food", "inner_thought": "Maybe we can go together."},
127
- ]
128
- result = random.choice(starters)
129
 
130
  message = result.get("message", f"Hey, {target.name}.")
131
  topic = result.get("topic", "small talk")
@@ -196,17 +187,10 @@ async def continue_conversation(
196
  max_tokens=512,
197
  )
198
 
199
- # LLM unavailable β€” scripted response keeps conversation alive in the UI
200
  if not result:
201
- replies = [
202
- {"message": "Ha, yeah, I was just thinking the same thing!", "inner_thought": "Go with the flow.", "sentiment_delta": 0.05, "trust_delta": 0.02},
203
- {"message": "Not too bad, honestly. Just keeping busy.", "inner_thought": "Keep it light.", "sentiment_delta": 0.03, "trust_delta": 0.01},
204
- {"message": "Interesting! Tell me more.", "inner_thought": "Show some curiosity.", "sentiment_delta": 0.04, "trust_delta": 0.02},
205
- {"message": "Yeah, it's been that kind of day.", "inner_thought": "Relate to them.", "sentiment_delta": 0.02, "trust_delta": 0.01},
206
- {"message": "I hear you. Things have been a bit hectic on my end too.", "inner_thought": "Empathize.", "sentiment_delta": 0.04, "trust_delta": 0.03},
207
- {"message": "Good point. I hadn't thought of it that way.", "inner_thought": "Give them credit.", "sentiment_delta": 0.05, "trust_delta": 0.03},
208
- ]
209
- result = random.choice(replies)
210
 
211
  message = result.get("message", "Hmm, interesting.")
212
 
 
3
  from __future__ import annotations
4
 
5
  import logging
 
6
  from dataclasses import dataclass, field
7
  from typing import Optional, TYPE_CHECKING
8
 
 
114
  max_tokens=512,
115
  )
116
 
117
+ # LLM unavailable β€” skip conversation entirely
118
  if not result:
119
+ return None
 
 
 
 
 
 
 
 
120
 
121
  message = result.get("message", f"Hey, {target.name}.")
122
  topic = result.get("topic", "small talk")
 
187
  max_tokens=512,
188
  )
189
 
190
+ # LLM unavailable β€” end conversation cleanly
191
  if not result:
192
+ conversation.is_active = False
193
+ return last_turn
 
 
 
 
 
 
 
194
 
195
  message = result.get("message", "Hmm, interesting.")
196
 
web/index.html CHANGED
@@ -2042,9 +2042,9 @@ function drawPerson(id, agent, globalIdx, W, H) {
2042
  return;
2043
  }
2044
 
2045
- if (walkAnim && movingUp) {
2046
  // ══════════════════════════════════════════════════════════
2047
- // BACK VIEW β€” agent walking away (toward top of screen)
2048
  // Same figure as front view but no face; hair covers back.
2049
  // ══════════════════════════════════════════════════════════
2050
  const twB = gender === 'female' ? 7 : 8;
 
2042
  return;
2043
  }
2044
 
2045
+ if (movingUp) {
2046
  // ══════════════════════════════════════════════════════════
2047
+ // BACK VIEW β€” agent moving/facing toward top of screen
2048
  // Same figure as front view but no face; hair covers back.
2049
  // ══════════════════════════════════════════════════════════
2050
  const twB = gender === 'female' ? 7 : 8;