Files
tcx4c70andAlexandre Alapetite 4f9b74acdc [LLM Classification] Skip duplicate LLM calls on no-op feed updates (#470)
* [LLM Classification] Skip duplicate LLM calls on no-op feed updates

Some RSS sources re-publish existing articles with no semantic change
(reformatted author, tweaked date, new enclosure attribute, etc.).
FreshRSS detects these as updated entries via hash mismatch and calls
EntryBeforeInsert again, which previously triggered another LLM API
call for every such pseudo-update.

The extension now stores a SHA-1 of the prompt it sent (plus the exact
list of tags it assigned) on each classified entry, under the
'llm_classification' attribute namespace. On a feed update of an
already-classified entry:

- if the new prompt hashes to the same value, the prior tags are
  restored and no LLM call is made;
- otherwise, behaviour follows the new 'Re-classify when content
  changes' toggle (default on): call the LLM and refresh, or keep the
  prior tags untouched.

When re-classifying, the prior tag list is used to remove only those
exact tags (instead of the previous prefix-based heuristic), so manual
tags sharing the prefix are preserved.

* Simplification
* Remove option (for now)
* Re-use existing information instead of additional attribute
* Reduce code

* fix: prompt_hash is cleared for updated entries

Signed-off-by: Adam Tao <tcx4c70@gmail.com>

* Remove PHPStan help

* Typo

---------

Signed-off-by: Adam Tao <tcx4c70@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
2026-07-03 23:05:32 +02:00
..
2026-06-29 15:01:38 +02:00