Spaces:
Sleeping

byte-vortex commited on
Commit
624ae2f
·
verified ·
1 Parent(s): f16b410

Deploy Myco from CI

Browse files
Files changed (1) hide show
  1. game/engine.py +8 -10
game/engine.py CHANGED
@@ -693,20 +693,18 @@ def eat_current(current=None, collection=None, history=None):
693
 
694
 
695
  # Updated get_myco_narrative to use the real engine
 
696
  def get_myco_narrative():
697
- """
698
- Asks the AI to generate a short, whimsical mushroom-related thought
699
- using the established Myco engine.
700
- """
701
- prompt = "Write a very short, friendly, under 80-character thought about mushrooms or the forest."
702
-
703
- # We call your actual _llm engine
704
- # Passing an empty dict for context since this is a global thought
705
  reply = _llm(prompt, context={})
706
 
707
- # Fallback to the 'dreaming' message if the AI fails
708
  if not reply:
709
  return "The mycelium is dreaming... ✨"
710
 
711
- return reply[:80]
 
 
 
 
 
712
 
 
693
 
694
 
695
  # Updated get_myco_narrative to use the real engine
696
+
697
  def get_myco_narrative():
698
+ prompt = "Write a very short, friendly thought about mushrooms or the forest."
 
 
 
 
 
 
 
699
  reply = _llm(prompt, context={})
700
 
 
701
  if not reply:
702
  return "The mycelium is dreaming... ✨"
703
 
704
+ # Attempt to extract just the 'thought' field if it's JSON
705
+ try:
706
+ data = json.loads(reply)
707
+ return data.get("thought", reply) # Return 'thought' if it exists, else raw reply
708
+ except:
709
+ return reply # Return raw if it's not JSON
710