TheExplainthis / ChatGPT-Line-Bot

This is a repository that allows you to integrate ChatGPT into Line.
MIT License
1.53k stars 1.86k forks source link

can only run when removed system message #9

Closed chiachichi closed 1 year ago

chiachichi commented 1 year ago

As the title: the code can only run when I removed initialize func

def initialize(self, user_id: str):
    self.storage[user_id] = [{
        'role': 'system', 'content': self.system_message
    }]
TheExplainthis commented 1 year ago

Could you please share the error message? Thank you.

sidneyzz commented 1 year ago

As a new environment variable SYSTEM_MESSAGE has been added in the updated gpt-3.5-turbo model(5eda54d) version, if this environment variable is not added in the secret of Replit, it will result in an openai.error.InvalidRequestError: None is not of type 'string' - 'messages.0.content' error.

TheExplainthis commented 1 year ago

Other than setting the Environment Variable, is there an update to the code for version v1.1.0? The main difference is that the old version uses text completion while the new version uses chat completion, so there are changes in the code as well.