diff --git a/.github/workflows/deploy_check.yml b/.github/workflows/deploy_check.yml
index 9f295a6c8..bb99a00b8 100644
--- a/.github/workflows/deploy_check.yml
+++ b/.github/workflows/deploy_check.yml
@@ -22,22 +22,23 @@ jobs:
run: echo "https://chatwoot-pr-${{ github.event.pull_request.number }}.herokuapp.com"
- name: Check Deployment Status
run: |
- max_attempts=10
+ max_attempts=15
attempt=1
status_code=0
echo "Waiting for review app to be deployed/redeployed, trying in 10 minutes..."
sleep 600
while [ $attempt -le $max_attempts ]; do
- response=$(curl -s -o /dev/null -w "%{http_code}" https://chatwoot-pr-${{ github.event.pull_request.number }}.herokuapp.com/api)
+ response=$(curl -s -o /dev/null -w "%{http_code}" https://chatwoot-pr-${{ github.event.pull_request.number }}.herokuapp.com/health)
status_code=$(echo $response | head -n 1)
if [ $status_code -eq 200 ]; then
- body=$(curl -s https://chatwoot-pr-${{ github.event.pull_request.number }}.herokuapp.com/api)
+ body=$(curl -s https://chatwoot-pr-${{ github.event.pull_request.number }}.herokuapp.com/health)
if echo "$body" | jq -e '.version and .timestamp and .queue_services == "ok" and .data_services == "ok"' > /dev/null; then
echo "Deployment successful"
exit 0
else
echo "Deployment status unknown, retrying in 3 minutes..."
sleep 180
+ attempt=$((attempt + 1))
fi
else
echo "Waiting for review app to be ready, retrying in 3 minutes..."
diff --git a/.gitignore b/.gitignore
index 0ecc74c91..7c9d7fd29 100644
--- a/.gitignore
+++ b/.gitignore
@@ -128,3 +128,4 @@ Thumbs.db
.claude/
.env.aios
.env.backup*
+reference/chatwoot-develop
diff --git a/app/controllers/health_controller.rb b/app/controllers/health_controller.rb
index fdf969a39..f696fa4ff 100644
--- a/app/controllers/health_controller.rb
+++ b/app/controllers/health_controller.rb
@@ -2,6 +2,26 @@
# authentication, and callbacks. Used for health checks
class HealthController < ActionController::Base # rubocop:disable Rails/ApplicationController
def show
- render json: { status: 'woot' }
+ render json: {
+ version: Chatwoot.config[:version] || 'dev',
+ timestamp: Time.current.to_fs(:db),
+ queue_services: redis_status,
+ data_services: postgres_status
+ }
+ end
+
+ private
+
+ def redis_status
+ r = Redis.new(Redis::Config.app)
+ r.ping ? 'ok' : 'failing'
+ rescue StandardError
+ 'failing'
+ end
+
+ def postgres_status
+ ActiveRecord::Base.connection.active? ? 'ok' : 'failing'
+ rescue StandardError
+ 'failing'
end
end
diff --git a/app/javascript/dashboard/routes/dashboard/captain/reservations/Index.vue b/app/javascript/dashboard/routes/dashboard/captain/reservations/Index.vue
index d75852367..27758b40d 100644
--- a/app/javascript/dashboard/routes/dashboard/captain/reservations/Index.vue
+++ b/app/javascript/dashboard/routes/dashboard/captain/reservations/Index.vue
@@ -257,6 +257,16 @@ const suiteRevenueChart = computed(() => ({
],
}));
+const statusColor = reservationStatus => {
+ const colors = {
+ draft: 'bg-n-slate-3 text-n-slate-11',
+ pending_payment: 'bg-n-amber-3 text-n-amber-11',
+ confirmed: 'bg-n-teal-3 text-n-teal-11',
+ cancelled: 'bg-n-ruby-3 text-n-ruby-11',
+ };
+ return colors[reservationStatus] || 'bg-n-slate-3 text-n-slate-11';
+};
+
onMounted(() => {
readFiltersFromRoute();
store.dispatch('captainUnits/get');
@@ -483,7 +493,8 @@ onMounted(() => {
{{ formatMoney(reservation.amount) }} |
{{ reservation.status_label }}
diff --git a/app/javascript/dashboard/routes/dashboard/conversation/reservation/ReservationSummary.vue b/app/javascript/dashboard/routes/dashboard/conversation/reservation/ReservationSummary.vue
index 35a5631c4..fb20a7fd5 100644
--- a/app/javascript/dashboard/routes/dashboard/conversation/reservation/ReservationSummary.vue
+++ b/app/javascript/dashboard/routes/dashboard/conversation/reservation/ReservationSummary.vue
@@ -73,6 +73,18 @@ const statusLabel = computed(() => {
: translated;
});
+const statusColor = computed(() => {
+ const status =
+ reservation.value?.ui_status || props.marker?.status || 'draft';
+ const colors = {
+ draft: 'bg-n-slate-3 text-n-slate-11',
+ pending_payment: 'bg-n-amber-3 text-n-amber-11',
+ confirmed: 'bg-n-teal-3 text-n-teal-11',
+ cancelled: 'bg-n-ruby-3 text-n-ruby-11',
+ };
+ return colors[status] || 'bg-n-slate-3 text-n-slate-11';
+});
+
const onCopyPix = async () => {
if (!pixValue.value) {
useAlert(
@@ -107,7 +119,12 @@ const onCopyPix = async () => {
{{
$t('CAPTAIN_RESERVATIONS.SIDEBAR.STATUS')
}}
- {{ statusLabel }}
+
+ {{ statusLabel }}
+
{{
diff --git a/enterprise/app/services/captain/tools/send_suite_images_tool.rb b/enterprise/app/services/captain/tools/send_suite_images_tool.rb
index 04bf46189..c2bb86e09 100644
--- a/enterprise/app/services/captain/tools/send_suite_images_tool.rb
+++ b/enterprise/app/services/captain/tools/send_suite_images_tool.rb
@@ -46,6 +46,8 @@ class Captain::Tools::SendSuiteImagesTool < Captain::Tools::BaseTool
@conversation ||= resolve_conversation(args, params)
return error_response('Erro técnico ao enviar fotos. Não consegui identificar a conversa atual.') if @conversation.blank?
+ enrich_suite_filters_from_conversation!(actual_params)
+
selected_items = find_selected_items(actual_params)
return no_images_response(actual_params) if selected_items.blank?
@@ -171,6 +173,34 @@ class Captain::Tools::SendSuiteImagesTool < Captain::Tools::BaseTool
items.limit(normalize_limit(actual_params[:limit]))
end
+ def enrich_suite_filters_from_conversation!(actual_params)
+ return if normalize_filter(actual_params[:suite_number]).present?
+
+ inferred_suite = infer_suite_number_from_last_incoming_message
+ return if inferred_suite.blank?
+
+ actual_params[:suite_number] = inferred_suite
+ end
+
+ def infer_suite_number_from_last_incoming_message
+ text = last_incoming_text
+ return nil if text.blank?
+
+ # Captura "suite 110", "suíte 110", "suite n 110", "suite nº 110".
+ match = text.match(/\bsu[ií]te\s*(?:n(?:u|ú)?m(?:ero)?\.?\s*)?(?:n[ºo]\s*)?([a-z0-9_-]{1,20})\b/i)
+ return nil if match.blank?
+
+ normalize_filter(match[1])
+ end
+
+ def last_incoming_text
+ @conversation.messages
+ .where(message_type: :incoming)
+ .order(created_at: :desc)
+ .limit(1)
+ .pick(:content)
+ end
+
def send_images(items)
items.count do |item|
next false unless item.image.attached?
diff --git a/progresso/colorful_reservation_status.md b/progresso/colorful_reservation_status.md
new file mode 100644
index 000000000..0bb98fb1f
--- /dev/null
+++ b/progresso/colorful_reservation_status.md
@@ -0,0 +1,23 @@
+# Adicionando Cores aos Status de Reserava
+
+**Objetivo:** Alterar a exibição em texto simples dos status das reservas (Rascunho, Confirmada, etc.) para tags visuais coloridas, facilitando a visualização rápida pelos capitães.
+
+**Contexto:** O componente UI de listagem de reservas (`Index.vue`) e o componente de resumo na barra lateral das conversas (`ReservationSummary.vue`) exibiam o `status_label` com um fundo cinza genérico para todos os status.
+
+**Passos:**
+1. Criada uma função `statusColor` que mapeia o campo `ui_status` do backend para classes CSS dinâmicas baseadas nas cores já disponíveis da paleta atual (Tailwind - `bg-n-...`).
+2. Atualizado o `Index.vue` na visualização tipo Lista (Tabela) para injetar essas classes de cor correspondente.
+3. Atualizado o `ReservationSummary.vue` (barra lateral do chat) para usar a mesma lógica no Computed property `statusColor`.
+
+**Principais Arquivos Alterados:**
+- [app/javascript/dashboard/routes/dashboard/captain/reservations/Index.vue](file:///Users/user/Dev/Produtos/Chatwoot-fazer-ai/fazer-ai-kanban/chatwoot/app/javascript/dashboard/routes/dashboard/captain/reservations/Index.vue)
+- [app/javascript/dashboard/routes/dashboard/conversation/reservation/ReservationSummary.vue](file:///Users/user/Dev/Produtos/Chatwoot-fazer-ai/fazer-ai-kanban/chatwoot/app/javascript/dashboard/routes/dashboard/conversation/reservation/ReservationSummary.vue)
+
+**Como Validar:**
+1. Acesse o painel web local (ex: `localhost:3001`).
+2. Vá até o menu de Reservas (Captain).
+3. Na visualização de "Lista", verifique se a coluna "Status" tem diferentes cores, como ex. cinza para Draft, verde para Confirmada, e amarelo para Aguardando Pagamento.
+4. Abra uma conversa que tenha uma reserva vinculada e veja se na barra lateral direita se o badge "Status" também aparece colorido de forma coerente com o `ui_status`.
+
+**Como Reverter:**
+As classes customizadas dinâmicas podem ser removidas revertendo o commit correspondente nestes arquivos, voltando assim o uso estático de `class="bg-n-surface-2 text-n-slate-12"` em ambos os templates do span.
diff --git a/progresso/deploy_check_health_endpoint.md b/progresso/deploy_check_health_endpoint.md
new file mode 100644
index 000000000..88c38e9d3
--- /dev/null
+++ b/progresso/deploy_check_health_endpoint.md
@@ -0,0 +1,27 @@
+# Correção do Deploy Check da Review App
+
+## Objetivo
+Corrigir a falha no pipeline de CI "Deploy Check" (`.github/workflows/deploy_check.yml`) que quebrava após 10 tentativas devido à Review App (Heroku) não retornar o healthcheck esperado.
+
+## Contexto
+O workflow do GitHub Actions esperava um JSON do endpoint `/api` contendo os campos `version`, `timestamp`, `queue_services` e `data_services` todos populados e com valor `"ok"` pros serviços. Porém, o endpoint `/api` (referente ao `ApiController#index`) não era exposto corretamente em alguns ambientes ou levantava erro 500 caso o Redis/Postgres demorassem a subir, além de cair em um loop infinito no script bash porque a variável `$attempt` não era incrementada se a chamada HTTP retornasse 200 mas o JSON fosse inválido.
+
+## Passos Realizados
+1. Mapeamos que já existia uma rota `get '/health', to: 'health#show'` apontando para o `HealthController` que apenas respondia `{ status: 'woot' }`.
+2. Alteramos o `HealthController#show` para retornar o JSON robusto exigido pelo workflow, fazendo o ping no Redis e no Postgres e blindando as exceções com `rescue StandardError` para nunca retornar 500 durante a fase de boot.
+3. Editamos o arquivo `.github/workflows/deploy_check.yml`:
+ - Trocamos o `curl` de `/api` para `/health`.
+ - Adicionamos a instrução `attempt=$((attempt + 1))` no bloco `else` (quando o teste do `jq` não passa), corrigindo o loop infinito.
+ - Aumentamos o `max_attempts` de 10 para 15 (dando 45 minutos de tolerância para a Review App subir o banco de dados e os dynos completamente).
+
+## Principais Arquivos Alterados
+- `app/controllers/health_controller.rb`
+- `.github/workflows/deploy_check.yml`
+
+## Como Validar
+1. Subir essas alterações (commit e push) na branch do PR.
+2. Acompanhar a aba "Actions" no GitHub e verificar o job "Check Deployment (pull_request)".
+3. O script bash deverá fazer o cURL em `/health` e, assim que o PostgreSQL e Redis reportarem `"ok"`, o step será marcado como "Deployment successful".
+
+## Como Reverter
+Basta fazer um git revert do commit que adicionou essas alterações ou retornar os arquivos aos estados anteriores (o `HealthController` retornando apenas `{ status: 'woot' }` e o `deploy_check.yml` voltando para `/api` sem o incremento).
diff --git a/reference/chatwoot-develop b/reference/chatwoot-develop
deleted file mode 160000
index 6c509f0ed..000000000
--- a/reference/chatwoot-develop
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 6c509f0edb7158cbefd95fc02bbe6efa7f1c50db
diff --git a/spec/enterprise/services/captain/tools/send_suite_images_tool_spec.rb b/spec/enterprise/services/captain/tools/send_suite_images_tool_spec.rb
index cca8f64d1..43080dcac 100644
--- a/spec/enterprise/services/captain/tools/send_suite_images_tool_spec.rb
+++ b/spec/enterprise/services/captain/tools/send_suite_images_tool_spec.rb
@@ -106,4 +106,40 @@ RSpec.describe Captain::Tools::SendSuiteImagesTool, type: :model do
expect(result[:success]).to be(true)
expect(result[:formatted_message]).to match(/não encontrei fotos cadastradas/i)
end
+
+ it 'infers suite number from customer message when suite_number is not passed' do
+ create(
+ :captain_gallery_item,
+ :inbox_scoped,
+ account: account,
+ captain_unit: unit,
+ inbox: conversation.inbox,
+ suite_category: 'hidromassagem',
+ suite_number: '110'
+ )
+ create(
+ :captain_gallery_item,
+ :inbox_scoped,
+ account: account,
+ captain_unit: unit,
+ inbox: conversation.inbox,
+ suite_category: 'hidromassagem',
+ suite_number: '101'
+ )
+ create(
+ :message,
+ conversation: conversation,
+ inbox: conversation.inbox,
+ message_type: :incoming,
+ content: 'Vc tem a foto da suíte 110?'
+ )
+
+ result = nil
+ expect do
+ result = tool.execute(tool_context, suite_category: 'hidromassagem')
+ end.to change { conversation.messages.outgoing.where(sender: assistant).count }.by(1)
+
+ expect(result[:success]).to be(true)
+ expect(result[:suite_number]).to eq('110')
+ end
end
|