fix(translate): exclude key columns from cache hash — only text + context fields
- _compute_source_hash now accepts context_keys parameter - source_data is filtered to only include context-relevant fields (not row_id, primary keys) - If no context_columns configured, hash is based on source_text + dict_hash + config_hash - This ensures identical text in different rows produces a cache hit
This commit is contained in:
@@ -133,7 +133,7 @@ class TranslationRecord(Base):
|
||||
token_count_output = Column(Integer, nullable=True)
|
||||
translation_duration_ms = Column(Integer, nullable=True)
|
||||
source_hash = Column(String, nullable=True,
|
||||
comment="SHA256(source_text+source_data+dict_snapshot_hash+config_hash) for cache dedup")
|
||||
comment="SHA256(source_text+context+dict_snapshot_hash+config_hash) for cache dedup — excludes key/identifier columns")
|
||||
created_at = Column(DateTime, default=lambda: datetime.now(UTC))
|
||||
|
||||
languages = relationship("TranslationLanguage", back_populates="record")
|
||||
|
||||
Reference in New Issue
Block a user