Open michaelwechner opened 1 month ago
I have implemented a quick fix inside src/app/chat-gpt.service.ts ... before sending I replace the role "error" by "assistant"
body['messages'] = this.replaceRoleError(messages);
+
Thanks for your input! I created this project back then when ChatGPT was quite new so I assume some things have changed in their API and the request/responses. As soon as I have time I will update this project to the latest angular version (with the new control flow syntax as well), and then will take a look at how its handled today.
Please feel free to create pull requests if you have fixes in the meantime (like this), as I can add those quicker.
When an error occurs, then a message is pushed using the role "error".
When the user then sends another message, then for example OpenAI will throw an error, because it does not know the role "error":
Object { message: "Invalid value: 'error'. Supported values are: 'system', 'assistant', 'user', 'function', and 'tool'.", type: "invalid_request_error", param: "messages[2].role", … }
I think error messages should be handled differently in the conversation history, such that this problem does not occur.
What do you think?