Melhorias na ferramenta send_suite_images para resolver confusão entre categoria e número de suíte: 1. **Descrições de parâmetros mais claras** - suite_category: exemplos específicos (Hidromassagem, ALEXA, STILO) - suite_number: apenas números (101, 102, 103) - remove exemplos confusos 2. **Instruções explícitas no system prompt** - Seção [Galeria de Fotos] com regras claras - Prioriza suite_category quando ambíguo - Evita confirmações desnecessárias com cliente 3. **Mensagens de erro melhoradas** - Sugere buscar por categoria quando busca por número falha - Feedback mais útil para a IA Resultado esperado: - Cliente: "Me manda foto da suite Alexa" - IA: busca por suite_category="Alexa" ✓ (sem pedir confirmação) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
64 lines
1.7 KiB
Ruby
64 lines
1.7 KiB
Ruby
# == Schema Information
|
|
#
|
|
# Table name: captain_conversation_insights
|
|
#
|
|
# id :bigint not null, primary key
|
|
# account_id :bigint not null
|
|
# captain_unit_id :bigint
|
|
# period_start :date not null
|
|
# period_end :date not null
|
|
# status :string default("pending"), not null
|
|
# payload :jsonb
|
|
# conversations_count :integer default(0)
|
|
# messages_count :integer default(0)
|
|
# llm_tokens_used :integer
|
|
# generated_at :datetime
|
|
# created_at :datetime not null
|
|
# updated_at :datetime not null
|
|
#
|
|
|
|
class Captain::ConversationInsight < ApplicationRecord
|
|
include Rails.application.routes.url_helpers
|
|
|
|
STATUSES = %w[pending processing done failed].freeze
|
|
|
|
belongs_to :account
|
|
belongs_to :captain_unit, class_name: 'Captain::Unit', optional: true
|
|
|
|
validates :period_start, :period_end, :status, presence: true
|
|
validates :status, inclusion: { in: STATUSES }
|
|
|
|
scope :done, -> { where(status: 'done') }
|
|
scope :for_unit, ->(unit_id) { where(captain_unit_id: unit_id) }
|
|
scope :for_period, ->(start_date, end_date) { where(period_start: start_date, period_end: end_date) }
|
|
|
|
def mark_processing!
|
|
update!(status: 'processing')
|
|
end
|
|
|
|
def mark_done!(payload, tokens_used: nil)
|
|
update!(
|
|
status: 'done',
|
|
payload: payload,
|
|
llm_tokens_used: tokens_used,
|
|
generated_at: Time.current
|
|
)
|
|
end
|
|
|
|
def mark_failed!
|
|
update!(status: 'failed')
|
|
end
|
|
|
|
def pending?
|
|
status == 'pending'
|
|
end
|
|
|
|
def processing?
|
|
status == 'processing'
|
|
end
|
|
|
|
def done?
|
|
status == 'done'
|
|
end
|
|
end
|