mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-05-08 17:58:20 +00:00
- Fix naive datetime.now() → datetime.now(UTC) in all ORM models - Fix seq race condition in DbRunEventStore.put() with FOR UPDATE and UNIQUE(thread_id, seq) constraint - Encapsulate _store access in RunManager.update_run_completion() - Deduplicate _store.put() logic in RunManager via _persist_to_store() - Add update_run_completion to RunStore ABC + MemoryRunStore - Wire follow_up_to_run_id through the full create path - Add error recovery to RunJournal._flush_sync() lost-event scenario - Add migration note for search_threads breaking change - Fix test_checkpointer_none_fix mock to set database=None Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
"""ORM model for user feedback on runs."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import UTC, datetime
|
|
|
|
from sqlalchemy import DateTime, String, Text
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from deerflow.persistence.base import Base
|
|
|
|
|
|
class FeedbackRow(Base):
|
|
__tablename__ = "feedback"
|
|
|
|
feedback_id: Mapped[str] = mapped_column(String(64), primary_key=True)
|
|
run_id: Mapped[str] = mapped_column(String(64), nullable=False, index=True)
|
|
thread_id: Mapped[str] = mapped_column(String(64), nullable=False, index=True)
|
|
owner_id: Mapped[str | None] = mapped_column(String(64), index=True)
|
|
message_id: Mapped[str | None] = mapped_column(String(64))
|
|
# message_id is an optional RunEventStore event identifier —
|
|
# allows feedback to target a specific message or the entire run
|
|
|
|
rating: Mapped[int] = mapped_column(nullable=False)
|
|
# +1 (thumbs-up) or -1 (thumbs-down)
|
|
|
|
comment: Mapped[str | None] = mapped_column(Text)
|
|
# Optional text feedback from the user
|
|
|
|
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=lambda: datetime.now(UTC))
|