mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-19 13:19:39 +02:00
* Start refactor * Interface updates * Rework Assistant, Provider, and tests for better domain boundaries * Consolidate and simplify OpenAI provider and provider concepts * Clean up assistant streaming * Improve assistant message orchestration logic * Clean up "thinking" UI interactions * Remove stale class * Regenerate VCR test responses
22 lines
495 B
Ruby
22 lines
495 B
Ruby
class Message < ApplicationRecord
|
|
belongs_to :chat
|
|
has_many :tool_calls, dependent: :destroy
|
|
|
|
enum :status, {
|
|
pending: "pending",
|
|
complete: "complete",
|
|
failed: "failed"
|
|
}
|
|
|
|
validates :content, presence: true
|
|
|
|
after_create_commit -> { broadcast_append_to chat, target: "messages" }, if: :broadcast?
|
|
after_update_commit -> { broadcast_update_to chat }, if: :broadcast?
|
|
|
|
scope :ordered, -> { order(created_at: :asc) }
|
|
|
|
private
|
|
def broadcast?
|
|
true
|
|
end
|
|
end
|