0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 09:05:23 +08:00
discourse/db
Natalie Tay 9f6fa67949
FEATURE: Automatic AI captions (#41586)
### settings

Settings required for V2 captions:
- discourse_ai_enabled = true
- ai_post_image_descriptions_enabled = true
- ai_helper_image_caption_agent must be set. It defaults to -26, the
default image caption agent

`+` optional tuning:
- ai_post_image_descriptions_per_post_limit, default 10
- ai_post_image_descriptions_backfill_hourly_rate, default 0, so
backfill is off by default
- ai_post_image_descriptions_backfill_max_age_days, default 30

These settings are required for generation/backfill:
- the selected `ai_helper_image_caption_agent` must exist and be enabled
- the agent/persona must be vision-enabled
- the resolved LLM must be vision-capable
- credits must be available
- ai_post_image_descriptions_backfill_hourly_rate > 0 for scheduled
backfill

______

### this pr 

... does _a few things_.

1. removes the old AI image captioning flow (v1)...
  - removes the composer manual captioning UI
  - stops inserting generated captions into post raw
  - removes `image_caption` from the AI helper enabled features setting

2. adds the new post image description flow (v2)...
  - backfills descriptions for existing post images
- stores descriptions in `ai_post_image_descriptions`, keyed by
`post_id`, `locale`, and `base62_sha1`
- keeps duplicate rows per post image instead of relying only on uploads
- cook-time lookup, deletion, and per-post editing stay simple even when
multiple posts reuse the same upload
- doing this also prevents the author of one post image from affecting
another post's image if they have the same image
- uses `base62_sha1` and `locale` for reuse when the same image appears
again
- exposes caption editing from the composer preview for
already-described post images
- includes descriptions in search indexing without inserting them into
raw
  - decorates cooked post images with localized `aria-description`
- shows the AI description visibly in the lightbox under the existing
image title
2026-07-15 13:24:10 +08:00
..
fixtures FIX: Make auto pseudogroups visible to logged on users (#41498) 2026-07-08 09:28:18 +10:00
migrate UX: Consolidate chat notifications into live notification preferences (#41538) 2026-07-14 08:32:48 +02:00
post_migrate UX: Consolidate chat notifications into live notification preferences (#41538) 2026-07-14 08:32:48 +02:00
api_test_seeds.rb
structure.sql FEATURE: Automatic AI captions (#41586) 2026-07-15 13:24:10 +08:00