fix(logging): add debug log for truncated messages

Added a debug-level log statement to capture the final set of messages before returning, which aids in tracing message processing and debugging potential issues in the message truncation logic. This enhances transparency and facilitates easier troubleshooting.
This commit is contained in:
Kumi 2024-11-06 16:41:13 +01:00
parent 21edc48050
commit 253c7e581f
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -487,12 +487,16 @@ class OpenAI(BaseAI):
),
}
return (
final_messages = (
[system_message_dict]
+ [truncated_messages[0]]
+ list(reversed(truncated_messages[1:]))
)
self.logger.log(f"Truncated messages: {final_messages}", "debug")
return final_messages
async def generate_chat_response(
self,
messages: List[Dict[str, str]],