Closed nicodemuz closed 1 week ago
how do you replicate this type of error? the project is working on php 8.2 so I don't know where you have this error.
by the way it's a symfony project, not laravel.
for now I've updated this project with a custom symfony cache.
I was able to replicate it by asking it a question (to init a conversation).
{
"type": "https:\/\/tools.ietf.org\/html\/rfc2616#section-10",
"title": "An error occurred",
"status": 500,
"detail": "Cannot assign Laravel\\SerializableClosure\\Serializers\\Native to property Symfony\\Component\\HttpFoundation\\Session\\SessionBagProxy::$usageReporter of type ?Closure",
"class": "TypeError",
"trace": [
{
"namespace": "",
"short_class": "",
"class": "",
"type": "",
"function": "",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/laravel\/serializable-closure\/src\/Serializers\/Native.php",
"line": 287,
"args": []
},
{
"namespace": "",
"short_class": "ReflectionProperty",
"class": "ReflectionProperty",
"type": "->",
"function": "setValue",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/laravel\/serializable-closure\/src\/Serializers\/Native.php",
"line": 287,
"args": []
},
{
"namespace": "Laravel\\SerializableClosure\\Serializers",
"short_class": "Native",
"class": "Laravel\\SerializableClosure\\Serializers\\Native",
"type": "::",
"function": "wrapClosures",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/laravel\/serializable-closure\/src\/Serializers\/Native.php",
"line": 228,
"args": []
},
{
"namespace": "Laravel\\SerializableClosure\\Serializers",
"short_class": "Native",
"class": "Laravel\\SerializableClosure\\Serializers\\Native",
"type": "::",
"function": "wrapClosures",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/laravel\/serializable-closure\/src\/Serializers\/Native.php",
"line": 284,
"args": []
},
{
"namespace": "Laravel\\SerializableClosure\\Serializers",
"short_class": "Native",
"class": "Laravel\\SerializableClosure\\Serializers\\Native",
"type": "::",
"function": "wrapClosures",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/laravel\/serializable-closure\/src\/Serializers\/Native.php",
"line": 284,
"args": []
},
{
"namespace": "Laravel\\SerializableClosure\\Serializers",
"short_class": "Native",
"class": "Laravel\\SerializableClosure\\Serializers\\Native",
"type": "::",
"function": "wrapClosures",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/laravel\/serializable-closure\/src\/Serializers\/Native.php",
"line": 284,
"args": []
},
{
"namespace": "Laravel\\SerializableClosure\\Serializers",
"short_class": "Native",
"class": "Laravel\\SerializableClosure\\Serializers\\Native",
"type": "::",
"function": "wrapClosures",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/laravel\/serializable-closure\/src\/Serializers\/Native.php",
"line": 228,
"args": []
},
{
"namespace": "Laravel\\SerializableClosure\\Serializers",
"short_class": "Native",
"class": "Laravel\\SerializableClosure\\Serializers\\Native",
"type": "::",
"function": "wrapClosures",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/laravel\/serializable-closure\/src\/Serializers\/Native.php",
"line": 284,
"args": []
},
{
"namespace": "Laravel\\SerializableClosure\\Serializers",
"short_class": "Native",
"class": "Laravel\\SerializableClosure\\Serializers\\Native",
"type": "::",
"function": "wrapClosures",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/laravel\/serializable-closure\/src\/Serializers\/Native.php",
"line": 284,
"args": []
},
{
"namespace": "Laravel\\SerializableClosure\\Serializers",
"short_class": "Native",
"class": "Laravel\\SerializableClosure\\Serializers\\Native",
"type": "::",
"function": "wrapClosures",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/laravel\/serializable-closure\/src\/Serializers\/Native.php",
"line": 228,
"args": []
},
{
"namespace": "Laravel\\SerializableClosure\\Serializers",
"short_class": "Native",
"class": "Laravel\\SerializableClosure\\Serializers\\Native",
"type": "::",
"function": "wrapClosures",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/laravel\/serializable-closure\/src\/Serializers\/Native.php",
"line": 284,
"args": []
},
{
"namespace": "Laravel\\SerializableClosure\\Serializers",
"short_class": "Native",
"class": "Laravel\\SerializableClosure\\Serializers\\Native",
"type": "::",
"function": "wrapClosures",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/laravel\/serializable-closure\/src\/Serializers\/Native.php",
"line": 284,
"args": []
},
{
"namespace": "Laravel\\SerializableClosure\\Serializers",
"short_class": "Native",
"class": "Laravel\\SerializableClosure\\Serializers\\Native",
"type": "::",
"function": "wrapClosures",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/laravel\/serializable-closure\/src\/Serializers\/Native.php",
"line": 284,
"args": []
},
{
"namespace": "Laravel\\SerializableClosure\\Serializers",
"short_class": "Native",
"class": "Laravel\\SerializableClosure\\Serializers\\Native",
"type": "::",
"function": "wrapClosures",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/laravel\/serializable-closure\/src\/Serializers\/Native.php",
"line": 284,
"args": []
},
{
"namespace": "Laravel\\SerializableClosure\\Serializers",
"short_class": "Native",
"class": "Laravel\\SerializableClosure\\Serializers\\Native",
"type": "::",
"function": "wrapClosures",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/laravel\/serializable-closure\/src\/Serializers\/Native.php",
"line": 284,
"args": []
},
{
"namespace": "Laravel\\SerializableClosure\\Serializers",
"short_class": "Native",
"class": "Laravel\\SerializableClosure\\Serializers\\Native",
"type": "::",
"function": "wrapClosures",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/laravel\/serializable-closure\/src\/Serializers\/Native.php",
"line": 124,
"args": []
},
{
"namespace": "Laravel\\SerializableClosure\\Serializers",
"short_class": "Native",
"class": "Laravel\\SerializableClosure\\Serializers\\Native",
"type": "->",
"function": "__serialize",
"file": null,
"line": null,
"args": []
},
{
"namespace": "",
"short_class": "",
"class": "",
"type": "",
"function": "serialize",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/botman\/botman\/src\/Traits\/HandlesConversations.php",
"line": 127,
"args": []
},
{
"namespace": "BotMan\\BotMan",
"short_class": "BotMan",
"class": "BotMan\\BotMan\\BotMan",
"type": "->",
"function": "serializeClosure",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/botman\/botman\/src\/Traits\/HandlesConversations.php",
"line": 160,
"args": []
},
{
"namespace": "BotMan\\BotMan",
"short_class": "BotMan",
"class": "BotMan\\BotMan\\BotMan",
"type": "->",
"function": "prepareCallbacks",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/botman\/botman\/src\/Traits\/HandlesConversations.php",
"line": 45,
"args": []
},
{
"namespace": "BotMan\\BotMan",
"short_class": "BotMan",
"class": "BotMan\\BotMan\\BotMan",
"type": "->",
"function": "storeConversation",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/botman\/botman\/src\/Messages\/Conversations\/Conversation.php",
"line": 67,
"args": []
},
{
"namespace": "BotMan\\BotMan\\Messages\\Conversations",
"short_class": "Conversation",
"class": "BotMan\\BotMan\\Messages\\Conversations\\Conversation",
"type": "->",
"function": "ask",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/src\/ChatBot\/Conversation\/QuestionConversation.php",
"line": 28,
"args": []
},
{
"namespace": "App\\ChatBot\\Conversation",
"short_class": "QuestionConversation",
"class": "App\\ChatBot\\Conversation\\QuestionConversation",
"type": "->",
"function": "askQuestion",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/src\/ChatBot\/Conversation\/QuestionConversation.php",
"line": 16,
"args": []
},
{
"namespace": "App\\ChatBot\\Conversation",
"short_class": "QuestionConversation",
"class": "App\\ChatBot\\Conversation\\QuestionConversation",
"type": "->",
"function": "run",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/botman\/botman\/src\/Traits\/HandlesConversations.php",
"line": 28,
"args": []
},
{
"namespace": "BotMan\\BotMan",
"short_class": "BotMan",
"class": "BotMan\\BotMan\\BotMan",
"type": "->",
"function": "startConversation",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/src\/Controller\/ChatController.php",
"line": 230,
"args": []
},
{
"namespace": "App\\Controller",
"short_class": "ChatController",
"class": "App\\Controller\\ChatController",
"type": "->",
"function": "App\\Controller\\{closure}",
"file": null,
"line": null,
"args": []
},
{
"namespace": "",
"short_class": "",
"class": "",
"type": "",
"function": "call_user_func_array",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/botman\/botman\/src\/BotMan.php",
"line": 507,
"args": []
},
{
"namespace": "BotMan\\BotMan",
"short_class": "BotMan",
"class": "BotMan\\BotMan\\BotMan",
"type": "->",
"function": "callMatchingMessages",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/botman\/botman\/src\/BotMan.php",
"line": 430,
"args": []
},
{
"namespace": "BotMan\\BotMan",
"short_class": "BotMan",
"class": "BotMan\\BotMan\\BotMan",
"type": "->",
"function": "listen",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/src\/Controller\/ChatController.php",
"line": 320,
"args": []
},
{
"namespace": "App\\Controller",
"short_class": "ChatController",
"class": "App\\Controller\\ChatController",
"type": "->",
"function": "message",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/symfony\/http-kernel\/HttpKernel.php",
"line": 163,
"args": []
},
{
"namespace": "Symfony\\Component\\HttpKernel",
"short_class": "HttpKernel",
"class": "Symfony\\Component\\HttpKernel\\HttpKernel",
"type": "->",
"function": "handleRaw",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/symfony\/http-kernel\/HttpKernel.php",
"line": 74,
"args": []
},
{
"namespace": "Symfony\\Component\\HttpKernel",
"short_class": "HttpKernel",
"class": "Symfony\\Component\\HttpKernel\\HttpKernel",
"type": "->",
"function": "handle",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/vendor\/symfony\/http-kernel\/Kernel.php",
"line": 184,
"args": []
},
{
"namespace": "Symfony\\Component\\HttpKernel",
"short_class": "Kernel",
"class": "Symfony\\Component\\HttpKernel\\Kernel",
"type": "->",
"function": "handle",
"file": "\/home\/nico\/Projects\/ai-chatbot-ChatGPT\/public\/index.php",
"line": 20,
"args": []
}
]
}
I don't use the question option on this botman project sorry. It has been replaced by an API connexion to chatGPT as a fallback. To do this you just need your own api key.
I don't use the question option on this botman project sorry. It has been replaced by an API connexion to chatGPT as a fallback. To do this you just need your own api key.
It's being used in here: https://github.com/jessicakuijer/ai-chatbot-ChatGPT/blob/main/src/Controller/ChatController.php#L227-L233
for now I've updated this project with a custom symfony cache.
This seems to work even for the Conversation class.
I tried your chatbot but it's getting an error such as:
I suppose it does not work on newer PHP versions that have type checks?