Add missing `ai_session_unref` calls to prevent memory leaks.
- In `_ai_request_thread`, release session on error paths and
after successful processing.
- In `cmd_ai_start`, release reference after passing ownership
to the AI window.
Replace manual g_free calls with auto_gchar for local_provider_name,
local_model, local_api_key, and response_data to ensure automatic
cleanup and prevent memory leaks.