mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-09 21:29:11 +00:00
Show snippet of truncated messages in debug logs to avoid log flooding
This commit is contained in:
@@ -449,7 +449,7 @@ def truncate_messages(
|
|||||||
truncated_message = encoder.decode(encoder.encode(original_question)[:remaining_tokens]).strip()
|
truncated_message = encoder.decode(encoder.encode(original_question)[:remaining_tokens]).strip()
|
||||||
messages = [ChatMessage(content=truncated_message, role=messages[0].role)]
|
messages = [ChatMessage(content=truncated_message, role=messages[0].role)]
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"Truncate current message to fit within max prompt size of {max_prompt_size} supported by {model_name} model:\n {truncated_message}"
|
f"Truncate current message to fit within max prompt size of {max_prompt_size} supported by {model_name} model:\n {truncated_message[:1000]}..."
|
||||||
)
|
)
|
||||||
|
|
||||||
if system_message:
|
if system_message:
|
||||||
|
|||||||
Reference in New Issue
Block a user