Skip to content

Commit 9f506ef

Browse files
committed
prompt tweaks
1 parent 6fdd314 commit 9f506ef

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

app/controllers/conversation_controller.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,25 @@ def character_landing
99
end
1010

1111
def export
12+
name = open_characters_persona_params.fetch('name', 'New character').strip
13+
personality = open_characters_persona_params.fetch('personality', '')
14+
description = open_characters_persona_params.fetch('description', '')
15+
1216
add_character_hash = base_open_characters_export.merge({
13-
"name": open_characters_persona_params.fetch('name', 'New character'),
14-
"roleInstruction": "You are to act as #{@character.name}, whos personality is detailed below:\n\n#{description_for_character}",
15-
"reminderMessage": "#{personality_for_character} Do not break character!",
17+
"name": name,
18+
"roleInstruction": "You are to act as #{name}, whos personality is detailed below:\n\n#{description}",
19+
"reminderMessage": "#{personality}\n\nDo not break character!",
1620
})
1721

1822
# Add a character image if one has been uploaded to the page
1923
avatar = @character.random_image_including_private
2024
add_character_hash[:avatar][:url] = avatar if avatar.present?
2125

2226
# Redirect to OpenCharacters
23-
2427
base_oc_url = 'https://josephrocca.github.io/OpenCharacters/'
2528
oc_params = { addCharacter: add_character_hash }
2629

27-
redirect_to "#{base_oc_url}##{ERB::Util.url_encode(oc_params)}"
30+
redirect_to "#{base_oc_url}##{ERB::Util.url_encode(oc_params.to_json)}"
2831
end
2932

3033
private

0 commit comments

Comments
 (0)