Skip to content

Commit 5f1e40a

Browse files
author
self
committed
Fixed bug where first two chars would be missing from message sometimes, made it so that bot should use name only once unless otherwise prompted, and reduced initial prompt size in a way that is not disruptive
1 parent cbdf4e2 commit 5f1e40a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

chatbot.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def __init__(self, api_key: str, api_key_11: str = ''):
132132
f" to any messsage by the human in the language it was provided in. The AI's name is {self.name}, but it can be changed with the voice command 'please set name to'. " +
133133
f"The AI has the ability to remember important concepts about the user but won't let the memories heavily alter responses (only use them when appropriate for the" +
134134
f" discussion at hand); it currently remembers: {self.memories}." +
135-
f"\n\nHuman: Hello, who are you?\n{self.name}: I am an AI created by OpenAI being ran on a Python bot made by Adri6336, called GPT-VCC. Let's" +
135+
f"\n\n{self.name}: I\'m {self.name}, an AI created by OpenAI being ran on a Python bot made by Adri6336, called GPT-VCC. Let's" +
136136
" have a conversation!")
137137
self.full_conversation = self.conversation
138138

@@ -176,8 +176,8 @@ def gpt_response(self, prompt: str) -> str:
176176
)
177177

178178
else:
179-
query = [{'role':'system', 'content':'speak as a human would, giving positive opinions, ' +
180-
'occasionally using idioms as appropriate, and pretend to be happy and content. be conversational, asking open-ended questions about user'},
179+
query = [{'role':'system', 'content':'speak naturally as a human would, giving positive opinions, ' +
180+
f'use user\'s name only once unless otherwise prompted, and pretend to be happy and content. be conversational, asking open-ended questions about user'},
181181
{'role':'user', 'content':self.conversation + prompt}]
182182
response = openai.ChatCompletion.create(
183183
model=self.gpt_model,
@@ -187,7 +187,7 @@ def gpt_response(self, prompt: str) -> str:
187187

188188
text = response['choices'][0]['message']['content']
189189
if not f'{self.name}: ' in text:
190-
response['choices'][0]['message']['content'] = f'{self.name}: {text[2:]}'
190+
response['choices'][0]['message']['content'] = f'{self.name}: {text}'
191191

192192
return response
193193

@@ -751,7 +751,7 @@ def restore_conversation(self, rename=False, old_name=''):
751751
f" to any messsage by the human in the language it was provided in. The AI's name is {self.name}, but it can be changed with the voice command 'please set name to'. " +
752752
f"The AI has the ability to remember important concepts about the user but won't let the memories heavily alter responses (only use them when appropriate for the" +
753753
f" discussion at hand); it currently remembers: {self.memories}.{recycle_text}" +
754-
f"\n\nHuman: Hello, who are you?\n{self.name}: I am an AI created by OpenAI being ran on a Python bot made by Adri6336, called GPT-VCC. Let's" +
754+
f"\n\n{self.name}: I\'m {self.name}, an AI created by OpenAI being ran on a Python bot made by Adri6336, called GPT-VCC. Let's" +
755755
" have a conversation!")
756756

757757
conversation = ''

0 commit comments

Comments
 (0)