Skip to content

Issue with chat_json decorator in devchat causing PROMPT template variable mutation #354

Description

@yangbobo2021

There seems to be an issue within the devchat's chat functionality, specifically with the chat_json decorator. When it's called multiple times, the PROMPT template variable undergoes an undesired mutation during execution. This mutation affects the outcome when the function is repeatedly invoked, leading to inconsistent behavior and potentially incorrect results.

Steps to reproduce:

  1. Set up a PROMPT template for use with the chat_json decorator in a devchat environment.
  2. Invoke a function decorated with chat_json multiple times that uses the PROMPT template.
  3. Observe that the content of PROMPT is changed after initial calls, affecting subsequent function calls.

Expected behavior: The PROMPT template variable should remain constant across multiple invocations of the decorated function, ensuring consistent functionality throughout.

Actual behavior: The PROMPT variable is mutated during the process, leading to inconsistencies and possibly incorrect operation of the decorated function across calls.

This issue significantly affects the reliability and predictability of using the devchat's chat feature with the chat_json decorator, especially in scenarios where function reusability is crucial. Any insights or fixes for this problem would be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions