Commit Graph
15 Commits
Author SHA1 Message Date
marcocosta10000 752bb94d48 feat(agent): detect and scrape explicitly requested URLs
Add URL visit detection that triggers a direct page fetch when the
user asks to enter, open, analyze, or read a site along with a URL.
Extend URL extraction to match bare domains (e.g. example.com.br),
deduplicate results, and normalize missing protocol prefixes. Update
the system prompt to instruct the model to treat visited webpage
content as the primary source when [WEBSITE CONTENT FROM ...] tags
are present.

Also rotate conversation context logs for 2026-10-27.
2026-10-27 17:29:08 -03:00
marcocosta10000 5697cd0c40 perf(agent): cache scraped pages and retry failed fetches
Adds a disk-backed scrape cache under workspace/web_cache keyed by
the SHA-256 of the URL, honoring WEB_SEARCH_SCRAPE_CACHE_TTL so
repeated lookups within the window skip the network entirely.

Fetches now retry twice with exponential backoff before giving up,
and URLs are screened against SCRAPING_BLOCKED_EXTENSIONS and
SCRAPING_BLOCKED_DOMAINS to avoid downloading binaries or
denylisted hosts.

New scraping knobs (enable flag, max chars, cache TTL, blocklists)
are exposed via .env, alongside a provider switch to stepfun with
the step-3.7-flash default model.
2026-10-26 17:01:50 -03:00
marcocosta10000 723ca1506b feat(agent): scrape linked pages to ground answers in real content
Adds `_fetch_page_content()`, which downloads a URL with a
browser-like User-Agent and uses BeautifulSoup with the lxml
parser to strip scripts, navigation, and other non-content
markup, returning up to 3000 characters of readable text.

The response validator now also compares generated replies
against this scraped text, flagging named entities and claims
that do not appear in the retrieved page content.

Dependencies: adds beautifulsoup4==4.12.3 and pins lxml==5.3.0
for parser compatibility.
2026-10-26 16:48:29 -03:00
marcocosta10000 9eed02645b feat(search): validate responses against web results
Adds a post-generation validation step that checks whether a
search-grounded reply is actually supported by the retrieved
results: it extracts cited URLs from the response and flags
replies that claim to have searched without citing any of the
provided sources, as well as replies containing specific
numbers or dates absent from the results.

Also switches the default model to xiaomi/mimo-v2.6-flash and
documents the anti-hallucination behavior in the README.
2026-10-26 16:35:20 -03:00
marcocosta10000 ac41cc5771 t4rere 2026-10-26 16:19:07 -03:00
marcocosta10000 4f9d83a451 rerere 2026-10-26 16:13:33 -03:00
marcocosta10000 854348ebeb fix(voice): transcribe audio using the user's preferred language
Voice notes were always recognized with a hardcoded English locale,
which broke transcription for non-English speakers. The handler now
maps the profile's `preferred_language` to a BCP-47 code and passes it
to the Google recognizer, falling back to `pt-BR`.

Also neutralizes the persona prompt so it follows the selected
language instead of forcing Brazilian Portuguese and a fixed gender,
and resets the default `preferred_language` to `pt`.
2026-10-26 15:51:52 -03:00
marcocosta10000 79a73f8f2e feat(bot): add /manual and /about commands to help output
Extend the /help message so users can discover the full user manual
with examples and tips via /manual, and view system information,
version, author, and license via /about.

Also includes the generated conversation context snapshot for
2026-10-26 and the recompiled agent bytecode.
2026-10-26 15:19:17 -03:00
marcocosta10000 fd136db535 chore(config): add .env.example and overhaul README, DEPLOY, and RULES documentation
Introduce a complete `.env.example` covering Telegram, AI provider,
proactive messaging, web search, and vision settings so new users can
bootstrap configuration without reading the source.

Rework README.md with a feature list, project structure, and variable
reference tables; restructure DEPLOY.md with a table of contents,
prerequisites, and env var tables; update RULES.md to declare English
as the interface and documentation language and to document the
`iniciar.sh` entry script. Also add docstrings to schedule and web
search helpers and rename `schedule_data` to `schedule_answers` for
consistency with the other wizard state variables.
2026-10-26 14:25:47 -03:00
marcocosta10000 9848120a1a docs(agent): add comprehensive module docstring and inline comments 2026-10-26 13:58:12 -03:00
marcocosta10000 6b11f05dab refactor(i18n): translate codebase and documentation to English
- Rewrite README.md, DEPLOY.md and RULES.md in English
- Translate module docstring, license string and inline comments
- Rename Portuguese state variables (is_agendamento, is_useragenda,
  is_configia) to English equivalents (is_schedule, is_dailyroutine,
  is_configai)
- Replace Portuguese web-search and file-creation trigger phrases
  with English keywords
2026-10-26 13:50:10 -03:00
marcocosta10000 4cd968a74e feat(vision): add configurable image analysis model and workspace file editing
- Add VISION_MODEL and VISION_PROVIDER env options with openrouter
  default and provider auto-detection from the model id
- Add /veriavision, /configiavision and /about commands
- Support natural-language editing of files inside workspace/ and a
  /baixar command to download them
- Replace config-based timezone with system-local time detection
- Add module version/author/license metadata
- Document development conventions in new RULES.md and update
  README.md/DEPLOY.md with the new commands and env vars
2026-10-26 11:28:59 -03:00
marcocosta10000 237a1dfb53 feat(agent): add automatic web search and rename uploads dir to workspace
- Add WEB_SEARCH_ENABLED and WEB_SEARCH_MAX_RESULTS config options
- Detect search-intent messages via trigger keywords and inject web
  results into the AI context
- Instruct the system prompt to use web search for factual, current,
  or time-sensitive questions instead of inventing data
- Rename uploads directory from `uploadsfiles/` to `workspace/`,
  updating .gitignore and backup instructions in DEPLOY.md
2026-10-26 10:32:31 -03:00
marcocosta10000 25288d2c0f feat(voice): transcribe Telegram voice notes with SpeechRecognition
Add a voice message handler that downloads OGG audio, converts it to
WAV via pydub/ffmpeg, and transcribes it with Google Speech Recognition
(pt-BR) before feeding the text into the normal message pipeline.

Also extract shared text processing into process_text_message, guard
against updates without a text attribute, switch the default AI provider
to openrouter with deepseek-v4-flash, and document the ffmpeg system
requirement in DEPLOY.md.
2026-10-25 17:27:42 -03:00
marcocosta10000 6b3b6541a7 feat: add psagentai agent with deployment and configuration
Initial project setup including the main agent script, configuration
files, profile JSON state, systemd service unit, startup script,
deployment documentation, and Python dependencies.

Includes .env, venv/, and __pycache__/ which should likely be
excluded via .gitignore to avoid committing secrets and artifacts.
2026-10-25 17:05:13 -03:00