COPY (
  select json_build_object(
    'id', id,
    'created_at', to_char(created_at at time zone 'Asia/Shanghai','YYYY-MM-DD HH24:MI:SS'),
    'source', source,
    'path', path,
    'model', model,
    'account_id', account_id,
    'has_tools', has_tools,
    'has_thinking', has_thinking,
    'has_stream', has_stream,
    'request_body', left(request_body, 50000)
  )::text
  from public.request_audit_logs
  where created_at >= timezone('Asia/Shanghai', date_trunc('day', now() at time zone 'Asia/Shanghai'))
  order by created_at asc, id asc
) TO STDOUT WITH CSV;
