TrendRadarDocsA PROJECT BYsansansansan's personal projects and softwaresandev.cc
HomeDocumentationCommunityPartnershipsIndividual SupportCredits
  • Start here
    • Choose a deployment
    • No server: GitHub Actions
    • Server / NAS: Docker
    • Try locally: Run with uv
    • Configure content & delivery
  • Data Sources
    • Platform Configuration
    • Self-hosted sources (AI)
    • RSS Feed Configuration
  • Content Filtering
    • Keyword Configuration
    • AI Smart Filtering
  • Push Notifications
    • Push Channels
    • Push Modes
    • Scheduling
  • AI Enhancement
    • AI Analysis & Push
    • AI Translation
    • MCP Chat Analysis
    • MCP Query Guide
  • Data & Operations
    • Storage Configuration
    • Config Editor
    • Publish web reports
    • Architecture
  • More
    • FAQ
  1. Docs
  2. /
  3. Content Filtering
  4. /
  5. AI Smart Filtering
PreviousKeyword ConfigurationNextPush Channels
© TrendRadar·GPL-3.0 License·Website·GitHub·by sansan

AI Smart Filtering

AI Smart Filtering is TrendRadar's advanced filtering feature. Unlike traditional keyword matching, you only need to describe your interests in natural language, and the AI automatically understands them and screens out the news you truly care about.

How it works

AI Smart Filtering works in four steps:
1
Describe your interests
In config/ai_interests.txt, write down what you care about in natural language, for example "I want to see news about AI and new energy."
2
The AI extracts tags
The AI automatically extracts structured interest tags from your description, to be used for matching and scoring later.
3
Batch scoring
The AI matches each news item against the extracted interest tags and assigns a relevance score from 0 to 1.
4
Threshold filtering
Only news that reaches the min_score threshold is pushed; anything below the threshold is filtered out.

How to enable

Enabling AI Smart Filtering takes just two steps: write the interest description file, then edit the configuration file.

1. Write your interest description

Edit the config/ai_interests.txt file and describe what you care about in natural language. No special syntax is required — just write a paragraph as if explaining it to a friend.
ai_interests.txt example
我对以下领域感兴趣:

1. AI 技术发展动态,包括大模型、AI Agent、AI 应用落地
2. 电动汽车市场趋势,特别是特斯拉、比亚迪等头部品牌的动向
3. 中国重大政策变化,尤其是经济和科技政策
4. 半导体芯片行业的技术突破和产业链变动
Any language works
The interest description can be written in any language — Chinese, English, or a mix. The AI will understand your intent automatically.
Title quality requirements
Besides defining what you want to see, you can also define what you don't want to see at the end of ai_interests.txt. For example, add requirements like "no clickbait" or "no advertorials", and the AI will take them into account — even if a title matches your interest tags, it may be scored lower or filtered out if it doesn't meet the quality criteria.

2. Edit the configuration file

In config/config.yaml, switch the filtering method to AI mode and set the score threshold:
filter:
  method: ai          # switch to AI filtering (the default is keyword filtering)

ai_filter:
  min_score: 0.7       # minimum score threshold (0-1); news below this score is not pushed
The higher the min_score, the stricter the filtering — fewer news items are pushed, but they are more relevant. We suggest starting at 0.7 and adjusting based on the actual results.
The final number of pushed items is also affected by report.mode. In incremental mode only new content is pushed; in current mode only items currently on the charts are pushed.
Threshold rangeEffectBest for
0.3-0.4Loose filtering; most news gets throughYou don't want to miss anything possibly relevant
0.5-0.6Moderate filtering; keeps clearly relevant newsThe recommended choice for most users
0.7-0.8Strict filtering; keeps only highly relevant contentYou only want the most essential news
0.9-1.0Extremely strict; may leave very few items pushedGenerally not recommended to set it this high

Core features

Automatic fallback: revert to keyword filtering when the AI fails
If the AI service fails (network timeout, API quota exhausted, etc.), the system automatically falls back to traditional keyword filtering, ensuring the push service is not interrupted. Once things recover, the next run automatically switches back to AI filtering.
Smart tag updates: re-classify only when needed
After you edit ai_interests.txt, the system intelligently gauges the scale of the change:
  • Minor edits (such as fine-tuning the wording): tags are updated incrementally, and already-analyzed news is not reprocessed
  • Major edits (such as adding a brand-new domain): tags are fully re-extracted and everything is re-scored
This mechanism avoids consuming a large number of API calls every time you make a small tweak.
Per-period customization: keywords in the morning, AI filtering in the evening
In timeline.yaml, each time period can set its filtering method independently. For example, use fast keyword filtering in the morning and more precise AI filtering in the evening:
periods:
  morning:
    start: "08:00"
    end: "10:00"
    filter: keyword       # morning: keyword filtering, fast

  evening:
    start: "19:00"
    end: "21:00"
    filter: ai            # evening: AI filtering, more precise
Deduplication: already-analyzed news is not reprocessed
AI filtering records the news it has already scored. On the next run, it only calls the AI to score newly added news, while reusing the previous scores for already-analyzed items. This not only speeds up processing but also saves on API call costs.

Advanced configuration

The settings below all have sensible defaults and usually don't need to be changed. If you want to fine-tune the AI filtering behavior, set them in the ai_filter section of config.yaml:
SettingDefaultDescription
batch_size200Number of titles sent to the AI per batch
batch_interval2Interval between batches (seconds), to avoid overly frequent requests
reclassify_threshold0.6Threshold for triggering a full reclassification (0-1); lower values lean toward full reclassification (more accurate but uses more tokens)
interests_file(default)Custom interest description filename, placed in the config/custom/ai/ directory. For example, "finance.txt" loads config/custom/ai/finance.txt
Related global settings
SettingDefaultDescription
filter.priority_sort_enabledtrueTag sorting method in AI mode. true = sort by the order defined in the interest description, false = sort by the number of matched items (most first)

Model configuration

AI Smart Filtering shares its model configuration with AI Analysis Push. If you have already configured AI_API_KEY and AI_MODEL for AI analysis, AI filtering reuses them directly — no need to configure them again.
Configure once, use in both places
Configure api_key and model once in the ai section of config.yaml, and both AI Analysis Push and AI Smart Filtering will use the same configuration. For detailed model configuration instructions, see the "AI Analysis Push" chapter.

AI filtering vs. keyword filtering

Each filtering method has its own strengths. You can choose based on your situation, or mix them by time period.
AspectKeyword filtering (keyword)AI filtering (ai)
ConfigurationWrite keyword rules (supports advanced syntax such as regex and grouping)Describe your interests in natural language, with no special syntax to learn
Matching precisionExact matching, but easily misses relevant content worded differentlySemantic matching that understands synonyms and contextual connections
SpeedMilliseconds, virtually no delayRequires API calls, so it takes some time
CostZero costConsumes API usage quota (usually very little)
Learning curveRequires learning keyword syntax (aliases, regex, grouping, etc.)Just write a few sentences — zero learning curve
Which to choose
If you don't want to spend time maintaining a keyword list, or the topics you follow change often, AI filtering is the better choice. If you need precise control (for example, only pushing news that contains a specific company name), keyword filtering is more suitable.