File tree Expand file tree Collapse file tree
changedetectionio/processors/restock_diff/plugins Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010`inject_datastore_into_plugins()` in pluggy_interface.py.
1111"""
1212import json
13+ import os
1314import re
1415from loguru import logger
1516from changedetectionio .pluggy_interface import hookimpl
8687 'No markdown, no backticks, no explanation — pure JSON only.'
8788)
8889
89- _MAX_CONTENT_CHARS = 8_000
90+ # Max characters of page content (JSON-LD + stripped text) sent to the LLM.
91+ # Some retailers (e.g. Amazon.de) place the buy-box price well past 8k chars,
92+ # so this is env-configurable. Larger values increase input-token cost per
93+ # check and may exceed local-model context windows (bump Ollama num_ctx to match).
94+ _MAX_CONTENT_CHARS = int (os .getenv ('LLM_RESTOCK_MAX_CONTENT_CHARS' , 15_000 ))
9095
9196
9297def _extract_jsonld (html_content : str ) -> str :
Original file line number Diff line number Diff line change @@ -71,7 +71,14 @@ services:
7171 # - DISABLE_VERSION_CHECK=true
7272 #
7373 # Disable all LLM / AI features, prompts etc
74- # - LLM_FEATURES_DISABLED=true
74+ # - LLM_FEATURES_DISABLED=true
75+ #
76+ # How much of the page text the AI reads when finding the price/stock, default 15000 characters.
77+ # Raise it if the price is missed (some shops put it far down the page).
78+ # Using a local model (Ollama)? It may only read the first part unless you raise its context size
79+ # (num_ctx) to about 8192 or more, otherwise it can miss the price.
80+ # In Ollama: run `ollama run <model>` then `/set parameter num_ctx 8192`
81+ # - LLM_RESTOCK_MAX_CONTENT_CHARS=15000
7582 #
7683 # A valid timezone name to run as (for scheduling watch checking) see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
7784 # - TZ=America/Los_Angeles
You can’t perform that action at this time.
0 commit comments