Skip to content

Commit

Permalink
test sim
Browse files Browse the repository at this point in the history
  • Loading branch information
Caerii committed Apr 10, 2023
1 parent 03fb2f0 commit 6071a1d
Showing 1 changed file with 45 additions and 4 deletions.
49 changes: 45 additions & 4 deletions xragents/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,16 @@ def personPlusAi(chr: Character):
# audio.cleanup("recording/ai/", "recording/user/") # delete the temporary files

# return history

def interactive_conversation(scene: Scene):
"""This is a basic conversation between you and n numbers of AI. Choose your session description and what characters you want."""

def twoAiPlusPerson(chr1: Character, chr2: Character):
history = []
with scene as sess:
"""This is a basic conversation between you and an AI. Choose your session description and what characters you want."""
with scene.make_scene(id=utils.next_session(),
name="Contemplations on Entities",
description=f"The following is an entertaining convo between {chr1.name} and {chr2.name} about the nature of artificial and biological entities, on the substance of souls, individuality, agency, and connection.",
characters=[chr1, chr2],
text_only=True,
) as sess:
# Create directories
utils.create_directory("recording/output/", False) # Output should not be cleared
utils.create_directory("recording/ai/") # Clears temporary files there
Expand Down Expand Up @@ -139,4 +144,40 @@ def interactive_conversation(scene: Scene):
# audio.cleanup("recording/ai/", "recording/user/") # delete the temporary files

return history

# def interactive_conversation(scene: Scene):
# """This is a basic conversation between you and n numbers of AI. Choose your session description and what characters you want."""
# history = []
# with scene as sess:
# # Create directories
# utils.create_directory("recording/output/", False) # Output should not be cleared
# utils.create_directory("recording/ai/") # Clears temporary files there
# utils.create_directory("recording/user/") # Clears temporary files there

# shouldntExit = True # conversation will loop until user wants to exit
# print(f"You are now talking with {chr1.name} and {chr2.name}!")
# print(f"Conversation description: {sess.description}")
# #print(f"{chr.name}: {chr.desc} ")
# while shouldntExit: # Keeps looping and listening to the user and gets input from AI as long as "quit" is not said by user
# # latest_record = audio.listen_until_quiet_again() # Audio based user input
# # latest_record = audio.ListenRecord(io.BytesIO(), pathlib.Path("dummy_file.wav"), input("You: ")) # Text based user input
# #print(latest_record.spoken_content)

# # if(latest_record.spoken_content == "quit" or latest_record.spoken_content is None): # Trigger for ending convo, will then concatenate
# # shouldntExit = False

# # latest_record.file_handle.close()

# for chr in sess.characters:
# response = sess.make_speak(chr, chr.primitivePath)
# history.append(setting.DialogHistory(response))

# #print(f"{chr.name}: {response}")

# # Save the audio files to the output directory
# #time.sleep(0.5) # time pause for audio files to be written properly (prevents error)
# # audio.concat_audio_double_directory("recording/ai/", "recording/user/") # the finished audio file is saved
# # audio.cleanup("recording/ai/", "recording/user/") # delete the temporary files

# return history

0 comments on commit 6071a1d

Please sign in to comment.