\pset tuples_only on
\pset format unaligned
with base as (
 select * from public.request_audit_logs
 where created_at >= timezone('Asia/Shanghai', date_trunc('day', now() at time zone 'Asia/Shanghai'))
)
select 'kw|voice_whisper_indextts|' || count(*) from base where request_body ilike any(array['%index.tts%','%indextts%','%whisper%','%语音转文本%','%文本转语音%'])
union all select 'kw|sublb_logs_audit|' || count(*) from base where request_body ilike any(array['%中转站%','%request_audit_logs%','%数据日志表%','%sublb%','%sub-lb%'])
union all select 'kw|skills|' || count(*) from base where request_body ilike any(array['%skill%','%技能%'])
union all select 'kw|image_generation_tests|' || count(*) from base where request_body ilike any(array['%Generate a high-quality%','%Generate a balanced quality image%','%blue rectangle%','%color calibration card%'])
union all select 'kw|heartbeat|' || count(*) from base where request_body ilike '%HEARTBEAT%'
union all select 'kw|agents_rules|' || count(*) from base where request_body ilike '%AGENTS.md%';
select 'latest|' || id || '|' || to_char(created_at at time zone 'Asia/Shanghai','HH24:MI:SS') || '|' || model || '|' || left(regexp_replace(request_body, E'[\n\r\t]+', ' ', 'g'), 300)
from base
order by id desc
limit 20;
