devchat-ai / devchat

Automate your dev tasks with AI-powered scripts, from your IDE's chat panel.
https://www.devchat.ai
Apache License 2.0
351 stars 42 forks source link

Avoid inserting empty strings using the chat decorator #242

Closed yangbobo2021 closed 9 months ago

yangbobo2021 commented 9 months ago

Problem Description

There is an issue where certain models do not support the input of empty strings. While this is an understandable limitation, it's important that our code gracefully handles this case to prevent unexpected behavior or errors.

Suggested Change

I propose we modify the chat decorator to include a check that prevents empty strings from being passed as input to the models. This should help us avoid unnecessary errors and ensure better stability and user experience.

Expected Behavior

When the modified chat decorator is used, it should:

  1. Check if the input string is empty.
  2. If it is, bypass the model call or handle it with a default response.
  3. Ensure that the rest of the pipeline works seamlessly with this change, without introducing any regression issues.

Additional context

This modification can help in ensuring that we're not unnecessarily invoking model calls with inputs that are known not to be supported, which can help save resources and prevent potential failures.