7 Commits
Author SHA1 Message Date
Asish 73fb62c120 [LLM Classification] Do not HTML-encode re-used tags again (#573)
* [LLM Classification] Do not HTML-encode re-used tags again

The tags of an entry are stored HTML-encoded: `applyClassification()`
encodes the tags returned by the LLM with `htmlspecialchars()`, like
SimplePie does for the categories of the feeds.

When an already classified entry is updated without any change to its
prompt, the extension re-uses the stored tags instead of calling the
LLM again, but passed them as-is to `applyClassification()`, which
encoded them a second time. So a tag such as `R&D` became `R&D` in
the database after classification, then `R&D` after the next
such update, and so on. When a list of allowed tags is configured, the
encoded tags did not match the list anymore (`R&D` is not `R&D`),
and were silently removed from the entry.

Decode the stored tags before re-using them, so that they go through
the same encoding and allow-list check as the tags returned by the LLM.
Decoding first also lets tags match a configured prefix containing such
characters.

Bump the extension version to 0.3.2.

* [LLM Classification] Decode single quotes in re-used tags too
2026-11-01 20:23:47 +01:00
Inverle 8ad3b24a37 Use PHP 8.1+ callable syntax in registerHook calls (#548)
* Use PHP 8.1+ callable syntax in registerHook calls

Documentation update for code examples: https://github.com/FreshRSS/FreshRSS/pull/9443

* Change compatibility to FreshRSS 1.25.0+ in GridView

Since PHP 8.1 syntax is being used now
2026-10-15 19:56:10 +02:00
Alexandre Alapetite b85d1911bd Minor fixes after FreshRSS release 1.30.0 (#523) 2026-09-10 21:41:07 +02:00
a-p-a-n 14e47fde45 Fix: Strip prefix from existing tags before re-adding in LLM classification (#497)
When filtering tags by prefix, the prefix was being preserved on existing tags
before they were re-added. This caused the prefix to be duplicated when
applyClassification re-applied it. Now we strip the prefix from existing tags
before re-adding them, preventing the duplication issue.

Closes #496
2026-07-24 16:30:42 +02:00
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
Alexandre Alapetite b7a8fa3366 Update LLM Classification (#482)
* Add better logging with API finish_reason
* Option for disabling allow_thinking
2026-06-29 15:01:38 +02:00
Alexandre Alapetite 0d4ad2c5d7 New LLM Classification extension (#458)
Extension to automatically tag incoming articles based on a prompt sent to an LLM.
Require:
* https://github.com/FreshRSS/FreshRSS/pull/8696
* https://github.com/FreshRSS/FreshRSS/pull/8700
2026-04-19 11:31:31 +02:00