mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-10 22:32:16 +02:00
feat: update environment variables and enhance scraping capabilities
- Adjusted Google Maps and YouTube micro pricing in the .env.example file for better cost management. - Introduced new environment variables for captcha solving and stealth browser hardening to improve scraping resilience. - Removed outdated smoke test for scraper API endpoints to streamline testing. - Enhanced anonymous chat agent's system prompt to clarify capabilities and suggest account creation for advanced features. - Updated Reddit fetch logic to prioritize new session handling and improve resilience against IP-related issues. - Added compacting functionality for scraper results to optimize data handling and presentation. - Improved workspace and document management tools with clearer descriptions and enhanced functionality. - Introduced new UI components for agent setup guidance in the web application.
This commit is contained in:
parent
271a21aee6
commit
1fd58752a3
24 changed files with 1326 additions and 320 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from surfsense_mcp.core.rendering import clip, to_json
|
||||
from surfsense_mcp.core.rendering import clip, compact_items, to_json
|
||||
|
||||
|
||||
def test_clip_leaves_short_text_untouched():
|
||||
|
|
@ -20,3 +20,23 @@ def test_to_json_serializes_non_native_values():
|
|||
|
||||
rendered = to_json({"at": datetime(2026, 1, 2, 3, 4, 5)})
|
||||
assert "2026-01-02" in rendered
|
||||
|
||||
|
||||
def test_compact_items_drops_html_and_excerpts_long_fields():
|
||||
result = {
|
||||
"items": [
|
||||
{"title": "t", "body": "b" * 5_000, "html": "<p>dup</p>", "upVotes": 3}
|
||||
]
|
||||
}
|
||||
compacted = compact_items(result, field_limit=100)
|
||||
item = compacted["items"][0]
|
||||
assert "html" not in item
|
||||
assert len(item["body"]) < 200 and "truncated" in item["body"]
|
||||
assert item["upVotes"] == 3
|
||||
# original untouched
|
||||
assert "html" in result["items"][0]
|
||||
|
||||
|
||||
def test_compact_items_passes_through_non_item_results():
|
||||
assert compact_items({"ok": True}) == {"ok": True}
|
||||
assert compact_items([1, 2]) == [1, 2]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue