This PR addresses the issue where the chat_json decorator would inadvertently mutate the PROMPT template variable during multiple invocations within the devchat application, leading to inconsistent behavior as documented in issue #354.
The proposed changes introduce a new variable prompt_new to hold the intermediary states, ensuring that the original PROMPT template remains unaffected across function calls. Both chat and chat_json functions have been updated to make use of prompt_new, providing a consistent and predictable outcome regardless of the number of invocations.
This PR addresses the issue where the
chat_json
decorator would inadvertently mutate thePROMPT
template variable during multiple invocations within the devchat application, leading to inconsistent behavior as documented in issue #354.The proposed changes introduce a new variable
prompt_new
to hold the intermediary states, ensuring that the originalPROMPT
template remains unaffected across function calls. Bothchat
andchat_json
functions have been updated to make use ofprompt_new
, providing a consistent and predictable outcome regardless of the number of invocations.Closes devchat-ai/devchat#354.