mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-06-06 04:59:24 +02:00
Eliminate extremely long log line for large checkpointds (#4236)
* Eliminate extremely long log line for large checkpointds * address greptile
This commit is contained in:
parent
426883bbf5
commit
965f9e98bf
@ -1,3 +1,4 @@
|
|||||||
|
import json
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@ -204,6 +205,15 @@ class ConnectorCheckpoint(BaseModel):
|
|||||||
def build_dummy_checkpoint(cls) -> "ConnectorCheckpoint":
|
def build_dummy_checkpoint(cls) -> "ConnectorCheckpoint":
|
||||||
return ConnectorCheckpoint(checkpoint_content={}, has_more=True)
|
return ConnectorCheckpoint(checkpoint_content={}, has_more=True)
|
||||||
|
|
||||||
|
def __str__(self) -> str:
|
||||||
|
"""String representation of the checkpoint, with truncation for large checkpoint content."""
|
||||||
|
MAX_CHECKPOINT_CONTENT_CHARS = 1000
|
||||||
|
|
||||||
|
content_str = json.dumps(self.checkpoint_content)
|
||||||
|
if len(content_str) > MAX_CHECKPOINT_CONTENT_CHARS:
|
||||||
|
content_str = content_str[: MAX_CHECKPOINT_CONTENT_CHARS - 3] + "..."
|
||||||
|
return f"ConnectorCheckpoint(checkpoint_content={content_str}, has_more={self.has_more})"
|
||||||
|
|
||||||
|
|
||||||
class DocumentFailure(BaseModel):
|
class DocumentFailure(BaseModel):
|
||||||
document_id: str
|
document_id: str
|
||||||
|
Loading…
x
Reference in New Issue
Block a user