297 Commits
Author SHA1 Message Date
Martin a4a98fa601 Merge pull request #472 from kuishou68/fix/issue-471-remove-duplicate-soundfile
fix: remove duplicate soundfile entry in requirements.txt
2026-04-22 09:42:23 +02:00
Cocoon-Break 0eb42e4a42 fix: remove duplicate soundfile entry in requirements.txt (Closes #471) 2026-04-14 15:04:31 +08:00
Martin 4c0a72ff61 Merge pull request #468 from octo-patch/fix/issue-394-lm-studio-url-parsing
fix: correct LM Studio URL parsing and uvicorn port binding
2026-04-11 16:46:56 +02:00
Martin 021644d786 Merge pull request #467 from octo-patch/fix/issue-274-searxsearch-query-encoding
fix: URL-encode search query and detect empty results as failure
2026-04-11 16:46:42 +02:00
Martin 725ceeea20 Merge pull request #466 from octo-patch/fix/issue-332-ollama-configurable-port
fix: use configured port from server_address for local Ollama connections
2026-04-11 16:46:16 +02:00
Martin 69bbd31abf Merge pull request #465 from octo-patch/fix/issue-312-dynamic-remote-debugging-port
fix: use dynamic free port for remote debugging to prevent SessionNotCreatedException
2026-04-11 16:44:08 +02:00
Martin 2944ff6892 Merge pull request #463 from octo-patch/fix/issue-352-configurable-backend-url
fix: make REACT_APP_BACKEND_URL configurable for remote deployments
2026-04-11 16:41:57 +02:00
Martin 6fd329acc6 Merge pull request #462 from octo-patch/fix/searxsearch-init-and-api-port
fix: use BACKEND_PORT env var in uvicorn and honor base_url arg in searxSearch
2026-04-11 16:40:09 +02:00
octo-patch 05aa5c2104 fix: correct LM Studio URL parsing and uvicorn port binding (fixes #394)
- lm_studio_fn: use urlparse to extract port from server_address so that
  addresses with an http:// prefix (e.g. http://127.0.0.1:1234, as
  documented in README) no longer break the Docker URL construction.
  Previously split(":")[1] returned "//127.0.0.1" instead of the port
  number, producing a malformed URL.
  Also fix the non-Docker path to avoid prepending http:// when the address
  already includes a scheme.

- api.py: pass the computed port variable to uvicorn.run() instead of the
  hardcoded literal 7777, so that BACKEND_PORT environment variable is
  actually honoured when starting the server directly.
2026-04-11 10:37:17 +08:00
octo-patch a976afdbd7 fix: URL-encode search query and detect empty results as failure (fixes #274)
- Use urllib.parse.urlencode to properly encode the POST body, so queries
  containing special characters like '&', '+', '=' are sent correctly
- Extend execution_failure_check to also detect "No search results" as a
  failure, preventing the agent from silently looping when all SearXNG
  engines are rate-limited and return no results
2026-04-10 10:07:06 +08:00
octo-patch 29aafda41d fix: use configured port from server_address for local Ollama connections (fixes #332)
When is_local=True, the Ollama host URL previously hardcoded port 11434,
ignoring the port specified in provider_server_address in config.ini.
Users who need to run Ollama on a non-default port (e.g. because 11434
is already in use) had no way to configure this without editing source code.

Now the port is extracted from provider_server_address when present,
falling back to 11434 if only a hostname is given.
2026-04-09 10:23:19 +08:00
octo-patch 37c9652e6d fix: use dynamic free port for remote debugging to prevent SessionNotCreatedException (fixes #312)
The hardcoded --remote-debugging-port=9222 caused SessionNotCreatedException
when port 9222 was already in use by another Chrome instance or process.
Replace with a dynamically allocated free port via socket binding.
2026-04-08 10:36:48 +08:00
Octopus f8fc43f6d7 fix: make REACT_APP_BACKEND_URL configurable for remote deployments (fixes #352)
When AgenticSeek is deployed on a remote server and accessed from a
different machine, the frontend JavaScript runs in the user's browser
with localhost:7777 which resolves to the user's local machine, not
the server - causing the 'System offline' error even though the backend
is running.

Change docker-compose.yml to read REACT_APP_BACKEND_URL from .env
(defaulting to http://localhost:7777 for local use) and document the
variable in .env.example so users can point the frontend at their
server's public IP when deploying remotely.
2026-04-07 10:38:24 +08:00
Octopus 3fc2ac5235 fix: use BACKEND_PORT env var in uvicorn and honor base_url arg in searxSearch
- api.py: uvicorn.run was hardcoding port=7777 instead of using the
  port variable populated from BACKEND_PORT env var, making BACKEND_PORT
  ineffective when running python api.py directly
- searxSearch: add missing 'import sys' (caused NameError when run as
  standalone script) and use constructor base_url arg with env var
  fallback so searxSearch(base_url=...) actually takes effect
2026-04-06 10:43:16 +08:00
Martin 31205febfe Merge pull request #460 from octo-patch/fix/provider-registration-bugs
fix: register anthropic provider, fix togetherAI alias, fix dsk_deepseek exception handling
2026-04-05 16:39:32 +02:00
Martin 1fbd8b135b Merge branch 'main' into fix/provider-registration-bugs 2026-04-05 16:39:08 +02:00
Martin 7b8a2271a3 Merge pull request #459 from octo-patch/fix/issue-382-prevent-server-crash-on-query-error
fix: return HTTP 500 instead of crashing server on query errors
2026-04-05 11:59:00 +02:00
Martin 4e985d8df6 Merge pull request #457 from octo-patch/fix/issue-367-make-plan-infinite-loop
fix: add max retry limit to PlannerAgent.make_plan to prevent infinite loop
2026-04-05 11:58:09 +02:00
Martin 74d38100c4 Merge pull request #455 from octo-patch/fix/issue-359-planner-unbound-answer
fix: resolve UnboundLocalError in PlannerAgent.process when stop flag is set
2026-04-05 11:57:16 +02:00
Martin 9e4613df71 Merge pull request #450 from octo-patch/feature/upgrade-minimax-m27
feat: upgrade MiniMax default model to M2.7
2026-04-05 11:55:47 +02:00
Octopus 2b8bc83a97 fix: register anthropic provider, normalize togetherAI alias, fix dsk_deepseek exception handling
- Add 'anthropic' to available_providers and unsafe_providers so users can set
  provider_name = anthropic in config.ini and use ANTHROPIC_API_KEY
- Add provider name alias normalization so 'togetherAI' (as documented in README)
  is accepted as equivalent to 'together'
- Fix NameError in dsk_deepseek: add 'as e' to AuthenticationError, RateLimitError,
  and NetworkError except clauses where 'e' was referenced but not bound
- Remove unreachable 'return thought' dead code at end of lm_studio_fn
- Update README to list Anthropic as a supported API provider
2026-04-05 10:41:54 +08:00
Octopus 872d01f8e5 fix: return HTTP 500 instead of calling sys.exit(1) on query errors
Previously, any unhandled exception during query processing caused the
entire backend server to exit via sys.exit(1), making the frontend show
'System offline. Deploy backend first.' until the container was restarted.
Also, is_generating was never reset to False on exception, permanently
blocking all subsequent queries with 429 responses.

- Replace sys.exit(1) with a proper HTTP 500 error response
- Move is_generating = False to the finally block so it always resets

Fixes #382
2026-04-04 11:23:41 +08:00
Octopus d1ecb15703 fix: add max retry limit to PlannerAgent.make_plan to prevent infinite loop (fixes #367) 2026-04-03 10:51:23 +08:00
Octopus 7cde1549b2 fix: initialize answer variable and reset stop flag in PlannerAgent.process (fixes #359) 2026-04-02 16:52:06 +08:00
PR Bot 1432266694 feat: upgrade MiniMax default model to M2.7
- Add MiniMax-M2.7 and MiniMax-M2.7-highspeed to supported models list
- Update docstring to list M2.7 models before M2.5
- Update README/README_CHS model references
- Add unit tests for M2.7 and M2.7-highspeed models
- Keep all previous models as alternatives
2026-03-18 16:33:04 +08:00
Martin 1036c5fbc1 Merge pull request #449 from guoyangzhen/fix/optional-tts-dependency
fix: make kokoro TTS optional to resolve num2words Python 3.12+ incompatibility
2026-03-16 20:02:51 +01:00
Martin 77ed25306e Merge pull request #448 from guoyangzhen/fix/startup-script-integer-comparison
fix: handle empty dir_size_bytes and remove deprecated docker-compose version
2026-03-16 20:02:07 +01:00
Martin d47761a6a5 Merge pull request #447 from guoyangzhen/fix/frontend-react-scripts-not-found
fix(frontend): ensure react-scripts is available in Docker container
2026-03-16 20:01:00 +01:00
Martin e135683426 Merge pull request #444 from ximiximi423/feat/add-minimax-provider
feat: add MiniMax as new LLM provider
2026-03-16 19:57:55 +01:00
guoyangzhen 53a47be80c fix: make kokoro TTS optional 2026-03-14 17:26:21 +08:00
guoyangzhen 75ce967107 fix: make kokoro TTS optional 2026-03-14 17:26:19 +08:00
guoyangzhen 9a8ce59520 fix: handle empty dir_size_bytes and remove deprecated docker-compose version 2026-03-14 17:09:33 +08:00
guoyangzhen a97010739b fix: handle empty dir_size_bytes and remove deprecated docker-compose version 2026-03-14 17:09:31 +08:00
guoyangzhen 7066f62942 fix(frontend): ensure react-scripts is available in Docker container
Use npm ci + npm rebuild for deterministic installs. Add verification
step that catches missing react-scripts early.

Fixes #411
2026-03-14 16:41:21 +08:00
ximi fc268ed087 feat: add MiniMax as new LLM provider
Add support for MiniMax M2.5 series models via OpenAI-compatible API:
- Add minimax_fn() to Provider class with configurable base URL
- Support both international and China mainland endpoints
- Update documentation in README.md and README_CHS.md
- Add MINIMAX_API_KEY and MINIMAX_BASE_URL to .env.example
- Add unit tests for MiniMax provider

Made-with: Cursor
2026-03-06 17:10:52 +08:00
Martin 781275c881 Merge pull request #439 from Br1an67/feat/issue-108-web-form-handling
feat: add support for select, textarea, and file upload in web forms
2026-03-02 19:45:10 +01:00
Martin 2a69fbef4b Merge pull request #440 from Br1an67/feat/issue-52-add-tests
test: add unit tests for parsing functions, logger, and utility
2026-03-02 19:44:20 +01:00
Martin fa4cef0e74 Merge pull request #438 from Br1an67/fix/issue-356-auto-update-chromedriver
fix: auto-update ChromeDriver when version mismatches Chrome
2026-03-02 19:43:39 +01:00
Martin f63b2c436d Merge pull request #437 from Br1an67/fix/issue-409-json-parsing
fix: handle JSON parsing errors in planner agent
2026-03-02 19:42:42 +01:00
Martin cb6210293a Merge pull request #425 from Aquarius10th/fix-apt-get-error
Specify the base image version to fix dependency missing or version c…
2026-03-02 19:41:02 +01:00
Br1an67 165dcb8d97 test: add unit tests for parsing functions, logger, and utility
Add 34 tests across 3 test files:

- test_browser_agent_parsing.py (20 tests): expand existing tests with
  coverage for extract_links, extract_form, clean_links, parse_answer,
  select_link, jsonify_search_results, stringify_search_results, and
  select_unvisited
- test_logger.py (9 tests): Logger initialization, message writing, log
  level handling, deduplication, and folder creation
- test_utility.py (5 tests): get_color_map returns correct structure and
  color values

All tests avoid LLM requests per issue requirements.
2026-03-02 00:28:48 +08:00
Br1an67 1e827a903b feat: add support for select, textarea, and file upload in web forms
Extend form handling to support:
- <select> dropdowns: detect options, select by visible text or value
- <textarea> fields: fill with text content
- <input type="file">: upload files by absolute path
- All element types are also discovered inside shadow DOM

Changes:
- find_inputs.js: discover <select> (with options) and <textarea>
- browser.py: import Select, handle new element types in
  get_form_inputs() and fill_form_inputs()
2026-03-02 00:16:28 +08:00
Br1an67 16f7f7c917 fix: auto-update ChromeDriver when version mismatches Chrome
Add version compatibility check before using existing ChromeDriver.
When the installed ChromeDriver major version does not match Chrome,
chromedriver_autoinstaller downloads the correct version automatically
instead of failing with a version mismatch error.

Add helper functions get_chromedriver_version() and
is_chromedriver_compatible() with tests for version matching logic.
2026-03-02 00:10:23 +08:00
Br1an67 f350378170 fix: handle JSON parsing errors in planner agent
Add try-except for json.JSONDecodeError in parse_agent_tasks() to
gracefully handle malformed JSON from LLM responses (e.g. Gemini 2.5
Flash via OpenRouter). Returns empty list on parse failure, which
triggers the existing retry mechanism in make_plan().

Add test suite for parse_agent_tasks() covering valid JSON, malformed
JSON, truncated JSON, and invalid agent name cases.
2026-03-02 00:03:36 +08:00
Martin 9611bf4081 Merge pull request #436 from arikusi/add-turkish-readme
docs: add Turkish translation (README_TR.md)
2026-02-28 21:32:00 +01:00
arikusi aeb9145d6e docs: add Turkish translation (README_TR.md) 2026-02-27 01:39:42 +03:00
Frank Zhou 889545f356 Specify the base image version to fix dependency missing or version conflict issues when using apt-get.
The originally specified version 3.11-slim is only an alias representing the latest version in the 3.11.x-slim series (for example, on November 22nd, its exact version number was 3.11.14-slim). After the base image is updated, various unexpected errors may occur when executing apt-get.
2025-11-23 00:03:26 +08:00
Martin 782a933971 Merge pull request #424 from Fosowl/dev
fix: remove unavailable engine from searxng config.
2025-11-15 14:56:20 +01:00
martin 42cd21346f fix: remove unavailable engine from searxng config to avoid warnings/errors 2025-11-15 14:49:42 +01:00
Martin abc765861a Merge pull request #405 from Fosowl/dev
readme update
2025-09-14 20:15:49 +02:00
martin.legrand 141bc5f097 readme update 2025-09-14 20:15:12 +02:00
Martin 8a713e5ec0 Merge pull request #404 from Fosowl/dev
fix : update readme for correct ollama start
2025-09-14 18:23:32 +02:00
martin.legrand 176863be55 fix : listen issue of ollama 2025-09-14 18:22:18 +02:00
Martin 0decd84541 Merge pull request #403 from Fosowl/dev
Fix various ubuntu issues + CLI instructions
2025-09-13 23:50:03 +02:00
martin.legrand edc0e69a82 fix : more linux issues 2025-09-13 23:47:24 +02:00
martin.legrand 60dd8a597f update readme.md 2025-09-13 22:34:05 +02:00
martin.legrand 28d255b8e9 update readme.md 2025-09-13 20:34:27 +02:00
martin.legrand 4554c6ef89 fix command_exists issue in .sh 2025-09-13 15:00:57 +02:00
martin.legrand fd8d940e58 rm test file 2025-09-13 14:31:59 +02:00
martin.legrand 87c8a3fb09 fix: redundant searxng folder causing error on ubuntu, tts issue, bigger mount point allowed by start_services, readme updated for cli mode 2025-09-13 14:30:21 +02:00
Martin be86fd07e1 Merge pull request #402 from Fosowl/dev
fix #400
2025-09-11 23:45:58 +02:00
martin.legrand d80bda8468 fix : unseen recursion mistake on empty value for work folder 2025-09-11 23:44:06 +02:00
Martin 308ba0e595 Merge pull request #379 from Fosowl/dev
readme update
2025-07-13 12:52:03 +02:00
martin legrand f72c1b9b07 update readme 2025-07-13 12:50:15 +02:00
Martin deaf142a0d Merge pull request #373 from Fosowl/dev
Fix backend url issue
2025-07-06 00:35:29 +02:00
martin legrand e0123bfc67 fix : searnxg url 2025-07-06 00:34:36 +02:00
martin legrand fa26cce44f fix : problem with frontend connection, enfore url 2025-07-06 00:24:02 +02:00
martin legrand cb0206e9ee fix : problem with frontend connection url selection 2025-07-06 00:19:46 +02:00
Martin a2f75e7281 Merge pull request #371 from Fosowl/dev
Fix readme typo
2025-07-05 14:47:04 +02:00
martin 3e652a6b99 update readme 2025-07-05 14:45:43 +02:00
Martin fd987e5b5c Merge pull request #370 from Fosowl/dev
Update readme + contributing.md
2025-07-02 18:02:44 +02:00
martin d30f3c5616 update readme 2025-07-01 21:29:49 +02:00
martin db62bb289e update readme 2025-07-01 21:28:55 +02:00
martin 23caf437b1 Update contributing.md + sponsorship 2025-07-01 21:25:58 +02:00
martin f5b1c4ab37 update flight search tool 2025-07-01 20:23:55 +02:00
martin 29044ebbfe update readme mistake #366 2025-07-01 20:07:13 +02:00
Martin 50d098fa96 Merge pull request #361 from natethompson44/docs/enhance-chromedriver-troubleshooting
docs: enhance ChromeDriver troubleshooting for Docker environments
2025-06-28 14:57:29 +02:00
Martin ba74f1efa2 Merge pull request #362 from natethompson44/fix/chromedriver-project-root-priority
fix: prioritize project root ChromeDriver for Docker compatibility
2025-06-28 14:55:18 +02:00
WINZO Platform Developer b3ec49c611 fix: prioritize project root ChromeDriver for Docker compatibility
- Check ./chromedriver before system PATH or auto-installer
- Add Docker environment detection and fallback logic
- Provide debug messages for ChromeDriver source identification
- Improve compatibility with undetected_chromedriver in stealth mode

This resolves issues where undetected_chromedriver downloads its own
ChromeDriver version, bypassing mounted binaries in Docker environments.
The project root approach ensures users can manually place the correct
ChromeDriver version and have it reliably detected.
2025-06-25 18:20:25 -05:00
WINZO Platform Developer 2a5fb69af6 docs: enhance ChromeDriver troubleshooting for Docker environments
- Add detailed Chrome for Testing API instructions
- Include Docker-specific guidance for stealth mode compatibility
- Add troubleshooting tips and version compatibility matrix
- Provide clear step-by-step solution for version mismatches

Fixes common ChromeDriver issues in Docker environments where
undetected_chromedriver bypasses mounted binaries.
2025-06-25 18:20:03 -05:00
Martin 2eb62e63eb Merge pull request #348 from christiancoleman/origin/headless-docker
Headless chrome in a container
2025-06-22 15:40:43 +02:00
Martin 30aecb406d Merge pull request #351 from mmlmt2604/fix_openrouter_freemodel
Enhance Memory class: Remove 'model_use' and 'time' in message payload when user use open router's free model
2025-06-22 15:34:40 +02:00
Mike Lin 860e52c3fa Enhance Memory class: Remove 'model_use' and 'time' in messages payload when user select free model from oepn router which result 500 error 2025-06-22 17:39:38 +08:00
Christian Coleman c7ffe46771 Added a warning for people that try to run a non-headless browser in a docker container. It errors in a very unhelpful way, and so this code tells the user in the output what's happening and also forces headless = True. If a user actually means to run a non-headless browser and view via X11 or something then the warning/output will lead them to the right place that they need to tweak. 2025-06-22 02:39:20 -04:00
Martin 12a6705724 Merge pull request #344 from Fosowl/dev
Fix : searxng search issue on docker
2025-06-21 15:12:47 +02:00
martin 0605fb4526 Fix : searxng issue on docker 2025-06-21 15:11:35 +02:00
Martin 100dda4370 Merge pull request #336 from nettanvirdev/main
Update: Updated The AgenticSeek Frontend
2025-06-20 22:50:03 +02:00
Martin b226c5d1da Merge pull request #339 from Fosowl/dev
Fix :  #338 python not found for key generation
2025-06-18 22:41:26 +02:00
martin bf740d8eb5 update readme 2025-06-18 22:40:29 +02:00
martin f8f987e8ba Merge branch 'main' into dev 2025-06-18 22:14:15 +02:00
martin 29ddf31f82 tup docstring 2025-06-18 22:13:48 +02:00
Martin 41d83e8c46 Merge pull request #327 from christiancoleman/ccdev
Issue with LM Studio not getting port when using Docker
2025-06-18 22:12:27 +02:00
martin 611eddb715 Fix : typo + set safe_mode to False since we now run in docker 2025-06-18 21:40:40 +02:00
martin 40b94c953b Fix : #338 python not found for key generation 2025-06-18 21:35:01 +02:00
Tanvir Ahamed ae7be9ca8d Fix: REACT_APP_BACKEND_URL environment variable issue in frontend in Updated UI.
Revised the BACKEND_URL constant to ensure the application prioritizes fetching the backend URL from the environment variable REACT_APP_BACKEND_URL before defaulting to `http://localhost:7777`.
2025-06-18 00:13:05 +06:00
Tanvir Ahamed 7439ea35c7 Update: Updated the ui 2025-06-18 00:01:24 +06:00
Martin 3550e6ee46 Merge pull request #335 from Fosowl/dev
feat : limiter.toml
2025-06-17 19:29:21 +02:00
martin 69dd856b45 feat : limiter.toml 2025-06-17 19:28:34 +02:00
Christian Coleman e33e3e15e4 Issue with LM Studio not getting port when using Docker 2025-06-15 18:53:36 -04:00
Martin 6bb0e5a16b Merge pull request #325 from Fosowl/dev
readme fixes
2025-06-14 17:48:21 +02:00
martin c388f6c871 readme fixes 2025-06-14 17:45:53 +02:00
Martin d214f3a9c7 Merge pull request #324 from Fosowl/dev
update readme
2025-06-14 17:23:29 +02:00
martin 8888f3c481 update readme 2025-06-14 17:15:48 +02:00
Martin 807358937e Merge pull request #260 from Futbolaholic/improve-readme-onboarding
I've enhanced the README to make it easier for you to get started.
2025-06-14 16:48:49 +02:00
Martin eebf3f3ff3 Merge pull request #323 from Fosowl/dev
Fix : windows docker issues
2025-06-14 16:46:55 +02:00
martin 5a06b21a67 fix : llm provider to be docker compatible with new net configuration 2025-06-14 15:52:00 +02:00
martin legrand fd18953e14 fix : frontend back url 2025-06-14 13:44:32 +02:00
martin legrand c305e025b8 spanish readme 2025-06-14 12:52:07 +02:00
martin 5d2d1c7b08 Merge branch 'main' into dev 2025-06-14 00:30:45 +02:00
martin a6cf09673b fix : docker on windows 2025-06-14 00:30:14 +02:00
Martin d485a32e06 Merge pull request #316 from Fosowl/dev
fix : #305  safer container management
2025-06-13 17:55:57 +02:00
Antoine VIVIES 939b241a45 Merge branch 'main' into improve-readme-onboarding 2025-06-13 11:20:08 +08:00
Martin 01a27c10ad Merge pull request #301 from sukrucildirr/main
chore: fix typos across codebase
2025-06-12 19:11:48 +02:00
Martin 24fea22540 Merge pull request #318 from drhiidden/feature/new-translation-spanish
README main edition - Reference to README_ES
2025-06-12 19:10:38 +02:00
drhiidden 1730172aaa Merge branch 'Fosowl:main' into feature/new-translation-spanish 2025-06-12 11:03:49 +02:00
druiz912 93acf4dfaf add link to spanish readme 2025-06-12 11:02:00 +02:00
martin legrand aa4c95a3f4 fix : #305 safer container management 2025-06-11 20:50:41 +02:00
Martin 2b3946d685 Merge pull request #308 from drhiidden/feature/new-translation-spanish
Add README in Spanish including installation, configuration and use
2025-06-11 19:32:26 +02:00
Rocko Lo a8e0f42939 Merge branch 'main' into improve-readme-onboarding 2025-06-10 17:20:56 -04:00
druiz912 7844d71108 Add README in Spanish including installation, configuration and use 2025-06-10 02:55:57 +02:00
sukrucildirr 7e6b08bc5d Update coder_agent.txt 2025-06-07 23:48:43 +03:00
sukrucildirr c74fb8a005 Update planner_agent.py 2025-06-07 23:47:22 +03:00
sukrucildirr 43acef2378 Update mcpFinder.py 2025-06-07 23:46:44 +03:00
sukrucildirr 4a0843f0aa Update text_to_speech.py 2025-06-07 23:46:17 +03:00
sukrucildirr 583b80707d Update planner_agent.txt 2025-06-07 23:45:25 +03:00
sukrucildirr 8bde81b0b5 Update examples.json 2025-06-07 23:42:56 +03:00
sukrucildirr 48a94d7042 Update dl_safetensors.sh 2025-06-07 23:40:42 +03:00
sukrucildirr b4a692047d Update start_services.sh 2025-06-07 23:39:17 +03:00
sukrucildirr 95a0edc2b6 Update README.md 2025-06-07 23:38:39 +03:00
Martin f271a5b205 Merge pull request #299 from Fosowl/dev
Update all readme
2025-06-06 18:53:54 +02:00
martin legrand 0cec4126d8 update config 2025-06-06 18:53:02 +02:00
martin legrand 946f3a8993 update all readme 2025-06-06 18:51:34 +02:00
martin legrand c09dee0329 merge main to dev 2025-06-06 18:40:14 +02:00
martin legrand 0a1a3eaf77 upd readme 2025-06-06 18:39:11 +02:00
Martin 361c53fb4d Merge pull request #298 from Fosowl/dev
Backend Containerization with Docker
2025-06-06 18:02:55 +02:00
Martin d04fa90391 Merge branch 'main' into dev 2025-06-06 18:01:32 +02:00
Martin 743541955d Merge pull request #289 from Chaudry24/mc/uv-integration
Updated to uv package manager for easier onboarding
2025-06-04 19:47:15 +02:00
Martin 80fea7f40d Merge pull request #279 from zjkal/patch-1
Edit README.md
2025-06-04 19:40:56 +02:00
Chaudry24 5aa08f7e88 misc. files from uv projects 2025-06-04 10:43:12 -05:00
Chaudry24 4cf5761603 feat: modified scripts to use uv instead of pip for easier onboarding 2025-06-04 10:42:55 -05:00
Chaudry24 e8e7a6ee3d fix: updated package for forwards compativility 2025-06-04 10:42:14 -05:00
Chaudry24 e869379751 chore: updated instructions to use uv package manager 2025-06-04 10:40:53 -05:00
martin legrand 42bb65e8f6 upd config.ini 2025-06-03 22:38:53 +02:00
martin legrand 517b4a79e0 upd config.ini 2025-06-03 22:35:50 +02:00
zjkal 665e886e31 * 修改其他域名的README的LOGO为统一LOGO
* 修改简体中文的README标题
2025-06-03 11:46:44 +08:00
martin legrand a58b1cf9f8 fix : conditional stt & tts activation 2025-06-03 02:19:50 +02:00
martin legrand 81760bfd9c upd reamdem 2025-06-02 22:33:27 +02:00
martin legrand e952ac3e61 readme upd 2025-06-02 22:31:43 +02:00
martin legrand e0fa4e6356 readme upd 2025-06-02 22:25:22 +02:00
martin legrand da6056e94c feat: fallback when openssl unavailable 2025-06-02 21:52:24 +02:00
martin legrand 5542914725 merge docker_deployement to dev 2025-06-01 21:56:32 +02:00
martin legrand 12af55f6c4 merge main to dev 2025-06-01 21:54:56 +02:00
martin legrand 2f8d2d4954 config.ini 2025-06-01 21:53:39 +02:00
Martin dc6a35bcf9 Merge pull request #272 from zeteticl/cht
Corrected the simplified Chinese in the README_CHT.md back to traditional Chinese
2025-06-01 21:51:42 +02:00
Sad a7c38819d6 Update README_CHT.md 2025-06-02 03:46:55 +08:00
martin legrand c81c0ffde6 requirement correction 2025-06-01 16:58:16 +02:00
martin legrand 444e7bce22 refactor : remove ntlk import 2025-06-01 16:47:05 +02:00
martin legrand d3f20819ff feat : working mount of work directory on docker 2025-06-01 16:44:07 +02:00
martin legrand 9f0fdd547e refactor: remove unsused sentiment analysis 2025-06-01 16:40:53 +02:00
martin legrand be1bfc5cf2 docker deploy of backend now working 2025-05-31 22:01:42 +02:00
martin legrand a3b0bb22aa latest attempt of dockerization 2025-05-31 19:44:58 +02:00
martin legrand fc74d4361a latest attempt of dockerization 2025-05-31 19:31:25 +02:00
martin legrand 54cc2a03ec feat : updating with latest docker backend build thx to #265 2025-05-31 17:20:40 +02:00
Martin eff5921217 Merge pull request #263 from snuow/feature/fix_README_JP
Fix minor text inconsistencies in README_JP.md
2025-05-31 14:44:51 +02:00
snuow 2ed59939a0 Fix minor text inconsistencies in README_JP.md
The translation was incorrect and has been corrected.
2025-05-31 17:23:31 +09:00
Martin 7c9d963db5 Merge pull request #258 from gabrielsallum/bugfix/204_selinux_problems_in_fedora
ticket#204 on the upstream repo, allow containers to access config dir under SELinux
2025-05-30 21:01:28 +02:00
Gabriel Pontes SallumandCopilot 3ab570e760 Update docker-compose.yml
Seems legit I tried locally seems to work fine also

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-30 11:02:44 -04:00
google-labs-jules[bot] e235aecbc1 I've enhanced the README to make it easier for you to get started.
Here's a summary of the key improvements:
- **Clearer Structure:** I've added new sections for Prerequisites, ChromeDriver Installation, Configuration, and Troubleshooting. I also suggested a Table of Contents.
- **Detailed Prerequisites:** I've explicitly listed all necessary software (Git, Python 3.10.x, Docker Engine & Compose, Chrome) with links and version recommendations.
- **Comprehensive ChromeDriver Guide:** I've consolidated instructions for version matching, downloading from official sources (Chrome for Testing), and PATH setup for all major operating systems.
- **Python Environment:** I've recommended `python3.10 -m venv` and provided OS-specific activation commands.
- **Installation Scripts & Manual Steps:** I've clarified script actions and potential issues (e.g., `pyaudio` on Windows) and streamlined manual installation instructions.
- **Local LLM Setup:** I've added detailed guides for installing Ollama and LM-Studio, pulling/downloading models (with examples), and configuring `config.ini` (including `http://` prefix for server addresses).
- **API LLM Setup:** I've provided thorough instructions for setting API keys as environment variables on Linux/macOS (including shell profile persistence) and Windows (temporary and permanent methods). I've also added example API key links.
- **Expanded `config.ini` Explanation:** I've offered more detailed descriptions for each configuration key, especially `work_dir`.
- **Improved Provider Tables:** I've restructured local and API provider tables for better clarity and linked to setup sections.
- **Enhanced Troubleshooting:**
    - I've updated 'Known Issues' for ChromeDriver, LM-Studio connections, and SearxNG URL (with Windows `export` alternatives).
    - I've transformed "Q: I get an error running cli.py" in FAQ into a comprehensive step-by-step troubleshooting guide.
    - I've added new FAQs for installing local LLM providers, acquiring models, setting API keys on Windows, and handling installation script failures.
- **Consistency:** I've ensured consistent terminology (e.g., "ChromeDriver").
- **OS-Specific Instructions:** I've provided clear, distinct commands and guidance for Linux, macOS, and Windows where necessary.

These changes aim to make your initial setup and troubleshooting process smoother and more accessible.
2025-05-30 09:31:22 +00:00
Gabriel Sallum 67e074165c Regarding ticket#204 on the upstream repo, allow containers to access config dir under SELinux
Under SELinux enforcement, the container was denied access to the bind-mounted ./searxng directory, causing permission errors. Adding the :z flag to the volume mount in docker-compose.yml applies the correct SELinux context for shared access.
2025-05-29 22:39:17 -04:00
Martin e7a4f41101 Merge pull request #255 from 0xthiagomartins/main
Add README_PTBR.md
2025-05-29 23:29:46 +02:00
Thiago Martins 12eb3d5a02 Merge branch 'Fosowl:main' into main 2025-05-29 17:40:38 -03:00
Thiago Martins 34fbaa1f3c Update README_PTBR with formatting corrections and add FAQ section 2025-05-29 17:36:42 -03:00
Martin d59e5d7eb8 Merge pull request #253 from Fosowl/Fosowl-patch-2
Update README.md
2025-05-29 21:52:01 +02:00
Martin 41b5772ff0 Update README.md 2025-05-29 21:51:25 +02:00
martin legrand b96e83dbbe feat : latest docker attempt + fix attempt for #249 2025-05-29 21:33:48 +02:00
martin legrand eadcfb66d1 merge 2025-05-29 15:37:32 +02:00
martin legrand 1c4a550c6f docker: latest backend dockerization attempt but crash 2025-05-29 15:35:00 +02:00
martin legrand 95aeaf74fa docker: latest backend dockerization attempt but crash 2025-05-29 15:34:23 +02:00
martin legrand ec1f7d31fb update start_servicees.sh 2025-05-29 10:51:08 +08:00
martin legrand abae98cf77 feat : optional run backend on host for start_services.sh 2025-05-29 10:51:08 +08:00
martin legrand 819a3fb98d remove commented service 2025-05-29 10:51:08 +08:00
martin legrand 7d74a348c9 comment out bundle approach 2025-05-29 10:51:08 +08:00
martin legrand a3ad635728 deploy : current attempt at backend dockerization 2025-05-29 10:51:08 +08:00
martin legrand 58656ab43c fix typo in readme 2025-05-28 18:41:47 +02:00
Martin c1a1e9409d Merge pull request #234 from hung-ngm/test-tools-parsing
Test tools parsing
2025-05-28 08:42:18 +02:00
Hung Nguyen 41fe95fcb1 Refine test_tools_parsing 2025-05-28 11:47:21 +10:00
Hung Nguyen c8bccc2395 Added unit tests for tools parsing 2025-05-28 11:44:00 +10:00
martin legrand f3da9f2965 gitignore 2025-05-27 23:25:33 +02:00
Martin e45fa86cda Merge pull request #231 from lckdl/main
fix issue #230
2025-05-27 21:48:30 +02:00
lck c8df9e759c fix: handle missing </think> tag in remove_reasoning_text 2025-05-28 02:26:41 +08:00
Martin b3672c60c0 Merge pull request #229 from Fosowl/dev
update readme
2025-05-27 19:35:08 +02:00
martin legrand 97460ded48 set config.ini back like before 2025-05-27 19:31:28 +02:00
martin legrand 9a34ff3646 set config.ini back like before 2025-05-27 19:30:26 +02:00
martin legrand a53842b8b7 update readme disclaimer 2025-05-27 19:29:03 +02:00
Martin 0a8d898e0b Merge pull request #224 from manra399/feature/added-docker-ignore
Added Docker Ignore file.
2025-05-27 18:50:51 +02:00
martin legrand 92f721886c idk 2025-05-27 18:21:31 +02:00
martin legrand 58f46d4351 update start_servicees.sh 2025-05-27 18:19:20 +02:00
manra399 ee6687df85 Added Docker Ignore file. 2025-05-27 13:55:52 +01:00
Thiago Martins 36de7eb389 Add README_PTBR 2025-05-26 17:21:56 -03:00
Martin 8d15546771 Merge pull request #212 from ifurther/patch-1
Update README_CHT.md
2025-05-26 18:48:14 +02:00
ifurther 7ad084b27f updat readme 2025-05-26 21:20:17 +08:00
Further 63cd5eddd7 Update README_CHT.md 2025-05-26 20:48:22 +08:00
martin legrand 50f9e11a35 feat : optional run backend on host for start_services.sh 2025-05-25 22:34:13 +02:00
martin legrand 500605d5da remove commented service 2025-05-25 21:57:56 +02:00
martin legrand 6ec9647d19 comment out bundle approach 2025-05-25 21:56:29 +02:00
martin legrand 16b8f1a451 deploy : current attempt at backend dockerization 2025-05-25 21:19:18 +02:00
martin legrand 6d053cc3a5 merge with #191 2025-05-25 15:39:23 +02:00
Martin 27b4aaa5e9 Merge pull request #191 from klimentij/feature/openrouter-provider
Openrouter provider
2025-05-25 15:18:57 +02:00
Klimentiy Bulygin 3c19f26792 Merge branch 'main' into feature/openrouter-provider 2025-05-25 13:15:56 +02:00
Klimentij Bulygin 12eec50e1c return original docker-compose 2025-05-25 13:14:10 +02:00
Klimentij Bulygin cd78cb36a0 minor 2025-05-25 13:13:03 +02:00
Klimentij Bulygin ec8cab2d6b Merge branch 'feature/openrouter-provider' of https://github.com/klimentij/agenticSeek into feature/openrouter-provider 2025-05-25 13:12:33 +02:00
Klimentij Bulygin b1f9375115 OpenRouter in .env.example 2025-05-25 13:11:10 +02:00
martin legrand 758faf6285 readme update & refactor llm_provider 2025-05-25 11:45:18 +02:00
Martin 20457a574a Merge pull request #197 from Fosowl/dev
Expandable view of reasoning above message instead of a separate view
2025-05-24 19:15:14 +02:00
martin legrand d375359582 feat : better view of reasoning 2025-05-24 12:45:10 +02:00
Klimentiy Bulygin f738fc732e Update config.ini 2025-05-24 00:16:16 +02:00
Klimentiy Bulygin 3be07e3dcb Update config.ini 2025-05-24 00:15:36 +02:00
Martin 7d252ad422 Merge pull request #190 from Fosowl/dev
Add stop button, reasoning view, add anthropic provider
2025-05-21 16:40:08 +02:00
Klimentij Bulygin 1c73ef141c Restore original config.ini settings 2025-05-20 22:47:09 +02:00
Klimentij Bulygin e3757f54ac Undo OpenRouter related changes to README files 2025-05-20 22:46:56 +02:00
Klimentij Bulygin 12afae7472 Fix: Correct provider_name parsing in config.ini 2025-05-20 19:58:59 +02:00
Klimentij Bulygin 9cbf62b47d Configure OpenRouter as default and verify API key handling 2025-05-20 17:50:41 +02:00
Klimentij Bulygin 51b0ca54c7 Initial commit for OpenRouter provider 2025-05-20 17:47:40 +02:00
martin legrand 0f116cc3d0 rm png file 2025-05-20 16:57:46 +02:00
martin legrand a19ef5df66 rm : test code 2025-05-20 16:56:13 +02:00
martin legrand 195b4a07a9 fix : safety of bash interpreter 2025-05-20 16:53:04 +02:00
martin legrand e3d01083d9 feat : stop button integration 2025-05-20 16:47:35 +02:00
martin legrand 102dc60efb feat : integrate reasoning view 2025-05-17 22:04:07 +02:00
Martin ca2b05b35e Merge pull request #188 from Fosowl/dev
Better browser fingerprint spoofing + Markdown support for frontend + block color display fix
2025-05-16 22:31:16 +02:00
martin legrand 713c01193f sec: no crossorigin allow 2025-05-16 14:05:36 +02:00
martin legrand 50a9cb8d27 fix : frontend color 2025-05-16 12:41:56 +02:00
martin legrand bd26d7233d refactor : comments + feat : selected lang in config influe browser config 2025-05-16 10:18:26 +02:00
martin legrand 45fbf5a88c fix comment 2025-05-16 09:24:46 +02:00
martin legrand 384d9a8c0b feat : markdown support on frontend 2025-05-16 09:19:45 +02:00
martin legrand 95d5aea1d5 feat : upgrade stealthness 2025-05-16 09:04:19 +02:00
martin legrand 38b1e17628 feat : better browser spoofing 2025-05-15 15:13:25 +02:00
martin legrand 637ca0f826 feat : attempt to bypass bot detection even more 2025-05-14 21:55:59 +02:00
martin legrand 201b3de15c feat : attempt to bypass bot detection 2025-05-14 21:43:13 +02:00
martin legrand 4739a1377c install: improve sh scripts 2025-05-14 18:50:40 +02:00
Martin 4bb7a21604 Merge pull request #181 from CoruNethron/main
Update README.md to match recent code changes
2025-05-12 22:59:19 +02:00
CoruNethron 725a3c3292 Update README.md to match recent code changes
`deepseek-api` was renamed to `deepseek`
`server` directory is now `llm_server`
2025-05-12 15:46:24 +10:00
Martin e72072090e Merge pull request #176 from Fosowl/dev
Fix connection issue with 0.0.0.0 in app.js + more wide browser view
2025-05-08 13:49:31 +02:00
martin legrand ef91502961 fix : connection issue with 0.0.0.0 in app.js + unzoom browser view 2025-05-08 13:38:07 +02:00
Martin 2048af854f Merge pull request #170 from Fosowl/dev
clarification in readme
2025-05-06 22:45:36 +02:00
martin legrand dd6ddaeca3 upd readme 2025-05-06 22:43:51 +02:00
martin legrand 47fec1914a comment out in progress mcp agent to avoid confusion 2025-05-06 22:39:15 +02:00
Martin 9ff69d1876 Merge pull request #168 from Fosowl/dev
update readme - enforce python 3.10
2025-05-06 20:24:44 +02:00
martin legrand ca2eea8089 update readme 2025-05-06 20:23:53 +02:00
Martin 3678c091ac Merge pull request #167 from rense/feature/remote-ollama
Allow connecting to a remote Ollama server
2025-05-06 19:49:18 +02:00
rense 94fb15359b allow connecting to remote Ollama server 2025-05-06 18:03:14 +02:00
Martin 3d1b3d02d9 Merge pull request #166 from Fosowl/dev
Update ja readme up to date
2025-05-06 11:02:13 +02:00
martin legrand c769e790bc upd: jp readme 2025-05-06 11:01:28 +02:00
martin legrand 23a51e6a05 upd: jp readme 2025-05-06 11:00:35 +02:00
martin legrand 94eada9d5d fix : return for json load 2025-05-05 19:11:56 +02:00
Martin 2cdbb49ecd Merge pull request #163 from Fosowl/dev
MCP Agent prototype (with no MCPs yet), Readme update, New function for memory system
2025-05-05 19:04:42 +02:00
MartinandCopilot dd033d4084 Update sources/memory.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-05 19:00:49 +02:00
martin legrand de2650c007 set limit_to_model_ctx to true 2025-05-05 18:36:37 +02:00
martin legrand deb79b81ca fix: typo 2025-05-05 18:32:06 +02:00
martin legrand 24dc1e1a2c fix: ensure logging is not on stdout/err 2025-05-05 18:29:42 +02:00
martin legrand af7619650a ja readme update 2025-05-05 18:17:58 +02:00
martin legrand df645f9a02 remove start ollama in windows scritp 2025-05-05 18:04:07 +02:00
martin legrand dc6eef8031 update readme 2025-05-05 18:01:02 +02:00
martin legrand 5c391dbb6e update japanese readme 2025-05-05 17:55:34 +02:00
martin legrand 101c103aeb fix : reset of blocks 2025-05-05 15:37:13 +02:00
martin legrand de315a43a1 upd readme 2025-05-05 14:23:10 +02:00
martin legrand 90f173ba52 upd readme 2025-05-05 14:22:18 +02:00
martin legrand e4591ea1b4 feat: improve compression/web agent memory management 2025-05-05 14:15:32 +02:00
martin legrand a7deffedec feat : improve memory system 2025-05-04 21:54:01 +02:00
martin legrand 5949540007 feat : tool description proprety 2025-05-04 19:29:31 +02:00
martin legrand 7afb79117b update agent 2025-05-04 18:49:04 +02:00
martin legrand 442bb4a340 Feat : MCP agent 2025-05-04 18:34:05 +02:00
Martin 99467be133 Merge pull request #162 from Fosowl/dev
upd readme examples
2025-05-04 12:02:27 +02:00
martin legrand 887060acdf upd readme 2025-05-04 12:01:44 +02:00
Martin 90609e960c Merge pull request #161 from Fosowl/dev
Update readme manual install instruction
2025-05-04 11:44:26 +02:00
martin legrand d893928221 update all readme 2025-05-04 11:43:32 +02:00
martin legrand 5bc086fd9d update fr readme 2025-05-04 11:24:40 +02:00
martin legrand aca176b9e7 update readme 2025-05-04 11:14:31 +02:00
Martin 9707dbcbf9 Merge pull request #159 from Fosowl/dev
Fixed tts not working with web interface
2025-05-03 19:23:16 +02:00
martin legrand 52e5af8116 fix : tts not working with web interface 2025-05-03 19:22:01 +02:00
Martin 42058244f2 Merge pull request #158 from Fosowl/dev
Chinese and Japanese Text-to-Speech support + readme update
2025-05-03 18:00:12 +02:00
martin legrand bddaa75e8c upd readme 2025-05-03 16:57:43 +02:00
martin legrand 7904439f35 feat : japanese tts support 2025-05-03 16:48:20 +02:00
martin legrand c873af3d00 fix : text to speech in chinese 2025-05-03 16:34:52 +02:00
Martin fa2852d3e7 Merge pull request #153 from Fosowl/dev
Update config.ini + fix requirement.txt + fix SSL issue with undetected chromedriver
2025-05-02 17:41:17 +02:00
martin legrand 1c4ebefae4 rm png file 2025-05-02 17:30:04 +02:00
martin legrand 96a6dd368a feat: fallback for ssl issues 2025-05-02 17:27:22 +02:00
martin legrand ed4f04b19c update requirement.txt 2025-05-02 17:26:26 +02:00
martin legrand f325865869 feat : update config 2025-05-02 16:56:52 +02:00
Martin a15dd998f3 Merge pull request #152 from Fosowl/dev
Improve chromedriver install error handling + improved fileFinder
2025-05-02 14:30:35 +02:00
martin legrand f17dc0550b feat: better fileFinder read 2025-05-02 14:23:00 +02:00
martin legrand ed76c8415b feat : fileFinder read pdf, browser better chromedriver install 2025-05-02 14:10:16 +02:00
Martin 9f2c105074 Merge pull request #151 from Fosowl/Fosowl-patch-1
Create FUNDING.yml
2025-05-02 11:38:48 +02:00
martin legrand 3cf1cab68f cmv 2025-05-01 22:16:55 +02:00
martin legrand 0579fd3bb6 upd readme 2025-05-01 22:14:59 +02:00
martin legrand c6688355a7 set code safety on by default 2025-05-01 22:10:54 +02:00
martin legrand 68ed1834a9 fix : errors related to API based LLMs 2025-05-01 18:17:03 +02:00
99 changed files with 13913 additions and 7897 deletions
+18
View File
@@ -0,0 +1,18 @@
# Python cache files
__pycache__/
*.py[cod]
# Virtual environments
agentic_seek_env/
.agentic_seek_env/
.env
# Git metadata
.git/
# macOS Finder files
.DS_Store
# Log files
*.log
+18 -1
View File
@@ -1,3 +1,20 @@
SEARXNG_BASE_URL="http://127.0.0.1:8080" SEARXNG_BASE_URL="http://searxng:8080"
REDIS_BASE_URL="redis://redis:6379/0"
WORK_DIR="/Users/username/Documents/workspace_with_my_files"
OLLAMA_PORT="11434"
LM_STUDIO_PORT="1234"
BACKEND_PORT="7777"
# Set this to your server's public IP/hostname when accessing the UI from a remote machine.
# Example: REACT_APP_BACKEND_URL=http://192.168.1.100:7777
REACT_APP_BACKEND_URL=http://localhost:7777
CUSTOM_ADDITIONAL_LLM_PORT="11435"
OPENAI_API_KEY='xxxxx' OPENAI_API_KEY='xxxxx'
DEEPSEEK_API_KEY='xxxxx' DEEPSEEK_API_KEY='xxxxx'
OPENROUTER_API_KEY='xxxxx'
TOGETHER_API_KEY='xxxxx'
GOOGLE_API_KEY='xxxxx'
ANTHROPIC_API_KEY='xxxxx'
MINIMAX_API_KEY='xxxxx'
# Optional: MiniMax API base URL (default: https://api.minimax.io/v1)
# For mainland China users: https://api.minimaxi.com/v1
# MINIMAX_BASE_URL='https://api.minimax.io/v1'
+3 -6
View File
@@ -23,16 +23,13 @@ A clear and concise description of what you expected to happen.
**Screenshots** **Screenshots**
If applicable, add screenshots to help explain your problem. If applicable, add screenshots to help explain your problem.
**LLM Model used**
The model you used, for example deepseek-r1:14b
**Desktop (please complete the following information):** **Desktop (please complete the following information):**
- OS: [e.g. iOS] - OS: [e.g. iOS]
- Browser [e.g. chrome, safari] - Browser [e.g. chrome, safari]
- Version [e.g. 22] - Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context** **Additional context**
Add any other context about the problem here. Add any other context about the problem here.
+4
View File
@@ -6,9 +6,12 @@
*.egg-info *.egg-info
cookies.json cookies.json
test_agent.py test_agent.py
searxng/uwsgi.ini.new
searxng/settings.yml.new
config.ini config.ini
.voices/ .voices/
experimental/ experimental/
chrome_bundle/
.logs/ .logs/
.screenshots/*.png .screenshots/*.png
.screenshots/*.jpg .screenshots/*.jpg
@@ -18,6 +21,7 @@ agentic_seek_env/*
.env .env
*/.env */.env
dsk/ dsk/
chrome136/
### react ### ### react ###
.DS_* .DS_*
+1
View File
@@ -0,0 +1 @@
3.10
+65 -9
View File
@@ -1,10 +1,31 @@
FROM ubuntu:22.04
# Warning: doesn't work yet, backend is run on host machine for now
WORKDIR /app FROM --platform=linux/amd64 python:3.11.12
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -qq -y && \ # Install essential packages and Chrome dependencies
apt-get install -y \ RUN apt-get update -y && apt-get install -y \
wget \
gnupg2 \
ca-certificates \
unzip \
xvfb \
libxss1 \
#libappindicator1 \
fonts-liberation \
libnss3 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
libdrm2 \
libxcomposite1 \
libxdamage1 \
libxrandr2 \
xdg-utils \
dbus \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update -y && \
apt-get install -y \
gcc \ gcc \
g++ \ g++ \
gfortran \ gfortran \
@@ -24,23 +45,58 @@ apt-get install -y \
libgtk-4-1 \ libgtk-4-1 \
libnss3 \ libnss3 \
xdg-utils \ xdg-utils \
wget && \ wget \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update -y && \
apt-get install -y \
alsa-utils \
&& rm -rf /var/lib/apt/lists/*
ENV CHROME_TESTING_VERSION=134.0.6998.88
ENV DISPLAY=:99
WORKDIR /app
RUN set -eux; \
wget -qO /tmp/chrome.zip \
"https://storage.googleapis.com/chrome-for-testing-public/${CHROME_TESTING_VERSION}/linux64/chrome-linux64.zip"; \
unzip -q /tmp/chrome.zip -d /opt; \
rm /tmp/chrome.zip; \
ln -s /opt/chrome-linux64/chrome /usr/local/bin/google-chrome; \
ln -s /opt/chrome-linux64/chrome /usr/local/bin/chrome; \
mkdir -p /opt/chrome; \
ln -s /opt/chrome-linux64/chrome /opt/chrome/chrome; \
google-chrome --version
RUN set -eux; \
wget -qO /tmp/chromedriver.zip \
"https://storage.googleapis.com/chrome-for-testing-public/${CHROME_TESTING_VERSION}/linux64/chromedriver-linux64.zip"; \
unzip -q /tmp/chromedriver.zip -d /tmp; \
mv /tmp/chromedriver-linux64/chromedriver /usr/local/bin; \
rm /tmp/chromedriver.zip; \
chmod +x /usr/local/bin/chromedriver; \
chromedriver --version
RUN chmod +x /opt/chrome/chrome RUN chmod +x /opt/chrome/chrome
# Install dependencies
RUN pip3 install --upgrade pip setuptools wheel
COPY requirements.txt . COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
RUN mkdir -p /opt/workspace
RUN mkdir -p /tmp && chmod 1777 /tmp
# Copy application code # Copy application code
COPY api.py . COPY api.py .
COPY sources/ ./sources/ COPY sources/ ./sources/
COPY prompts/ ./prompts/ COPY prompts/ ./prompts/
COPY crx/ crx/ COPY crx/ crx/
COPY llm_router/ llm_router/ COPY llm_router/ llm_router/
COPY .env .
COPY config.ini . COPY config.ini .
# Expose port
EXPOSE 8000 EXPOSE 8000
# Run the application # Run the application
+371 -181
View File
@@ -4,7 +4,7 @@
<img align="center" src="./media/agentic_seek_logo.png" width="300" height="300" alt="Agentic Seek Logo"> <img align="center" src="./media/agentic_seek_logo.png" width="300" height="300" alt="Agentic Seek Logo">
<p> <p>
English | [中文](./README_CHS.md) | [繁體中文](./README_CHT.md) | [Français](./README_FR.md) | [日本語](./README_JP.md) English | [中文](./README_CHS.md) | [繁體中文](./README_CHT.md) | [Français](./README_FR.md) | [日本語](./README_JP.md) | [Português (Brasil)](./README_PTBR.md) | [Español](./README_ES.md) | [Türkçe](./README_TR.md)
*A **100% local alternative to Manus AI**, this voice-enabled AI assistant autonomously browses the web, writes code, and plans tasks while keeping all data on your device. Tailored for local reasoning models, it runs entirely on your hardware, ensuring complete privacy and zero cloud dependency.* *A **100% local alternative to Manus AI**, this voice-enabled AI assistant autonomously browses the web, writes code, and plans tasks while keeping all data on your device. Tailored for local reasoning models, it runs entirely on your hardware, ensuring complete privacy and zero cloud dependency.*
@@ -22,7 +22,7 @@
* 📋 Plans & Executes Complex Tasks - From trip planning to complex projects — it can split big tasks into steps and get things done using multiple AI agents. * 📋 Plans & Executes Complex Tasks - From trip planning to complex projects — it can split big tasks into steps and get things done using multiple AI agents.
* 🎙️ Voice-Enabled - Clean, fast, futuristic voice and speech to text allowing you to talk to it like it's your personal AI from a sci-fi movie * 🎙️ Voice-Enabled - Clean, fast, futuristic voice and speech to text allowing you to talk to it like it's your personal AI from a sci-fi movie. (In progress)
### **Demo** ### **Demo**
@@ -32,15 +32,21 @@ https://github.com/user-attachments/assets/b8ca60e9-7b3b-4533-840e-08f9ac426316
Disclaimer: This demo, including all the files that appear (e.g: CV_candidates.zip), are entirely fictional. We are not a corporation, we seek open-source contributors not candidates. Disclaimer: This demo, including all the files that appear (e.g: CV_candidates.zip), are entirely fictional. We are not a corporation, we seek open-source contributors not candidates.
> 🛠️ **Work in Progress** Looking for contributors! > 🛠⚠️ **Active Work in Progress**
## Installation > 🙏 This project started as a side-project and has zero roadmap and zero funding. It's grown way beyond what I expected by ending in GitHub Trending. Contributions, feedback, and patience are deeply appreciated.
Make sure you have chrome driver, docker and python3.10 (or newer) installed. ## Prerequisites
For issues related to chrome driver, see the **Chromedriver** section. Before you begin, ensure you have the following software installed:
### 1️⃣ **Clone the repository and setup** * **Git:** For cloning the repository. [Download Git](https://git-scm.com/downloads)
* **Python 3.10.x:** We strongly recommend using Python version 3.10.x. Using other versions might lead to dependency errors. [Download Python 3.10](https://www.python.org/downloads/release/python-3100/) (pick a 3.10.x version).
* **Docker Engine & Docker Compose:** For running bundled services like SearxNG.
* Install Docker Desktop (which includes Docker Compose V2): [Windows](https://docs.docker.com/desktop/install/windows-install/) | [Mac](https://docs.docker.com/desktop/install/mac-install/) | [Linux](https://docs.docker.com/desktop/install/linux-install/)
* Alternatively, install Docker Engine and Docker Compose separately on Linux: [Docker Engine](https://docs.docker.com/engine/install/) | [Docker Compose](https://docs.docker.com/compose/install/) (ensure you install Compose V2, e.g., `sudo apt-get install docker-compose-plugin`).
### 1. **Clone the repository and setup**
```sh ```sh
git clone https://github.com/Fosowl/agenticSeek.git git clone https://github.com/Fosowl/agenticSeek.git
@@ -48,70 +54,82 @@ cd agenticSeek
mv .env.example .env mv .env.example .env
``` ```
### 2 **Create a virtual env** ### 2. Change the .env file content
```sh ```sh
python3 -m venv agentic_seek_env SEARXNG_BASE_URL="http://searxng:8080" # http://127.0.0.1:8080 if running on host
source agentic_seek_env/bin/activate REDIS_BASE_URL="redis://redis:6379/0"
# On Windows: agentic_seek_env\Scripts\activate WORK_DIR="/Users/mlg/Documents/workspace_for_ai"
OLLAMA_PORT="11434"
LM_STUDIO_PORT="1234"
CUSTOM_ADDITIONAL_LLM_PORT="11435"
OPENAI_API_KEY='optional'
DEEPSEEK_API_KEY='optional'
OPENROUTER_API_KEY='optional'
TOGETHER_API_KEY='optional'
GOOGLE_API_KEY='optional'
ANTHROPIC_API_KEY='optional'
``` ```
### 3️⃣ **Install package**
**Automatic Installation (Recommanded):** Update the `.env` file with your own values as needed:
For Linux/Macos: - **SEARXNG_BASE_URL**: Leave unchanged unless running on host with CLI mode.
- **REDIS_BASE_URL**: Leave unchanged
- **WORK_DIR**: Path to your working directory on your local machine. AgenticSeek will be able to read and interact with these files.
- **OLLAMA_PORT**: Port number for the Ollama service.
- **LM_STUDIO_PORT**: Port number for the LM Studio service.
- **CUSTOM_ADDITIONAL_LLM_PORT**: Port for any additional custom LLM service.
**API Key are totally optional for user who choose to run LLM locally. Which is the primary purpose of this project. Leave empty if you have sufficient hardware**
### 3. **Start Docker**
Make sure Docker is installed and running on your system. You can start Docker using the following commands:
- **On Linux/macOS:**
Open a terminal and run:
```sh
sudo systemctl start docker
```
Or launch Docker Desktop from your applications menu if installed.
- **On Windows:**
Start Docker Desktop from the Start menu.
You can verify Docker is running by executing:
```sh ```sh
./install.sh docker info
``` ```
If you see information about your Docker installation, it is running correctly.
For windows: See the table of [Local Providers](#list-of-local-providers) below for a summary.
```sh
./install.bat
```
**Manually:** Next step: [Run AgenticSeek locally](#start-services-and-run)
First, you need to install these packages: *See the [Troubleshooting](#troubleshooting) section if you are having issues.*
*If your hardware can't run LLMs locally, see [Setup to run with an API](#setup-to-run-with-an-api).*
- *Linux*: *For detailed `config.ini` explanations, see [Config Section](#config).*
Updates package list (apt-get update).
Install these:
alsa-utils, portaudio19-dev, python3-pyaudio, libgtk-3-dev, libnotify-dev, libgconf-2-4, libnss3, libxss1, selenium
Make sure to install docker + docker-compose if not already.
- *Macos*:
Update package list.
Install chromedriver.
Install portaudio.
Install chromedriver and selenium.
- *Windows*:
Install pyreadline3, selenium portaudio, pyAudio and chromedriver
Then install pip requirements:
```sh
pip3 install -r requirements.txt
# or
python3 setup.py install
```
--- ---
## Setup for running LLM locally on your machine ## Setup for running LLM locally on your machine
**We recommend using at the very least Deepseek 14B, smaller models will struggle with tasks especially for web browsing.** **Hardware Requirements:**
To run LLMs locally, you'll need sufficient hardware. At a minimum, a GPU capable of running Magistral, Qwen or Deepseek 14B is required. See the FAQ for detailed model/performance recommendations.
**Setup your local provider** **Setup your local provider**
Start your local provider, for example with ollama: Start your local provider (for example with ollama):
Unless you wish to to run AgenticSeek on host (CLI mode), export or set the provider listen address:
```sh
export OLLAMA_HOST=0.0.0.0:11434
```
Then, start you provider:
```sh ```sh
ollama serve ollama serve
@@ -121,110 +139,180 @@ See below for a list of local supported provider.
**Update the config.ini** **Update the config.ini**
Change the config.ini file to set the provider_name to a supported provider and provider_model to `deepseek-r1:14b` Change the config.ini file to set the provider_name to a supported provider and provider_model to a LLM supported by your provider. We recommend reasoning model such as *Magistral* or *Deepseek*.
NOTE: `deepseek-r1:14b`is an example, use a bigger model if your hardware allow it. See the **FAQ** at the end of the README for required hardware.
```sh ```sh
[MAIN] [MAIN]
is_local = True is_local = True # Whenever you are running locally or with remote provider.
provider_name = ollama # or lm-studio, openai, etc.. provider_name = ollama # or lm-studio, openai, etc..
provider_model = deepseek-r1:14b provider_model = deepseek-r1:14b # choose a model that fit your hardware
provider_server_address = 127.0.0.1:11434 provider_server_address = 127.0.0.1:11434
agent_name = Jarvis # name of your AI
recover_last_session = True # whenever to recover the previous session
save_session = True # whenever to remember the current session
speak = False # text to speech
listen = False # Speech to text, only for CLI, experimental
jarvis_personality = False # Whenever to use a more "Jarvis" like personality (experimental)
languages = en zh # The list of languages, Text to speech will default to the first language on the list
[BROWSER]
headless_browser = True # leave unchanged unless using CLI on host.
stealth_mode = True # Use undetected selenium to reduce browser detection
``` ```
**Warning**:
- The `config.ini` file format does not support comments.
Do not copy and paste the example configuration directly, as comments will cause errors. Instead, manually modify the `config.ini` file with your desired settings, excluding any comments.
- Do *NOT* set provider_name to `openai` if using LM-studio for running LLMs. Set it to `lm-studio`.
- Some provider (eg: lm-studio) require you to have `http://` in front of the IP. For example `http://127.0.0.1:1234`
**List of local providers** **List of local providers**
| Provider | Local? | Description | | Provider | Local? | Description |
|-----------|--------|-----------------------------------------------------------| |-----------|--------|-----------------------------------------------------------|
| ollama | Yes | Run LLMs locally with ease using ollama as a LLM provider | | ollama | Yes | Run LLMs locally with ease using ollama as a LLM provider |
| lm-studio | Yes | Run LLM locally with LM studio (set `provider_name` to `lm-studio`)| | lm-studio | Yes | Run LLM locally with LM studio (set `provider_name` to `lm-studio`)|
| openai | Yes | Use openai compatible API | | openai | Yes | Use openai compatible API (eg: llama.cpp server) |
Next step: [Start services and run AgenticSeek](#Start-services-and-Run) Next step: [Start services and run AgenticSeek](#Start-services-and-Run)
*See the **Known issues** section if you are having issues* *See the [Troubleshooting](#troubleshooting) section if you are having issues.*
*If your hardware can't run LLMs locally, see [Setup to run with an API](#setup-to-run-with-an-api).*
*See the **Run with an API** section if your hardware can't run deepseek locally* *For detailed `config.ini` explanations, see [Config Section](#config).*
*See the **Config** section for detailled config file explanation.*
---
## Setup to run with an API ## Setup to run with an API
Set the desired provider in the `config.ini`. See below for a list of API providers. This setup uses external, cloud-based LLM providers. You'll need an API key from your chosen service.
```sh **1. Choose an API Provider and Get an API Key:**
Refer to the [List of API Providers](#list-of-api-providers) below. Visit their websites to sign up and obtain an API key.
**2. Set Your API Key as an Environment Variable:**
* **Linux/macOS:**
Open your terminal and use the `export` command. It's best to add this to your shell's profile file (e.g., `~/.bashrc`, `~/.zshrc`) for persistence.
```sh
export PROVIDER_API_KEY="your_api_key_here"
# Replace PROVIDER_API_KEY with the specific variable name, e.g., OPENAI_API_KEY, GOOGLE_API_KEY
```
Example for TogetherAI:
```sh
export TOGETHER_API_KEY="xxxxxxxxxxxxxxxxxxxxxx"
```
* **Windows:**
* **Command Prompt (Temporary for current session):**
```cmd
set PROVIDER_API_KEY=your_api_key_here
```
* **PowerShell (Temporary for current session):**
```powershell
$env:PROVIDER_API_KEY="your_api_key_here"
```
* **Permanently:** Search for "environment variables" in the Windows search bar, click "Edit the system environment variables," then click the "Environment Variables..." button. Add a new User variable with the appropriate name (e.g., `OPENAI_API_KEY`) and your key as the value.
*(See FAQ: [How do I set API keys?](#how-do-i-set-api-keys) for more details).*
**3. Update `config.ini`:**
```ini
[MAIN] [MAIN]
is_local = False is_local = False
provider_name = openai provider_name = openai # Or google, deepseek, togetherAI, huggingface
provider_model = gpt-4o provider_model = gpt-3.5-turbo # Or gemini-1.5-flash, deepseek-chat, mistralai/Mixtral-8x7B-Instruct-v0.1 etc.
provider_server_address = 127.0.0.1:5000 provider_server_address = # Typically ignored or can be left blank when is_local = False for most APIs
# ... other settings ...
``` ```
Warning: Make sure there is not trailing space in the config. *Warning:* Make sure there are no trailing spaces in the `config.ini` values.
Export your API key: `export <<PROVIDER>>_API_KEY="xxx"` **List of API Providers**
Example: export `TOGETHER_API_KEY="xxxxx"` | Provider | `provider_name` | Local? | Description | API Key Link (Examples) |
|--------------|-----------------|--------|---------------------------------------------------|---------------------------------------------|
| OpenAI | `openai` | No | Use ChatGPT models via OpenAI's API. | [platform.openai.com/signup](https://platform.openai.com/signup) |
| Google Gemini| `google` | No | Use Google Gemini models via Google AI Studio. | [aistudio.google.com/keys](https://aistudio.google.com/keys) |
| Deepseek | `deepseek` | No | Use Deepseek models via their API. | [platform.deepseek.com](https://platform.deepseek.com) |
| Hugging Face | `huggingface` | No | Use models from Hugging Face Inference API. | [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens) |
| TogetherAI | `togetherAI` | No | Use various open-source models via TogetherAI API.| [api.together.ai/settings/api-keys](https://api.together.ai/settings/api-keys) |
| OpenRouter | `openrouter` | No | Use OpenRouter Models| [https://openrouter.ai/](https://openrouter.ai/) |
| MiniMax | `minimax` | No | Use MiniMax models (e.g., MiniMax-M2.7, MiniMax-M2.5).| [platform.minimax.io](https://platform.minimax.io/user-center/basic-information) |
**List of API providers** *Note:*
* We advise against using `gpt-4o` or other OpenAI models for complex web browsing and task planning as current prompt optimizations are geared towards models like Deepseek.
| Provider | Local? | Description | * Coding/bash tasks might encounter issues with Gemini, as it may not strictly follow formatting prompts optimized for Deepseek.
|-----------|--------|-----------------------------------------------------------| * The `provider_server_address` in `config.ini` is generally not used when `is_local = False` as the API endpoint is usually hardcoded in the respective provider's library.
| openai | Depends | Use ChatGPT API |
| deepseek-api | No | Deepseek API (non-private) |
| huggingface| No | Hugging-Face API (non-private) |
| togetherAI | No | Use together AI API (non-private) |
| google | No | Use google gemini API (non-private) |
Next step: [Start services and run AgenticSeek](#Start-services-and-Run) Next step: [Start services and run AgenticSeek](#Start-services-and-Run)
*See the **Known issues** section if you are having issues* *See the **Known issues** section if you are having issues*
*See the **Config** section for detailled config file explanation.* *See the **Config** section for detailed config file explanation.*
--- ---
## Start services and Run ## Start services and Run
Activate your python env if needed. By default AgenticSeek is run fully in docker.
```sh
source agentic_seek_env/bin/activate **Option 1:** Run in Docker, use web interface:
```
Start required services. This will start all services from the docker-compose.yml, including: Start required services. This will start all services from the docker-compose.yml, including:
- searxng - searxng
- redis (required by searxng) - redis (required by searxng)
- frontend - frontend
- backend (if using `full` when using the web interface)
```sh ```sh
sudo ./start_services.sh # MacOS ./start_services.sh full # MacOS
start ./start_services.cmd # Window start start_services.cmd full # Window
``` ```
**Options 1:** Run with the CLI interface. **Warning:** This step will download and load all Docker images, which may take up to 30 minutes. After starting the services, please wait until the backend service is fully running (you should see **backend: "GET /health HTTP/1.1" 200 OK** in the log) before sending any messages. The backend services might take 5 minute to start on first run.
```sh
python3 cli.py
```
**Options 2:** Run with the Web interface.
Start the backend.
```sh
python3 api.py
```
Go to `http://localhost:3000/` and you should see the web interface. Go to `http://localhost:3000/` and you should see the web interface.
*Troubleshooting service start:* If these scripts fail, ensure Docker Engine is running and Docker Compose (V2, `docker compose`) is correctly installed. Check the output in the terminal for error messages. See [FAQ: Help! I get an error when running AgenticSeek or its scripts.](#faq-troubleshooting)
**Option 2:** CLI mode:
To run with CLI interface you would have to install package on host:
```sh
./install.sh
./install.bat # windows
```
Then you must change the SEARXNG_BASE_URL in `config.ini` to:
```sh
SEARXNG_BASE_URL="http://localhost:8080"
```
Start required services. This will start some services from the docker-compose.yml, including:
- searxng
- redis (required by searxng)
- frontend
```sh
./start_services.sh # MacOS
start start_services.cmd # Window
```
Run: uv run: `uv run python -m ensurepip` to ensure uv has pip enabled.
Use the CLI: `uv run cli.py`
--- ---
## Usage ## Usage
Make sure the services are up and running with `./start_services.sh` and run the AgenticSeek with `python3 cli.py` for CLI mode or `python3 api.py` then go to `localhost:3000` for web interface. Make sure the services are up and running with `./start_services.sh full` and go to `localhost:3000` for web interface.
You can also use speech to text by setting `listen = True` in the config. Only for CLI mode. You can also use speech to text by setting `listen = True` in the config. Only for CLI mode.
@@ -232,37 +320,22 @@ To exit, simply say/type `goodbye`.
Here are some example usage: Here are some example usage:
### Coding/Bash > *Make a snake game in python!*
> *Make a snake game in python* > *Search the web for top cafes in Rennes, France, and save a list of three with their addresses in rennes_cafes.txt.*
> *Show me how to multiply matrice in C* > *Write a Go program to calculate the factorial of a number, save it as factorial.go in your workspace*
> *Make a blackjack in golang* > *Search my summer_pictures folder for all JPG files, rename them with todays date, and save a list of renamed files in photos_list.txt*
### Web search > *Search online for popular sci-fi movies from 2024 and pick three to watch tonight. Save the list in movie_night.txt.*
> *Do a web search to find cool tech startup in Japan working on cutting edge AI research* > *Search the web for the latest AI news articles from 2025, select three, and write a Python script to scrape their titles and summaries. Save the script as news_scraper.py and the summaries in ai_news.txt in /home/projects*
> *Can you find on the internet who created AgenticSeek?* > *Friday, search the web for a free stock price API, register with supersuper7434567@gmail.com then write a Python script to fetch using the API daily prices for Tesla, and save the results in stock_prices.csv*
> *Can you use a fuel calculator online to estimate the cost of a Nice - Milan trip* *Note that form filling capabilities are still experimental and might fail.*
### File system
> *Hey can you find where is contract.pdf i lost it*
> *Show me how much space I have left on my disk*
> *Can you follow the readme and install project at /home/path/project*
### Casual
> *Tell me about Rennes, France*
> *Should I pursue a phd ?*
> *What's the best workout routine ?*
After you type your query, AgenticSeek will allocate the best agent for the task. After you type your query, AgenticSeek will allocate the best agent for the task.
@@ -297,7 +370,7 @@ Clone the repository and enter the `server/`folder.
```sh ```sh
git clone --depth 1 https://github.com/Fosowl/agenticSeek.git git clone --depth 1 https://github.com/Fosowl/agenticSeek.git
cd agenticSeek/server/ cd agenticSeek/llm_server/
``` ```
Install server specific requirements: Install server specific requirements:
@@ -325,7 +398,7 @@ Set the `provider_server_address` to the ip address of the machine that will run
is_local = False is_local = False
provider_name = server provider_name = server
provider_model = deepseek-r1:70b provider_model = deepseek-r1:70b
provider_server_address = x.x.x.x:3333 provider_server_address = http://x.x.x.x:3333
``` ```
@@ -335,6 +408,8 @@ Next step: [Start services and run AgenticSeek](#Start-services-and-Run)
## Speech to Text ## Speech to Text
Warning: speech to text only work in CLI mode at the moment.
Please note that currently speech to text only work in english. Please note that currently speech to text only work in english.
The speech-to-text functionality is disabled by default. To enable it, set the listen option to True in the config.ini file: The speech-to-text functionality is disabled by default. To enable it, set the listen option to True in the config.ini file:
@@ -368,88 +443,158 @@ Example config:
is_local = True is_local = True
provider_name = ollama provider_name = ollama
provider_model = deepseek-r1:32b provider_model = deepseek-r1:32b
provider_server_address = 127.0.0.1:11434 provider_server_address = http://127.0.0.1:11434 # Example for Ollama; use http://127.0.0.1:1234 for LM-Studio
agent_name = Friday agent_name = Friday
recover_last_session = False recover_last_session = False
save_session = False save_session = False
speak = False speak = False
listen = False listen = False
work_dir = /Users/mlg/Documents/ai_folder
jarvis_personality = False jarvis_personality = False
languages = en zh languages = en zh # List of languages for TTS and potentially routing.
[BROWSER] [BROWSER]
headless_browser = False headless_browser = False
stealth_mode = False stealth_mode = False
``` ```
**Explanation**: **Explanation of `config.ini` Settings**:
- is_local -> Runs the agent locally (True) or on a remote server (False). * **`[MAIN]` Section:**
* `is_local`: `True` if using a local LLM provider (Ollama, LM-Studio, local OpenAI-compatible server) or the self-hosted server option. `False` if using a cloud-based API (OpenAI, Google, etc.).
* `provider_name`: Specifies the LLM provider.
* Local options: `ollama`, `lm-studio`, `openai` (for local OpenAI-compatible servers), `server` (for the self-hosted server setup).
* API options: `openai`, `google`, `deepseek`, `huggingface`, `togetherAI`.
* `provider_model`: The specific model name or ID for the chosen provider (e.g., `deepseekcoder:6.7b` for Ollama, `gpt-3.5-turbo` for OpenAI API, `mistralai/Mixtral-8x7B-Instruct-v0.1` for TogetherAI).
* `provider_server_address`: The address of your LLM provider.
* For local providers: e.g., `http://127.0.0.1:11434` for Ollama, `http://127.0.0.1:1234` for LM-Studio.
* For the `server` provider type: The address of your self-hosted LLM server (e.g., `http://your_server_ip:3333`).
* For cloud APIs (`is_local = False`): This is often ignored or can be left blank, as the API endpoint is usually handled by the client library.
* `agent_name`: Name of the AI assistant (e.g., Friday). Used as a trigger word for speech-to-text if enabled.
* `recover_last_session`: `True` to attempt to restore the previous session's state, `False` to start fresh.
* `save_session`: `True` to save the current session's state for potential recovery, `False` otherwise.
* `speak`: `True` to enable text-to-speech voice output, `False` to disable.
* `listen`: `True` to enable speech-to-text voice input (CLI mode only), `False` to disable.
* `work_dir`: **Crucial:** The directory where AgenticSeek will read/write files. **Ensure this path is valid and accessible on your system.**
* `jarvis_personality`: `True` to use a more "Jarvis-like" system prompt (experimental), `False` for the standard prompt.
* `languages`: A comma-separated list of languages (e.g., `en, zh, fr`). Used for TTS voice selection (defaults to the first) and can assist the LLM router. Avoid too many or very similar languages for router efficiency.
* **`[BROWSER]` Section:**
* `headless_browser`: `True` to run the automated browser without a visible window (recommended for web interface or non-interactive use). `False` to show the browser window (useful for CLI mode or debugging).
* `stealth_mode`: `True` to enable measures to make browser automation harder to detect. May require manual installation of browser extensions like anticaptcha.
- provider_name -> The provider to use (one of: `ollama`, `server`, `lm-studio`, `deepseek-api`)
- provider_model -> The model used, e.g., deepseek-r1:32b. This section summarizes the supported LLM provider types. Configure them in `config.ini`.
- provider_server_address -> Server address, e.g., 127.0.0.1:11434 for local. Set to anything for non-local API. **Local Providers (Run on Your Own Hardware):**
- agent_name -> Name of the agent, e.g., Friday. Used as a trigger word for TTS. | Provider Name in `config.ini` | `is_local` | Description | Setup Section |
|-------------------------------|------------|-----------------------------------------------------------------------------|------------------------------------------------------------------|
| `ollama` | `True` | Use Ollama to serve local LLMs. | [Setup for running LLM locally](#setup-for-running-llm-locally-on-your-machine) |
| `lm-studio` | `True` | Use LM-Studio to serve local LLMs. | [Setup for running LLM locally](#setup-for-running-llm-locally-on-your-machine) |
| `openai` (for local server) | `True` | Connect to a local server that exposes an OpenAI-compatible API (e.g., llama.cpp). | [Setup for running LLM locally](#setup-for-running-llm-locally-on-your-machine) |
| `server` | `False` | Connect to the AgenticSeek self-hosted LLM server running on another machine. | [Setup to run the LLM on your own server](#setup-to-run-the-llm-on-your-own-server) |
- recover_last_session -> Restarts from last session (True) or not (False). **API Providers (Cloud-Based):**
- save_session -> Saves session data (True) or not (False). | Provider Name in `config.ini` | `is_local` | Description | Setup Section |
|-------------------------------|------------|--------------------------------------------------|-----------------------------------------------------|
| `openai` | `False` | Use OpenAI's official API (e.g., GPT-3.5, GPT-4). | [Setup to run with an API](#setup-to-run-with-an-api) |
| `google` | `False` | Use Google's Gemini models via API. | [Setup to run with an API](#setup-to-run-with-an-api) |
| `deepseek` | `False` | Use Deepseek's official API. | [Setup to run with an API](#setup-to-run-with-an-api) |
| `huggingface` | `False` | Use Hugging Face Inference API. | [Setup to run with an API](#setup-to-run-with-an-api) |
| `togetherAI` | `False` | Use TogetherAI's API for various open models. | [Setup to run with an API](#setup-to-run-with-an-api) |
- speak -> Enables voice output (True) or not (False). ---
## Troubleshooting
- listen -> listen to voice input (True) or not (False). If you encounter issues, this section provides guidance.
- work_dir -> Folder the AI will have access to. eg: /Users/user/Documents/. # Known Issues
- jarvis_personality -> Uses a JARVIS-like personality (True) or not (False). This simply change the prompt file. ## ChromeDriver Issues
- languages -> The list of supported language, needed for the llm router to work properly, avoid putting too many or too similar languages. **Error Example:** `SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version XXX`
- headless_browser -> Runs browser without a visible window (True) or not (False). ### Root Cause
ChromeDriver version incompatibility occurs when:
1. Your installed ChromeDriver version doesn't match your Chrome browser version
2. In Docker environments, `undetected_chromedriver` may download its own ChromeDriver version, bypassing the mounted binary
- stealth_mode -> Make bot detector time harder. Only downside is you have to manually install the anticaptcha extension. ### Solution Steps
- languages -> List of supported languages. Required for agent routing system. The longer the languages list the more model will be downloaded. #### 1. Check Your Chrome Version
Open Google Chrome → `Settings > About Chrome` to find your version (e.g., "Version 134.0.6998.88")
## Providers #### 2. Download Matching ChromeDriver
The table below show the available providers: **For Chrome 115 and newer:** Use the [Chrome for Testing API](https://googlechromelabs.github.io/chrome-for-testing/)
- Visit the Chrome for Testing availability dashboard
- Find your Chrome version or the closest available match
- Download the ChromeDriver for your OS (Linux64 for Docker environments)
| Provider | Local? | Description | **For older Chrome versions:** Use the [legacy ChromeDriver downloads](https://chromedriver.chromium.org/downloads)
|-----------|--------|-----------------------------------------------------------|
| ollama | Yes | Run LLMs locally with ease using ollama as a LLM provider |
| server | Yes | Host the model on another machine, run your local machine |
| lm-studio | Yes | Run LLM locally with LM studio (`lm-studio`) |
| openai | Depends | Use ChatGPT API (non-private) or openai compatible API |
| deepseek-api | No | Deepseek API (non-private) |
| huggingface| No | Hugging-Face API (non-private) |
| togetherAI | No | Use together AI API (non-private) |
| google | No | Use google gemini API (non-private) |
To select a provider change the config.ini: ![Download ChromeDriver from Chrome for Testing](./media/chromedriver_readme.png)
#### 3. Install ChromeDriver (Choose One Method)
**Method A: Project Root Directory (Recommended for Docker)**
```bash
# Place the downloaded chromedriver binary in your project root
cp path/to/downloaded/chromedriver ./chromedriver
chmod +x ./chromedriver # Make executable on Linux/macOS
``` ```
is_local = True
provider_name = ollama **Method B: System PATH**
provider_model = deepseek-r1:32b ```bash
provider_server_address = 127.0.0.1:5000 # Linux/macOS
sudo mv chromedriver /usr/local/bin/
sudo chmod +x /usr/local/bin/chromedriver
# Windows: Place chromedriver.exe in a folder that's in your PATH
``` ```
`is_local`: should be True for any locally running LLM, otherwise False.
`provider_name`: Select the provider to use by it's name, see the provider list above. #### 4. Verify Installation
```bash
# Test the ChromeDriver version
./chromedriver --version
# OR if in PATH:
chromedriver --version
```
`provider_model`: Set the model to use by the agent. ### Docker-Specific Notes
`provider_server_address`: can be set to anything if you are not using the server provider. ⚠️ **Important for Docker Users:**
- The Docker volume mount approach may not work with stealth mode (`undetected_chromedriver`)
- **Solution**: Place ChromeDriver in the project root directory as `./chromedriver`
- The application will automatically detect and use this binary
- You should see: `"Using ChromeDriver from project root: ./chromedriver"` in the logs
# Known issues ### Troubleshooting Tips
## Chromedriver Issues 1. **Still getting version mismatch?**
- Verify the ChromeDriver is executable: `ls -la ./chromedriver`
- Check the ChromeDriver version: `./chromedriver --version`
- Ensure it matches your Chrome browser version
**Known error #1:** *chromedriver mismatch* 2. **Docker container issues?**
- Check backend logs: `docker logs backend`
- Look for the message: `"Using ChromeDriver from project root"`
- If not found, verify the file exists and is executable
3. **Chrome for Testing versions**
- Use the exact version match when possible
- For version 134.0.6998.88, use ChromeDriver 134.0.6998.165 (closest available)
- Major version numbers must match (134 = 134)
### Version Compatibility Matrix
| Chrome Version | ChromeDriver Version | Status |
|----------------|---------------------|---------|
| 134.0.6998.x | 134.0.6998.165 | ✅ Works |
| 133.0.6943.x | 133.0.6943.141 | ✅ Works |
| 132.0.6834.x | 132.0.6834.159 | ✅ Works |
*For the latest compatibility, check the [Chrome for Testing dashboard](https://googlechromelabs.github.io/chrome-for-testing/)*
`Exception: Failed to initialize browser: Message: session not created: This version of ChromeDriver only supports Chrome version 113 `Exception: Failed to initialize browser: Message: session not created: This version of ChromeDriver only supports Chrome version 113
Current browser version is 134.0.6998.89 with binary path` Current browser version is 134.0.6998.89 with binary path`
@@ -470,6 +615,32 @@ And download the chromedriver version matching your OS.
If this section is incomplete please raise an issue. If this section is incomplete please raise an issue.
## connection adapters Issues
```
Exception: Provider lm-studio failed: HTTP request failed: No connection adapters were found for '127.0.0.1:1234/v1/chat/completions'` (Note: port may vary)
```
* **Cause:** The `provider_server_address` in `config.ini` for `lm-studio` (or other similar local OpenAI-compatible servers) is missing the `http://` prefix or is pointing to the wrong port.
* **Solution:**
* Ensure the address includes `http://`. LM-Studio typically defaults to `http://127.0.0.1:1234`.
* Correct `config.ini`: `provider_server_address = http://127.0.0.1:1234` (or your actual LM-Studio server port).
## SearxNG Base URL Not Provided
```
raise ValueError("SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.")
ValueError: SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.`
```
This might arise if you are running the CLI mode with the wrong base url for searxng.
The SEARXNG_BASE_URL should be depending on whenever you run in docker or on host:
**Run on host**: `SEARXNG_BASE_URL="http://localhost:8080"`
**Run fully in docker (web interface)**: `SEARXNG_BASE_URL="http://searxng:8080"`
## FAQ ## FAQ
**Q: What hardware do I need?** **Q: What hardware do I need?**
@@ -479,13 +650,9 @@ If this section is incomplete please raise an issue.
| 7B | 8GB Vram | ⚠️ Not recommended. Performance is poor, frequent hallucinations, and planner agents will likely fail. | | 7B | 8GB Vram | ⚠️ Not recommended. Performance is poor, frequent hallucinations, and planner agents will likely fail. |
| 14B | 12 GB VRAM (e.g. RTX 3060) | ✅ Usable for simple tasks. May struggle with web browsing and planning tasks. | | 14B | 12 GB VRAM (e.g. RTX 3060) | ✅ Usable for simple tasks. May struggle with web browsing and planning tasks. |
| 32B | 24+ GB VRAM (e.g. RTX 4090) | 🚀 Success with most tasks, might still struggle with task planning | | 32B | 24+ GB VRAM (e.g. RTX 4090) | 🚀 Success with most tasks, might still struggle with task planning |
| 70B+ | 48+ GB Vram (eg. mac studio) | 💪 Excellent. Recommended for advanced use cases. | | 70B+ | 48+ GB Vram | 💪 Excellent. Recommended for advanced use cases. |
**Q: Why Deepseek R1 over other models?** **Q: I get an error what do I do?**
Deepseek R1 excels at reasoning and tool use for its size. We think its a solid fit for our needs other models work fine, but Deepseek is our primary pick.
**Q: I get an error running `cli.py`. What do I do?**
Ensure local is running (`ollama serve`), your `config.ini` matches your provider, and dependencies are installed. If none work feel free to raise an issue. Ensure local is running (`ollama serve`), your `config.ini` matches your provider, and dependencies are installed. If none work feel free to raise an issue.
@@ -495,18 +662,41 @@ Yes with Ollama, lm-studio or server providers, all speech to text, LLM and text
**Q: Why should I use AgenticSeek when I have Manus?** **Q: Why should I use AgenticSeek when I have Manus?**
This started as Side-Project we did out of interest about AI agents. Whats special about it is that we want to use local model and avoid APIs.
We draw inspiration from Jarvis and Friday (Iron man movies) to make it "cool" but for functionnality we take more inspiration from Manus, because that's what people want in the first place: a local manus alternative.
Unlike Manus, AgenticSeek prioritizes independence from external systems, giving you more control, privacy and avoid api cost. Unlike Manus, AgenticSeek prioritizes independence from external systems, giving you more control, privacy and avoid api cost.
**Q: Who is behind the project ?**
The project was created by me, along with two friends who serve as maintainers and contributors from the open-source community on GitHub. Were just a group of passionate individuals, not a startup or affiliated with any organization.
Any AgenticSeek account on X other than my personal account (https://x.com/Martin993886460) is an impersonation.
## Contribute ## Contribute
Were looking for developers to improve AgenticSeek! Check out open issues or discussion. Were looking for developers to improve AgenticSeek! Check out open issues or discussion.
[Contribution guide](./docs/CONTRIBUTING.md) [Contribution guide](./docs/CONTRIBUTING.md)
[![Star History Chart](https://api.star-history.com/svg?repos=Fosowl/agenticSeek&type=Date)](https://www.star-history.com/#Fosowl/agenticSeek&Date)
## Sponsors:
Want to level up AgenticSeek capabilities with features like flight search, trip planning, or snagging the best shopping deals? Consider crafting a custom tool with SerpApi to unlock more Jarvis-like capabilities. With SerpApi, you can turbocharge your agent for specialized tasks while staying in full control.
<a href="https://serpapi.com/"><img src="./media/banners/sponsor_banner_serpapi.png" height="350" alt="SerpApi Banner" ></a>
See [Contributing.md](./docs/CONTRIBUTING.md) to learn how to integrate custom tools!
### **Patron sponsor**:
- [tatra-labs](https://github.com/tatra-labs)
## Maintainers: ## Maintainers:
> [Fosowl](https://github.com/Fosowl)
> [steveh8758](https://github.com/steveh8758) > [Fosowl](https://github.com/Fosowl) | Paris Time
> [antoineVIVIES](https://github.com/antoineVIVIES) | Taipei Time
## Special Thanks:
> [tcsenpai](https://github.com/tcsenpai) and [plitc](https://github.com/plitc) For helping with backend dockerization
[![Star History Chart](https://api.star-history.com/svg?repos=Fosowl/agenticSeek&type=Date)](https://www.star-history.com/#Fosowl/agenticSeek&Date)
+456 -287
View File
@@ -1,53 +1,52 @@
# AgenticSeek:私有、本地的 Manus 替代方案
<p align="center"> <p align="center">
<img align="center" src="./media/whale_readme.jpg"> <img align="center" src="./media/agentic_seek_logo.png" width="300" height="300" alt="Agentic Seek Logo">
<p> <p>
English | [中文](./README_CHS.md) | [繁體中文](./README_CHT.md) | [Français](./README_FR.md) | [日本語](./README_JP.md) | [Português (Brasil)](./README_PTBR.md) | [Español](./README_ES.md) | [Türkçe](./README_TR.md)
[English](./README.md) | 中文 | [日本語](./README_JP.md) *一个**100%本地运行的 Manus AI 替代品**,支持语音的 AI 助手,可自主浏览网页、编写代码、规划任务,所有数据仅保存在你的设备上。专为本地推理模型设计,完全在你的硬件上运行,确保隐私无忧,无需云端依赖。*
# AgenticSeek: 類似 Manus 但基於 Deepseek R1 Agents 的本地模型。 [![访问 AgenticSeek](https://img.shields.io/static/v1?label=Website&message=AgenticSeek&color=blue&style=flat-square)](https://fosowl.github.io/agenticSeek.html) ![License](https://img.shields.io/badge/license-GPL--3.0-green) [![Discord](https://img.shields.io/badge/Discord-Join%20Us-7289DA?logo=discord&logoColor=white)](https://discord.gg/8hGDaME3TC) [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/fosowl.svg?style=social&label=Update%20%40Fosowl)](https://x.com/Martin993886460) [![GitHub stars](https://img.shields.io/github/stars/Fosowl/agenticSeek?style=social)](https://github.com/Fosowl/agenticSeek/stargazers)
**Manus AI 的本地替代品**,它是一个具有语音功能的大语言模型秘书,可以 Coding、访问你的电脑文件、浏览网页,并自动修正错误与反省,最重要的是不会向云端传送任何资料。采用 DeepSeek R1 等推理模型构建,完全在本地硬体上运行,进而保证资料的隐私。 ### 为什么选择 AgenticSeek
[![Visit AgenticSeek](https://img.shields.io/static/v1?label=Website&message=AgenticSeek&color=blue&style=flat-square)](https://fosowl.github.io/agenticSeek.html) ![License](https://img.shields.io/badge/license-GPL--3.0-green) [![Discord](https://img.shields.io/badge/Discord-Join%20Us-7289DA?logo=discord&logoColor=white)](https://discord.gg/8hGDaME3TC) [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/fosowl.svg?style=social&label=Update%20%40Fosowl)](https://x.com/Martin993886460) * 🔒 完全本地 & 私有 —— 所有内容都在你的电脑上运行,无云端、无数据共享。你的文件、对话和搜索都保持私密。
> 🛠️ **目前还在开发阶段** – 欢迎任何贡献者加入我们! * 🌐 智能网页浏览 —— AgenticSeek 可自主浏览互联网:搜索、阅读、提取信息、填写网页表单,全程免手动。
https://github.com/user-attachments/assets/4bd5faf6-459f-4f94-bd1d-238c4b331469 * 💻 自动化编程助手 —— 需要代码?它能编写、调试并运行 Python、C、Go、Java 等程序,无需监督。
> *在大阪和东京深入搜寻人工智慧新创公司,至少找到 5 家,然后储存在 research_japan.txt 档案中* * 🧠 智能代理选择 —— 你提问,它自动判断最合适的代理来完成任务。就像有一支专家团队随时待命。
> *你可以用 C 语言制作俄罗斯方块游戏吗?* * 📋 规划并执行复杂任务 —— 从旅行规划到复杂项目,可将大任务拆分为步骤,调用多个 AI 代理协作完成。
> *我想设定一个新的专案档案索引,命名为 mark2。* * 🎙️ 语音支持 —— 干净、快速、未来感的语音与语音转文本功能,让你像科幻电影中的 AI 一样与它对话。(开发中)
### **演示**
> *你能搜索 agenticSeek 项目,了解需要哪些技能,然后打开 CV_candidates.zip 并告诉我哪些最匹配该项目吗?*
## Features: https://github.com/user-attachments/assets/b8ca60e9-7b3b-4533-840e-08f9ac426316
- **100% 本机运行**: 本机运行,不使用云端服务,所以资料绝不会散布出去,我的东西还是我的!不会被当作其他服务的训练资料 免责声明:本演示及出现的所有文件(如 CV_candidates.zip)均为虚构。我们不是公司,只寻求开源贡献者而非候选人
- **文件的交互系统**: 使用 bash 去浏览本机资料和操作本机系统。 > 🛠⚠️ **项目正在积极开发中**
- **自主 Coding**: AgenticSeek 可以自己运行、Debug、编译 Python、C、Golang 和各种语言 > 🙏 本项目起初只是一个副业,没有路线图也没有资金支持。它意外地登上了 GitHub Trending。非常感谢大家的贡献、反馈与耐心
- **代理助理**: 不同的工作由不同的助理去处理问题。AgenticSeek 会自己寻找最适合的助理去做相对应的工作。 ## 前置条件
- **规划**: 对于复杂的任务,AgenticSeek 会交办给不同的助理进行规划和执行。 开始前,请确保已安装以下软件:
- **自主学习**: 自动在网路上寻找资料。 * **Git:** 用于克隆仓库。[下载 Git](https://git-scm.com/downloads)
* **Python 3.10.x:** 强烈推荐使用 Python 3.10.x 版本。使用其他版本可能导致依赖错误。[下载 Python 3.10](https://www.python.org/downloads/release/python-3100/)(选择 3.10.x 版本)。
* **Docker Engine & Docker Compose:** 用于运行捆绑服务如 SearxNG。
* 安装 Docker Desktop(包含 Docker Compose V2):[Windows](https://docs.docker.com/desktop/install/windows-install/) | [Mac](https://docs.docker.com/desktop/install/mac-install/) | [Linux](https://docs.docker.com/desktop/install/linux-install/)
* 或者在 Linux 上分别安装 Docker Engine 和 Docker Compose[Docker Engine](https://docs.docker.com/engine/install/) | [Docker Compose](https://docs.docker.com/compose/install/)(确保安装 Compose V2,例如 `sudo apt-get install docker-compose-plugin`)。
- **记忆功能**: 对于每次的对话进行统整、保存对话,并且在本地储存用户的使用习惯。 ### 1. **克隆仓库并设置**
---
## **安装**
确保已安装了 Chrome driverDocker 和 Python 3.10(或更新)。
有关于 Chrome driver 的问题,请参见 **Chromedriver** 部分。
### 1️⃣ **复制储存库与设置环境变数**
```sh ```sh
git clone https://github.com/Fosowl/agenticSeek.git git clone https://github.com/Fosowl/agenticSeek.git
@@ -55,461 +54,631 @@ cd agenticSeek
mv .env.example .env mv .env.example .env
``` ```
### 2 **建立虚拟环境** ### 2. 修改 .env 文件内容
```sh ```sh
python3 -m venv agentic_seek_env SEARXNG_BASE_URL="http://searxng:8080" # 如果在主机上运行 CLI 模式,使用 http://127.0.0.1:8080
source agentic_seek_env/bin/activate REDIS_BASE_URL="redis://redis:6379/0"
# On Windows: agentic_seek_env\Scripts\activate WORK_DIR="/Users/mlg/Documents/workspace_for_ai"
OLLAMA_PORT="11434"
LM_STUDIO_PORT="1234"
CUSTOM_ADDITIONAL_LLM_PORT="11435"
OPENAI_API_KEY='optional'
DEEPSEEK_API_KEY='optional'
OPENROUTER_API_KEY='optional'
TOGETHER_API_KEY='optional'
GOOGLE_API_KEY='optional'
ANTHROPIC_API_KEY='optional'
``` ```
### 3️⃣ **安装所需套件** 根据需要更新 `.env` 文件:
**自动安装:** - **SEARXNG_BASE_URL**: 除非在主机上运行 CLI 模式,否则保持不变。
- **REDIS_BASE_URL**: 保持不变
- **WORK_DIR**: 本地工作目录路径。AgenticSeek 可读取和操作这些文件。
- **OLLAMA_PORT**: Ollama 服务端口号。
- **LM_STUDIO_PORT**: LM Studio 服务端口号。
- **CUSTOM_ADDITIONAL_LLM_PORT**: 任何额外自定义 LLM 服务的端口。
**API 密钥对于选择本地运行 LLM 的用户完全可选,这也是本项目的主要目的。如果硬件足够,请留空。**
### 3. **启动 Docker**
确保 Docker 已安装并在系统上运行。可以使用以下命令启动 Docker:
- **Linux/macOS:**
打开终端运行:
```sh
sudo systemctl start docker
```
或者如果已安装,从应用程序菜单启动 Docker Desktop。
- **Windows:**
从开始菜单启动 Docker Desktop。
可以通过执行以下命令验证 Docker 是否运行:
```sh ```sh
./install.sh docker info
``` ```
如果看到 Docker 安装信息,则表示运行正常。
**手动安装:** 请参阅下面的[本地提供商列表](#本地提供商列表)了解摘要。
```sh 下一步:[本地运行 AgenticSeek](#启动服务并运行)
pip3 install -r requirements.txt
# or
python3 setup.py install
```
## 在本地机器上运行 AgenticSeek *如果遇到问题,请参阅[故障排除](#故障排除)部分。*
*如果硬件无法本地运行 LLM,请参阅[使用 API 运行设置](#使用-api-运行设置)。*
*有关详细 `config.ini` 说明,请参阅[配置部分](#配置)。*
**建议至少使用 Deepseek 14B 以上参数的模型,较小的模型难以使用助理功能并且很快就会忘记上下文之间的关系。** ---
**本地运行助手** ## 在您的机器上本地运行 LLM 的设置
启动你的本地提供者,例如使用 ollama: **硬件要求:**
要本地运行 LLM,您需要足够的硬件。至少需要能够运行 Magistral、Qwen 或 Deepseek 14B 的 GPU。有关详细的模型/性能建议,请参阅 FAQ。
**设置您的本地提供商**
启动您的本地提供商,例如使用 ollama:
```sh ```sh
ollama serve ollama serve
``` ```
请参阅下方支持的本地提供列表。 请参阅下的本地支持提供列表。
修改 `config.ini` 文件,将 `provider_name` 设置为支持的提供者,并将 `provider_model` 设置为 `deepseek-r1:14b` **更新 config.ini**
注意:`deepseek-r1:14b` 只是一个示例,如果你的硬件允许,可以使用更大的模型 更改 config.ini 文件,将 provider_name 设置为支持的提供商,provider_model 设置为您的提供商支持的 LLM。我们推荐推理模型,如 *Magistral* 或 *Deepseek*
有关所需硬件,请参阅 README 末尾的 **FAQ**。
```sh ```sh
[MAIN] [MAIN]
is_local = True is_local = True # 无论您是本地运行还是使用远程提供商。
provider_name = ollama # 或 lm-studio, openai 等 provider_name = ollama # 或 lm-studioopenai 等
provider_model = deepseek-r1:14b provider_model = deepseek-r1:14b # 选择适合您硬件的模型
provider_server_address = 127.0.0.1:11434 provider_server_address = 127.0.0.1:11434
agent_name = Jarvis # 您的 AI 名称
recover_last_session = True # 是否恢复上一个会话
save_session = True # 是否记住当前会话
speak = False # 文本转语音
listen = False # 语音转文本,仅限 CLI,实验性
jarvis_personality = False # 是否使用更"Jarvis"风格的性格(实验性)
languages = en zh # 语言列表,文本转语音将默认使用列表中的第一种语言
[BROWSER]
headless_browser = True # 除非在主机上使用 CLI,否则保持不变。
stealth_mode = True # 使用不可检测的 selenium 减少浏览器检测
``` ```
**本地提供者列表** **警告**
| 提供者 | 本地? | 描述 | - `config.ini` 文件格式不支持注释。
|-------------|--------|-------------------------------------------------------| 不要直接复制粘贴示例配置,因为注释会导致错误。相反,手动修改 `config.ini` 文件,使用您所需的设置,排除任何注释。
| ollama | 是 | 使用 ollama 作为 LLM 提供者,轻松本地运行 LLM |
| lm-studio | 是 | 使用 LM Studio 本地运行 LLM(将 `provider_name` 设置为 `lm-studio`|
| openai | 否 | 使用兼容的 API |
下一步: [Start services and run AgenticSeek](#Start-services-and-Run) - 如果使用 LM-studio 运行 LLM,请*不要*将 provider_name 设置为 `openai`。将其设置为 `lm-studio`。
--- - 某些提供商(例如:lm-studio)要求您在 IP 前加上 `http://`。例如 `http://127.0.0.1:1234`
## **Run with an API (透过 API 执行)** **本地提供商列表**
设定 `config.ini` | 提供商 | 本地? | 描述 |
|-----------|--------|-----------------------------------------------------------|
| ollama | 是 | 使用 ollama 作为 LLM 提供商轻松本地运行 LLM |
| lm-studio | 是 | 使用 LM studio 本地运行 LLM(将 `provider_name` 设置为 `lm-studio`|
| openai | 是 | 使用 openai 兼容 API(例如:llama.cpp 服务器) |
```sh 下一步:[启动服务并运行 AgenticSeek](#启动服务并运行)
*如果遇到问题,请参阅[故障排除](#故障排除)部分。*
*如果硬件无法本地运行 LLM,请参阅[使用 API 运行设置](#使用-api-运行设置)。*
*有关详细 `config.ini` 说明,请参阅[配置部分](#配置)。*
## 使用 API 运行设置
此设置使用外部、基于云的 LLM 提供商。您需要从所选服务获取 API 密钥。
**1. 选择 API 提供商并获取 API 密钥:**
请参阅下面的[API 提供商列表](#api-提供商列表)。访问他们的网站注册并获取 API 密钥。
**2. 将您的 API 密钥设置为环境变量:**
* **Linux/macOS:**
打开终端并使用 `export` 命令。最好将其添加到 shell 的配置文件中(例如 `~/.bashrc`、`~/.zshrc`)以保持持久性。
```sh
export PROVIDER_API_KEY="your_api_key_here"
# 将 PROVIDER_API_KEY 替换为特定的变量名,例如 OPENAI_API_KEY、GOOGLE_API_KEY
```
TogetherAI 示例:
```sh
export TOGETHER_API_KEY="xxxxxxxxxxxxxxxxxxxxxx"
```
* **Windows:**
* **命令提示符(当前会话临时):**
```cmd
set PROVIDER_API_KEY=your_api_key_here
```
* **PowerShell(当前会话临时):**
```powershell
$env:PROVIDER_API_KEY="your_api_key_here"
```
* **永久性:** 在 Windows 搜索栏中搜索"环境变量",点击"编辑系统环境变量",然后点击"环境变量..."按钮。添加一个新的用户变量,使用适当的名称(例如 `OPENAI_API_KEY`)和您的密钥作为值。
*(有关更多详细信息,请参阅 FAQ:[如何设置 API 密钥?](#如何设置-api-密钥))。*
**3. 更新 `config.ini`**
```ini
[MAIN] [MAIN]
is_local = False is_local = False
provider_name = openai provider_name = openai # 或 google、deepseek、togetherAI、huggingface
provider_model = gpt-4o provider_model = gpt-3.5-turbo # 或 gemini-1.5-flash、deepseek-chat、mistralai/Mixtral-8x7B-Instruct-v0.1 等。
provider_server_address = 127.0.0.1:5000 provider_server_address = # 当 is_local = False 时,对于大多数 API 通常被忽略或可以留空
# ... 其他设置 ...
``` ```
*警告:* 确保 `config.ini` 值中没有尾随空格。
警告:确保 `config.ini` 没有行尾空格。 **API 提供商列表**
如果使用基于本机的 openai-based api 则把 `is_local` 设定为 `True` | 提供商 | `provider_name` | 本地? | 描述 | API 密钥链接(示例) |
|--------------|-----------------|--------|---------------------------------------------------|---------------------------------------------|
| OpenAI | `openai` | 否 | 通过 OpenAI 的 API 使用 ChatGPT 模型。 | [platform.openai.com/signup](https://platform.openai.com/signup) |
| Google Gemini| `google` | 否 | 通过 Google AI Studio 使用 Google Gemini 模型。 | [aistudio.google.com/keys](https://aistudio.google.com/keys) |
| Deepseek | `deepseek` | 否 | 通过他们的 API 使用 Deepseek 模型。 | [platform.deepseek.com](https://platform.deepseek.com) |
| Hugging Face | `huggingface` | 否 | 使用 Hugging Face Inference API 中的模型。 | [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens) |
| TogetherAI | `togetherAI` | 否 | 通过 TogetherAI API 使用各种开源模型。| [api.together.ai/settings/api-keys](https://api.together.ai/settings/api-keys) |
| OpenRouter | `openrouter` | No | 通过 OpenRouter 使用各种开源模型| [https://openrouter.ai/](https://openrouter.ai/) |
| MiniMax | `minimax` | 否 | 使用 MiniMax 模型(如 MiniMax-M2.7、MiniMax-M2.5)。 | [platform.minimax.io](https://platform.minimax.io/user-center/basic-information) |
同时更改你的 IP 为 openai-based api 的 IP。 *注意:*
* 我们不建议将 `gpt-4o` 或其他 OpenAI 模型用于复杂的网页浏览和任务规划,因为当前的提示优化针对 Deepseek 等模型。
* 编码/bash 任务可能会遇到 Gemini 的问题,因为它可能不严格遵循针对 Deepseek 优化的格式化提示。
* 当 `is_local = False` 时,`config.ini` 中的 `provider_server_address` 通常不使用,因为 API 端点通常在相应提供商的库中硬编码。
下一步: [Start services and run AgenticSeek](#Start-services-and-Run) 下一步:[启动服务并运行 AgenticSeek](#启动服务并运行)
*如果遇到问题,请参阅**已知问题**部分*
*有关详细配置文件说明,请参阅**配置**部分。*
--- ---
## Start services and Run ## 启动服务并运行
(启动服务并运行)
如果需要,请激活你的 Python 环境 默认情况下,AgenticSeek 完全在 Docker 中运行
```sh
source agentic_seek_env/bin/activate
```
启动所需的服务。这将启动 `docker-compose.yml` 中的所有服务,包括 **选项 1:** 在 Docker 中运行,使用 Web 界面
- searxng
- redis(由 redis 提供支持) 启动所需服务。这将启动 docker-compose.yml 中的所有服务,包括:
- 前端 - searxng
- redissearxng 所需)
- frontend
- backend(如果使用 Web 界面时使用 `full`
```sh ```sh
sudo ./start_services.sh # MacOS ./start_services.sh full # MacOS
start ./start_services.cmd # Windows start start_services.cmd full # Windows
``` ```
**选项 1:** 使用 CLI 界面运行 **警告:** 此步骤将下载并加载所有 Docker 镜像,可能需要长达 30 分钟。启动服务后,请等待后端服务完全运行(您应该在日志中看到 **backend: "GET /health HTTP/1.1" 200 OK**)后再发送任何消息。首次运行时,后端服务可能需要 5 分钟才能启动
转到 `http://localhost:3000/`,您应该会看到 Web 界面。
*服务启动故障排除:* 如果这些脚本失败,请确保 Docker Engine 正在运行并且 Docker ComposeV2`docker compose`)已正确安装。检查终端输出中的错误消息。请参阅 [FAQ:帮助!运行 AgenticSeek 或其脚本时出现错误。](#faq-故障排除)
**选项 2:** CLI 模式:
要使用 CLI 界面运行,您必须在主机上安装软件包:
```sh ```sh
python3 cli.py ./install.sh
./install.bat # windows
``` ```
**选项 2:** 使用 Web 界面运行。 然后您必须将 `config.ini` 中的 SEARXNG_BASE_URL 更改为:
注意:目前我們建議您使用 CLI 界面。Web 界面仍在積極開發中。
启动后端服务。
```sh ```sh
python3 api.py SEARXNG_BASE_URL="http://localhost:8080"
``` ```
访问 `http://localhost:3000/`,你应该会看到 Web 界面。 启动所需服务。这将启动 docker-compose.yml 中的一些服务,包括:
- searxng
- redissearxng 所需)
- frontend
请注意,目前 Web 界面不支持消息流式传输。 ```sh
./start_services.sh # MacOS
start start_services.cmd # Windows
```
运行:uv run: `uv run python -m ensurepip` 以确保 uv 已启用 pip。
*如果你不知道如何开始,请参阅 **Usage** 部分* 使用 CLI`uv run cli.py`
--- ---
## Usage 使用方法 ## 使用方法
确保 agenticSeek 在中文环境下正常工作,请确保在 config.ini 中设置语言选项 确保服务已通过 `./start_services.sh full` 启动并运行,然后转到 `localhost:3000` 使用 Web 界面
languages = en zh
更多信息请参阅 Config 部分
确定所有的核心档案都启用了,也就是执行过这条命令 `./start_services.sh` 然后你就可以使用 `python3 cli.py` 来启动 AgenticSeek 了! 您也可以通过设置 `listen = True` 来使用语音转文本。仅限 CLI 模式。
```sh 要退出,只需说/输入 `goodbye`。
sudo ./start_services.sh
python3 cli.py
```
当你看到执行后显示 `>>> ` 以下是一些使用示例:
这表示一切运作正常,AgenticSeek 正在等待你给他任何指令。
你也可以透过设定 `config.ini` 内的 `listen = True` 来启用语音转文字。
要退出时,只要和他说 `goodbye` 就可以退出! > *用 python 写一个贪吃蛇游戏!*
以下是一些用法: > *搜索法国雷恩的最佳咖啡馆,并将三家及其地址保存到 rennes_cafes.txt。*
### Coding/Bash > *写一个 Go 程序计算阶乘,保存为 factorial.go 到你的工作区*
> *在 Golang 中帮助我进行矩阵乘法* > *在 summer_pictures 文件夹中查找所有 JPG 文件,用今天日期重命名,并将重命名文件列表保存到 photos_list.txt*
> *使用 nmap 扫描我的网路,找出是否有任何可疑装置连接* > *在线搜索 2024 年热门科幻电影,挑选三部今晚观看,保存到 movie_night.txt。*
> *用 Python 制作一个贪食蛇游戏* > *搜索 2025 年最新 AI 新闻文章,选三篇,写 Python 脚本抓取标题和摘要,脚本保存为 news_scraper.py,摘要保存到 ai_news.txt/home/projects*
### 网路搜寻 > *周五,搜索免费股票价格 API,用 supersuper7434567@gmail.com 注册,然后写 Python 脚本每日获取特斯拉股价,结果保存到 stock_prices.csv*
> *进行网路搜寻,找出日本从事尖端人工智慧研究的酷炫科技新创公司* *请注意,表单填写功能仍为实验性,可能失败。*
> *你能在网路上找到谁创造了 AgenticSeek 吗?* 输入查询后,AgenticSeek 将分配最佳代理执行任务。
> *你能在哪个网站上找到便宜的 RTX 4090 吗?* 由于这是早期原型,代理路由系统可能无法总是根据您的查询分配正确的代理。
### 档案浏览与搜寻 因此,您应该非常明确地表达您想要什么以及 AI 可能如何进行,例如如果您希望它进行网页搜索,不要说:
> *嘿,你能找到我遗失的 million_dollars_contract.pdf 在哪里吗?* `你知道哪些适合独自旅行的国家吗?`
> *告诉我我的磁碟还剩下多少空间* 而应说:
> *寻找并阅读 README.md,并按照安装说明进行操作* `进行网页搜索,找出最适合独自旅行的国家`
### 日常聊天
> *告诉我关于法国的事*
> *人生的意义是什么?*
> *我应该在锻炼前还是锻炼后服用肌酸?*
当你把指令送出后,AgenticSeek 会自动调用最能提供帮助的助理,去完成你交办的工作和指令。
但也有可能出现怪怪的情况,或是你要找飞机机票,他跑去教你如何一步步做出一台飞机(开玩笑的,但真的可能出现),因为这是一个早期专案,我们会努力教导他、完善他的!
所以我们希望你在使用时,能明确地表明你希望他要怎么做,下面给你一个范例!
你该说:
- 进行网络搜索,找出哪些国家最适合独自旅行
而不是说:
- 你知道哪些国家适合独自旅行?
--- ---
## **在自己的服务器上运行 LLM 的设置**
--- 如果您有功能强大的计算机或可以使用的服务器,但想从笔记本电脑使用它,您可以选择使用我们的自定义 llm 服务器在远程服务器上运行 LLM。
## **在本地执行属于你的 LLM 伺服器** 在将运行 AI 模型的"服务器"上,获取 IP 地址
如果你有一台功能强大的电脑或伺服器,但你想透过笔记型电脑使用它,那么你可以选择在远端伺服器上执行 LLM。
### 1️⃣ **设定并启动伺服器脚本**
在运行 AI 模型的「伺服器」上,取得 IP 位址
```sh ```sh
ip a | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}' | cut -d/ -f1 ip a | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}' | cut -d/ -f1 # 本地 IP
curl https://ipinfo.io/ip # 公共 IP
``` ```
注意:请在 Windows 或 MacOS,分别使用 `ipconfig``ifconfig` 来寻找 IP 址。 注意:对于 Windows 或 macOS,分别使用 ipconfigifconfig找 IP 址。
**如果你希望使用基于 Openai 的服务,请按照 *透过 API 执行* 部分进行。** 克隆仓库并进入 `server/` 文件夹。
复制储存库并且进入 `server/` 资料夹。
```sh ```sh
git clone --depth 1 https://github.com/Fosowl/agenticSeek.git git clone --depth 1 https://github.com/Fosowl/agenticSeek.git
cd agenticSeek/server/ cd agenticSeek/llm_server/
``` ```
安装伺服器所需的套件 安装服务器特定要求
```sh ```sh
pip3 install -r requirements.txt pip3 install -r requirements.txt
``` ```
执行伺服器脚本。 运行服务器脚本。
```sh ```sh
python3 app.py --provider ollama --port 3333 python3 app.py --provider ollama --port 3333
``` ```
您可以选择使用 `ollama``llamacpp` 作为 LLM 服务框架 您可以选择使用 `ollama` 和 `llamacpp` 作为 LLM 服务。
### 2️⃣ **执行** 现在在您的个人计算机上:
在你的电脑上: 更改 `config.ini` 文件,将 `provider_name` 设置为 `server``provider_model` 设置为 `deepseek-r1:xxb`。
将 `provider_server_address` 设置为将运行模型的机器的 IP 地址。
- 更改 `config.ini`
- `provider_name = server`
- `provider_model = deepseek-r1:14b`
- `provider_server_address = {你执行模型的电脑的 IP 位址}`
```sh ```sh
[MAIN] [MAIN]
is_local = False is_local = False
provider_name = server provider_name = server
provider_model = deepseek-r1:14b provider_model = deepseek-r1:70b
provider_server_address = x.x.x.x:3333 provider_server_address = http://x.x.x.x:3333
``` ```
下一步:[启动服务并运行 AgenticSeek](#启动服务并运行)
--- ---
## 语音转文 ## 语音转文
请注意,目前语音转文字功能仅支持英语 警告:目前语音转文本仅适用于 CLI 模式
预设状况下,语音转文字功能是停用的。若要启用它,请在 `config.ini` 档案中,将 `listen` 选项设为 `True` 请注意,目前语音转文本仅适用于英语。
语音转文本功能默认禁用。要启用它,请在 config.ini 文件中将 listen 选项设置为 True
``` ```
listen = True listen = True
``` ```
启用后 AgenticSeek 会聆听你是否呼唤他,他才会开始听你说的话,你可以在 *config.ini* 内去设定,要怎么叫他。 启用后,语音转文本功能会监听触发关键字,即代理的名称,然后开始处理您的输入。您可以通过更新 *config.ini* 文件中的 `agent_name` 值来自定义代理的名称:
``` ```
agent_name = Friday agent_name = Friday
``` ```
为了获得比较好的结果,我们建议使用常见的英文名称JohnEmma”)作为他的名字 为了获得最佳识别效果,我们建议使用常见的英文名称"John""Emma" 作为代理名称
当你看到程式开始执行时,请大声说出他的名字,就可以唤醒 AgenticSeek 去聆听!(如:Friday 一旦您看到转录开始出现,请大声说出代理的名称以唤醒它(例如,"Friday")。
清楚说出你的需求 清晰地说出您的查询
用确认短结束你说的话,以通知 AgenticSeek 继续。确认短句的范例包括: 用确认短结束您的请求,以指示系统继续。确认短语的示例包括:
``` ```
"do it", "go ahead", "execute", "run", "start", "thanks", "would ya", "please", "okay?", "proceed", "continue", "go on", "do that", "go it", "do you understand?" "do it", "go ahead", "execute", "run", "start", "thanks", "would ya", "please", "okay?", "proceed", "continue", "go on", "do that", "go it", "do you understand?"
``` ```
## Config ## 配置
Config 范例: 配置示例:
``` ```
[MAIN] [MAIN]
is_local = True is_local = True
provider_name = ollama provider_name = ollama
provider_model = deepseek-r1:1.5b provider_model = deepseek-r1:32b
provider_server_address = 127.0.0.1:11434 provider_server_address = http://127.0.0.1:11434 # Ollama 示例;LM-Studio 使用 http://127.0.0.1:1234
agent_name = Friday agent_name = Friday
recover_last_session = False recover_last_session = False
save_session = False save_session = False
speak = False speak = False
listen = False listen = False
work_dir = /Users/mlg/Documents/ai_folder
jarvis_personality = False jarvis_personality = False
languages = en zh languages = en zh # TTS 和潜在路由的语言列表。
[BROWSER] [BROWSER]
headless_browser = False headless_browser = False
stealth_mode = False stealth_mode = False
``` ```
**说明**: **`config.ini` 设置说明**
- is_local
- True:在本地运行。
- False:在远端伺服器运行。
- provider_name
- 框架类型
- `ollama`, `server`, `lm-studio`, `deepseek-api`
- provider_model
- 运行的模型
- `deepseek-r1:1.5b`, `deepseek-r1:14b`
- provider_server_address
- 伺服器 IP
- `127.0.0.1:11434`
- agent_name
- AgenticSeek 的名字,用作TTS的触发单词。
- `Friday`
- recover_last_session
- True:从上个对话继续。
- False:重启对话。
- save_session
- True:储存对话纪录。
- False:不保存。
- speak
- True:启用语音输出。
- False:关闭语音输出。
- listen
- True:启用语音输入。
- False:关闭语音输入。
- work_dir
- AgenticSeek 拥有能存取与交互的工作目录。
- jarvis_personality
> 就是那个钢铁人的 JARVIS
- True:启用 JARVIS 个性。
- False:关闭 JARVIS 个性。
- headless_browser
- True:前景浏览器。(很酷,推荐使用他 XD)
- False:背景执行浏览器。
- stealth_mode
- 隐私模式,但需要你自己安装反爬虫扩充功能。
- languages
- 支持的语言列表。用于代理路由系统。语言列表越长,下载的模型越多。
## 框架 * **`[MAIN]` 部分:**
* `is_local`: 如果使用本地 LLM 提供商(Ollama、LM-Studio、本地 OpenAI 兼容服务器)或自托管服务器选项,则为 `True`。如果使用基于云的 API(OpenAI、Google 等),则为 `False`。
* `provider_name`: 指定 LLM 提供商。
* 本地选项:`ollama`、`lm-studio`、`openai`(用于本地 OpenAI 兼容服务器)、`server`(用于自托管服务器设置)。
* API 选项:`openai`、`google`、`deepseek`、`huggingface`、`togetherAI`。
* `provider_model`: 所选提供商的特定模型名称或 ID(例如,Ollama 的 `deepseekcoder:6.7b`OpenAI API 的 `gpt-3.5-turbo`TogetherAI 的 `mistralai/Mixtral-8x7B-Instruct-v0.1`)。
* `provider_server_address`: 您的 LLM 提供商的地址。
* 对于本地提供商:例如,Ollama 的 `http://127.0.0.1:11434`LM-Studio 的 `http://127.0.0.1:1234`。
* 对于 `server` 提供商类型:您的自托管 LLM 服务器的地址(例如 `http://your_server_ip:3333`)。
* 对于云 API`is_local = False`):这通常被忽略或可以留空,因为 API 端点通常由客户端库处理。
* `agent_name`: AI 助手的名称(例如 Friday)。如果启用,用作语音转文本的触发词。
* `recover_last_session`: `True` 尝试恢复上一个会话的状态,`False` 重新开始。
* `save_session`: `True` 保存当前会话的状态以供潜在恢复,`False` 否则。
* `speak`: `True` 启用文本转语音语音输出,`False` 禁用。
* `listen`: `True` 启用语音转文本语音输入(仅限 CLI 模式),`False` 禁用。
* `work_dir`: **关键:** AgenticSeek 将读取/写入文件的目录。**确保此路径在您的系统上有效且可访问。**
* `jarvis_personality`: `True` 使用更"Jarvis-like"的系统提示(实验性),`False` 使用标准提示。
* `languages`: 逗号分隔的语言列表(例如 `en, zh, fr`)。用于 TTS 语音选择(默认为第一个),并可以协助 LLM 路由器。为避免路由器效率低下,避免使用过多或非常相似的语言。
* **`[BROWSER]` 部分:**
* `headless_browser`: `True` 在没有可见窗口的情况下运行自动化浏览器(推荐用于 Web 界面或非交互式使用)。`False` 显示浏览器窗口(对于 CLI 模式或调试有用)。
* `stealth_mode`: `True` 启用使浏览器自动化更难检测的措施。可能需要手动安装浏览器扩展,如 anticaptcha。
下表显示了可用的框架: 本节总结了支持的 LLM 提供商类型。在 `config.ini` 中配置它们。
| 框架 | 本地? | 描述| **本地提供商(在您自己的硬件上运行):**
|-|-|-|
| ollama | 可 | 使用 ollama 框架去执行本地模型 |
| server | 可 | 本地伺服器执行模型远端调用 |
| lm-studio | 可 | 使用 LM Studio 在本地运行 LLM(设定provider_name为lm-studio|
| openai | 不可 | 使用 ChatGPT API(无法保证隐私)|
| deepseek-api | 不可 | 使用 Deepseek API (无法保证隐私)|
| huggingface | 不可 | 使用 Hugging-Face API (无法保证隐私)|
若要选择框架,请变更 `config.ini` 文件: | config.ini 中的提供商名称 | `is_local` | 描述 | 设置部分 |
|-------------------------------|------------|-----------------------------------------------------------------------------|------------------------------------------------------------------|
| `ollama` | `True` | 使用 Ollama 轻松提供本地 LLM。 | [在您的机器上本地运行 LLM 的设置](#在您的机器上本地运行-llm-的设置) |
| `lm-studio` | `True` | 使用 LM-Studio 提供本地 LLM。 | [在您的机器上本地运行 LLM 的设置](#在您的机器上本地运行-llm-的设置) |
| `openai`(用于本地服务器) | `True` | 连接到暴露 OpenAI 兼容 API 的本地服务器(例如,llama.cpp)。 | [在您的机器上本地运行 LLM 的设置](#在您的机器上本地运行-llm-的设置) |
| `server` | `False` | 连接到在另一台机器上运行的 AgenticSeek 自托管 LLM 服务器。 | [在自己的服务器上运行 LLM 的设置](#在自己的服务器上运行-llm-的设置) |
**API 提供商(基于云):**
| config.ini 中的提供商名称 | `is_local` | 描述 | 设置部分 |
|-------------------------------|------------|--------------------------------------------------|-----------------------------------------------------|
| `openai` | `False` | 使用 OpenAI 的官方 API(例如,GPT-3.5、GPT-4)。 | [使用 API 运行设置](#使用-api-运行设置) |
| `google` | `False` | 通过 API 使用 Google 的 Gemini 模型。 | [使用 API 运行设置](#使用-api-运行设置) |
| `deepseek` | `False` | 使用 Deepseek 的官方 API。 | [使用 API 运行设置](#使用-api-运行设置) |
| `huggingface` | `False` | 使用 Hugging Face Inference API。 | [使用 API 运行设置](#使用-api-运行设置) |
| `togetherAI` | `False` | 使用 TogetherAI 的 API 获取各种开放模型。 | [使用 API 运行设置](#使用-api-运行设置) |
---
## 故障排除
如果遇到问题,本节提供指导。
# 已知问题
## ChromeDriver 问题
**错误示例:** `SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version XXX`
### 根本原因
ChromeDriver 版本不兼容发生在:
1. 您安装的 ChromeDriver 版本与 Chrome 浏览器版本不匹配
2. 在 Docker 环境中,`undetected_chromedriver` 可能会下载自己的 ChromeDriver 版本,绕过挂载的二进制文件
### 解决步骤
#### 1. 检查您的 Chrome 版本
打开 Google Chrome → `设置 > 关于 Chrome` 查找您的版本(例如,"版本 134.0.6998.88"
#### 2. 下载匹配的 ChromeDriver
**对于 Chrome 115 及更新版本:** 使用 [Chrome for Testing API](https://googlechromelabs.github.io/chrome-for-testing/)
- 访问 Chrome for Testing 可用性仪表板
- 找到您的 Chrome 版本或最接近的可用匹配
- 为您的操作系统下载 ChromeDriverDocker 环境使用 Linux64
**对于旧版 Chrome** 使用 [旧版 ChromeDriver 下载](https://chromedriver.chromium.org/downloads)
![从 Chrome for Testing 下载 ChromeDriver](./media/chromedriver_readme.png)
#### 3. 安装 ChromeDriver(选择一种方法)
**方法 A:项目根目录(Docker 推荐)**
```bash
# 将下载的 chromedriver 二进制文件放在项目根目录
cp path/to/downloaded/chromedriver ./chromedriver
chmod +x ./chromedriver # 在 Linux/macOS 上使其可执行
``` ```
is_local = False
provider_name = openai **方法 B:系统 PATH**
provider_model = gpt-4o ```bash
provider_server_address = 127.0.0.1:5000 # Linux/macOS
sudo mv chromedriver /usr/local/bin/
sudo chmod +x /usr/local/bin/chromedriver
# Windows:将 chromedriver.exe 放在 PATH 中的文件夹中
``` ```
`is_local`: 对于任何本地运行的 LLM 都应该为 True,否则为 False。
`provider_name`: 透过名称选择要使用的框架,请参阅上面的框架清单。 #### 4. 验证安装
```bash
# 测试 ChromeDriver 版本
./chromedriver --version
# 或者在 PATH 中:
chromedriver --version
```
`provider_model`: 设定 AgenticSeek 使用的模型。 ### Docker 特定说明
`provider_server_address`: 如果不使用云端 API,则可以将其设定为任何内容。 ⚠️ **Docker 用户重要:**
- Docker 卷挂载方法可能不适用于隐身模式(`undetected_chromedriver`
- **解决方案:** 将 ChromeDriver 放在项目根目录中作为 `./chromedriver`
- 应用程序将自动检测并使用此二进制文件
- 您应该在日志中看到:`"Using ChromeDriver from project root: ./chromedriver"`
# Known issues (已知问题) ### 故障排除提示
## Chromedriver Issues 1. **仍然遇到版本不匹配?**
- 验证 ChromeDriver 是否可执行:`ls -la ./chromedriver`
- 检查 ChromeDriver 版本:`./chromedriver --version`
- 确保它与您的 Chrome 浏览器版本匹配
**已知问题 #1:** *chromedriver mismatch* 2. **Docker 容器问题?**
- 检查后端日志:`docker logs backend`
- 查找消息:`"Using ChromeDriver from project root"`
- 如果未找到,请验证文件是否存在且可执行
3. **Chrome for Testing 版本**
- 尽可能使用完全匹配的版本
- 对于版本 134.0.6998.88,使用 ChromeDriver 134.0.6998.165(最接近的可用版本)
- 主要版本号必须匹配(134 = 134)
### 版本兼容性矩阵
| Chrome 版本 | ChromeDriver 版本 | 状态 |
|----------------|---------------------|---------|
| 134.0.6998.x | 134.0.6998.165 | ✅ 可用 |
| 133.0.6943.x | 133.0.6943.141 | ✅ 可用 |
| 132.0.6834.x | 132.0.6834.159 | ✅ 可用 |
*有关最新兼容性,请查看 [Chrome for Testing 仪表板](https://googlechromelabs.github.io/chrome-for-testing/)*
`Exception: Failed to initialize browser: Message: session not created: This version of ChromeDriver only supports Chrome version 113 `Exception: Failed to initialize browser: Message: session not created: This version of ChromeDriver only supports Chrome version 113
Current browser version is 134.0.6998.89 with binary path` Current browser version is 134.0.6998.89 with binary path`
如果的浏览器和 chromedriver 版本不一样,就会发生这种情况。 如果的浏览器和 chromedriver 版本不匹配,会发生这种情况。
你可以透过以下连结下载最新版本: 您需要导航到下载最新版本:
https://developer.chrome.com/docs/chromedriver/downloads https://developer.chrome.com/docs/chromedriver/downloads
如果您使用的是 Chrome 版本 115 或更新版本,请前往 如果您使用 Chrome 版本 115 或更新版本,请转到
https://googlechromelabs.github.io/chrome-for-testing/ https://googlechromelabs.github.io/chrome-for-testing/
下载与你的作业系统相符的 chromedriver 版本。 下载与您的操作系统匹配的 chromedriver 版本。
![alt text](./media/chromedriver_readme.png) ![alt text](./media/chromedriver_readme.png)
如果有其他问题,请提供尽量详细的叙述到 Issues 上,尽可能包含当前环境和问题是怎么发生的 如果此部分不完整,请提出问题
## 连接适配器问题
```
Exception: Provider lm-studio failed: HTTP request failed: No connection adapters were found for '127.0.0.1:1234/v1/chat/completions'`(注意:端口可能不同)
```
* **原因:** `config.ini` 中 `lm-studio`(或其他类似的本地 OpenAI 兼容服务器)的 `provider_server_address` 缺少 `http://` 前缀或指向错误的端口。
* **解决方案:**
* 确保地址包含 `http://`。LM-Studio 通常默认为 `http://127.0.0.1:1234`。
* 正确的 `config.ini``provider_server_address = http://127.0.0.1:1234`(或您的实际 LM-Studio 服务器端口)。
## SearxNG 基本 URL 未提供
```
raise ValueError("SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.")
ValueError: SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.`
```
如果您使用错误的 searxng 基本 URL 运行 CLI 模式,可能会出现这种情况。
SEARXNG_BASE_URL 应根据您是在 Docker 中运行还是在主机上运行而有所不同:
**在主机上运行**`SEARXNG_BASE_URL="http://localhost:8080"`
**完全在 Docker 中运行(Web 界面)**`SEARXNG_BASE_URL="http://searxng:8080"`
## FAQ ## FAQ
**Q: 我需要什麼硬體?** **问:我需要什么硬件?**
| 模型大小 | GPU | 備註 | | 模型大小 | GPU | 评论 |
|-----------|--------|-----------------------------------------------------------| |-----------|--------|-----------------------------------------------------------|
| 7B | 8GB Vram | ⚠️ 不推。性能差,經常出現幻覺,規劃代理可能會失敗。 | | 7B | 8GB 显存 | ⚠️ 不推。性能差,频繁出现幻觉,规划代理可能会失败。 |
| 14B | 12 GB VRAM (例如 RTX 3060) | ✅ 適用於簡單任務。可能在網頁瀏覽和規劃任務上表現不佳。 | | 14B | 12 GB VRAM例如 RTX 3060 | ✅ 可用于简单任务。可能在网页浏览和规划任务方面有困难。 |
| 32B | 24+ GB VRAM (例如 RTX 4090) | 🚀 大多數任務成功,可能仍在任務規劃上有困難。 | | 32B | 24+ GB VRAM例如 RTX 4090 | 🚀 大多数任务成功,可能仍在任务规划方面有困难 |
| 70B+ | 48+ GB Vram (例如 mac studio) | 💪 表現優異。建議用於高級使用情境。 | | 70B+ | 48+ GB 显存 | 💪 优秀。推荐用于高级用例。 |
**Q:为什么选择 Deepseek R1 而不是其他模型?** **问:我遇到错误该怎么办?**
就其尺寸而言,Deepseek R1 在推理和使用方面表现出色。我们认为非常适合我们的需求,其他模型也很好用,但 Deepseek 是我们最后选定的模型 确保本地正在运行(`ollama serve`),您的 `config.ini` 与您的提供商匹配,并且依赖项已安装。如果都不起作用,请随时提出问题
**Q:我在执行时 `cli.py` 时出现错误。我该怎么办** **问:它真的可以 100% 本地运行吗**
1. 确保 Ollama 正在运行(ollama serve 是的,使用 Ollama、lm-studio 或服务器提供商,所有语音转文本、LLM 和文本转语音模型都在本地运行。非本地选项(OpenAI 或其他 API)是可选的。
2.`config.ini``provider_name` 的框架选择正确。
3. 依赖套件已安装
4. 如果均无效,请随时提出 Issues,同样尽可能包含当前环境和问题是怎么发生的。
**Q:它真的是 100% 本地运行吗** **问:当我有 Manus 时,为什么应该使用 AgenticSeek**
是的,透过 Ollama 或其他框架,所有语音转文字、LLM 和文字转语音模型都在本地运行 与 Manus 不同,AgenticSeek 优先考虑独立于外部系统,给您更多控制、隐私和避免 API 成本
*但你能选择非本地执行(OpenAI 或其他 API),同样也是可以的*
**问:谁是这个项目的幕后推手?**
**Q:我有 Manus 为甚么还要用 AgenticSeek** 这个项目是由我创建的,还有两个朋友作为维护者和 GitHub 上开源社区的贡献者。我们只是一群充满热情的个人,不是初创公司,也不隶属于任何组织。
这是我们因为兴趣做的一个小 Side-Project,他特别的点在于是一个全部本地化的模型,而且可以像钢铁人里面一样与 `Jarvis` 对话,听起来就超级酷的吧!随着 Manus 的进化,我们也相应的加入更多功能! X 上除了我的个人账户(https://x.com/Martin993886460)之外的任何 AgenticSeek 账户都是冒充的。
**Q:它比 Manus 好在哪里?**
不不不,AgenticSeek 和 Manus 是不同取向的东西,我们优先考虑的是本地执行和隐私,而不是基于云端。这是一个与 Manus 相比起来更有趣且易使用的方案!
**Q: 是否支持中文以外的语言?**
DeepSeek R1 天生会说中文
但注意:代理路由系统只懂英文,所以必须通过 config.ini 的 languages 参数(如 languages = en zh)告诉系统:
如果不设置中文?后果可能是:你让它写代码,结果跳出来个"医生代理"(虽然我们根本没有这个代理... 但系统会一脸懵圈!)
实际上会下载一个小型翻译模型来协助任务分配
## 贡献 ## 贡献
我们正在寻找开发来改 AgenticSeek你可以在 Issues 查看未解决的问题或和我们讨论更酷的新功能! 我们正在寻找开发人员来改 AgenticSeek查看开放的问题或讨论。
[贡献指南](./docs/CONTRIBUTING.md)
## 赞助商:
想要通过航班搜索、旅行规划或抢购最佳购物优惠等功能来提升 AgenticSeek 的能力?考虑使用 SerpApi 制作自定义工具,以解锁更多 Jarvis 般的功能。使用 SerpApi,您可以为专业任务加速您的代理,同时保持完全控制。
<a href="https://serpapi.com/"><img src="./media/banners/sponsor_banner_serpapi.png" height="350" alt="SerpApi Banner" ></a>
查看 [Contributing.md](./docs/CONTRIBUTING.md) 了解如何集成自定义工具!
### **赞助商**
- [tatra-labs](https://github.com/tatra-labs)
## 维护者:
> [Fosowl](https://github.com/Fosowl) | 巴黎时间
> [antoineVIVIES](https://github.com/antoineVIVIES) | 台北时间
## 特别感谢:
> [tcsenpai](https://github.com/tcsenpai) 和 [plitc](https://github.com/plitc) 协助后端 Docker 化
[![Star History Chart](https://api.star-history.com/svg?repos=Fosowl/agenticSeek&type=Date)](https://www.star-history.com/#Fosowl/agenticSeek&Date) [![Star History Chart](https://api.star-history.com/svg?repos=Fosowl/agenticSeek&type=Date)](https://www.star-history.com/#Fosowl/agenticSeek&Date)
[Contribution guide](./docs/CONTRIBUTING.md)
## 作者:
> [Fosowl](https://github.com/Fosowl)
> [steveh8758](https://github.com/steveh8758)
+455 -288
View File
@@ -1,54 +1,52 @@
# AgenticSeek:私有、本地的 Manus 替代方案
<p align="center"> <p align="center">
<img align="center" src="./media/whale_readme.jpg"> <img align="center" src="./media/agentic_seek_logo.png" width="300" height="300" alt="Agentic Seek Logo">
<p> <p>
-------------------------------------------------------------------------------- English | [中文](./README_CHS.md) | [繁體中文](./README_CHT.md) | [Français](./README_FR.md) | [日本語](./README_JP.md) | [Português (Brasil)](./README_PTBR.md) | [Español](./README_ES.md) | [Türkçe](./README_TR.md)
[English](./README.md) | 繁體中文 | [日本語](./README_JP.md)
# AgenticSeek: 類似 Manus 但基於 Deepseek R1 Agents 的本地模型。 *一個**100%本地運行的 Manus AI 替代品**,支援語音的 AI 助手,可自主瀏覽網頁、編寫代碼、規劃任務,所有數據僅保存在你的設備上。專為本地推理模型設計,完全在你的硬件上運行,確保隱私無憂,無需雲端依賴。*
[![訪問 AgenticSeek](https://img.shields.io/static/v1?label=Website&message=AgenticSeek&color=blue&style=flat-square)](https://fosowl.github.io/agenticSeek.html) ![License](https://img.shields.io/badge/license-GPL--3.0-green) [![Discord](https://img.shields.io/badge/Discord-Join%20Us-7289DA?logo=discord&logoColor=white)](https://discord.gg/8hGDaME3TC) [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/fosowl.svg?style=social&label=Update%20%40Fosowl)](https://x.com/Martin993886460) [![GitHub stars](https://img.shields.io/github/stars/Fosowl/agenticSeek?style=social)](https://github.com/Fosowl/agenticSeek/stargazers)
**Manus AI 的本地替代品**,它是一個具有語音功能的大語言模型秘書,可以 Coding、訪問你的電腦文件、瀏覽網頁,並自動修正錯誤與反省,最重要的是不會向雲端傳送任何資料。採用 DeepSeek R1 等推理模型構建,完全在本地硬體上運行,進而保證資料的隱私。 ### 為什麼選擇 AgenticSeek
[![Visit AgenticSeek](https://img.shields.io/static/v1?label=Website&message=AgenticSeek&color=blue&style=flat-square)](https://fosowl.github.io/agenticSeek.html) ![License](https://img.shields.io/badge/license-GPL--3.0-green) [![Discord](https://img.shields.io/badge/Discord-Join%20Us-7289DA?logo=discord&logoColor=white)](https://discord.gg/8hGDaME3TC) [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/fosowl.svg?style=social&label=Update%20%40Fosowl)](https://x.com/Martin993886460) * 🔒 完全本地 & 私有 —— 所有內容都在你的電腦上運行,無雲端、無數據共享。你的文件、對話和搜索都保持私密。
> 🛠️ **目前還在開發階段** – 歡迎任何貢獻者加入我們! * 🌐 智能網頁瀏覽 —— AgenticSeek 可自主瀏覽互聯網:搜索、閱讀、提取信息、填寫網頁表單,全程免手動。
https://github.com/user-attachments/assets/4bd5faf6-459f-4f94-bd1d-238c4b331469 * 💻 自動化編程助手 —— 需要代碼?它能編寫、調試並運行 Python、C、Go、Java 等程序,無需監督。
> *在大阪和東京深入搜尋人工智慧新創公司,至少找到 5 家,然後儲存在 research_japan.txt 檔案中* * 🧠 智能代理選擇 —— 你提問,它自動判斷最合適的代理來完成任務。就像有一支專家團隊隨時待命。
> *你可以用 C 語言製作俄羅斯方塊遊戲嗎?* * 📋 規劃並執行複雜任務 —— 從旅行規劃到複雜項目,可將大任務拆分為步驟,調用多個 AI 代理協作完成。
> *我想設定一個新的專案檔案索引,命名為 mark2。* * 🎙️ 語音支持 —— 乾淨、快速、未來感的語音與語音轉文本功能,讓你像科幻電影中的 AI 一樣與它對話。(開發中)
### **演示**
> *你能搜索 agenticSeek 項目,了解需要哪些技能,然後打開 CV_candidates.zip 並告訴我哪些最匹配該項目嗎?*
## Features: https://github.com/user-attachments/assets/b8ca60e9-7b3b-4533-840e-08f9ac426316
- **100% 本機運行**: 本機運行,不使用雲端服務,所以資料絕不會散布出去,我的東西還是我的!不會被當作其他服務的訓練資料 免責聲明:本演示及出現的所有文件(如 CV_candidates.zip)均為虛構。我們不是公司,只尋求開源貢獻者而非候選人
- **文件的交互系統**: 使用 bash 去瀏覽本機資料和操作本機系統。 > 🛠⚠️ **項目正在積極開發中**
- **自主 Coding**: AgenticSeek 可以自己運行、Debug、編譯 Python、C、Golang 和各種語言 > 🙏 本項目起初只是一個副業,沒有路線圖也沒有資金支持。它意外地登上了 GitHub Trending。非常感謝大家的貢獻、反饋與耐心
- **代理助理**: 不同的工作由不同的助理去處理問題。AgenticSeek 會自己尋找最適合的助理去做相對應的工作。 ## 前置條件
- **規劃**: 對於複雜的任務,AgenticSeek 會交辦給不同的助理進行規劃和執行。 開始前,請確保已安裝以下軟件:
- **自主學習**: 自動在網路上尋找資料。 * **Git:** 用於克隆倉庫。[下載 Git](https://git-scm.com/downloads)
* **Python 3.10.x:** 強烈推薦使用 Python 3.10.x 版本。使用其他版本可能導致依賴錯誤。[下載 Python 3.10](https://www.python.org/downloads/release/python-3100/)(選擇 3.10.x 版本)。
* **Docker Engine & Docker Compose:** 用於運行捆綁服務如 SearxNG。
* 安裝 Docker Desktop(包含 Docker Compose V2):[Windows](https://docs.docker.com/desktop/install/windows-install/) | [Mac](https://docs.docker.com/desktop/install/mac-install/) | [Linux](https://docs.docker.com/desktop/install/linux-install/)
* 或者在 Linux 上分別安裝 Docker Engine 和 Docker Compose[Docker Engine](https://docs.docker.com/engine/install/) | [Docker Compose](https://docs.docker.com/compose/install/)(確保安裝 Compose V2,例如 `sudo apt-get install docker-compose-plugin`)。
- **記憶功能**: 對於每次的對話進行統整、保存對話,並且在本地儲存用戶的使用習慣。 ### 1. **克隆倉庫並設置**
---
## **安裝**
確保已安裝了 Chrome driverDocker 和 Python 3.10(或更新)。
有關於 Chrome driver 的問題,請參見 **Chromedriver** 部分。
### 1️⃣ **複製儲存庫與設置環境變數**
```sh ```sh
git clone https://github.com/Fosowl/agenticSeek.git git clone https://github.com/Fosowl/agenticSeek.git
@@ -56,461 +54,630 @@ cd agenticSeek
mv .env.example .env mv .env.example .env
``` ```
### 2 **建立虛擬環境** ### 2. 修改 .env 文件內容
```sh ```sh
python3 -m venv agentic_seek_env SEARXNG_BASE_URL="http://searxng:8080" # 如果在主機上運行 CLI 模式,使用 http://127.0.0.1:8080
source agentic_seek_env/bin/activate REDIS_BASE_URL="redis://redis:6379/0"
# On Windows: agentic_seek_env\Scripts\activate WORK_DIR="/Users/mlg/Documents/workspace_for_ai"
OLLAMA_PORT="11434"
LM_STUDIO_PORT="1234"
CUSTOM_ADDITIONAL_LLM_PORT="11435"
OPENAI_API_KEY='optional'
DEEPSEEK_API_KEY='optional'
OPENROUTER_API_KEY='optional'
TOGETHER_API_KEY='optional'
GOOGLE_API_KEY='optional'
ANTHROPIC_API_KEY='optional'
``` ```
### 3️⃣ **安裝所需套件** 根據需要更新 `.env` 文件:
**自動安裝:** - **SEARXNG_BASE_URL**: 除非在主機上運行 CLI 模式,否則保持不變。
- **REDIS_BASE_URL**: 保持不變
- **WORK_DIR**: 本地工作目錄路徑。AgenticSeek 可讀取和操作這些文件。
- **OLLAMA_PORT**: Ollama 服務端口號。
- **LM_STUDIO_PORT**: LM Studio 服務端口號。
- **CUSTOM_ADDITIONAL_LLM_PORT**: 任何額外自定義 LLM 服務的端口。
**API 密鑰對於選擇本地運行 LLM 的用戶完全可選,這也是本項目的主要目的。如果硬件足夠,請留空。**
### 3. **啟動 Docker**
確保 Docker 已安裝並在系統上運行。可以使用以下命令啟動 Docker:
- **Linux/macOS:**
打開終端運行:
```sh
sudo systemctl start docker
```
或者如果已安裝,從應用程序菜單啟動 Docker Desktop。
- **Windows:**
從開始菜單啟動 Docker Desktop。
可以通過執行以下命令驗證 Docker 是否運行:
```sh ```sh
./install.sh docker info
``` ```
如果看到 Docker 安裝信息,則表示運行正常。
**手動安裝:** 請參閱下面的[本地提供商列表](#本地提供商列表)了解摘要。
```sh 下一步:[本地運行 AgenticSeek](#啟動服務並運行)
pip3 install -r requirements.txt
# or
python3 setup.py install
```
## 在本地機器上運行 AgenticSeek *如果遇到問題,請參閱[故障排除](#故障排除)部分。*
*如果硬件無法本地運行 LLM,請參閱[使用 API 運行設置](#使用-api-運行設置)。*
*有關詳細 `config.ini` 說明,請參閱[配置部分](#配置)。*
**建議至少使用 Deepseek 14B 以上參數的模型,較小的模型難以使用助理功能並且很快就會忘記上下文之間的關係。** ---
**本地运行助手** ## 在您的機器上本地運行 LLM 的設置
启动你的本地提供者,例如使用 ollama: **硬件要求:**
要本地運行 LLM,您需要足夠的硬件。至少需要能夠運行 Magistral、Qwen 或 Deepseek 14B 的 GPU。有關詳細的模型/性能建議,請參閱 FAQ。
**設置您的本地提供商**
啟動您的本地提供商,例如使用 ollama:
```sh ```sh
ollama serve ollama serve
``` ```
请参阅下方支持的本地提供列表。 請參閱下面的本地支持提供列表。
修改 `config.ini` 文件,将 `provider_name` 设置为支持的提供者,并将 `provider_model` 设置为 `deepseek-r1:14b` **更新 config.ini**
注意:`deepseek-r1:14b` 只是一个示例,如果你的硬件允许,可以使用更大的模型 更改 config.ini 文件,將 provider_name 設置為支持的提供商,provider_model 設置為您的提供商支持的 LLM。我們推薦推理模型,如 *Magistral* 或 *Deepseek*
有關所需硬件,請參閱 README 末尾的 **FAQ**。
```sh ```sh
[MAIN] [MAIN]
is_local = True is_local = True # 無論您是本地運行還是使用遠程提供商。
provider_name = ollama # 或 lm-studio, openai 等 provider_name = ollama # 或 lm-studioopenai 等
provider_model = deepseek-r1:14b provider_model = deepseek-r1:14b # 選擇適合您硬件的模型
provider_server_address = 127.0.0.1:11434 provider_server_address = 127.0.0.1:11434
agent_name = Jarvis # 您的 AI 名稱
recover_last_session = True # 是否恢復上一個會話
save_session = True # 是否記住當前會話
speak = False # 文本轉語音
listen = False # 語音轉文本,僅限 CLI,實驗性
jarvis_personality = False # 是否使用更"Jarvis"風格的性格(實驗性)
languages = en zh # 語言列表,文本轉語音將默認使用列表中的第一種語言
[BROWSER]
headless_browser = True # 除非在主機上使用 CLI,否則保持不變。
stealth_mode = True # 使用不可檢測的 selenium 減少瀏覽器檢測
``` ```
**本地提供者列表** **警告**
| 提供者 | 本地? | 描述 | - `config.ini` 文件格式不支持註釋。
|-------------|--------|-------------------------------------------------------| 不要直接複製粘貼示例配置,因為註釋會導致錯誤。相反,手動修改 `config.ini` 文件,使用您所需的設置,排除任何註釋。
| ollama | 是 | 使用 ollama 作为 LLM 提供者,轻松本地运行 LLM |
| lm-studio | 是 | 使用 LM Studio 本地运行 LLM(将 `provider_name` 设置为 `lm-studio`|
| openai | 否 | 使用兼容的 API |
下一步: [Start services and run AgenticSeek](#Start-services-and-Run) - 如果使用 LM-studio 運行 LLM,請*不要*將 provider_name 設置為 `openai`。將其設置為 `lm-studio`。
--- - 某些提供商(例如:lm-studio)要求您在 IP 前加上 `http://`。例如 `http://127.0.0.1:1234`
## **Run with an API (透過 API 執行)** **本地提供商列表**
設定 `config.ini` | 提供商 | 本地? | 描述 |
|-----------|--------|-----------------------------------------------------------|
| ollama | 是 | 使用 ollama 作為 LLM 提供商輕鬆本地運行 LLM |
| lm-studio | 是 | 使用 LM studio 本地運行 LLM(將 `provider_name` 設置為 `lm-studio`|
| openai | 是 | 使用 openai 兼容 API(例如:llama.cpp 服務器) |
```sh 下一步:[啟動服務並運行 AgenticSeek](#啟動服務並運行)
*如果遇到問題,請參閱[故障排除](#故障排除)部分。*
*如果硬件無法本地運行 LLM,請參閱[使用 API 運行設置](#使用-api-運行設置)。*
*有關詳細 `config.ini` 說明,請參閱[配置部分](#配置)。*
## 使用 API 運行設置
此設置使用外部、基於雲的 LLM 提供商。您需要從所選服務獲取 API 密鑰。
**1. 選擇 API 提供商並獲取 API 密鑰:**
請參閱下面的[API 提供商列表](#api-提供商列表)。訪問他們的網站註冊並獲取 API 密鑰。
**2. 將您的 API 密鑰設置為環境變量:**
* **Linux/macOS:**
打開終端並使用 `export` 命令。最好將其添加到 shell 的配置文件中(例如 `~/.bashrc`、`~/.zshrc`)以保持持久性。
```sh
export PROVIDER_API_KEY="your_api_key_here"
# 將 PROVIDER_API_KEY 替換為特定的變量名,例如 OPENAI_API_KEY、GOOGLE_API_KEY
```
TogetherAI 示例:
```sh
export TOGETHER_API_KEY="xxxxxxxxxxxxxxxxxxxxxx"
```
* **Windows:**
* **命令提示符(當前會話臨時):**
```cmd
set PROVIDER_API_KEY=your_api_key_here
```
* **PowerShell(當前會話臨時):**
```powershell
$env:PROVIDER_API_KEY="your_api_key_here"
```
* **永久性:** 在 Windows 搜索欄中搜索"環境變量",點擊"編輯系統環境變量",然後點擊"環境變量..."按鈕。添加一個新的用戶變量,使用適當的名稱(例如 `OPENAI_API_KEY`)和您的密鑰作為值。
*(有關更多詳細信息,請參閱 FAQ:[如何設置 API 密鑰?](#如何設置-api-密鑰))。*
**3. 更新 `config.ini`**
```ini
[MAIN] [MAIN]
is_local = False is_local = False
provider_name = openai provider_name = openai # 或 google、deepseek、togetherAI、huggingface
provider_model = gpt-4o provider_model = gpt-3.5-turbo # 或 gemini-1.5-flash、deepseek-chat、mistralai/Mixtral-8x7B-Instruct-v0.1 等。
provider_server_address = 127.0.0.1:5000 provider_server_address = # 當 is_local = False 時,對於大多數 API 通常被忽略或可以留空
# ... 其他設置 ...
``` ```
*警告:* 確保 `config.ini` 值中沒有尾隨空格。
警告:確保 `config.ini` 沒有行尾空格。 **API 提供商列表**
如果使用基於本機的 openai-based api 則把 `is_local` 設定為 `True` | 提供商 | `provider_name` | 本地? | 描述 | API 密鑰鏈接(示例) |
|--------------|-----------------|--------|---------------------------------------------------|---------------------------------------------|
| OpenAI | `openai` | 否 | 通過 OpenAI 的 API 使用 ChatGPT 模型。 | [platform.openai.com/signup](https://platform.openai.com/signup) |
| Google Gemini| `google` | 否 | 通過 Google AI Studio 使用 Google Gemini 模型。 | [aistudio.google.com/keys](https://aistudio.google.com/keys) |
| Deepseek | `deepseek` | 否 | 通過他們的 API 使用 Deepseek 模型。 | [platform.deepseek.com](https://platform.deepseek.com) |
| Hugging Face | `huggingface` | 否 | 使用 Hugging Face Inference API 中的模型。 | [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens) |
| TogetherAI | `togetherAI` | 否 | 通過 TogetherAI API 使用各種開源模型。| [api.together.ai/settings/api-keys](https://api.together.ai/settings/api-keys) |
| OpenRouter | `openrouter` | No | 通过 OpenRouter 使用各种开源模型| [https://openrouter.ai/](https://openrouter.ai/) |
同時更改你的 IP 為 openai-based api 的 IP。 *注意:*
* 我們不建議將 `gpt-4o` 或其他 OpenAI 模型用於複雜的網頁瀏覽和任務規劃,因為當前的提示優化針對 Deepseek 等模型。
* 編碼/bash 任務可能會遇到 Gemini 的問題,因為它可能不嚴格遵循針對 Deepseek 優化的格式化提示。
* 當 `is_local = False` 時,`config.ini` 中的 `provider_server_address` 通常不使用,因為 API 端點通常在相應提供商的庫中硬編碼。
下一步: [Start services and run AgenticSeek](#Start-services-and-Run) 下一步:[啟動服務並運行 AgenticSeek](#啟動服務並運行)
*如果遇到問題,請參閱**已知問題**部分*
*有關詳細配置文件說明,請參閱**配置**部分。*
--- ---
## Start services and Run ## 啟動服務並運行
(启动服务并运行)
如果需要,请激活你的 Python 环境 默認情況下,AgenticSeek 完全在 Docker 中運行
```sh
source agentic_seek_env/bin/activate
```
启动所需的服务。这将启动 `docker-compose.yml` 中的所有服务,包括 **選項 1:** 在 Docker 中運行,使用 Web 界面
- searxng
- redis(由 redis 提供支持) 啟動所需服務。這將啟動 docker-compose.yml 中的所有服務,包括:
- 前端 - searxng
- redissearxng 所需)
- frontend
- backend(如果使用 Web 界面時使用 `full`
```sh ```sh
sudo ./start_services.sh # MacOS ./start_services.sh full # MacOS
start ./start_services.cmd # Windows start start_services.cmd full # Windows
``` ```
**选项 1:** 使用 CLI 界面运行 **警告:** 此步驟將下載並加載所有 Docker 鏡像,可能需要長達 30 分鐘。啟動服務後,請等待後端服務完全運行(您應該在日誌中看到 **backend: "GET /health HTTP/1.1" 200 OK**)後再發送任何消息。首次運行時,後端服務可能需要 5 分鐘才能啟動
轉到 `http://localhost:3000/`,您應該會看到 Web 界面。
*服務啟動故障排除:* 如果這些腳本失敗,請確保 Docker Engine 正在運行並且 Docker ComposeV2`docker compose`)已正確安裝。檢查終端輸出中的錯誤消息。請參閱 [FAQ:幫助!運行 AgenticSeek 或其腳本時出現錯誤。](#faq-故障排除)
**選項 2:** CLI 模式:
要使用 CLI 界面運行,您必須在主機上安裝軟件包:
```sh ```sh
python3 cli.py ./install.sh
./install.bat # windows
``` ```
**选项 2:** 使用 Web 界面运行。 然後您必須將 `config.ini` 中的 SEARXNG_BASE_URL 更改為:
注意:目前我們建議您使用 CLI 界面。Web 界面仍在積極開發中。
启动后端服务。
```sh ```sh
python3 api.py SEARXNG_BASE_URL="http://localhost:8080"
``` ```
访问 `http://localhost:3000/`,你应该会看到 Web 界面。 啟動所需服務。這將啟動 docker-compose.yml 中的一些服務,包括:
- searxng
- redissearxng 所需)
- frontend
请注意,目前 Web 界面不支持消息流式传输。 ```sh
./start_services.sh # MacOS
start start_services.cmd # Windows
```
運行:uv run: `uv run python -m ensurepip` 以確保 uv 已啟用 pip。
*如果你不知道如何開始,請參閱 **Usage** 部分* 使用 CLI`uv run cli.py`
--- ---
## Usage 使用方法 ## 使用方法
为确保 agenticSeek 在中文环境下正常工作,请确保在 config.ini 中设置语言选项 確保服務已通過 `./start_services.sh full` 啟動並運行,然後轉到 `localhost:3000` 使用 Web 界面
languages = en zh
更多信息请参阅 Config 部分
確定所有的核心檔案都啟用了,也就是執行過這條命令 `./start_services.sh` 然後你就可以使用 `python3 cli.py` 來啟動 AgenticSeek 了! 您也可以通過設置 `listen = True` 來使用語音轉文本。僅限 CLI 模式。
```sh 要退出,只需說/輸入 `goodbye`。
sudo ./start_services.sh
python3 cli.py
```
當你看到執行後顯示 `>>> ` 以下是一些使用示例:
這表示一切運作正常,AgenticSeek 正在等待你給他任何指令。
你也可以透過設定 `config.ini` 內的 `listen = True` 來啟用語音轉文字。
要退出時,只要和他說 `goodbye` 就可以退出! > *用 python 寫一個貪吃蛇遊戲!*
以下是一些用法: > *搜索法國雷恩的最佳咖啡館,並將三家及其地址保存到 rennes_cafes.txt。*
### Coding/Bash > *寫一個 Go 程序計算階乘,保存為 factorial.go 到你的工作區*
> *在 Golang 中幫助我進行矩陣乘法* > *在 summer_pictures 文件夾中查找所有 JPG 文件,用今天日期重命名,並將重命名文件列表保存到 photos_list.txt*
> *使用 nmap 掃描我的網路,找出是否有任何可疑裝置連接* > *在線搜索 2024 年熱門科幻電影,挑選三部今晚觀看,保存到 movie_night.txt。*
> *用 Python 製作一個貪食蛇遊戲* > *搜索 2025 年最新 AI 新聞文章,選三篇,寫 Python 腳本抓取標題和摘要,腳本保存為 news_scraper.py,摘要保存到 ai_news.txt/home/projects*
### 網路搜尋 > *周五,搜索免費股票價格 API,用 supersuper7434567@gmail.com 註冊,然後寫 Python 腳本每日獲取特斯拉股價,結果保存到 stock_prices.csv*
> *進行網路搜尋,找出日本從事尖端人工智慧研究的酷炫科技新創公司* *請注意,表單填寫功能仍為實驗性,可能失敗。*
> *你能在網路上找到誰創造了 AgenticSeek 嗎?* 輸入查詢後,AgenticSeek 將分配最佳代理執行任務。
> *你能在哪個網站上找到便宜的 RTX 4090 嗎?* 由於這是早期原型,代理路由系統可能無法總是根據您的查詢分配正確的代理。
### 檔案瀏覽與搜尋 因此,您應該非常明確地表達您想要什麼以及 AI 可能如何進行,例如如果您希望它進行網頁搜索,不要說:
> *嘿,你能找到我遺失的 million_dollars_contract.pdf 在哪裡嗎?* `你知道哪些適合獨自旅行的國家嗎?`
> *告訴我我的磁碟還剩下多少空間* 而應說:
> *尋找並閱讀 README.md,並按照安裝說明進行操作* `進行網頁搜索,找出最適合獨自旅行的國家`
### 日常聊天
> *告訴我關於法國的事*
> *人生的意義是什麼?*
> *我應該在鍛鍊前還是鍛鍊後服用肌酸?*
當你把指令送出後,AgenticSeek 會自動調用最能提供幫助的助理,去完成你交辦的工作和指令。
但也有可能出現怪怪的情況,或是你要找飛機機票,他跑去教你如何一步步做出一台飛機(開玩笑的,但真的可能出現),因為這是一個早期專案,我們會努力教導他、完善他的!
所以我們希望你在使用時,能明確地表明你希望他要怎麼做,下面給你一個範例!
你該說:
- 进行网络搜索,找出哪些国家最适合独自旅行
而不是說:
- 你知道哪些国家适合独自旅行?
--- ---
## **在自己的服務器上運行 LLM 的設置**
--- 如果您有功能強大的計算機或可以使用的服務器,但想從筆記本電腦使用它,您可以選擇使用我們的自定義 llm 服務器在遠程服務器上運行 LLM。
## **在本地執行屬於你的 LLM 伺服器** 在將運行 AI 模型的"服務器"上,獲取 IP 地址
如果你有一台功能強大的電腦或伺服器,但你想透過筆記型電腦使用它,那麼你可以選擇在遠端伺服器上執行 LLM。
### 1️⃣ **設定並啟動伺服器腳本**
在運行 AI 模型的「伺服器」上,取得 IP 位址
```sh ```sh
ip a | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}' | cut -d/ -f1 ip a | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}' | cut -d/ -f1 # 本地 IP
curl https://ipinfo.io/ip # 公共 IP
``` ```
注意:請在 Windows 或 MacOS,分別使用 `ipconfig``ifconfig` 來尋找 IP 址。 注意:對於 Windows 或 macOS,分別使用 ipconfigifconfig找 IP 址。
**如果你希望使用基於 Openai 的服務,請按照 *透過 API 執行* 部分進行。** 克隆倉庫並進入 `server/` 文件夾。
複製儲存庫並且進入 `server/` 資料夾。
```sh ```sh
git clone --depth 1 https://github.com/Fosowl/agenticSeek.git git clone --depth 1 https://github.com/Fosowl/agenticSeek.git
cd agenticSeek/server/ cd agenticSeek/llm_server/
``` ```
安裝伺服器所需的套件 安裝服務器特定要求
```sh ```sh
pip3 install -r requirements.txt pip3 install -r requirements.txt
``` ```
執行伺服器腳本。 運行服務器腳本。
```sh ```sh
python3 app.py --provider ollama --port 3333 python3 app.py --provider ollama --port 3333
``` ```
您可以選擇使用 `ollama``llamacpp` 作為 LLM 服務框架 您可以選擇使用 `ollama` 和 `llamacpp` 作為 LLM 服務。
### 2️⃣ **執行** 現在在您的個人計算機上:
在你的電腦上: 更改 `config.ini` 文件,將 `provider_name` 設置為 `server``provider_model` 設置為 `deepseek-r1:xxb`。
將 `provider_server_address` 設置為將運行模型的機器的 IP 地址。
- 更改 `config.ini`
- `provider_name = server`
- `provider_model = deepseek-r1:14b`
- `provider_server_address = {你執行模型的電腦的 IP 位址}`
```sh ```sh
[MAIN] [MAIN]
is_local = False is_local = False
provider_name = server provider_name = server
provider_model = deepseek-r1:14b provider_model = deepseek-r1:70b
provider_server_address = x.x.x.x:3333 provider_server_address = http://x.x.x.x:3333
``` ```
下一步:[啟動服務並運行 AgenticSeek](#啟動服務並運行)
--- ---
## 語音轉文 ## 語音轉文
请注意,目前语音转文字功能仅支持英语 警告:目前語音轉文本僅適用於 CLI 模式
預設狀況下,語音轉文字功能是停用的。若要啟用它,請在 `config.ini` 檔案中,將 `listen` 選項設為 `True` 請注意,目前語音轉文本僅適用於英語。
語音轉文本功能默認禁用。要啟用它,請在 config.ini 文件中將 listen 選項設置為 True
``` ```
listen = True listen = True
``` ```
啟用後 AgenticSeek 會聆聽你是否呼喚他,他才會開始聽你說的話,你可以在 *config.ini* 內去設定,要怎麼叫他。 啟用後,語音轉文本功能會監聽觸發關鍵字,即代理的名稱,然後開始處理您的輸入。您可以通過更新 *config.ini* 文件中的 `agent_name` 值來自定義代理的名稱:
``` ```
agent_name = Friday agent_name = Friday
``` ```
為了獲得比較好的結果,我們建議使用常見的英文名稱JohnEmma”)作為他的名字 為了獲得最佳識別效果,我們建議使用常見的英文名稱"John""Emma" 作為代理名稱
當你看到程式開始執行時,請大聲說出他的名字,就可以喚醒 AgenticSeek 去聆聽!(如:Friday 一旦您看到轉錄開始出現,請大聲說出代理的名稱以喚醒它(例如,"Friday")。
清楚說出你的需求 清晰地說出您的查詢
用確認短結束你說的話,以通知 AgenticSeek 繼續。確認短句的範例包括: 用確認短結束您的請求,以指示系統繼續。確認短語的示例包括:
``` ```
"do it", "go ahead", "execute", "run", "start", "thanks", "would ya", "please", "okay?", "proceed", "continue", "go on", "do that", "go it", "do you understand?" "do it", "go ahead", "execute", "run", "start", "thanks", "would ya", "please", "okay?", "proceed", "continue", "go on", "do that", "go it", "do you understand?"
``` ```
## Config ## 配置
Config 範例: 配置示例:
``` ```
[MAIN] [MAIN]
is_local = True is_local = True
provider_name = ollama provider_name = ollama
provider_model = deepseek-r1:1.5b provider_model = deepseek-r1:32b
provider_server_address = 127.0.0.1:11434 provider_server_address = http://127.0.0.1:11434 # Ollama 示例;LM-Studio 使用 http://127.0.0.1:1234
agent_name = Friday agent_name = Friday
recover_last_session = False recover_last_session = False
save_session = False save_session = False
speak = False speak = False
listen = False listen = False
work_dir = /Users/mlg/Documents/ai_folder
jarvis_personality = False jarvis_personality = False
languages = en zh languages = en zh # TTS 和潛在路由的語言列表。
[BROWSER] [BROWSER]
headless_browser = False headless_browser = False
stealth_mode = False stealth_mode = False
``` ```
**說明**: **`config.ini` 設置說明**
- is_local
- True:在本地運行。
- False:在遠端伺服器運行。
- provider_name
- 框架類型
- `ollama`, `server`, `lm-studio`, `deepseek-api`
- provider_model
- 運行的模型
- `deepseek-r1:1.5b`, `deepseek-r1:14b`
- provider_server_address
- 伺服器 IP
- `127.0.0.1:11434`
- agent_name
- AgenticSeek 的名字,用作TTS的觸發單詞。
- `Friday`
- recover_last_session
- True:從上個對話繼續。
- False:重啟對話。
- save_session
- True:儲存對話紀錄。
- False:不保存。
- speak
- True:啟用語音輸出。
- False:關閉語音輸出。
- listen
- True:啟用語音輸入。
- False:關閉語音輸入。
- work_dir
- AgenticSeek 擁有能存取與交互的工作目錄。
- jarvis_personality
> 就是那個鋼鐵人的 JARVIS
- True:啟用 JARVIS 個性。
- False:關閉 JARVIS 個性。
- headless_browser
- True:前景瀏覽器。(很酷,推薦使用他 XD)
- False:背景執行瀏覽器。
- stealth_mode
- 隱私模式,但需要你自己安裝反爬蟲擴充功能。
- languages
- 支持的语言列表。用于代理路由系统。语言列表越长,下载的模型越多。
## 框架 * **`[MAIN]` 部分:**
* `is_local`: 如果使用本地 LLM 提供商(Ollama、LM-Studio、本地 OpenAI 兼容服務器)或自託管服務器選項,則為 `True`。如果使用基於雲的 API(OpenAI、Google 等),則為 `False`。
* `provider_name`: 指定 LLM 提供商。
* 本地選項:`ollama`、`lm-studio`、`openai`(用於本地 OpenAI 兼容服務器)、`server`(用於自託管服務器設置)。
* API 選項:`openai`、`google`、`deepseek`、`huggingface`、`togetherAI`。
* `provider_model`: 所選提供商的特定模型名稱或 ID(例如,Ollama 的 `deepseekcoder:6.7b`OpenAI API 的 `gpt-3.5-turbo`TogetherAI 的 `mistralai/Mixtral-8x7B-Instruct-v0.1`)。
* `provider_server_address`: 您的 LLM 提供商的地址。
* 對於本地提供商:例如,Ollama 的 `http://127.0.0.1:11434`LM-Studio 的 `http://127.0.0.1:1234`。
* 對於 `server` 提供商類型:您的自託管 LLM 服務器的地址(例如 `http://your_server_ip:3333`)。
* 對於雲 API`is_local = False`):這通常被忽略或可以留空,因為 API 端點通常由客戶端庫處理。
* `agent_name`: AI 助手的名稱(例如 Friday)。如果啟用,用作語音轉文本的觸發詞。
* `recover_last_session`: `True` 嘗試恢復上一個會話的狀態,`False` 重新開始。
* `save_session`: `True` 保存當前會話的狀態以供潛在恢復,`False` 否則。
* `speak`: `True` 啟用文本轉語音語音輸出,`False` 禁用。
* `listen`: `True` 啟用語音轉文本語音輸入(僅限 CLI 模式),`False` 禁用。
* `work_dir`: **關鍵:** AgenticSeek 將讀取/寫入文件的目錄。**確保此路徑在您的系統上有效且可訪問。**
* `jarvis_personality`: `True` 使用更"Jarvis-like"的系統提示(實驗性),`False` 使用標準提示。
* `languages`: 逗號分隔的語言列表(例如 `en, zh, fr`)。用於 TTS 語音選擇(默認為第一個),並可以協助 LLM 路由器。為避免路由器效率低下,避免使用過多或非常相似的語言。
* **`[BROWSER]` 部分:**
* `headless_browser`: `True` 在沒有可見窗口的情況下運行自動化瀏覽器(推薦用於 Web 界面或非交互式使用)。`False` 顯示瀏覽器窗口(對於 CLI 模式或調試有用)。
* `stealth_mode`: `True` 啟用使瀏覽器自動化更難檢測的措施。可能需要手動安裝瀏覽器擴展,如 anticaptcha。
下表顯示了可用的框架: 本節總結了支持的 LLM 提供商類型。在 `config.ini` 中配置它們。
| 框架 | 本地? | 描述| **本地提供商(在您自己的硬件上運行):**
|-|-|-|
| ollama | 可 | 使用 ollama 框架去執行本地模型 |
| server | 可 | 本地伺服器執行模型遠端調用 |
| lm-studio | 可 | 使用 LM Studio 在本地運行 LLM(設定provider_name為lm-studio|
| openai | 不可 | 使用 ChatGPT API(無法保證隱私)|
| deepseek-api | 不可 | 使用 Deepseek API (無法保證隱私)|
| huggingface | 不可 | 使用 Hugging-Face API (無法保證隱私)|
若要選擇框架,請變更 `config.ini` 文件: | config.ini 中的提供商名稱 | `is_local` | 描述 | 設置部分 |
|-------------------------------|------------|-----------------------------------------------------------------------------|------------------------------------------------------------------|
| `ollama` | `True` | 使用 Ollama 輕鬆提供本地 LLM。 | [在您的機器上本地運行 LLM 的設置](#在您的機器上本地運行-llm-的設置) |
| `lm-studio` | `True` | 使用 LM-Studio 提供本地 LLM。 | [在您的機器上本地運行 LLM 的設置](#在您的機器上本地運行-llm-的設置) |
| `openai`(用於本地服務器) | `True` | 連接到暴露 OpenAI 兼容 API 的本地服務器(例如,llama.cpp)。 | [在您的機器上本地運行 LLM 的設置](#在您的機器上本地運行-llm-的設置) |
| `server` | `False` | 連接到在另一台機器上運行的 AgenticSeek 自託管 LLM 服務器。 | [在自己的服務器上運行 LLM 的設置](#在自己的服務器上運行-llm-的設置) |
**API 提供商(基於雲):**
| config.ini 中的提供商名稱 | `is_local` | 描述 | 設置部分 |
|-------------------------------|------------|--------------------------------------------------|-----------------------------------------------------|
| `openai` | `False` | 使用 OpenAI 的官方 API(例如,GPT-3.5、GPT-4)。 | [使用 API 運行設置](#使用-api-運行設置) |
| `google` | `False` | 通過 API 使用 Google 的 Gemini 模型。 | [使用 API 運行設置](#使用-api-運行設置) |
| `deepseek` | `False` | 使用 Deepseek 的官方 API。 | [使用 API 運行設置](#使用-api-運行設置) |
| `huggingface` | `False` | 使用 Hugging Face Inference API。 | [使用 API 運行設置](#使用-api-運行設置) |
| `togetherAI` | `False` | 使用 TogetherAI 的 API 獲取各種開放模型。 | [使用 API 運行設置](#使用-api-運行設置) |
---
## 故障排除
如果遇到問題,本節提供指導。
# 已知問題
## ChromeDriver 問題
**錯誤示例:** `SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version XXX`
### 根本原因
ChromeDriver 版本不兼容發生在:
1. 您安裝的 ChromeDriver 版本與 Chrome 瀏覽器版本不匹配
2. 在 Docker 環境中,`undetected_chromedriver` 可能會下載自己的 ChromeDriver 版本,繞過掛載的二進制文件
### 解決步驟
#### 1. 檢查您的 Chrome 版本
打開 Google Chrome → `設置 > 關於 Chrome` 查找您的版本(例如,"版本 134.0.6998.88"
#### 2. 下載匹配的 ChromeDriver
**對於 Chrome 115 及更新版本:** 使用 [Chrome for Testing API](https://googlechromelabs.github.io/chrome-for-testing/)
- 訪問 Chrome for Testing 可用性儀表板
- 找到您的 Chrome 版本或最接近的可用匹配
- 為您的操作系統下載 ChromeDriverDocker 環境使用 Linux64
**對於舊版 Chrome** 使用 [舊版 ChromeDriver 下載](https://chromedriver.chromium.org/downloads)
![從 Chrome for Testing 下載 ChromeDriver](./media/chromedriver_readme.png)
#### 3. 安裝 ChromeDriver(選擇一種方法)
**方法 A:項目根目錄(Docker 推薦)**
```bash
# 將下載的 chromedriver 二進制文件放在項目根目錄
cp path/to/downloaded/chromedriver ./chromedriver
chmod +x ./chromedriver # 在 Linux/macOS 上使其可執行
``` ```
is_local = False
provider_name = openai **方法 B:系統 PATH**
provider_model = gpt-4o ```bash
provider_server_address = 127.0.0.1:5000 # Linux/macOS
sudo mv chromedriver /usr/local/bin/
sudo chmod +x /usr/local/bin/chromedriver
# Windows:將 chromedriver.exe 放在 PATH 中的文件夾中
``` ```
`is_local`: 對於任何本地運行的 LLM 都應該為 True,否則為 False。
`provider_name`: 透過名稱選擇要使用的框架,請參閱上面的框架清單。 #### 4. 驗證安裝
```bash
# 測試 ChromeDriver 版本
./chromedriver --version
# 或者在 PATH 中:
chromedriver --version
```
`provider_model`: 設定 AgenticSeek 使用的模型。 ### Docker 特定說明
`provider_server_address`: 如果不使用雲端 API,則可以將其設定為任何內容。 ⚠️ **Docker 用戶重要:**
- Docker 卷掛載方法可能不適用於隱身模式(`undetected_chromedriver`
- **解決方案:** 將 ChromeDriver 放在項目根目錄中作為 `./chromedriver`
- 應用程序將自動檢測並使用此二進制文件
- 您應該在日誌中看到:`"Using ChromeDriver from project root: ./chromedriver"`
# Known issues (已知問題) ### 故障排除提示
## Chromedriver Issues 1. **仍然遇到版本不匹配?**
- 驗證 ChromeDriver 是否可執行:`ls -la ./chromedriver`
- 檢查 ChromeDriver 版本:`./chromedriver --version`
- 確保它與您的 Chrome 瀏覽器版本匹配
**已知問題 #1:** *chromedriver mismatch* 2. **Docker 容器問題?**
- 檢查後端日誌:`docker logs backend`
- 查找消息:`"Using ChromeDriver from project root"`
- 如果未找到,請驗證文件是否存在且可執行
3. **Chrome for Testing 版本**
- 盡可能使用完全匹配的版本
- 對於版本 134.0.6998.88,使用 ChromeDriver 134.0.6998.165(最接近的可用版本)
- 主要版本號必須匹配(134 = 134)
### 版本兼容性矩陣
| Chrome 版本 | ChromeDriver 版本 | 狀態 |
|----------------|---------------------|---------|
| 134.0.6998.x | 134.0.6998.165 | ✅ 可用 |
| 133.0.6943.x | 133.0.6943.141 | ✅ 可用 |
| 132.0.6834.x | 132.0.6834.159 | ✅ 可用 |
*有關最新兼容性,請查看 [Chrome for Testing 儀表板](https://googlechromelabs.github.io/chrome-for-testing/)*
`Exception: Failed to initialize browser: Message: session not created: This version of ChromeDriver only supports Chrome version 113 `Exception: Failed to initialize browser: Message: session not created: This version of ChromeDriver only supports Chrome version 113
Current browser version is 134.0.6998.89 with binary path` Current browser version is 134.0.6998.89 with binary path`
如果的瀏覽器和 chromedriver 版本不一樣,就會發生這種情況。 如果的瀏覽器和 chromedriver 版本不匹配,會發生這種情況。
你可以透過以下連結下載最新版本: 您需要導航到下載最新版本:
https://developer.chrome.com/docs/chromedriver/downloads https://developer.chrome.com/docs/chromedriver/downloads
如果您使用的是 Chrome 版本 115 或更新版本,請前往 如果您使用 Chrome 版本 115 或更新版本,請轉到
https://googlechromelabs.github.io/chrome-for-testing/ https://googlechromelabs.github.io/chrome-for-testing/
下載與你的作業系統相符的 chromedriver 版本。 下載與您的操作系統匹配的 chromedriver 版本。
![alt text](./media/chromedriver_readme.png) ![alt text](./media/chromedriver_readme.png)
如果有其他問題,請提供盡量詳細的敘述到 Issues 上,盡可能包含當前環境和問題是怎麼發生的 如果此部分不完整,請提出問題
## 連接適配器問題
```
Exception: Provider lm-studio failed: HTTP request failed: No connection adapters were found for '127.0.0.1:1234/v1/chat/completions'`(注意:端口可能不同)
```
* **原因:** `config.ini` 中 `lm-studio`(或其他類似的本地 OpenAI 兼容服務器)的 `provider_server_address` 缺少 `http://` 前綴或指向錯誤的端口。
* **解決方案:**
* 確保地址包含 `http://`。LM-Studio 通常默認為 `http://127.0.0.1:1234`。
* 正確的 `config.ini``provider_server_address = http://127.0.0.1:1234`(或您的實際 LM-Studio 服務器端口)。
## SearxNG 基本 URL 未提供
```
raise ValueError("SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.")
ValueError: SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.`
```
如果您使用錯誤的 searxng 基本 URL 運行 CLI 模式,可能會出現這種情況。
SEARXNG_BASE_URL 應根據您是在 Docker 中運行還是在主機上運行而有所不同:
**在主機上運行**`SEARXNG_BASE_URL="http://localhost:8080"`
**完全在 Docker 中運行(Web 界面)**`SEARXNG_BASE_URL="http://searxng:8080"`
## FAQ ## FAQ
**Q: 我需要什麼硬體?** **問:我需要什麼硬件?**
| 模型大小 | GPU | 備註 | | 模型大小 | GPU | 評論 |
|-----------|--------|-----------------------------------------------------------| |-----------|--------|-----------------------------------------------------------|
| 7B | 8GB Vram | ⚠️ 不推薦。性能差,經常出現幻覺,規劃代理可能會失敗。 | | 7B | 8GB 顯存 | ⚠️ 不推薦。性能差,頻繁出現幻覺,規劃代理可能會失敗。 |
| 14B | 12 GB VRAM (例如 RTX 3060) | ✅ 用於簡單任務。可能在網頁瀏覽和規劃任務上表現不佳。 | | 14B | 12 GB VRAM例如 RTX 3060 | ✅ 用於簡單任務。可能在網頁瀏覽和規劃任務方面有困難。 |
| 32B | 24+ GB VRAM (例如 RTX 4090) | 🚀 大多數任務成功,可能仍在任務規劃有困難 | | 32B | 24+ GB VRAM例如 RTX 4090 | 🚀 大多數任務成功,可能仍在任務規劃方面有困難 |
| 70B+ | 48+ GB Vram (例如 mac studio) | 💪 表現優異。建議用於高級使用情境。 | | 70B+ | 48+ GB 顯存 | 💪 優秀。推薦用於高級用例。 |
**Q:為什麼選擇 Deepseek R1 而不是其他模型?** **問:我遇到錯誤該怎麼辦?**
就其尺寸而言,Deepseek R1 在推理和使用方面表現出色。我們認為非常適合我們的需求,其他模型也很好用,但 Deepseek 是我們最後選定的模型 確保本地正在運行(`ollama serve`),您的 `config.ini` 與您的提供商匹配,並且依賴項已安裝。如果都不起作用,請隨時提出問題
**Q:我在執行時 `cli.py` 時出現錯誤。我該怎麼辦** **問:它真的可以 100% 本地運行嗎**
1. 確保 Ollama 正在運行(ollama serve 是的,使用 Ollama、lm-studio 或服務器提供商,所有語音轉文本、LLM 和文本轉語音模型都在本地運行。非本地選項(OpenAI 或其他 API)是可選的。
2.`config.ini``provider_name` 的框架選擇正確。
3. 依賴套件已安裝
4. 如果均無效,請隨時提出 Issues,同樣盡可能包含當前環境和問題是怎麼發生的。
**Q:它真的是 100% 本地運行嗎** **問:當我有 Manus 時,為什麼應該使用 AgenticSeek**
是的,透過 Ollama 或其他框架,所有語音轉文字、LLM 和文字轉語音模型都在本地運行 與 Manus 不同,AgenticSeek 優先考慮獨立於外部系統,給您更多控制、隱私和避免 API 成本
*但你能選擇非本地執行(OpenAI 或其他 API),同樣也是可以的*
**問:誰是這個項目的幕後推手?**
**Q:我有 Manus 為甚麼還要用 AgenticSeek** 這個項目是由我創建的,還有兩個朋友作為維護者和 GitHub 上開源社區的貢獻者。我們只是一群充滿熱情的個人,不是初創公司,也不隸屬於任何組織。
這是我們因為興趣做的一個小 Side-Project,他特別的點在於是一個全部本地化的模型,而且可以像鋼鐵人裡面一樣與 `Jarvis` 對話,聽起來就超級酷的吧!隨著 Manus 的進化,我們也相應的加入更多功能! X 上除了我的個人賬戶(https://x.com/Martin993886460)之外的任何 AgenticSeek 賬戶都是冒充的。
**Q:它比 Manus 好在哪裡?**
不不不,AgenticSeek 和 Manus 是不同取向的東西,我們優先考慮的是本地執行和隱私,而不是基於雲端。這是一個與 Manus 相比起來更有趣且易使用的方案!
**Q: 是否支持中文以外的语言?**
DeepSeek R1 天生会说中文
但注意:代理路由系统只懂英文,所以必须通过 config.ini 的 languages 参数(如 languages = en zh)告诉系统:
如果不设置中文?后果可能是:你让它写代码,结果跳出来个"医生代理"(虽然我们根本没有这个代理... 但系统会一脸懵圈!)
实际上会下载一个小型翻译模型来协助任务分配
## 貢獻 ## 貢獻
我們正在尋找開發來改 AgenticSeek你可以在 Issues 查看未解決的問題或和我們討論更酷的新功能! 我們正在尋找開發人員來改 AgenticSeek查看開放的問題或討論。
[貢獻指南](./docs/CONTRIBUTING.md)
## 贊助商:
想要通過航班搜索、旅行規劃或搶購最佳購物優惠等功能來提升 AgenticSeek 的能力?考慮使用 SerpApi 製作自定義工具,以解鎖更多 Jarvis 般的功能。使用 SerpApi,您可以為專業任務加速您的代理,同時保持完全控制。
<a href="https://serpapi.com/"><img src="./media/banners/sponsor_banner_serpapi.png" height="350" alt="SerpApi Banner" ></a>
查看 [Contributing.md](./docs/CONTRIBUTING.md) 了解如何集成自定義工具!
### **贊助商**
- [tatra-labs](https://github.com/tatra-labs)
## 維護者:
> [Fosowl](https://github.com/Fosowl) | 巴黎時間
> [antoineVIVIES](https://github.com/antoineVIVIES) | 台北時間
## 特別感謝:
> [tcsenpai](https://github.com/tcsenpai) 和 [plitc](https://github.com/plitc) 協助後端 Docker 化
[![Star History Chart](https://api.star-history.com/svg?repos=Fosowl/agenticSeek&type=Date)](https://www.star-history.com/#Fosowl/agenticSeek&Date) [![Star History Chart](https://api.star-history.com/svg?repos=Fosowl/agenticSeek&type=Date)](https://www.star-history.com/#Fosowl/agenticSeek&Date)
[Contribution guide](./docs/CONTRIBUTING.md)
## 作者:
> [Fosowl](https://github.com/Fosowl)
> [steveh8758](https://github.com/steveh8758)
+682
View File
@@ -0,0 +1,682 @@
# AgenticSeek: Una Alternativa Privada y Local a Manus
<p align="center">
<img align="center" src="./media/agentic_seek_logo.png" width="300" height="300" alt="Agentic Seek Logo">
<p>
English | [中文](./README_CHS.md) | [繁體中文](./README_CHT.md) | [Français](./README_FR.md) | [日本語](./README_JP.md) | [Português (Brasil)](./README_PTBR.md) | [Español](./README_ES.md) | [Türkçe](./README_TR.md)
*Un asistente de IA con capacidad de voz que es una **alternativa 100% local a Manus AI**, navega autónomamente por la web, escribe código y planifica tareas manteniendo todos los datos en tu dispositivo. Diseñado para modelos de razonamiento local, funciona completamente en tu hardware, garantizando privacidad total y cero dependencia de la nube.*
[![Visitar AgenticSeek](https://img.shields.io/static/v1?label=Website&message=AgenticSeek&color=blue&style=flat-square)](https://fosowl.github.io/agenticSeek.html) ![License](https://img.shields.io/badge/license-GPL--3.0-green) [![Discord](https://img.shields.io/badge/Discord-Join%20Us-7289DA?logo=discord&logoColor=white)](https://discord.gg/8hGDaME3TC) [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/fosowl.svg?style=social&label=Update%20%40Fosowl)](https://x.com/Martin993886460) [![GitHub stars](https://img.shields.io/github/stars/Fosowl/agenticSeek?style=social)](https://github.com/Fosowl/agenticSeek/stargazers)
### ¿Por qué AgenticSeek?
* 🔒 Totalmente Local & Privado - Todo funciona en tu máquina, sin nube, sin compartir datos. Tus archivos, conversaciones y búsquedas permanecen privados.
* 🌐 Navegación Web Inteligente - AgenticSeek puede navegar por Internet de forma autónoma: buscar, leer, extraer información, completar formularios web, todo sin manos.
* 💻 Asistente de Programación Autónomo - ¿Necesitas código? Puede escribir, depurar y ejecutar programas en Python, C, Go, Java y más, sin supervisión.
* 🧠 Selección Inteligente de Agentes - Tú pides, él elige automáticamente el mejor agente para la tarea. Como tener un equipo de expertos siempre disponible.
* 📋 Planifica y Ejecuta Tareas Complejas - Desde planificación de viajes hasta proyectos complejos, puede dividir grandes tareas en pasos y completarlos utilizando múltiples agentes de IA.
* 🎙️ Compatibilidad con Voz - Voz limpia, rápida y futurista con reconocimiento de voz, permitiéndote conversar como si fuera tu IA personal de una película de ciencia ficción. (En desarrollo)
### **Demo**
> *¿Puedes buscar el proyecto agenticSeek, aprender qué habilidades se necesitan, luego abrir CV_candidates.zip y decirme cuáles coinciden mejor con el proyecto?*
https://github.com/user-attachments/assets/b8ca60e9-7b3b-4533-840e-08f9ac426316
Descargo de responsabilidad: Esta demostración y todos los archivos que aparecen (ej: CV_candidates.zip) son completamente ficticios. No somos una corporación, buscamos colaboradores de código abierto, no candidatos.
> 🛠⚠️ **Trabajo Activo en Progreso**
> 🙏 Este proyecto comenzó como un proyecto paralelo y no tiene hoja de ruta ni financiación. Creció mucho más allá de lo esperado al aparecer en GitHub Trending. Las contribuciones, comentarios y paciencia son profundamente apreciados.
## Prerrequisitos
Antes de comenzar, asegúrate de tener instalado:
* **Git:** Para clonar el repositorio. [Descargar Git](https://git-scm.com/downloads)
* **Python 3.10.x:** Se recomienda encarecidamente Python 3.10.x. Otras versiones pueden causar errores de dependencia. [Descargar Python 3.10](https://www.python.org/downloads/release/python-3100/) (selecciona la versión 3.10.x).
* **Docker Engine & Docker Compose:** Para ejecutar servicios empaquetados como SearxNG.
* Instalar Docker Desktop (incluye Docker Compose V2): [Windows](https://docs.docker.com/desktop/install/windows-install/) | [Mac](https://docs.docker.com/desktop/install/mac-install/) | [Linux](https://docs.docker.com/desktop/install/linux-install/)
* O instalar Docker Engine y Docker Compose por separado en Linux: [Docker Engine](https://docs.docker.com/engine/install/) | [Docker Compose](https://docs.docker.com/compose/install/) (asegúrate de instalar Compose V2, por ejemplo `sudo apt-get install docker-compose-plugin`).
### 1. **Clonar el repositorio y configurar**
```sh
git clone https://github.com/Fosowl/agenticSeek.git
cd agenticSeek
mv .env.example .env
```
### 2. Modificar el contenido del archivo .env
```sh
SEARXNG_BASE_URL="http://searxng:8080" # Si ejecutas en modo CLI en el host, usa http://127.0.0.1:8080
REDIS_BASE_URL="redis://redis:6379/0"
WORK_DIR="/Users/mlg/Documents/workspace_for_ai"
OLLAMA_PORT="11434"
LM_STUDIO_PORT="1234"
CUSTOM_ADDITIONAL_LLM_PORT="11435"
OPENAI_API_KEY='optional'
DEEPSEEK_API_KEY='optional'
OPENROUTER_API_KEY='optional'
TOGETHER_API_KEY='optional'
GOOGLE_API_KEY='optional'
ANTHROPIC_API_KEY='optional'
```
Actualiza el archivo `.env` según sea necesario:
- **SEARXNG_BASE_URL**: Mantener sin cambios a menos que ejecutes en modo CLI en el host.
- **REDIS_BASE_URL**: Mantener sin cambios
- **WORK_DIR**: Ruta al directorio de trabajo local. AgenticSeek podrá leer e interactuar con estos archivos.
- **OLLAMA_PORT**: Número de puerto para el servicio Ollama.
- **LM_STUDIO_PORT**: Número de puerto para el servicio LM Studio.
- **CUSTOM_ADDITIONAL_LLM_PORT**: Puerto para cualquier servicio LLM adicional personalizado.
**Las claves API son completamente opcionales para quienes optan por ejecutar LLM localmente, que es el objetivo principal de este proyecto. Déjalas en blanco si tienes hardware suficiente.**
### 3. **Iniciar Docker**
Asegúrate de que Docker esté instalado y ejecutándose en tu sistema. Puedes iniciar Docker con los siguientes comandos:
- **Linux/macOS:**
Abre una terminal y ejecuta:
```sh
sudo systemctl start docker
```
O inicia Docker Desktop desde el menú de aplicaciones, si está instalado.
- **Windows:**
Inicia Docker Desktop desde el menú Inicio.
Puedes verificar si Docker se está ejecutando ejecutando:
```sh
docker info
```
Si ves información sobre tu instalación de Docker, está funcionando correctamente.
Consulta la [Lista de proveedores locales](#lista-de-proveedores-locales) a continuación para obtener un resumen.
Siguiente paso: [Ejecutar AgenticSeek localmente](#iniciar-servicios-y-ejecutar)
*Si tienes problemas, consulta la sección [Solución de problemas](#solución-de-problemas).*
*Si tu hardware no puede ejecutar LLM localmente, consulta [Configuración para ejecutar con una API](#configuración-para-ejecutar-con-una-api).*
*Para explicaciones detalladas de `config.ini`, consulta la [sección Configuración](#configuración).*
---
## Configuración para ejecutar LLM localmente en tu máquina
**Requisitos de hardware:**
Para ejecutar LLM localmente, necesitarás hardware suficiente. Como mínimo, se requiere una GPU capaz de ejecutar Magistral, Qwen o Deepseek 14B. Consulta el FAQ para recomendaciones detalladas de modelo/rendimiento.
**Configura tu proveedor local**
Inicia tu proveedor local, por ejemplo con ollama:
```sh
ollama serve
```
Consulta la lista de proveedores locales admitidos a continuación.
**Actualizar config.ini**
Cambia el archivo config.ini para establecer provider_name en un proveedor admitido y provider_model en un LLM admitido por tu proveedor. Recomendamos modelos de razonamiento como *Magistral* o *Deepseek*.
Consulta el **FAQ** al final del README para el hardware necesario.
```sh
[MAIN]
is_local = True # Ya sea que ejecutes localmente o con un proveedor remoto.
provider_name = ollama # o lm-studio, openai, etc.
provider_model = deepseek-r1:14b # elige un modelo compatible con tu hardware
provider_server_address = 127.0.0.1:11434
agent_name = Jarvis # el nombre de tu IA
recover_last_session = True # recuperar sesión anterior
save_session = True # recordar sesión actual
speak = False # texto a voz
listen = False # voz a texto, solo para CLI, experimental
jarvis_personality = False # usar personalidad más "Jarvis" (experimental)
languages = en zh # Lista de idiomas, TTS usará el primero de la lista por defecto
[BROWSER]
headless_browser = True # mantener sin cambios a menos que uses CLI en el host.
stealth_mode = True # Usa selenium indetectable para reducir la detección del navegador
```
**Advertencia**:
- El formato del archivo `config.ini` no admite comentarios.
No copies y pegues la configuración de ejemplo directamente, ya que los comentarios causarán errores. En su lugar, modifica manualmente el archivo `config.ini` con tu configuración deseada, sin comentarios.
- *NO* establezcas provider_name como `openai` si estás usando LM-studio para ejecutar LLM. Úsalo como `lm-studio`.
- Algunos proveedores (ej: lm-studio) requieren `http://` antes de la IP. Ejemplo: `http://127.0.0.1:1234`
**Lista de proveedores locales**
| Proveedor | ¿Local? | Descripción |
|-----------|--------|-----------------------------------------------------------|
| ollama | Sí | Ejecuta LLM localmente fácilmente usando ollama |
| lm-studio | Sí | Ejecuta LLM localmente con LM studio (establecer `provider_name` = `lm-studio`)|
| openai | Sí | Usa API compatible con openai (ej: servidor llama.cpp) |
Siguiente paso: [Iniciar servicios y ejecutar AgenticSeek](#iniciar-servicios-y-ejecutar)
*Si tienes problemas, consulta la sección [Solución de problemas](#solución-de-problemas).*
*Si tu hardware no puede ejecutar LLM localmente, consulta [Configuración para ejecutar con una API](#configuración-para-ejecutar-con-una-api).*
*Para explicaciones detalladas de `config.ini`, consulta la [sección Configuración](#configuración).*
## Configuración para ejecutar con una API
Esta configuración utiliza proveedores de LLM externos basados en la nube. Necesitarás obtener claves API del servicio elegido.
**1. Elige un proveedor de API y obtén una clave API:**
Consulta la [Lista de proveedores de API](#lista-de-proveedores-de-api) a continuación. Visita sus sitios web para registrarte y obtener claves API.
**2. Establece tu clave API como variable de entorno:**
* **Linux/macOS:**
Abre una terminal y usa el comando `export`. Es mejor agregarlo al archivo de configuración de tu shell (ej: `~/.bashrc`, `~/.zshrc`) para que sea persistente.
```sh
export PROVIDER_API_KEY="your_api_key_here"
# Reemplaza PROVIDER_API_KEY con el nombre de variable específico, ej: OPENAI_API_KEY, GOOGLE_API_KEY
```
Ejemplo de TogetherAI:
```sh
export TOGETHER_API_KEY="xxxxxxxxxxxxxxxxxxxxxx"
```
* **Windows:**
* **Símbolo del sistema (temporal para la sesión actual):**
```cmd
set PROVIDER_API_KEY=your_api_key_here
```
* **PowerShell (temporal para la sesión actual):**
```powershell
$env:PROVIDER_API_KEY="your_api_key_here"
```
* **Permanente:** Busca "variables de entorno" en la barra de búsqueda de Windows, haz clic en "Editar las variables de entorno del sistema", luego en el botón "Variables de entorno...". Agrega una nueva variable de usuario con el nombre apropiado (ej: `OPENAI_API_KEY`) y tu clave como valor.
*(Para más detalles, consulta el FAQ: [¿Cómo configuro una clave API?](#cómo-configuro-una-clave-api)).*
**3. Actualiza `config.ini`:**
```ini
[MAIN]
is_local = False
provider_name = openai # o google, deepseek, togetherAI, huggingface
provider_model = gpt-3.5-turbo # o gemini-1.5-flash, deepseek-chat, mistralai/Mixtral-8x7B-Instruct-v0.1, etc.
provider_server_address = # Cuando is_local = False, generalmente se ignora o puede dejarse en blanco para la mayoría de las API
# ... otras configuraciones ...
```
*Advertencia:* Asegúrate de que no haya espacios al final de los valores en config.
**Lista de proveedores de API**
| Proveedor | `provider_name` | ¿Local? | Descripción | Enlace de clave API (ejemplo) |
|--------------|-----------------|--------|---------------------------------------------------|---------------------------------------------|
| OpenAI | `openai` | No | Usa modelos ChatGPT a través de la API de OpenAI. | [platform.openai.com/signup](https://platform.openai.com/signup) |
| Google Gemini| `google` | No | Usa modelos Google Gemini a través de Google AI Studio. | [aistudio.google.com/keys](https://aistudio.google.com/keys) |
| Deepseek | `deepseek` | No | Usa modelos Deepseek a través de su API. | [platform.deepseek.com](https://platform.deepseek.com) |
| Hugging Face | `huggingface` | No | Usa modelos del Hugging Face Inference API. | [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens) |
| TogetherAI | `togetherAI` | No | Usa varios modelos de código abierto a través de la API de TogetherAI.| [api.together.ai/settings/api-keys](https://api.together.ai/settings/api-keys) |
*Nota:*
* No recomendamos usar `gpt-4o` u otros modelos OpenAI para navegación web compleja y planificación de tareas, ya que la optimización actual de prompts está dirigida a modelos como Deepseek.
* Las tareas de codificación/bash pueden fallar con Gemini, ya que tiende a ignorar nuestro formato de prompt optimizado para Deepseek r1.
* Cuando `is_local = False`, `provider_server_address` en `config.ini` generalmente no se usa, ya que los endpoints de API suelen estar codificados en las bibliotecas del proveedor correspondiente.
Siguiente paso: [Iniciar servicios y ejecutar AgenticSeek](#iniciar-servicios-y-ejecutar)
*Si tienes problemas, consulta la sección **Problemas conocidos***
*Para explicaciones detalladas del archivo de configuración, consulta la **sección Configuración**.*
---
## Iniciar servicios y ejecutar
Por defecto, AgenticSeek se ejecuta completamente en Docker.
**Opción 1:** Ejecutar en Docker con interfaz web:
Inicia los servicios necesarios. Esto iniciará todos los servicios del docker-compose.yml, incluyendo:
- searxng
- redis (requerido para searxng)
- frontend
- backend (si usas `full` para la interfaz web)
```sh
./start_services.sh full # MacOS
start start_services.cmd full # Windows
```
**Advertencia:** Este paso descargará y cargará todas las imágenes de Docker, lo que puede tardar hasta 30 minutos. Después de iniciar los servicios, espera hasta que el servicio backend esté completamente ejecutándose (deberías ver **backend: "GET /health HTTP/1.1" 200 OK** en el registro) antes de enviar cualquier mensaje. En la primera ejecución, el servicio backend puede tardar 5 minutos en iniciarse.
Ve a `http://localhost:3000/` y deberías ver la interfaz web.
*Solución de problemas de inicio de servicios:* Si estos scripts fallan, asegúrate de que Docker Engine esté ejecutándose y que Docker Compose (V2, `docker compose`) esté correctamente instalado. Revisa los mensajes de error en la salida de la terminal. Consulta [FAQ: ¡Ayuda! Obtengo errores al ejecutar AgenticSeek o sus scripts.](#faq-solución-de-problemas)
**Opción 2:** Modo CLI:
Para ejecutar con la interfaz CLI, debes instalar los paquetes en el host:
```sh
./install.sh
./install.bat # windows
```
Luego debes cambiar SEARXNG_BASE_URL en `config.ini` a:
```sh
SEARXNG_BASE_URL="http://localhost:8080"
```
Inicia los servicios necesarios. Esto iniciará algunos servicios del docker-compose.yml, incluyendo:
- searxng
- redis (requerido para searxng)
- frontend
```sh
./start_services.sh # MacOS
start start_services.cmd # Windows
```
Ejecuta: uv run: `uv run python -m ensurepip` para asegurarte de que uv tenga pip habilitado.
Usa CLI: `uv run cli.py`
---
## Uso
Asegúrate de que los servicios estén ejecutándose con `./start_services.sh full` y luego ve a `localhost:3000` para la interfaz web.
También puedes usar voz a texto configurando `listen = True`. Solo para modo CLI.
Para salir, simplemente di/escribe `goodbye`.
Algunos ejemplos de uso:
> *¡Haz un juego de la serpiente en python!*
> *Busca en la web los mejores cafés en Rennes, Francia, y guarda una lista de tres con sus direcciones en rennes_cafes.txt.*
> *Escribe un programa Go para calcular el factorial de un número, guárdalo como factorial.go en tu workspace*
> *Busca en la carpeta summer_pictures todos los archivos JPG, renómbralos con la fecha de hoy y guarda la lista de archivos renombrados en photos_list.txt*
> *Busca en línea películas de ciencia ficción populares de 2024 y elige tres para ver esta noche. Guarda la lista en movie_night.txt.*
> *Busca en la web los últimos artículos de noticias de IA de 2025, selecciona tres y escribe un script Python para extraer títulos y resúmenes. Guarda el script como news_scraper.py y los resúmenes en ai_news.txt en /home/projects*
> *Viernes, busca en la web una API gratuita de precios de acciones, regístrate con supersuper7434567@gmail.com y escribe un script Python para obtener los precios diarios de Tesla usando la API, guardando los resultados en stock_prices.csv*
*Ten en cuenta que el llenado de formularios sigue siendo experimental y puede fallar.*
Después de ingresar tu consulta, AgenticSeek asignará el mejor agente para la tarea.
Como este es un prototipo inicial, el sistema de enrutamiento de agentes puede no asignar siempre el agente correcto a tu consulta.
Por lo tanto, sé muy explícito sobre lo que quieres y cómo la IA podría proceder, por ejemplo, si quieres que realice una búsqueda web, no digas:
`¿Conoces algunos buenos países para viajar solo?`
En su lugar, di:
`Realiza una búsqueda web y descubre cuáles son los mejores países para viajar solo`
---
## **Configuración para ejecutar LLM en tu propio servidor**
Si tienes una computadora potente o un servidor al que puedes acceder, pero quieres usarlo desde tu laptop, puedes optar por ejecutar el LLM en un servidor remoto usando nuestro servidor llm personalizado.
En tu "servidor" que ejecutará el modelo de IA, obtén la dirección IP
```sh
ip a | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}' | cut -d/ -f1 # IP local
curl https://ipinfo.io/ip # IP pública
```
Nota: Para Windows o macOS, usa ipconfig o ifconfig para encontrar la dirección IP.
Clona el repositorio y entra en la carpeta `server/`.
```sh
git clone --depth 1 https://github.com/Fosowl/agenticSeek.git
cd agenticSeek/llm_server/
```
Instala los requisitos específicos del servidor:
```sh
pip3 install -r requirements.txt
```
Ejecuta el script del servidor.
```sh
python3 app.py --provider ollama --port 3333
```
Puedes elegir entre usar `ollama` y `llamacpp` como servicio LLM.
Ahora en tu computadora personal:
Cambia el archivo `config.ini` para establecer `provider_name` como `server` y `provider_model` como `deepseek-r1:xxb`.
Establece `provider_server_address` a la dirección IP de la máquina que ejecutará el modelo.
```sh
[MAIN]
is_local = False
provider_name = server
provider_model = deepseek-r1:70b
provider_server_address = http://x.x.x.x:3333
```
Siguiente paso: [Iniciar servicios y ejecutar AgenticSeek](#iniciar-servicios-y-ejecutar)
---
## Voz a Texto
Advertencia: La voz a texto solo funciona en modo CLI en este momento.
Ten en cuenta que la voz a texto solo funciona en inglés en este momento.
La funcionalidad de voz a texto está deshabilitada por defecto. Para habilitarla, establece listen en True en el archivo config.ini:
```
listen = True
```
Cuando está habilitado, la función de voz a texto escucha una palabra clave de activación, que es el nombre del agente, antes de procesar tu entrada. Puedes personalizar el nombre del agente actualizando el valor `agent_name` en *config.ini*:
```
agent_name = Friday
```
Para un mejor reconocimiento, recomendamos usar un nombre común en inglés como "John" o "Emma" como nombre de agente.
Una vez que veas que comienza a aparecer la transcripción, di el nombre del agente en voz alta para activarlo (ej: "Friday").
Di tu consulta claramente.
Termina tu solicitud con una frase de confirmación para indicar al sistema que proceda. Ejemplos de frases de confirmación incluyen:
```
"do it", "go ahead", "execute", "run", "start", "thanks", "would ya", "please", "okay?", "proceed", "continue", "go on", "do that", "go it", "do you understand?"
```
## Configuración
Ejemplo de configuración:
```
[MAIN]
is_local = True
provider_name = ollama
provider_model = deepseek-r1:32b
provider_server_address = http://127.0.0.1:11434 # Ejemplo de Ollama; LM-Studio usa http://127.0.0.1:1234
agent_name = Friday
recover_last_session = False
save_session = False
speak = False
listen = False
jarvis_personality = False
languages = en zh # Lista de idiomas para TTS y enrutamiento potencial.
[BROWSER]
headless_browser = False
stealth_mode = False
```
**Explicación de la configuración de `config.ini`**:
* **Sección `[MAIN]`:**
* `is_local`: `True` si usas proveedores de LLM locales (Ollama, LM-Studio, servidor local compatible con OpenAI) o la opción de servidor autoalojado. `False` si usas API basadas en la nube (OpenAI, Google, etc.).
* `provider_name`: Especifica el proveedor de LLM.
* Opciones locales: `ollama`, `lm-studio`, `openai` (para servidor local compatible con OpenAI), `server` (para configuración de servidor autoalojado).
* Opciones de API: `openai`, `google`, `deepseek`, `huggingface`, `togetherAI`.
* `provider_model`: Nombre o ID específico del modelo del proveedor seleccionado (ej: `deepseekcoder:6.7b` para Ollama, `gpt-3.5-turbo` para API de OpenAI, `mistralai/Mixtral-8x7B-Instruct-v0.1` para TogetherAI).
* `provider_server_address`: La dirección de tu proveedor de LLM.
* Para proveedores locales: ej: `http://127.0.0.1:11434` para Ollama, `http://127.0.0.1:1234` para LM-Studio.
* Para el tipo de proveedor `server`: La dirección de tu servidor LLM autoalojado (ej: `http://your_server_ip:3333`).
* Para API en la nube (`is_local = False`): Esto generalmente se ignora o puede dejarse en blanco, ya que los endpoints de API suelen ser manejados por las bibliotecas del cliente.
* `agent_name`: El nombre del asistente de IA (ej: Friday). Si está habilitado, se utiliza como palabra de activación para voz a texto.
* `recover_last_session`: `True` para intentar recuperar el estado de la sesión anterior, `False` para comenzar de nuevo.
* `save_session`: `True` para guardar el estado de la sesión actual para una posible recuperación, `False` en caso contrario.
* `speak`: `True` para habilitar la salida de voz de texto a voz, `False` para deshabilitar.
* `listen`: `True` para habilitar la entrada de voz de voz a texto (solo modo CLI), `False` para deshabilitar.
* `work_dir`: **Crítico:** El directorio donde AgenticSeek leerá/escribirá archivos. **Asegúrate de que esta ruta sea válida y accesible en tu sistema.**
* `jarvis_personality`: `True` para usar prompts del sistema más al estilo "Jarvis" (experimental), `False` para usar prompts estándar.
* `languages`: Lista de idiomas separados por comas (ej: `en, zh, fr`). Se utiliza para la selección de voz TTS (predeterminado el primero) y puede ayudar al enrutador LLM. Para evitar ineficiencias del enrutador, evita usar demasiados idiomas o idiomas muy similares.
* **Sección `[BROWSER]`:**
* `headless_browser`: `True` para ejecutar el navegador automatizado sin una ventana visible (recomendado para interfaz web o uso no interactivo). `False` para mostrar la ventana del navegador (útil para modo CLI o depuración).
* `stealth_mode`: `True` para habilitar medidas que dificultan la detección de la automatización del navegador. Puede requerir la instalación manual de extensiones del navegador como anticaptcha.
Esta sección resume los tipos de proveedores de LLM admitidos. Configúralos en `config.ini`.
**Proveedores locales (ejecutándose en tu propio hardware):**
| Nombre del proveedor en config.ini | `is_local` | Descripción | Sección de configuración |
|-------------------------------|------------|-----------------------------------------------------------------------------|------------------------------------------------------------------|
| `ollama` | `True` | Proporciona LLM localmente fácilmente usando Ollama. | [Configuración para ejecutar LLM localmente en tu máquina](#configuración-para-ejecutar-llm-localmente-en-tu-máquina) |
| `lm-studio` | `True` | Proporciona LLM localmente con LM-Studio. | [Configuración para ejecutar LLM localmente en tu máquina](#configuración-para-ejecutar-llm-localmente-en-tu-máquina) |
| `openai` (para servidor local) | `True` | Conéctate a un servidor local que exponga una API compatible con OpenAI (ej: llama.cpp). | [Configuración para ejecutar LLM localmente en tu máquina](#configuración-para-ejecutar-llm-localmente-en-tu-máquina) |
| `server` | `False` | Conéctate al servidor LLM autoalojado de AgenticSeek que se ejecuta en otra máquina. | [Configuración para ejecutar LLM en tu propio servidor](#configuración-para-ejecutar-llm-en-tu-propio-servidor) |
**Proveedores de API (basados en la nube):**
| Nombre del proveedor en config.ini | `is_local` | Descripción | Sección de configuración |
|-------------------------------|------------|--------------------------------------------------|-----------------------------------------------------|
| `openai` | `False` | Usa la API oficial de OpenAI (ej: GPT-3.5, GPT-4). | [Configuración para ejecutar con una API](#configuración-para-ejecutar-con-una-api) |
| `google` | `False` | Usa modelos Google Gemini a través de API. | [Configuración para ejecutar con una API](#configuración-para-ejecutar-con-una-api) |
| `deepseek` | `False` | Usa la API oficial de Deepseek. | [Configuración para ejecutar con una API](#configuración-para-ejecutar-con-una-api) |
| `huggingface` | `False` | Usa Hugging Face Inference API. | [Configuración para ejecutar con una API](#configuración-para-ejecutar-con-una-api) |
| `togetherAI` | `False` | Usa varios modelos abiertos a través de la API de TogetherAI. | [Configuración para ejecutar con una API](#configuración-para-ejecutar-con-una-api) |
---
## Solución de problemas
Si encuentras problemas, esta sección proporciona orientación.
# Problemas conocidos
## Problemas de ChromeDriver
**Ejemplo de error:** `SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version XXX`
### Causa principal
La incompatibilidad de versión de ChromeDriver ocurre cuando:
1. La versión de ChromeDriver que instalaste no coincide con la versión del navegador Chrome
2. En entornos Docker, `undetected_chromedriver` puede descargar su propia versión de ChromeDriver, evitando los binarios montados
### Pasos de solución
#### 1. Verifica tu versión de Chrome
Abre Google Chrome → `Configuración > Acerca de Chrome` para encontrar tu versión (ej: "Versión 134.0.6998.88")
#### 2. Descarga ChromeDriver coincidente
**Para Chrome 115 y versiones más recientes:** Usa [Chrome for Testing API](https://googlechromelabs.github.io/chrome-for-testing/)
- Visita el panel de disponibilidad de Chrome for Testing
- Encuentra tu versión de Chrome o la coincidencia disponible más cercana
- Descarga ChromeDriver para tu sistema operativo (usa Linux64 para entornos Docker)
**Para versiones antiguas de Chrome:** Usa [Descargas heredadas de ChromeDriver](https://chromedriver.chromium.org/downloads)
![Descargar ChromeDriver desde Chrome for Testing](./media/chromedriver_readme.png)
#### 3. Instala ChromeDriver (elige un método)
**Método A: Directorio raíz del proyecto (recomendado para Docker)**
```bash
# Coloca el binario de chromedriver descargado en el directorio raíz del proyecto
cp path/to/downloaded/chromedriver ./chromedriver
chmod +x ./chromedriver # Hazlo ejecutable en Linux/macOS
```
**Método B: PATH del sistema**
```bash
# Linux/macOS
sudo mv chromedriver /usr/local/bin/
sudo chmod +x /usr/local/bin/chromedriver
# Windows: Coloca chromedriver.exe en una carpeta en PATH
```
#### 4. Verifica la instalación
```bash
# Prueba la versión de ChromeDriver
./chromedriver --version
# O si está en PATH:
chromedriver --version
```
### Instrucciones específicas de Docker
⚠️ **Importante para usuarios de Docker:**
- El método de montaje de volúmenes de Docker puede no funcionar con el modo sigiloso (`undetected_chromedriver`)
- **Solución:** Coloca ChromeDriver en el directorio raíz del proyecto como `./chromedriver`
- La aplicación lo detectará automáticamente y usará este binario
- Deberías ver en los registros: `"Using ChromeDriver from project root: ./chromedriver"`
### Consejos para solución de problemas
1. **¿Sigues teniendo incompatibilidad de versión?**
- Verifica que ChromeDriver sea ejecutable: `ls -la ./chromedriver`
- Comprueba la versión de ChromeDriver: `./chromedriver --version`
- Asegúrate de que coincida con tu versión del navegador Chrome
2. **¿Problemas con el contenedor Docker?**
- Revisa los registros del backend: `docker logs backend`
- Busca el mensaje: `"Using ChromeDriver from project root"`
- Si no se encuentra, verifica que el archivo exista y sea ejecutable
3. **Versiones de Chrome for Testing**
- Usa una coincidencia exacta cuando sea posible
- Para la versión 134.0.6998.88, usa ChromeDriver 134.0.6998.165 (la versión disponible más cercana)
- El número de versión principal debe coincidir (134 = 134)
### Matriz de compatibilidad de versiones
| Versión de Chrome | Versión de ChromeDriver | Estado |
|----------------|---------------------|---------|
| 134.0.6998.x | 134.0.6998.165 | ✅ Disponible |
| 133.0.6943.x | 133.0.6943.141 | ✅ Disponible |
| 132.0.6834.x | 132.0.6834.159 | ✅ Disponible |
*Para la compatibilidad más reciente, consulta el [Panel de Chrome for Testing](https://googlechromelabs.github.io/chrome-for-testing/)*
`Exception: Failed to initialize browser: Message: session not created: This version of ChromeDriver only supports Chrome version 113
Current browser version is 134.0.6998.89 with binary path`
Esto sucede si tu navegador y la versión de chromedriver no coinciden.
Necesitas navegar para descargar la versión más reciente:
https://developer.chrome.com/docs/chromedriver/downloads
Si usas Chrome versión 115 o superior, ve a:
https://googlechromelabs.github.io/chrome-for-testing/
y descarga la versión de chromedriver que coincida con tu sistema operativo.
![alt text](./media/chromedriver_readme.png)
Si esta sección está incompleta, abre un issue.
## Problemas de adaptadores de conexión
```
Exception: Provider lm-studio failed: HTTP request failed: No connection adapters were found for '127.0.0.1:1234/v1/chat/completions'` (nota: el puerto puede variar)
```
* **Causa:** Falta el prefijo `http://` en `provider_server_address` para `lm-studio` (u otro servidor local compatible con OpenAI similar) en `config.ini`, o apunta al puerto incorrecto.
* **Solución:**
* Asegúrate de que la dirección incluya `http://`. LM-Studio normalmente usa `http://127.0.0.1:1234` por defecto.
* `config.ini` correcto: `provider_server_address = http://127.0.0.1:1234` (o tu puerto real del servidor LM-Studio).
## URL base de SearxNG no proporcionada
```
raise ValueError("SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.")
ValueError: SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.`
```
Esto puede ocurrir si ejecutas el modo CLI con la URL base de searxng incorrecta.
SEARXNG_BASE_URL debe diferir según si ejecutas en Docker o en el host:
**Ejecutando en el host:** `SEARXNG_BASE_URL="http://localhost:8080"`
**Ejecutando completamente en Docker (interfaz web):** `SEARXNG_BASE_URL="http://searxng:8080"`
## FAQ
**P: ¿Qué hardware necesito?**
| Tamaño del modelo | GPU | Comentarios |
|-----------|--------|-----------------------------------------------------------|
| 7B | 8GB VRAM | ⚠️ No recomendado. Rendimiento pobre, alucinaciones frecuentes, los agentes de planificación pueden fallar. |
| 14B | 12 GB VRAM (ej: RTX 3060) | ✅ Utilizable para tareas simples. Puede tener dificultades con la navegación web y la planificación de tareas. |
| 32B | 24+ GB VRAM (ej: RTX 4090) | 🚀 Éxito en la mayoría de las tareas, aún puede tener dificultades con la planificación de tareas |
| 70B+ | 48+ GB VRAM | 💪 Excelente. Recomendado para casos de uso avanzados. |
**P: ¿Qué hago si encuentro errores?**
Asegúrate de que lo local esté ejecutándose (`ollama serve`), que tu `config.ini` coincida con tu proveedor y que las dependencias estén instaladas. Si nada funciona, no dudes en abrir un issue.
**P: ¿Realmente puede ejecutarse 100% localmente?**
Sí, con proveedores Ollama, lm-studio o server, todos los modelos de voz a texto, LLM y texto a voz se ejecutan localmente. Las opciones no locales (OpenAI u otras API) son opcionales.
**P: ¿Por qué debería usar AgenticSeek cuando tengo Manus?**
A diferencia de Manus, AgenticSeek prioriza la independencia de los sistemas externos, dándote más control, privacidad y evitando costos de API.
**P: ¿Quién está detrás de este proyecto?**
Este proyecto fue creado por mí, con dos amigos como mantenedores y contribuyentes de la comunidad de código abierto en GitHub. Solo somos individuos apasionados, no una startup, ni estamos afiliados a ninguna organización.
Cualquier cuenta de AgenticSeek en X además de mi cuenta personal (https://x.com/Martin993886460) es impostora.
## Contribuir
¡Buscamos desarrolladores para mejorar AgenticSeek! Revisa los issues abiertos o discusiones.
[Guía de contribución](./docs/CONTRIBUTING.md)
## Patrocinadores:
¿Quieres mejorar las capacidades de AgenticSeek con funciones como búsqueda de vuelos, planificación de viajes o obtención de las mejores ofertas de compras? Considera usar SerpApi para crear herramientas personalizadas que desbloqueen más funcionalidades al estilo Jarvis. Con SerpApi, puedes acelerar tu agente para tareas profesionales mientras mantienes el control total.
<a href="https://serpapi.com/"><img src="./media/banners/sponsor_banner_serpapi.png" height="350" alt="SerpApi Banner" ></a>
¡Consulta [Contributing.md](./docs/CONTRIBUTING.md) para aprender cómo integrar herramientas personalizadas!
### **Patrocinadores**:
- [tatra-labs](https://github.com/tatra-labs)
## Mantenedores:
> [Fosowl](https://github.com/Fosowl) | Hora de París
> [antoineVIVIES](https://github.com/antoineVIVIES) | Hora de Taipei
## Agradecimientos especiales:
> [tcsenpai](https://github.com/tcsenpai) y [plitc](https://github.com/plitc) por ayudar con la dockerización del backend
[![Star History Chart](https://api.star-history.com/svg?repos=Fosowl/agenticSeek&type=Date)](https://www.star-history.com/#Fosowl/agenticSeek&Date)
+491 -253
View File
@@ -1,54 +1,52 @@
# AgenticSeek : Une Alternative Privée et Locale à Manus
<p align="center"> <p align="center">
<img align="center" src="./media/whale_readme.jpg"> <img align="center" src="./media/agentic_seek_logo.png" width="300" height="300" alt="Agentic Seek Logo">
<p> <p>
-------------------------------------------------------------------------------- English | [中文](./README_CHS.md) | [繁體中文](./README_CHT.md) | [Français](./README_FR.md) | [日本語](./README_JP.md) | [Português (Brasil)](./README_PTBR.md) | [Español](./README_ES.md) | [Türkçe](./README_TR.md)
[English](./README.md) | [繁體中文](./README_CHT.md) | [日本語](./README_JP.md) | Français
# AgenticSeek: Une IA comme Manus mais à base d'agents DeepSeek R1 fonctionnant en local. *Un assistant IA avec reconnaissance vocale qui est une **alternative 100% locale à Manus AI**, navigue de manière autonome sur le web, écrit du code et planifie des tâches tout en gardant toutes les données sur votre appareil. Conçu pour des modèles de raisonnement locaux, il fonctionne entièrement sur votre matériel, garantissant une confidentialité totale et zéro dépendance au cloud.*
Une alternative **entièrement locale** à Manus AI, un assistant IA qui code, explore votre système de fichiers, navigue sur le web et corrige ses erreurs, tout cela sans envoyer la moindre donnée dans le cloud. Cet agent autonome fonctionne entièrement sur votre hardware, garantissant la confidentialité de vos données. [![Visiter AgenticSeek](https://img.shields.io/static/v1?label=Website&message=AgenticSeek&color=blue&style=flat-square)](https://fosowl.github.io/agenticSeek.html) ![License](https://img.shields.io/badge/license-GPL--3.0-green) [![Discord](https://img.shields.io/badge/Discord-Join%20Us-7289DA?logo=discord&logoColor=white)](https://discord.gg/8hGDaME3TC) [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/fosowl.svg?style=social&label=Update%20%40Fosowl)](https://x.com/Martin993886460) [![GitHub stars](https://img.shields.io/github/stars/Fosowl/agenticSeek?style=social)](https://github.com/Fosowl/agenticSeek/stargazers)
[![Visit AgenticSeek](https://img.shields.io/static/v1?label=Website&message=AgenticSeek&color=blue&style=flat-square)](https://fosowl.github.io/agenticSeek.html) ![License](https://img.shields.io/badge/license-GPL--3.0-green) [![Discord](https://img.shields.io/badge/Discord-Join%20Us-7289DA?logo=discord&logoColor=white)](https://discord.gg/8hGDaME3TC) [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/fosowl.svg?style=social&label=Update%20%40Fosowl)](https://x.com/Martin993886460) ### Pourquoi choisir AgenticSeek ?
> 🛠️ **En cours de développement** On cherche activement des contributeurs! * 🔒 Totalement Local & Privé - Tout fonctionne sur votre machine, sans cloud, sans partage de données. Vos fichiers, conversations et recherches restent privés.
https://github.com/user-attachments/assets/4bd5faf6-459f-4f94-bd1d-238c4b331469 * 🌐 Navigation Web Intelligente - AgenticSeek peut naviguer sur Internet de manière autonome : rechercher, lire, extraire des informations, remplir des formulaires web, le tout sans intervention manuelle.
> *Recherche sur le web des activités à faire à Paris* * 💻 Assistant de Programmation Autonome - Besoin de code ? Il peut écrire, déboguer et exécuter des programmes en Python, C, Go, Java et plus encore, sans supervision.
> *Code le jeu snake en python* * 🧠 Sélection Intelligente d'Agents - Vous demandez, il choisit automatiquement le meilleur agent pour la tâche. Comme avoir une équipe d'experts toujours disponible.
> *J'aimerais que tu trouve une api météo et que tu me code une application qui affiche la météo à Toulouse* * 📋 Planifie et Exécute des Tâches Complexes - De la planification de voyage aux projets complexes, il peut décomposer de grandes tâches en étapes et les compléter en utilisant plusieurs agents IA.
* 🎙️ Prise en Charge Vocale - Voix claire, rapide et futuriste avec reconnaissance vocale, vous permettant de converser comme avec votre IA personnelle de film de science-fiction. (En développement)
### **Démo**
> *Peux-tu rechercher le projet agenticSeek, apprendre quelles compétences sont nécessaires, puis ouvrir CV_candidates.zip et me dire lesquels correspondent le mieux au projet ?*
## Fonctionnalités: https://github.com/user-attachments/assets/b8ca60e9-7b3b-4533-840e-08f9ac426316
- **100% Local**: Fonctionne en local sur votre PC. Vos données restent les vôtres. Avertissement : Cette démonstration et tous les fichiers qui apparaissent (ex: CV_candidates.zip) sont entièrement fictifs. Nous ne sommes pas une entreprise, nous recherchons des contributeurs open source, pas des candidats.
- **Accès à vos Fichiers**: Utilise bash pour naviguer et manipuler vos fichiers. > 🛠⚠️ **Travail Actif en Cours**
- **Codage semi-autonome**: Peut écrire, déboguer et exécuter du code en Python, C, Golang et d'autres langages à venir. > 🙏 Ce projet a commencé comme un projet parallèle et n'a ni feuille de route ni financement. Il a grandi bien au-delà des attentes en apparaissant dans GitHub Trending. Les contributions, commentaires et de la patience sont profondément appréciés.
- **Routage d'Agent**: Sélectionne automatiquement lagent approprié pour la tâche. ## Prérequis
- **Planification**: Pour les taches complexe utilise plusieurs agents. Avant de commencer, assurez-vous d'avoir installé :
- **Navigation Web Autonome**: Navigation web autonome. * **Git:** Pour cloner le dépôt. [Télécharger Git](https://git-scm.com/downloads)
* **Python 3.10.x:** Python 3.10.x est fortement recommandé. D'autres versions peuvent causer des erreurs de dépendance. [Télécharger Python 3.10](https://www.python.org/downloads/release/python-3100/) (sélectionnez la version 3.10.x).
* **Docker Engine & Docker Compose:** Pour exécuter des services empaquetés comme SearxNG.
* Installer Docker Desktop (inclut Docker Compose V2): [Windows](https://docs.docker.com/desktop/install/windows-install/) | [Mac](https://docs.docker.com/desktop/install/mac-install/) | [Linux](https://docs.docker.com/desktop/install/linux-install/)
* Ou installer Docker Engine et Docker Compose séparément sur Linux: [Docker Engine](https://docs.docker.com/engine/install/) | [Docker Compose](https://docs.docker.com/compose/install/) (assurez-vous d'installer Compose V2, par exemple `sudo apt-get install docker-compose-plugin`).
- **Memoire efficace**: Gestion efficace de la mémoire et des sessions. ### 1. **Cloner le dépôt et configurer**
---
## **Installation**
Assurez-vous davoir installé le pilote Chrome, Docker et Python 3.10 (ou une version plus récente).
Pour les problèmes liés au pilote Chrome, consultez la section Chromedriver.
### 1️⃣ Cloner le repo et configurer
```sh ```sh
git clone https://github.com/Fosowl/agenticSeek.git git clone https://github.com/Fosowl/agenticSeek.git
@@ -56,193 +54,310 @@ cd agenticSeek
mv .env.example .env mv .env.example .env
``` ```
### 2 **Créer un environnement virtuel** ### 2. Modifier le contenu du fichier .env
```sh ```sh
python3 -m venv agentic_seek_env SEARXNG_BASE_URL="http://searxng:8080" # Si vous exécutez en mode CLI sur l'hôte, utilisez http://127.0.0.1:8080
source agentic_seek_env/bin/activate REDIS_BASE_URL="redis://redis:6379/0"
# Sur Windows: agentic_seek_env\Scripts\activate WORK_DIR="/Users/mlg/Documents/workspace_for_ai"
OLLAMA_PORT="11434"
LM_STUDIO_PORT="1234"
CUSTOM_ADDITIONAL_LLM_PORT="11435"
OPENAI_API_KEY='optional'
DEEPSEEK_API_KEY='optional'
OPENROUTER_API_KEY='optional'
TOGETHER_API_KEY='optional'
GOOGLE_API_KEY='optional'
ANTHROPIC_API_KEY='optional'
``` ```
### 3️⃣ **Installation** Mettez à jour le fichier `.env` selon vos besoins :
**Automatique:** - **SEARXNG_BASE_URL**: Gardez inchangé sauf si vous exécutez en mode CLI sur l'hôte.
- **REDIS_BASE_URL**: Gardez inchangé
- **WORK_DIR**: Chemin vers le répertoire de travail local. AgenticSeek pourra lire et interagir avec ces fichiers.
- **OLLAMA_PORT**: Numéro de port pour le service Ollama.
- **LM_STUDIO_PORT**: Numéro de port pour le service LM Studio.
- **CUSTOM_ADDITIONAL_LLM_PORT**: Port pour tout service LLM personnalisé supplémentaire.
**Les clés API sont complètement optionnelles pour ceux qui choisissent d'exécuter LLM localement, ce qui est l'objectif principal de ce projet. Laissez-les vides si vous avez du matériel suffisant.**
### 3. **Démarrer Docker**
Assurez-vous que Docker est installé et fonctionne sur votre système. Vous pouvez démarrer Docker avec les commandes suivantes :
- **Linux/macOS:**
Ouvrez un terminal et exécutez :
```sh
sudo systemctl start docker
```
Ou démarrez Docker Desktop depuis le menu des applications, s'il est installé.
- **Windows:**
Démarrez Docker Desktop depuis le menu Démarrer.
Vous pouvez vérifier si Docker fonctionne en exécutant :
```sh ```sh
./install.sh docker info
``` ```
Si vous voyez des informations sur votre installation Docker, cela fonctionne correctement.
**Manuel:** Consultez la [Liste des fournisseurs locaux](#liste-des-fournisseurs-locaux) ci-dessous pour un résumé.
```sh Prochaine étape: [Exécuter AgenticSeek localement](#démarrer-les-services-et-exécuter)
pip3 install -r requirements.txt
```
*Si vous rencontrez des problèmes, consultez la section [Dépannage](#dépannage).*
*Si votre matériel ne peut pas exécuter LLM localement, consultez [Configuration pour exécuter avec une API](#configuration-pour-exécuter-avec-une-api).*
*Pour des explications détaillées de `config.ini`, consultez la [section Configuration](#configuration).*
## Faire fonctionner sur votre machine ---
**Nous recommandons dutiliser au minimum DeepSeek 14B, les modèles plus petits ont du mal avec lutilisation des outils et oublient rapidement le contexte.** ## Configuration pour exécuter LLM localement sur votre machine
**Exigences matérielles:**
Pour exécuter LLM localement, vous aurez besoin de matériel suffisant. Au minimum, une GPU capable d'exécuter Magistral, Qwen ou Deepseek 14B est requise. Consultez la FAQ pour des recommandations détaillées de modèle/performance.
**Configurez votre fournisseur local**
Démarrez votre fournisseur local, par exemple avec ollama:
Lancer votre provider local, par exemple avec ollama:
```sh ```sh
ollama serve ollama serve
``` ```
Voyez la section **Provider** pour la liste de provideurs disponible. Consultez la liste des fournisseurs locaux pris en charge ci-dessous.
Modifiez le fichier config.ini pour définir provider_name sur le nom d'un provideur et provider_model sur le LLM à utiliser. **Mettre à jour config.ini**
Changez le fichier config.ini pour définir provider_name sur un fournisseur pris en charge et provider_model sur un LLM pris en charge par votre fournisseur. Nous recommandons des modèles de raisonnement comme *Magistral* ou *Deepseek*.
Consultez la **FAQ** à la fin du README pour le matériel nécessaire.
```sh ```sh
[MAIN] [MAIN]
is_local = True is_local = True # Que vous exécutiez localement ou avec un fournisseur distant.
provider_name = ollama # ou lm-studio, openai, etc... provider_name = ollama # ou lm-studio, openai, etc.
provider_model = deepseek-r1:14b provider_model = deepseek-r1:14b # choisissez un modèle compatible avec votre matériel
provider_server_address = 127.0.0.1:11434 provider_server_address = 127.0.0.1:11434
agent_name = Jarvis # le nom de votre IA
recover_last_session = True # récupérer la session précédente
save_session = True # mémoriser la session actuelle
speak = False # texte vers parole
listen = False # parole vers texte, uniquement pour CLI, expérimental
jarvis_personality = False # utiliser une personnalité plus "Jarvis" (expérimental)
languages = en zh # Liste des langues, TTS utilisera la première de la liste par défaut
[BROWSER]
headless_browser = True # garder inchangé sauf si vous utilisez CLI sur l'hôte.
stealth_mode = True # Utilise selenium indétectable pour réduire la détection du navigateur
``` ```
**Liste des provideurs locaux** **Avertissement**:
- Le format du fichier `config.ini` ne prend pas en charge les commentaires.
Ne copiez et collez pas directement la configuration d'exemple, car les commentaires causeront des erreurs. Modifiez plutôt manuellement le fichier `config.ini` avec votre configuration souhaitée, sans commentaires.
- *NE* définissez PAS provider_name sur `openai` si vous utilisez LM-studio pour exécuter LLM. Utilisez `lm-studio`.
- Certains fournisseurs (ex: lm-studio) nécessitent `http://` avant l'IP. Exemple: `http://127.0.0.1:1234`
**Liste des fournisseurs locaux**
| Fournisseur | Local ? | Description | | Fournisseur | Local ? | Description |
|-------------|---------|-----------------------------------------------------------| |-----------|--------|-----------------------------------------------------------|
| ollama | Oui | Exécutez des LLM localement avec facilité en utilisant ollama comme fournisseur LLM | | ollama | Oui | Exécute LLM localement facilement en utilisant ollama |
| lm-studio | Oui | Exécutez un LLM localement avec LM studio (définissez `provider_name` sur `lm-studio`) | | lm-studio | Oui | Exécute LLM localement avec LM studio (définir `provider_name` = `lm-studio`)|
| openai | Oui | Utilisez une API local compatible avec openai | | openai | Oui | Utilise une API compatible avec openai (ex: serveur llama.cpp) |
Prochaine étape: [Démarrer les services et exécuter AgenticSeek](#démarrer-les-services-et-exécuter)
*Si vous rencontrez des problèmes, consultez la section [Dépannage](#dépannage).*
*Si votre matériel ne peut pas exécuter LLM localement, consultez [Configuration pour exécuter avec une API](#configuration-pour-exécuter-avec-une-api).*
*Pour des explications détaillées de `config.ini`, consultez la [section Configuration](#configuration).*
## Configuration pour exécuter avec une API
Cette configuration utilise des fournisseurs de LLM externes basés sur le cloud. Vous devrez obtenir des clés API du service choisi.
**1. Choisissez un fournisseur d'API et obtenez une clé API:**
Consultez la [Liste des fournisseurs d'API](#liste-des-fournisseurs-dapi) ci-dessous. Visitez leurs sites web pour vous inscrire et obtenir des clés API.
**2. Définissez votre clé API comme variable d'environnement:**
* **Linux/macOS:**
Ouvrez un terminal et utilisez la commande `export`. Il est préférable de l'ajouter au fichier de configuration de votre shell (ex: `~/.bashrc`, `~/.zshrc`) pour qu'elle soit persistante.
```sh
export PROVIDER_API_KEY="your_api_key_here"
# Remplacez PROVIDER_API_KEY par le nom de variable spécifique, ex: OPENAI_API_KEY, GOOGLE_API_KEY
```
Exemple TogetherAI:
```sh
export TOGETHER_API_KEY="xxxxxxxxxxxxxxxxxxxxxx"
```
* **Windows:**
* **Invite de commandes (temporaire pour la session actuelle):**
```cmd
set PROVIDER_API_KEY=your_api_key_here
```
* **PowerShell (temporaire pour la session actuelle):**
```powershell
$env:PROVIDER_API_KEY="your_api_key_here"
```
* **Permanent:** Recherchez "variables d'environnement" dans la barre de recherche Windows, cliquez sur "Modifier les variables d'environnement système", puis sur le bouton "Variables d'environnement...". Ajoutez une nouvelle variable utilisateur avec le nom approprié (ex: `OPENAI_API_KEY`) et votre clé comme valeur.
*(Pour plus de détails, consultez la FAQ: [Comment configurer une clé API ?](#comment-configurer-une-clé-api)).*
### **Démarrer les services & Exécuter** **3. Mettez à jour `config.ini`:**
```ini
[MAIN]
is_local = False
provider_name = openai # ou google, deepseek, togetherAI, huggingface
provider_model = gpt-3.5-turbo # ou gemini-1.5-flash, deepseek-chat, mistralai/Mixtral-8x7B-Instruct-v0.1, etc.
provider_server_address = # Lorsque is_local = False, généralement ignoré ou peut être laissé vide pour la plupart des API
# ... autres configurations ...
```
*Avertissement:* Assurez-vous qu'il n'y a pas d'espaces à la fin des valeurs dans config.
**Liste des fournisseurs d'API**
| Fournisseur | `provider_name` | Local ? | Description | Lien de clé API (exemple) |
|--------------|-----------------|--------|---------------------------------------------------|---------------------------------------------|
| OpenAI | `openai` | Non | Utilise les modèles ChatGPT via l'API OpenAI. | [platform.openai.com/signup](https://platform.openai.com/signup) |
| Google Gemini| `google` | Non | Utilise les modèles Google Gemini via Google AI Studio. | [aistudio.google.com/keys](https://aistudio.google.com/keys) |
| Deepseek | `deepseek` | Non | Utilise les modèles Deepseek via leur API. | [platform.deepseek.com](https://platform.deepseek.com) |
| Hugging Face | `huggingface` | Non | Utilise les modèles du Hugging Face Inference API. | [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens) |
| TogetherAI | `togetherAI` | Non | Utilise divers modèles open source via l'API TogetherAI.| [api.together.ai/settings/api-keys](https://api.together.ai/settings/api-keys) |
*Note:*
* Nous ne recommandons pas d'utiliser `gpt-4o` ou d'autres modèles OpenAI pour la navigation web complexe et la planification de tâches, car l'optimisation actuelle des prompts cible des modèles comme Deepseek.
* Les tâches de codage/bash peuvent échouer avec Gemini, car il a tendance à ignorer notre format de prompt optimisé pour Deepseek r1.
* Lorsque `is_local = False`, `provider_server_address` dans `config.ini` n'est généralement pas utilisé, car les endpoints d'API sont généralement gérés par les bibliothèques du fournisseur correspondant.
Prochaine étape: [Démarrer les services et exécuter AgenticSeek](#démarrer-les-services-et-exécuter)
*Si vous rencontrez des problèmes, consultez la section **Problèmes connus***
*Pour des explications détaillées du fichier de configuration, consultez la **section Configuration**.*
---
## Démarrer les services et exécuter
Par défaut, AgenticSeek s'exécute entièrement dans Docker.
**Option 1:** Exécuter dans Docker avec interface web:
Démarrez les services nécessaires. Cela démarrera tous les services du docker-compose.yml, y compris:
- searxng
- redis (requis pour searxng)
- frontend
- backend (si vous utilisez `full` pour l'interface web)
Activez votre environnement Python si nécessaire.
```sh ```sh
source agentic_seek_env/bin/activate ./start_services.sh full # MacOS
start start_services.cmd full # Windows
``` ```
Démarrez les services requis. Cela lancera tous les services définis dans le fichier docker-compose.yml, y compris : **Avertissement:** Cette étape téléchargera et chargera toutes les images Docker, ce qui peut prendre jusqu'à 30 minutes. Après avoir démarré les services, attendez que le service backend soit complètement opérationnel (vous devriez voir **backend: "GET /health HTTP/1.1" 200 OK** dans les logs) avant d'envoyer des messages. Lors du premier démarrage, le service backend peut prendre 5 minutes pour démarrer.
Allez à `http://localhost:3000/` et vous devriez voir l'interface web.
*Dépannage du démarrage des services:* Si ces scripts échouent, assurez-vous que Docker Engine fonctionne et que Docker Compose (V2, `docker compose`) est correctement installé. Vérifiez les messages d'erreur dans la sortie du terminal. Consultez [FAQ: Aide ! J'obtiens des erreurs lors de l'exécution d'AgenticSeek ou de ses scripts.](#faq-dépannage)
**Option 2:** Mode CLI:
Pour exécuter avec l'interface CLI, vous devez installer les packages sur l'hôte:
```sh
./install.sh
./install.bat # windows
```
Ensuite, vous devez changer SEARXNG_BASE_URL dans `config.ini` en:
```sh
SEARXNG_BASE_URL="http://localhost:8080"
```
Démarrez les services nécessaires. Cela démarrera certains services du docker-compose.yml, y compris:
- searxng - searxng
- redis (nécessaire pour searxng) - redis (requis pour searxng)
- frontend - frontend
```sh ```sh
sudo ./start_services.sh # MacOS ./start_services.sh # MacOS
start ./start_services.cmd # Windows start start_services.cmd # Windows
``` ```
**Option 1 :** Exécuter avec l'interface CLI. Exécutez: uv run: `uv run python -m ensurepip` pour vous assurer que uv a pip activé.
```sh Utilisez CLI: `uv run cli.py`
python3 cli.py
```
**Option 2 :** Exécuter avec l'interface Web.
Démarrez le backend.
```sh
python3 api.py
```
Allez sur `http://localhost:3000/` et vous devriez voir l'interface web.
Veuillez noter que l'interface web ne diffuse pas les messages en continu pour le moment.
Voyez la section **Utilisation** si vous ne comprenez pas comment lutiliser
Voyez la section **Problèmes** connus si vous rencontrez des problèmes
Voyez la section **Exécuter avec une API** si votre matériel ne peut pas exécuter DeepSeek localement
Voyez la section **Configuration** pour une explication détaillée du fichier de configuration.
--- ---
## Utilisation ## Utilisation
Assurez-vous que les services sont en cours dexécution avec ./start_services.sh et lancez AgenticSeek avec le CLI ou l'interface Web. Assurez-vous que les services fonctionnent avec `./start_services.sh full` puis allez à `localhost:3000` pour l'interface web.
**CLI:** Vous pouvez également utiliser la parole vers texte en définissant `listen = True`. Uniquement pour le mode CLI.
Vous verrez un prompt : ">>> "
Cela indique quAgenticSeek attend que vous saisissiez des instructions.
Vous pouvez également utiliser la reconnaissance vocale en définissant `listen = True` dans la configuration.
Pour quitter, dites simplement `goodbye`.
**Interface:** Pour quitter, dites/tapez simplement `goodbye`.
Assurez-vous d'avoir bien démarré le backend avec `python3 api.py`. Quelques exemples d'utilisation:
Allez sur `localhost:3000` où vous verrez une interface web.
Tapez simplement votre message et patientez.
Si vous n'avez pas d'interface sur `localhost:3000`, c'est que vous n'avez pas démarré les services avec `start_services.sh`.
Voici quelques exemples dutilisation : > *Fais un jeu de serpent en python !*
### Programmation > *Recherche sur le web les meilleurs cafés à Rennes, France, et sauvegarde une liste de trois avec leurs adresses dans rennes_cafes.txt.*
> *Aide-moi avec la multiplication de matrices en Golang* > *Écris un programme Go pour calculer la factorielle d'un nombre, sauvegarde-le comme factorial.go dans ton workspace*
> *Initalize un nouveau project python, setup le readme, gitignore etc.. et fait un premier commit* > *Recherche dans le dossier summer_pictures tous les fichiers JPG, renomme-les avec la date d'aujourd'hui et sauvegarde la liste des fichiers renommés dans photos_list.txt*
> *Fais un jeu snake en Python* > *Recherche en ligne les films de science-fiction populaires de 2024 et choisis-en trois à regarder ce soir. Sauvegarde la liste dans movie_night.txt.*
### Recherche web > *Recherche sur le web les derniers articles d'actualité sur l'IA de 2025, sélectionne-en trois et écris un script Python pour extraire les titres et résumés. Sauvegarde le script comme news_scraper.py et les résumés dans ai_news.txt dans /home/projects*
> *Fais une recherche sur le web pour trouver des startups technologiques au Japon qui travaillent sur des recherches avancées en IA* > *Vendredi, recherche sur le web une API gratuite de prix d'actions, inscris-toi avec supersuper7434567@gmail.com et écris un script Python pour obtenir les prix quotidiens de Tesla en utilisant l'API, en sauvegardant les résultats dans stock_prices.csv*
> *Peux-tu trouver sur internet qui a créé agenticSeek ?* *Notez que le remplissage de formulaires est toujours expérimental et peut échouer.*
> *Peux-tu trouver sur quel site je peux acheter une RTX 4090 à bas prix ?*
### Fichier
> *Hé, peux-tu trouver où est contrat.pdf ? Je lai perdu*
> *Montre-moi combien despace il me reste sur mon disque*
> *Trouve et lis le fichier README.md et suis les instructions dinstallation*
### Conversation
> *Parle-moi de la France*
> *Quel est le sens de la vie ?*
> *Donne moi une recette simple pour ce midi j'ai pas d'inspi*
Après avoir saisi votre requête, AgenticSeek attribuera le meilleur agent pour la tâche. Après avoir saisi votre requête, AgenticSeek attribuera le meilleur agent pour la tâche.
Le système de routage des agents peut parfois ne pas toujours attribuer le bon agent en fonction de votre requête. Comme il s'agit d'un prototype initial, le système de routage des agents peut ne pas toujours attribuer l'agent correct à votre requête.
Par conséquent, vous devez être assez explicite sur ce que vous voulez et sur la manière dont lIA doit procéder. Par exemple, si vous voulez quelle effectue une recherche sur le web, ne dites pas : Par conséquent, soyez très explicite sur ce que vous voulez et comment l'IA pourrait procéder, par exemple si vous voulez qu'elle effectue une recherche web, ne dites pas:
Connait-tu de bons pays pour voyager seul ? `Connais-tu de bons pays pour voyager seul ?`
Dites plutôt : Dites plutôt:
Fait une recherche sur le web, quels sont les meilleurs pays pour voyager seul? `Effectue une recherche web et découvre quels sont les meilleurs pays pour voyager seul`
--- ---
## **Exécuter le LLM sur votre propre serveur** ## **Configuration pour exécuter LLM sur votre propre serveur**
Si vous disposez dun ordinateur puissant ou dun serveur que vous voulez utiliser, mais que vous souhaitez y accéder depuis votre ordinateur portable, vous avez la possibilité dexécuter le LLM sur un serveur distant. Si vous avez un ordinateur puissant ou un serveur auquel vous pouvez accéder, mais que vous voulez l'utiliser depuis votre ordinateur portable, vous pouvez choisir d'exécuter le LLM sur un serveur distant en utilisant notre serveur llm personnalisé.
### 1️⃣ **Configurer et démarrer les scripts du serveur** Sur votre "serveur" qui exécutera le modèle d'IA, obtenez l'adresse IP
Sur votre "serveur" qui exécutera le modèle IA, obtenez ladresse IP
```sh ```sh
ip a | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}' | cut -d/ -f1 ip a | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}' | cut -d/ -f1 # IP locale
curl https://ipinfo.io/ip # IP publique
``` ```
Remarque : Pour Windows ou macOS, utilisez respectivement ipconfig ou ifconfig pour trouver ladresse IP. Note: Pour Windows ou macOS, utilisez ipconfig ou ifconfig pour trouver l'adresse IP.
Clonez le dépôt et entrez dans le dossier server/.
Clonez le dépôt et entrez dans le dossier `server/`.
```sh ```sh
git clone --depth 1 https://github.com/Fosowl/agenticSeek.git git clone --depth 1 https://github.com/Fosowl/agenticSeek.git
cd agenticSeek/server/ cd agenticSeek/llm_server/
``` ```
Installez les dépendances spécifiques au serveur : Installez les exigences spécifiques au serveur:
```sh ```sh
pip3 install -r requirements.txt pip3 install -r requirements.txt
@@ -254,191 +369,314 @@ Exécutez le script du serveur.
python3 app.py --provider ollama --port 3333 python3 app.py --provider ollama --port 3333
``` ```
Vous avez le choix entre utiliser ollama et llamacpp comme service LLM. Vous pouvez choisir d'utiliser `ollama` et `llamacpp` comme service LLM.
### 2️⃣ **Lancer** Maintenant sur votre ordinateur personnel:
Maintenant, sur votre ordinateur personnel : Changez le fichier `config.ini` pour définir `provider_name` sur `server` et `provider_model` sur `deepseek-r1:xxb`.
Définissez `provider_server_address` sur l'adresse IP de la machine qui exécutera le modèle.
Modifiez le fichier config.ini pour définir provider_name sur server et provider_model sur deepseek-r1:14b.
Définissez provider_server_address sur ladresse IP de la machine qui exécutera le modèle.
```sh ```sh
[MAIN] [MAIN]
is_local = False is_local = False
provider_name = server provider_name = server
provider_model = deepseek-r1:14b provider_model = deepseek-r1:70b
provider_server_address = x.x.x.x:3333 provider_server_address = http://x.x.x.x:3333
``` ```
Ensuite, exécutez avec le CLI ou l'interface graphique comme expliqué dans la section pour les fournisseurs locaux. Prochaine étape: [Démarrer les services et exécuter AgenticSeek](#démarrer-les-services-et-exécuter)
## **Exécuter avec une API externe** ---
AVERTISSEMENT : Assurez-vous quil ny a pas despace en fin de ligne dans la configuration. ## Parole vers Texte
```sh Avertissement: La speech-to-text ne fonctionne qu'en mode CLI pour le moment.
[MAIN]
is_local = False Notez que la parole vers texte ne fonctionne qu'en anglais pour le moment.
provider_name = openai
provider_model = gpt-4o La fonctionnalité de parole vers texte est désactivée par défaut. Pour l'activer, définissez listen sur True dans le fichier config.ini:
provider_server_address = 127.0.0.1:5000 # n'importe pas
```
listen = True
``` ```
**Liste de provideurs API** Lorsqu'elle est activée, la fonction de parole vers texte écoute un mot-clé de déclenchement, qui est le nom de l'agent, avant de traiter votre entrée. Vous pouvez personnaliser le nom de l'agent en mettant à jour la valeur `agent_name` dans *config.ini*:
| Fournisseur | Local ? | Description |
|--------------|---------|-----------------------------------------------------------|
| openai | Non | Utilise l'API ChatGPT |
| deepseek-api | Non | API Deepseek (non privé) |
| huggingface | Non | API Hugging-Face (non privé) |
| togetherAI | Non | Utilise l'API Together AI (non privé) |
| google | Non | Utilise l'API Google Gemini (non privé) |
Ensuite, exécutez avec le CLI ou l'interface graphique comme expliqué dans la section pour les fournisseurs locaux. ```
agent_name = Friday
```
## Config Pour une meilleure reconnaissance, nous recommandons d'utiliser un nom commun en anglais comme "John" ou "Emma" comme nom d'agent.
Exemple de configuration : Une fois que vous voyez la transcription commencer à apparaître, dites le nom de l'agent à haute voix pour le réveiller (ex: "Friday").
Dites votre requête clairement.
Terminez votre demande par une phrase de confirmation pour indiquer au système de continuer. Les exemples de phrases de confirmation incluent:
```
"do it", "go ahead", "execute", "run", "start", "thanks", "would ya", "please", "okay?", "proceed", "continue", "go on", "do that", "go it", "do you understand?"
```
## Configuration
Exemple de configuration:
``` ```
[MAIN] [MAIN]
is_local = True is_local = True
provider_name = ollama provider_name = ollama
provider_model = deepseek-r1:1.5b provider_model = deepseek-r1:32b
provider_server_address = 127.0.0.1:11434 provider_server_address = http://127.0.0.1:11434 # Exemple Ollama; LM-Studio utilise http://127.0.0.1:1234
agent_name = Friday agent_name = Friday
recover_last_session = False recover_last_session = False
save_session = False save_session = False
speak = False speak = False
listen = False listen = False
work_dir = /Users/mlg/Documents/ai_folder
jarvis_personality = False jarvis_personality = False
languages = en fr languages = en zh # Liste des langues pour TTS et routage potentiel.
[BROWSER] [BROWSER]
headless_browser = False headless_browser = False
stealth_mode = False stealth_mode = False
``` ```
**Explication du fichier config.ini**: **Explication des paramètres de `config.ini`**:
`is_local` -> Exécute lagent localement (True) ou sur un serveur distant (False). * **Section `[MAIN]`:**
* `is_local`: `True` si vous utilisez des fournisseurs de LLM locaux (Ollama, LM-Studio, serveur local compatible OpenAI) ou l'option de serveur auto-hébergé. `False` si vous utilisez des API basées sur le cloud (OpenAI, Google, etc.).
* `provider_name`: Spécifie le fournisseur de LLM.
* Options locales: `ollama`, `lm-studio`, `openai` (pour serveur local compatible OpenAI), `server` (pour configuration de serveur auto-hébergé).
* Options d'API: `openai`, `google`, `deepseek`, `huggingface`, `togetherAI`.
* `provider_model`: Nom ou ID spécifique du modèle du fournisseur sélectionné (ex: `deepseekcoder:6.7b` pour Ollama, `gpt-3.5-turbo` pour API OpenAI, `mistralai/Mixtral-8x7B-Instruct-v0.1` pour TogetherAI).
* `provider_server_address`: L'adresse de votre fournisseur de LLM.
* Pour les fournisseurs locaux: ex: `http://127.0.0.1:11434` pour Ollama, `http://127.0.0.1:1234` pour LM-Studio.
* Pour le type de fournisseur `server`: L'adresse de votre serveur LLM auto-hébergé (ex: `http://your_server_ip:3333`).
* Pour les API cloud (`is_local = False`): Ceci est généralement ignoré ou peut être laissé vide, car les endpoints d'API sont généralement gérés par les bibliothèques clientes.
* `agent_name`: Le nom de l'assistant IA (ex: Friday). Si activé, utilisé comme mot de déclenchement pour la parole vers texte.
* `recover_last_session`: `True` pour tenter de récupérer l'état de la session précédente, `False` pour recommencer.
* `save_session`: `True` pour sauvegarder l'état de la session actuelle pour une récupération potentielle, `False` sinon.
* `speak`: `True` pour activer la sortie vocale de texte vers parole, `False` pour désactiver.
* `listen`: `True` pour activer l'entrée vocale de parole vers texte (uniquement mode CLI), `False` pour désactiver.
* `work_dir`: **Critique:** Le répertoire où AgenticSeek lira/écrira des fichiers. **Assurez-vous que ce chemin est valide et accessible sur votre système.**
* `jarvis_personality`: `True` pour utiliser des invites système plus "Jarvis-like" (expérimental), `False` pour utiliser des invites standard.
* `languages`: Liste de langues séparées par des virgules (ex: `en, zh, fr`). Utilisé pour la sélection de voix TTS (première par défaut) et peut aider le routeur LLM. Pour éviter les inefficacités du routeur, évitez d'utiliser trop de langues ou des langues très similaires.
* **Section `[BROWSER]`:**
* `headless_browser`: `True` pour exécuter le navigateur automatisé sans fenêtre visible (recommandé pour l'interface web ou l'utilisation non interactive). `False` pour afficher la fenêtre du navigateur (utile pour le mode CLI ou le débogage).
* `stealth_mode`: `True` pour activer des mesures qui rendent plus difficile la détection de l'automatisation du navigateur. Peut nécessiter l'installation manuelle d'extensions de navigateur comme anticaptcha.
`provider_name` -> Le fournisseur à utiliser (parmi : ollama, server, lm-studio, deepseek-api). Cette section résume les types de fournisseurs de LLM pris en charge. Configurez-les dans `config.ini`.
`provider_model` -> Le modèle utilisé, par exemple, deepseek-r1:1.5b. **Fournisseurs locaux (fonctionnant sur votre propre matériel):**
`provider_server_address` -> Adresse du serveur, par exemple, 127.0.0.1:11434 pour local. Définissez nimporte quoi pour une API non locale. | Nom du fournisseur dans config.ini | `is_local` | Description | Section de configuration |
|-------------------------------|------------|-----------------------------------------------------------------------------|------------------------------------------------------------------|
| `ollama` | `True` | Fournit LLM localement facilement en utilisant Ollama. | [Configuration pour exécuter LLM localement sur votre machine](#configuration-pour-exécuter-llm-localement-sur-votre-machine) |
| `lm-studio` | `True` | Fournit LLM localement avec LM-Studio. | [Configuration pour exécuter LLM localement sur votre machine](#configuration-pour-exécuter-llm-localement-sur-votre-machine) |
| `openai` (pour serveur local) | `True` | Connectez-vous à un serveur local exposant une API compatible OpenAI (ex: llama.cpp). | [Configuration pour exécuter LLM localement sur votre machine](#configuration-pour-exécuter-llm-localement-sur-votre-machine) |
| `server` | `False` | Connectez-vous au serveur LLM auto-hébergé d'AgenticSeek fonctionnant sur une autre machine. | [Configuration pour exécuter LLM sur votre propre serveur](#configuration-pour-exécuter-llm-sur-votre-propre-serveur) |
`agent_name` -> Nom de lagent, par exemple, Friday. Utilisé comme mot déclencheur pour la reconnaissance vocale. **Fournisseurs d'API (basés sur le cloud):**
`recover_last_session` -> Reprend la dernière session (True) ou non (False). | Nom du fournisseur dans config.ini | `is_local` | Description | Section de configuration |
|-------------------------------|------------|--------------------------------------------------|-----------------------------------------------------|
| `openai` | `False` | Utilise l'API officielle d'OpenAI (ex: GPT-3.5, GPT-4). | [Configuration pour exécuter avec une API](#configuration-pour-exécuter-avec-une-api) |
| `google` | `False` | Utilise les modèles Google Gemini via API. | [Configuration pour exécuter avec une API](#configuration-pour-exécuter-avec-une-api) |
| `deepseek` | `False` | Utilise l'API officielle de Deepseek. | [Configuration pour exécuter avec une API](#configuration-pour-exécuter-avec-une-api) |
| `huggingface` | `False` | Utilise Hugging Face Inference API. | [Configuration pour exécuter avec une API](#configuration-pour-exécuter-avec-une-api) |
| `togetherAI` | `False` | Utilise divers modèles ouverts via l'API TogetherAI. | [Configuration pour exécuter avec une API](#configuration-pour-exécuter-avec-une-api) |
`save_session` -> Sauvegarde les données de la session (True) ou non (False). ---
## Dépannage
`speak` -> Active la sortie vocale (True) ou non (False). Si vous rencontrez des problèmes, cette section fournit des conseils.
`listen` -> Écoute les entrées vocales (True) ou non (False).
`work_dir` -> Dossier auquel lIA aura accès, par exemple : /Users/user/Documents/.
`jarvis_personality` -> Utilise une personnalité inspiré de Jarvis (True) ou non (False). Cela utilise simplement une prompt alternative. Marche moins bien en français.
`headless_browser` -> Exécute le navigateur sans fenêtre visible (True) ou non (False).
`stealth_mode` -> Rend la détection des bots plus difficile. Le seul inconvénient est que vous devez installer manuellement lextension anticaptcha.
`languages` -> La liste de languages supportés (nécessaire pour le routage d'agents). Plus la liste est longue. Plus un nombre important de modèles sera téléchargés.
## Providers
Le tableau ci-dessous montre les LLM providers disponibles :
| Provider | Local? | Description |
|-----------|--------|-----------------------------------------------------------|
| ollama | Yes | Exécutez des LLM localement avec facilité en utilisant Ollama comme fournisseur LLM
| server | Yes | Hébergez le modèle sur une autre machine, exécutez sur votre machine locale
| lm-studio | Yes | Exécutez un LLM localement avec LM Studio (définissez provider_name sur lm-studio)
| openai | No | Utilise l'API ChatGPT (pas privé) |
| deepseek-api | No | Utilise l'API Deepseek (pas privé) |
| huggingface| No | Utilise Hugging-Face (pas privé) |
| together| No | Utilise l'api Together AI |
Pour sélectionner un provider LLM, modifiez le config.ini :
```
is_local = False
provider_name = openai
provider_model = gpt-4o
provider_server_address = 127.0.0.1:5000
```
`is_local` : doit être True pour tout LLM exécuté localement, sinon False.
`provider_name` : Sélectionnez le fournisseur à utiliser par son nom, voir la liste des fournisseurs ci-dessus.
`provider_model` : Définissez le modèle à utiliser par lagent.
`provider_server_address` : peut être défini sur nimporte quoi si vous nutilisez pas le fournisseur server.
# Problèmes connus # Problèmes connus
## Problèmes avec Chromedriver ## Problèmes de ChromeDriver
Erreur #1:**incompatibilité** **Exemple d'erreur:** `SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version XXX`
### Cause racine
L'incompatibilité de version de ChromeDriver se produit lorsque:
1. La version de ChromeDriver que vous avez installée ne correspond pas à la version du navigateur Chrome
2. Dans les environnements Docker, `undetected_chromedriver` peut télécharger sa propre version de ChromeDriver, contournant les binaires montés
### Étapes de résolution
#### 1. Vérifiez votre version de Chrome
Ouvrez Google Chrome → `Paramètres > À propos de Chrome` pour trouver votre version (ex: "Version 134.0.6998.88")
#### 2. Téléchargez ChromeDriver correspondant
**Pour Chrome 115 et versions ultérieures:** Utilisez [Chrome for Testing API](https://googlechromelabs.github.io/chrome-for-testing/)
- Visitez le tableau de disponibilité de Chrome for Testing
- Trouvez votre version de Chrome ou la correspondance disponible la plus proche
- Téléchargez ChromeDriver pour votre système d'exploitation (utilisez Linux64 pour les environnements Docker)
**Pour les anciennes versions de Chrome:** Utilisez [Téléchargements hérités de ChromeDriver](https://chromedriver.chromium.org/downloads)
![Télécharger ChromeDriver depuis Chrome for Testing](./media/chromedriver_readme.png)
#### 3. Installez ChromeDriver (choisissez une méthode)
**Méthode A: Répertoire racine du projet (recommandé pour Docker)**
```bash
# Placez le binaire chromedriver téléchargé dans le répertoire racine du projet
cp path/to/downloaded/chromedriver ./chromedriver
chmod +x ./chromedriver # Rendez-le exécutable sur Linux/macOS
```
**Méthode B: PATH système**
```bash
# Linux/macOS
sudo mv chromedriver /usr/local/bin/
sudo chmod +x /usr/local/bin/chromedriver
# Windows: Placez chromedriver.exe dans un dossier du PATH
```
#### 4. Vérifiez l'installation
```bash
# Testez la version de ChromeDriver
./chromedriver --version
# Ou s'il est dans PATH:
chromedriver --version
```
### Instructions spécifiques à Docker
⚠️ **Important pour les utilisateurs de Docker:**
- La méthode de montage de volumes Docker peut ne pas fonctionner avec le mode furtif (`undetected_chromedriver`)
- **Solution:** Placez ChromeDriver dans le répertoire racine du projet en tant que `./chromedriver`
- L'application le détectera automatiquement et utilisera ce binaire
- Vous devriez voir dans les logs: `"Using ChromeDriver from project root: ./chromedriver"`
### Conseils de dépannage
1. **Toujours une incompatibilité de version ?**
- Vérifiez que ChromeDriver est exécutable: `ls -la ./chromedriver`
- Vérifiez la version de ChromeDriver: `./chromedriver --version`
- Assurez-vous qu'elle correspond à votre version du navigateur Chrome
2. **Problèmes avec le conteneur Docker ?**
- Vérifiez les logs du backend: `docker logs backend`
- Recherchez le message: `"Using ChromeDriver from project root"`
- S'il n'est pas trouvé, vérifiez que le fichier existe et est exécutable
3. **Versions de Chrome for Testing**
- Utilisez une correspondance exacte lorsque possible
- Pour la version 134.0.6998.88, utilisez ChromeDriver 134.0.6998.165 (la version disponible la plus proche)
- Le numéro de version principal doit correspondre (134 = 134)
### Matrice de compatibilité des versions
| Version de Chrome | Version de ChromeDriver | Statut |
|----------------|---------------------|---------|
| 134.0.6998.x | 134.0.6998.165 | ✅ Disponible |
| 133.0.6943.x | 133.0.6943.141 | ✅ Disponible |
| 132.0.6834.x | 132.0.6834.159 | ✅ Disponible |
*Pour la compatibilité la plus récente, consultez le [Tableau de Chrome for Testing](https://googlechromelabs.github.io/chrome-for-testing/)*
`Exception: Failed to initialize browser: Message: session not created: This version of ChromeDriver only supports Chrome version 113 `Exception: Failed to initialize browser: Message: session not created: This version of ChromeDriver only supports Chrome version 113
Current browser version is 134.0.6998.89 with binary path` Current browser version is 134.0.6998.89 with binary path`
Cela se produit sil y a une incompatibilité entre votre navigateur et la version de chromedriver. Cela se produit si votre navigateur et la version de chromedriver ne correspondent pas.
Vous devez naviguer pour télécharger la dernière version : Vous devez naviguer pour télécharger la dernière version:
https://developer.chrome.com/docs/chromedriver/downloads https://developer.chrome.com/docs/chromedriver/downloads
Si vous utilisez Chrome version 115 ou plus récent, allez sur : Si vous utilisez Chrome version 115 ou supérieure, allez à:
https://googlechromelabs.github.io/chrome-for-testing/ https://googlechromelabs.github.io/chrome-for-testing/
Et téléchargez la version de chromedriver correspondant à votre système dexploitation. et téléchargez la version de chromedriver correspondant à votre système d'exploitation.
![alt text](./media/chromedriver_readme.png) ![alt text](./media/chromedriver_readme.png)
Si cette section est incomplète, merci de faire une nouvelle issue sur github. Si cette section est incomplète, ouvrez un issue.
## Problèmes d'adaptateurs de connexion
```
Exception: Provider lm-studio failed: HTTP request failed: No connection adapters were found for '127.0.0.1:1234/v1/chat/completions'` (note: le port peut varier)
```
* **Cause:** Il manque le préfixe `http://` dans `provider_server_address` pour `lm-studio` (ou un autre serveur local compatible OpenAI similaire) dans `config.ini`, ou il pointe vers le mauvais port.
* **Solution:**
* Assurez-vous que l'adresse inclut `http://`. LM-Studio utilise généralement `http://127.0.0.1:1234` par défaut.
* `config.ini` correct: `provider_server_address = http://127.0.0.1:1234` (ou votre port réel du serveur LM-Studio).
## URL de base de SearxNG non fournie
```
raise ValueError("SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.")
ValueError: SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.`
```
Cela peut se produire si vous exécutez le mode CLI avec une URL de base de searxng incorrecte.
SEARXNG_BASE_URL doit différer selon que vous exécutez dans Docker ou sur l'hôte:
**Exécution sur l'hôte:** `SEARXNG_BASE_URL="http://localhost:8080"`
**Exécution complètement dans Docker (interface web):** `SEARXNG_BASE_URL="http://searxng:8080"`
## FAQ ## FAQ
**Q: Quel matériel est nécessaire ?**
| Taille du Modèle | GPU | Commentaire | **Q: De quel matériel ai-je besoin ?**
|--------------------|------|----------------------------------------------------------|
| 7B | 8 Go VRAM | ⚠️ Non recommandé. Performances médiocres, hallucinations fréquentes, et l'agent planificateur échouera probablement. |
| 14B | 12 Go VRAM (par ex. RTX 3060) | ✅ Utilisable pour des tâches simples. Peut rencontrer des difficultés avec la navigation web et les tâches de planification. |
| 32B | 24+ Go VRAM (par ex. RTX 4090) | 🚀 Réussite avec la plupart des tâches, peut encore avoir des difficultés avec la planification des tâches. |
| 70B+ | 48+ Go VRAM (par ex. Mac Studio) | 💪 Excellent. Recommandé pour des cas d'utilisation avancés. |
**Q: Pourquoi deepseek et pas un autre modèle** | Taille du modèle | GPU | Commentaires |
|-----------|--------|-----------------------------------------------------------|
| 7B | 8GB VRAM | ⚠️ Non recommandé. Performances médiocres, hallucinations fréquentes, les agents de planification peuvent échouer. |
| 14B | 12 GB VRAM (ex: RTX 3060) | ✅ Utilisable pour des tâches simples. Peut avoir des difficultés avec la navigation web et la planification de tâches. |
| 32B | 24+ GB VRAM (ex: RTX 4090) | 🚀 Réussit la plupart des tâches, peut encore avoir des difficultés avec la planification de tâches |
| 70B+ | 48+ GB VRAM | 💪 Excellent. Recommandé pour les cas d'utilisation avancés. |
DeepSeek R1 excelle dans le raisonnement et lutilisation doutils pour sa taille. Nous pensons que cest un choix solide pour nos besoins, bien que dautres modèles fonctionnent également (bien que moins bien pour un nombre équivalent de paramètres). **Q: Que faire si je rencontre des erreurs ?**
**Q: J'ai une erreur quand je lance le programme, je fait quoi?** Assurez-vous que le local fonctionne (`ollama serve`), que votre `config.ini` correspond à votre fournisseur et que les dépendances sont installées. Si rien ne fonctionne, n'hésitez pas à ouvrir un issue.
Assurez-vous quOllama est en cours dexécution (ollama serve), que votre config.ini correspond à votre fournisseur, et que les dépendances sont installées. Si cela ne fonctionne pas, nhésitez pas à signaler un problème. **Q: Peut-il vraiment fonctionner à 100% localement ?**
**Q: C'est vraiment 100% local?** Oui, avec les fournisseurs Ollama, lm-studio ou server, tous les modèles de parole vers texte, LLM et texte vers parole fonctionnent localement. Les options non locales (OpenAI ou autres API) sont optionnelles.
Oui, avec les fournisseurs Ollama, lm-studio ou Server, toute la reconnaissance vocale, le LLM et la synthèse vocale fonctionnent localement. Les options non locales (OpenAI ou autres API) sont facultatives. **Q: Pourquoi devrais-je utiliser AgenticSeek quand j'ai Manus ?**
**Q: En quoi c'est supérieur à Manus** Contrairement à Manus, AgenticSeek privilégie l'indépendance des systèmes externes, vous donnant plus de contrôle, de confidentialité et évitant les coûts d'API.
Il ne l'est certainement pas, mais nous privilégions lexécution locale et la confidentialité par rapport à une approche basée sur le cloud. Cest une alternative plus accessible et surtout moins cher ! **Q: Qui est derrière ce projet ?**
## Contribution Ce projet a été créé par moi, avec deux amis comme mainteneurs et des contributeurs de la communauté open source sur GitHub. Nous sommes juste des individus passionnés, pas une startup, ni affiliés à aucune organisation.
Nous recherchons des développeurs pour améliorer AgenticSeek ! Consultez la section "issues" github ou les discussions. Tout compte AgenticSeek sur X autre que mon compte personnel (https://x.com/Martin993886460) est un imposteur.
## Contribuer
Nous recherchons des développeurs pour améliorer AgenticSeek ! Consultez les problèmes ouverts ou les discussions.
[Guide de contribution](./docs/CONTRIBUTING.md)
## Sponsors:
Vous voulez améliorer les capacités d'AgenticSeek avec des fonctionnalités comme la recherche de vols, la planification de voyages ou l'obtention des meilleures offres d'achat ? Envisagez d'utiliser SerpApi pour créer des outils personnalisés qui débloquent plus de fonctionnalités de type Jarvis. Avec SerpApi, vous pouvez accélérer votre agent pour des tâches professionnelles tout en gardant le contrôle total.
<a href="https://serpapi.com/"><img src="./media/banners/sponsor_banner_serpapi.png" height="350" alt="SerpApi Banner" ></a>
Consultez [Contributing.md](./docs/CONTRIBUTING.md) pour apprendre comment intégrer des outils personnalisés !
### **Sponsors**:
- [tatra-labs](https://github.com/tatra-labs)
## Mainteneurs:
> [Fosowl](https://github.com/Fosowl) | Heure de Paris
> [antoineVIVIES](https://github.com/antoineVIVIES) | Heure de Taipei
## Remerciements spéciaux:
> [tcsenpai](https://github.com/tcsenpai) et [plitc](https://github.com/plitc) pour avoir aidé à la dockerisation du backend
[![Star History Chart](https://api.star-history.com/svg?repos=Fosowl/agenticSeek&type=Date)](https://www.star-history.com/#Fosowl/agenticSeek&Date) [![Star History Chart](https://api.star-history.com/svg?repos=Fosowl/agenticSeek&type=Date)](https://www.star-history.com/#Fosowl/agenticSeek&Date)
[Guide du contributeur](./docs/CONTRIBUTING.md)
## Auteurs/Mainteneurs:
> [Fosowl](https://github.com/Fosowl)
> [steveh8758](https://github.com/steveh8758)
+459 -256
View File
@@ -1,61 +1,52 @@
# AgenticSeek: Manusのプライベートでローカルな代替品
<p align="center"> <p align="center">
<img align="center" src="./media/whale_readme.jpg"> <img align="center" src="./media/agentic_seek_logo.png" width="300" height="300" alt="Agentic Seek Logo">
<p> <p>
-------------------------------------------------------------------------------- English | [中文](./README_CHS.md) | [繁體中文](./README_CHT.md) | [Français](./README_FR.md) | [日本語](./README_JP.md) | [Português (Brasil)](./README_PTBR.md) | [Español](./README_ES.md) | [Türkçe](./README_TR.md)
[English](./README.md) | [中文](./README_CHS.md) | [繁體中文](./README_CHT.md) | [Français](./README_FR.md) | 日本語
# AgenticSeek: Deepseek R1エージェントによって動作するManusのようなAI。 *音声対応のAIアシスタントで、**100%ローカルで動作するManus AIの代替品**です。自律的にウェブを閲覧し、コードを書き、タスクを計画し、すべてのデータをデバイス上に保持します。ローカル推論モデル向けに設計されており、完全にあなたのハードウェア上で動作し、プライバシーを保証し、クラウドへの依存をゼロにします。*
[![AgenticSeekを訪問](https://img.shields.io/static/v1?label=Website&message=AgenticSeek&color=blue&style=flat-square)](https://fosowl.github.io/agenticSeek.html) ![License](https://img.shields.io/badge/license-GPL--3.0-green) [![Discord](https://img.shields.io/badge/Discord-Join%20Us-7289DA?logo=discord&logoColor=white)](https://discord.gg/8hGDaME3TC) [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/fosowl.svg?style=social&label=Update%20%40Fosowl)](https://x.com/Martin993886460) [![GitHub stars](https://img.shields.io/github/stars/Fosowl/agenticSeek?style=social)](https://github.com/Fosowl/agenticSeek/stargazers)
**Manus AIの完全なローカル代替品**、音声対応のAIアシスタントで、コードを書き、ファイルシステムを探索し、ウェブを閲覧し、ミスを修正し、データをクラウドに送信することなくすべてを行います。DeepSeek R1のような推論モデルを使用して構築されており、この自律エージェントは完全にハードウェア上で動作し、データのプライバシーを保護します。 ### なぜAgenticSeekを選ぶのか?
[![Visit AgenticSeek](https://img.shields.io/static/v1?label=Website&message=AgenticSeek&color=blue&style=flat-square)](https://fosowl.github.io/agenticSeek.html) ![License](https://img.shields.io/badge/license-GPL--3.0-green) [![Discord](https://img.shields.io/badge/Discord-Join%20Us-7289DA?logo=discord&logoColor=white)](https://discord.gg/8hGDaME3TC) [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/fosowl.svg?style=social&label=Update%20%40Fosowl)](https://x.com/Martin993886460) * 🔒 完全にローカル&プライベート - すべてがあなたのマシン上で動作し、クラウドなし、データ共有なし。あなたのファイル、会話、検索はプライベートのままです。
> 🛠️ **進行中の作業** – 貢献者を探しています! * 🌐 インテリジェントなウェブブラウジング - AgenticSeekは自律的にインターネットを閲覧できます:検索、読み取り、情報抽出、ウェブフォーム入力、すべて手動操作なしで。
* 💻 自律的なプログラミングアシスタント - コードが必要ですか?Python、C、Go、Javaなどのプログラムを監督なしで書き、デバッグし、実行できます。
* 🧠 インテリジェントなエージェント選択 - あなたが要求すると、自動的に最適なエージェントがタスクに割り当てられます。常に利用可能な専門家チームを持っているようなものです。
* 📋 複雑なタスクの計画と実行 - 旅行計画から複雑なプロジェクトまで、大きなタスクをステップに分解し、複数のAIエージェントを使用して完了できます。
https://github.com/user-attachments/assets/fe9e8006-0462-4793-8b31-25bd42c6d1eb * 🎙️ 音声サポート - クリーンで高速で未来的な音声と音声認識機能により、SF映画のようなパーソナルAIと会話できます。(開発中)
### **デモ**
> *agenticSeekプロジェクトを検索して必要なスキルを学び、CV_candidates.zipを開いて、どの候補がプロジェクトに最も適しているか教えてくれますか?*
https://github.com/user-attachments/assets/b8ca60e9-7b3b-4533-840e-08f9ac426316
*そしてもっと多くのことができます!* 免責事項:このデモと表示されるすべてのファイル(例:CV_candidates.zip)は完全に架空のものです。私たちは企業ではなく、候補者ではなくオープンソースの貢献者を求めています。
> *大阪と東京のAIスタートアップを深く調査し、少なくとも5つ見つけて、research_japan.txtファイルに保存してください* > 🛠⚠️ **アクティブな開発中**
> *C言語でテトリスゲームを作れますか?* > 🙏 このプロジェクトはサイドプロジェクトとして始まり、ロードマップも資金もありませんでした。GitHub Trendingに登場して予想以上に成長しました。貢献、フィードバック、忍耐に深く感謝します。
> *新しいプロジェクトファイルインデックスをmark2として設定したいです。* ## 前提条件
始める前に、以下がインストールされていることを確認してください:
## 特徴: * **Git:** リポジトリをクローンするため。[Gitをダウンロード](https://git-scm.com/downloads)
* **Python 3.10.x:** Python 3.10.xを強く推奨します。他のバージョンでは依存関係エラーが発生する可能性があります。[Python 3.10をダウンロード](https://www.python.org/downloads/release/python-3100/)3.10.xバージョンを選択)。
* **Docker Engine & Docker Compose:** SearxNGなどのパッケージ化されたサービスを実行するため。
* Docker Desktopをインストール(Docker Compose V2を含む):[Windows](https://docs.docker.com/desktop/install/windows-install/) | [Mac](https://docs.docker.com/desktop/install/mac-install/) | [Linux](https://docs.docker.com/desktop/install/linux-install/)
* またはLinuxでDocker EngineとDocker Composeを別々にインストール:[Docker Engine](https://docs.docker.com/engine/install/) | [Docker Compose](https://docs.docker.com/compose/install/)(Compose V2をインストールしていることを確認、例:`sudo apt-get install docker-compose-plugin`)。
- **100%ローカル**: クラウドなし、ハードウェア上で動作。データはあなたのものです。 ### 1. **リポジトリをクローンして設定**
- **ファイルシステムの操作**: bashを使用してファイルを簡単にナビゲートおよび操作します。
- **自律的なコーディング**: Python、C、Golangなどのコードを書き、デバッグし、実行できます。
- **エージェントルーティング**: タスクに最適なエージェントを自動的に選択します。
- **計画**: 複雑なタスクの場合、複数のエージェントを起動して計画および実行します。
- **自律的なウェブブラウジング**: 自律的なウェブナビゲーション。
- **メモリ**: 効率的なメモリとセッション管理。
---
## **インストール**
chrome driver、docker、およびpython3.10(またはそれ以降)がインストールされていることを確認してください。
chrome driverに関連する問題については、**Chromedriver**セクションを参照してください。
### 1️⃣ **リポジトリをクローンしてセットアップ**
```sh ```sh
git clone https://github.com/Fosowl/agenticSeek.git git clone https://github.com/Fosowl/agenticSeek.git
@@ -63,230 +54,311 @@ cd agenticSeek
mv .env.example .env mv .env.example .env
``` ```
### 2 **仮想環境を作成** ### 2. .envファイルの内容を変更
```sh ```sh
python3 -m venv agentic_seek_env SEARXNG_BASE_URL="http://searxng:8080" # ホストでCLIモードを実行する場合はhttp://127.0.0.1:8080を使用
source agentic_seek_env/bin/activate REDIS_BASE_URL="redis://redis:6379/0"
# Windowsの場合: agentic_seek_env\Scripts\activate WORK_DIR="/Users/mlg/Documents/workspace_for_ai"
OLLAMA_PORT="11434"
LM_STUDIO_PORT="1234"
CUSTOM_ADDITIONAL_LLM_PORT="11435"
OPENAI_API_KEY='optional'
DEEPSEEK_API_KEY='optional'
OPENROUTER_API_KEY='optional'
TOGETHER_API_KEY='optional'
GOOGLE_API_KEY='optional'
ANTHROPIC_API_KEY='optional'
``` ```
### 3️⃣ **パッケージをインストール** 必要に応じて`.env`ファイルを更新してください:
**自動インストール:** - **SEARXNG_BASE_URL**: ホストでCLIモードを実行する場合を除き、変更しないでください。
- **REDIS_BASE_URL**: 変更しないでください
- **WORK_DIR**: ローカル作業ディレクトリへのパス。AgenticSeekはこれらのファイルを読み取り、操作できます。
- **OLLAMA_PORT**: Ollamaサービスのポート番号。
- **LM_STUDIO_PORT**: LM Studioサービスのポート番号。
- **CUSTOM_ADDITIONAL_LLM_PORT**: 追加のカスタムLLMサービスのポート。
**APIキーは、ローカルでLLMを実行することを選択するユーザーには完全にオプションであり、これがこのプロジェクトの主な目的です。ハードウェアが十分にある場合は空のままにしてください。**
### 3. **Dockerを起動**
Dockerがインストールされ、システム上で実行されていることを確認してください。以下のコマンドでDockerを起動できます:
- **Linux/macOS:**
ターミナルを開いて実行:
```sh
sudo systemctl start docker
```
または、インストールされている場合はアプリケーションメニューからDocker Desktopを起動。
- **Windows:**
スタートメニューからDocker Desktopを起動。
Dockerが実行されているかは以下で確認できます:
```sh ```sh
./install.sh docker info
``` ```
Dockerインストール情報が表示されれば正常に動作しています。
**手動で:** 要約については以下の[ローカルプロバイダーリスト](#ローカルプロバイダーリスト)を参照してください。
```sh 次のステップ:[ローカルでAgenticSeekを実行](#サービスを起動して実行)
pip3 install -r requirements.txt
# または *問題が発生した場合は、[トラブルシューティング](#トラブルシューティング)セクションを参照してください。*
python3 setup.py install *ハードウェアがローカルでLLMを実行できない場合は、[APIを使用した実行設定](#apiを使用した実行設定)を参照してください。*
``` *詳細な`config.ini`の説明については、[設定セクション](#設定)を参照してください。*
--- ---
## ローカルマシンでLLMを実行するためのセットアップ ## マシン上でローカルにLLMを実行する設定
**少なくともDeepseek 14Bを使用することをお勧めします。小さいモデルでは、特にウェブブラウジングのタスクで苦労する可能性があります。** **ハードウェア要件:**
**ローカルプロバイダーをセットアップする** LLMをローカルで実行するには、十分なハードウェアが必要です。少なくともMagistral、Qwen、またはDeepseek 14Bを実行できるGPUが必要です。詳細なモデル/パフォーマンスの推奨事項についてはFAQを参照してください。
たとえば、ollamaを使用してローカルプロバイダーを開始します: **ローカルプロバイダーを設定**
例えばollamaを使用してローカルプロバイダーを起動:
```sh ```sh
ollama serve ollama serve
``` ```
以下に、サポートされているローカルプロバイダーのリストを示します サポートされているローカルプロバイダーのリストは以下を参照してください
**config.iniを更新する** **config.iniを更新**
config.iniファイルを変更して、`provider_name`をサポートされているプロバイダーに設定し、`provider_model``deepseek-r1:14b`に設定します。 config.iniファイルを変更して、provider_nameをサポートされているプロバイダーにprovider_modelをプロバイダーがサポートするLLMに設定します。*Magistral*や*Deepseek*などの推論モデルをお勧めします。
注意: `deepseek-r1:14b`は例です。ハードウェアが許可する場合は、より大きなモデルを使用してください。 必要なハードウェアについては、READMEの最後にある**FAQ**を参照してください。
```sh ```sh
[MAIN] [MAIN]
is_local = True is_local = True # ローカルで実行するかリモートプロバイダーを使用するか
provider_name = ollama # または lm-studio、openai など provider_name = ollama # またはlm-studio、openaiなど
provider_model = deepseek-r1:14b provider_model = deepseek-r1:14b # ハードウェアに互換性のあるモデルを選択
provider_server_address = 127.0.0.1:11434 provider_server_address = 127.0.0.1:11434
agent_name = Jarvis # AIの名前
recover_last_session = True # 前のセッションを復元
save_session = True # 現在のセッションを記憶
speak = False # テキスト読み上げ
listen = False # 音声認識、CLIのみ、実験的
jarvis_personality = False # より「Jarvis」的な性格を使用(実験的)
languages = en zh # 言語リスト、TTSはデフォルトでリストの最初を使用
[BROWSER]
headless_browser = True # ホストでCLIを使用する場合を除き変更しない
stealth_mode = True # 検出されにくいseleniumを使用してブラウザ検出を減らす
``` ```
**ローカルプロバイダーのリスト** **警告**:
| プロバイダー | ローカル? | 説明 | - `config.ini`ファイル形式はコメントをサポートしていません。
コメントがエラーを引き起こすため、サンプル設定を直接コピー&ペーストしないでください。代わりに、コメントなしで希望の設定で`config.ini`ファイルを手動で変更してください。
- LM-studioを使用してLLMを実行する場合、provider_nameを`openai`に設定*しない*でください。`lm-studio`として使用してください。
- 一部のプロバイダー(例:lm-studio)では、IPの前に`http://`が必要です。例:`http://127.0.0.1:1234`
**ローカルプロバイダーリスト**
| プロバイダー | ローカル? | 説明 |
|-----------|--------|-----------------------------------------------------------| |-----------|--------|-----------------------------------------------------------|
| ollama | はい | ollamaをLLMプロバイダーとして使用してローカルでLLMを簡単に実行 | | ollama | はい | ollamaを使用して簡単にローカルでLLMを実行 |
| lm-studio | はい | LM studioを使用してローカルLLMを実行(`provider_name``lm-studio`に設定)| | lm-studio | はい | LM studioローカルLLMを実行(`provider_name` = `lm-studio`に設定)|
| openai | はい | OpenAI互換APIを使用 | | openai | はい | OpenAI互換API(例:llama.cppサーバー)を使用 |
次のステップ: [サービスを開始してAgenticSeekを実行する](#Start-services-and-Run) 次のステップ[サービスを起動してAgenticSeekを実行](#サービスを起動して実行)
*問題が発生している場合は、**既知の問題**セクションを参照してください。* *問題が発生し場合は、[トラブルシューティング](#トラブルシューティング)セクションを参照してください。*
*ハードウェアがローカルでLLMを実行できない場合は、[APIを使用した実行設定](#apiを使用した実行設定)を参照してください。*
*詳細な`config.ini`の説明については、[設定セクション](#設定)を参照してください。*
*ハードウェアがDeepseekをローカルで実行できない場合は、**APIを使用した実行**セクションを参照してください。* ## APIを使用した実行設定
*詳細な設定ファイルの説明については、**設定**セクションを参照してください。* この設定では、外部のクラウドベースのLLMプロバイダーを使用します。選択したサービスからAPIキーを取得する必要があります。
--- **1. APIプロバイダーを選択し、APIキーを取得:**
## APIを使用したセットアップ 以下の[APIプロバイダーリスト](#apiプロバイダーリスト)を参照してください。ウェブサイトにアクセスして登録し、APIキーを取得してください。
`config.ini`で希望するプロバイダーを設定してください。 **2. APIキーを環境変数として設定:**
```sh * **Linux/macOS:**
ターミナルを開き、`export`コマンドを使用します。永続的にするにはシェルの設定ファイル(例:`~/.bashrc`、`~/.zshrc`)に追加するのがベストです。
```sh
export PROVIDER_API_KEY="your_api_key_here"
# PROVIDER_API_KEYを特定の変数名に置き換えてください、例:OPENAI_API_KEY、GOOGLE_API_KEY
```
TogetherAIの例:
```sh
export TOGETHER_API_KEY="xxxxxxxxxxxxxxxxxxxxxx"
```
* **Windows:**
* **コマンドプロンプト(現在のセッション限定):**
```cmd
set PROVIDER_API_KEY=your_api_key_here
```
* **PowerShell(現在のセッション限定):**
```powershell
$env:PROVIDER_API_KEY="your_api_key_here"
```
* **永続的:** Windowsの検索バーで「環境変数」を検索し、「システムの環境変数を編集」をクリックしてから「環境変数...」ボタンをクリックします。適切な名前(例:`OPENAI_API_KEY`)とキーを値として新しいユーザー変数を追加します。
*(詳細については、FAQを参照してください:[APIキーを設定する方法?](#apiキーを設定する方法))。*
**3. `config.ini`を更新:**
```ini
[MAIN] [MAIN]
is_local = False is_local = False
provider_name = openai provider_name = openai # またはgoogle、deepseek、togetherAI、huggingface
provider_model = gpt-4o provider_model = gpt-3.5-turbo # またはgemini-1.5-flash、deepseek-chat、mistralai/Mixtral-8x7B-Instruct-v0.1など
provider_server_address = 127.0.0.1:5000 provider_server_address = # is_local = Falseの場合、ほとんどのAPIでは無視されるか空にできる
# ... その他の設定 ...
``` ```
*警告:* configの値に末尾のスペースがないことを確認してください。
警告: `config.ini`に末尾のスペースがないことを確認してください。 **APIプロバイダーリスト**
ローカルのOpenAIベースのAPIを使用する場合は、`is_local`をTrueに設定してください。 | プロバイダー | `provider_name` | ローカル? | 説明 | APIキーリンク(例) |
|--------------|-----------------|--------|---------------------------------------------------|---------------------------------------------|
| OpenAI | `openai` | いいえ | OpenAIのAPIを通じてChatGPTモデルを使用。 | [platform.openai.com/signup](https://platform.openai.com/signup) |
| Google Gemini| `google` | いいえ | Google AI Studioを通じてGoogle Geminiモデルを使用。 | [aistudio.google.com/keys](https://aistudio.google.com/keys) |
| Deepseek | `deepseek` | いいえ | 彼らのAPIを通じてDeepseekモデルを使用。 | [platform.deepseek.com](https://platform.deepseek.com) |
| Hugging Face | `huggingface` | いいえ | Hugging Face Inference APIのモデルを使用。 | [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens) |
| TogetherAI | `togetherAI` | いいえ | TogetherAI APIを通じて様々なオープンソースモデルを使用。| [api.together.ai/settings/api-keys](https://api.together.ai/settings/api-keys) |
| OpenRouter | `openrouter` | いいえ | OpenRouter APIを通じて様々なオープンソースモデルを使用。| [openrouter.api](https://openrouter.ai/) |
OpenAIベースのAPIが独自のサーバーで実行されている場合は、IPアドレスを変更してください。 *注:*
* 複雑なウェブブラウジングとタスクプランニングには`gpt-4o`や他のOpenAIモデルの使用は推奨しません。現在のプロンプト最適化はDeepseekなどのモデルを対象としているためです。
* コーディング/bashタスクはGeminiで失敗する可能性があります。Deepseek r1用に最適化されたプロンプト形式を無視する傾向があるためです。
* `is_local = False`の場合、`config.ini`の`provider_server_address`は通常使用されません。APIエンドポイントは通常、対応するプロバイダーのライブラリで処理されるためです。
次のステップ: [サービスを開始してAgenticSeekを実行する](#Start-services-and-Run) 次のステップ[サービスを起動してAgenticSeekを実行](#サービスを起動して実行)
*問題が発生している場合は、**既知の問題**セクションを参照してください* *問題が発生し場合は、**既知の問題**セクションを参照してください*
*詳細な設定ファイルの説明については、**設定**セクションを参照してください。* *詳細な設定ファイルの説明については、**設定セクション**を参照してください。*
--- ---
## サービスの開始と実行 ## サービスを起動して実行
必要に応じてPython環境をアクティブにしてください デフォルトでは、AgenticSeekは完全にDocker内で実行されます
```sh
source agentic_seek_env/bin/activate
```
必要なサービスを開始します。これにより、docker-compose.ymlから以下のサービスがすべて開始されます: **オプション1:** DockerでWebインターフェースを使用して実行:
- searxng
- redis (searxngに必要) 必要なサービスを起動します。これにより、docker-compose.ymlのすべてのサービスが起動します:
- フロントエンド - searxng
- redissearxngに必要)
- frontend
- backendWebインターフェースに`full`を使用する場合)
```sh ```sh
sudo ./start_services.sh # MacOS ./start_services.sh full # MacOS
start ./start_services.cmd # Windows start start_services.cmd full # Windows
``` ```
**オプション1:** CLIインターフェースで実行 **警告:** このステップではすべてのDockerイメージがダウンロードされロードされます。最大30分かかる場合があります。サービスを起動した後、メッセージを送信する前にバックエンドサービスが完全に実行されていることを確認してください(ログに**backend: "GET /health HTTP/1.1" 200 OK**が表示されるはずです)。初回実行時、バックエンドサービスは起動に5分かかる場合があります
```sh
python3 cli.py
```
**オプション2:** Webインターフェースで実行。
注意: 現在、CLIの使用を推奨しています。Webインターフェースは開発中です。
バックエンドを開始します。
```sh
python3 api.py
```
`http://localhost:3000/`にアクセスすると、Webインターフェースが表示されます。 `http://localhost:3000/`にアクセスすると、Webインターフェースが表示されます。
現在、Webインターフェースではメッセージのストリーミングがサポートされていないことに注意してください。 *サービス起動のトラブルシューティング:* これらのスクリプトが失敗する場合は、Docker Engineが実行中でDocker ComposeV2、`docker compose`)が正しくインストールされていることを確認してください。ターミナル出力のエラーメッセージを確認してください。[FAQ: ヘルプ!AgenticSeekまたはそのスクリプトを実行するとエラーが発生します](#faq-トラブルシューティング)を参照してください。
--- **オプション2:** CLIモード:
## 使い方 CLIインターフェースで実行するには、ホストにパッケージをインストールする必要があります:
警告: 現在、サポートされている言語は英語、中国語、フランス語のみです。他の言語でのプロンプトは機能しますが、適切なエージェントにルーティングされない場合があります。
サービスが`./start_services.sh`で起動していることを確認し、`python3 cli.py`でagenticSeekを実行します。
```sh ```sh
sudo ./start_services.sh ./install.sh
python3 cli.py ./install.bat # windows
``` ```
`>>> `と表示されます 次に、`config.ini`のSEARXNG_BASE_URLを以下に変更する必要があります:
これは、agenticSeekが指示を待っていることを示します。
configで`listen = True`を設定することで、音声認識を使用することもできます。
終了するには、単に`goodbye`と言います。 ```sh
SEARXNG_BASE_URL="http://localhost:8080"
```
以下は使用例です: 必要なサービスを起動します。これにより、docker-compose.ymlの一部のサービスが起動します:
- searxng
- redissearxngに必要)
- frontend
### コーディング/バッシュ ```sh
./start_services.sh # MacOS
start start_services.cmd # Windows
```
> *Pythonでスネークゲームを作成* 実行:uv run: `uv run python -m ensurepip` でuvがpipを有効にしていることを確認します。
> *C言語で行列の掛け算を教えて* CLIを使用:`uv run cli.py`
> *Golangでブラックジャックを作成*
### ウェブ検索
> *日本の最先端のAI研究を行っているクールなテックスタートアップを見つけるためにウェブ検索を行う*
> *agenticSeekを作成したのは誰かをインターネットで見つけることができますか?*
> *オンラインの燃料計算機を使用して、ニースからミラノまでの旅行の費用を見積もることができますか?*
### ファイルシステム
> *契約書.pdfがどこにあるか見つけてくれませんか?*
> *ディスクにどれだけの空き容量があるか教えて*
> *READMEを読んでプロジェクトを/home/path/projectにインストールしてください*
### カジュアル
> *フランスのレンヌについて教えて*
> *博士号を追求すべきですか?*
> *最高のワークアウトルーチンは何ですか?*
クエリを入力すると、agenticSeekはタスクに最適なエージェントを割り当てます。
これは初期のプロトタイプであるため、エージェントルーティングシステムはクエリに基づいて常に適切なエージェントを割り当てるとは限りません。
したがって、何を望んでいるか、AIがどのように進行するかについて非常に明確にする必要があります。たとえば、ウェブ検索を行いたい場合は、次のように言わないでください:
`一人旅に良い国を知っていますか?`
代わりに、次のように尋ねてください:
`ウェブ検索を行い、一人旅に最適な国を見つけてください`
--- ---
## **ボーナス: 自分のサーバーでLLMを実行するためのセットアップ** ## 使用方法
強力なコンピュータやサーバーを持っていて、それをラップトップから使用したい場合、リモートサーバーでLLMを実行するオプションがあります。 サービスが`./start_services.sh full`で実行されていることを確認し、`localhost:3000`にアクセスしてWebインターフェースを使用します。
AIモデルを実行する「サーバー」で、IPアドレスを取得します。 `listen = True`を設定することで音声認識も使用できます。CLIモードのみ。
終了するには、単に`goodbye`と言う/入力します。
使用例:
> *Pythonでスネークゲームを作って!*
> *ウェブでフランスのレンヌの最高のカフェを検索し、3つとその住所をrennes_cafes.txtに保存して*
> *階乗を計算するGoプログラムを書き、factorial.goとしてワークスペースに保存して*
> *summer_picturesフォルダ内のすべてのJPGファイルを検索し、今日の日付で名前を変更し、名前変更されたファイルのリストをphotos_list.txtに保存して*
> *オンラインで2024年の人気SF映画を検索し、今夜見るために3つ選び、movie_night.txtに保存して*
> *ウェブで2025年の最新AIニュース記事を検索し、3つ選び、タイトルと要約を抽出するPythonスクリプトを書き、スクリプトをnews_scraper.pyとして保存し、要約をai_news.txtに保存(/home/projects*
> *金曜日、無料の株価APIをウェブ検索し、supersuper7434567@gmail.comで登録し、APIを使用してテスラの日次株価を取得するPythonスクリプトを書き、結果をstock_prices.csvに保存して*
*フォーム入力はまだ実験的であり、失敗する可能性があることに注意してください。*
クエリを入力すると、AgenticSeekが最適なエージェントをタスクに割り当てます。
これは初期プロトタイプであるため、エージェントルーティングシステムは常にクエリに正しいエージェントを割り当てられるとは限りません。
したがって、あなたが何を望んでいるか、そしてAIがどのように進めるかを非常に明確に表現する必要があります。例えば、ウェブ検索をしてほしい場合は、次のように言わないでください:
`一人旅に適した国を知っていますか?`
代わりに、次のように言ってください:
`ウェブ検索を実行し、一人旅に最適な国を見つけてください`
---
## **独自のサーバーでLLMを実行する設定**
強力なコンピューターやアクセス可能なサーバーを持っているが、ラップトップから使用したい場合は、カスタムllmサーバーを使用してリモートサーバーでLLMを実行することを選択できます。
AIモデルを実行する「サーバー」で、IPアドレスを取得します
```sh ```sh
ip a | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}' | cut -d/ -f1 # ローカルIP ip a | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}' | cut -d/ -f1 # ローカルIP
curl https://ipinfo.io/ip # 公開IP curl https://ipinfo.io/ip # パブリックIP
``` ```
注意: WindowsまたはmacOSの場合、IPアドレスを見つけるには、それぞれ`ipconfig`または`ifconfig`を使用してください。 注:WindowsまたはmacOSでは、IPアドレスを見つけるためにipconfigまたはifconfigを使用してください。
リポジトリをクローンし、`server/`フォルダに移動します。 リポジトリをクローンし、`server/`フォルダに移動します。
```sh ```sh
git clone --depth 1 https://github.com/Fosowl/agenticSeek.git git clone --depth 1 https://github.com/Fosowl/agenticSeek.git
cd agenticSeek/server/ cd agenticSeek/llm_server/
``` ```
サーバー固有の依存関係をインストールします: サーバー固有の要件をインストールします
```sh ```sh
pip3 install -r requirements.txt pip3 install -r requirements.txt
@@ -298,11 +370,11 @@ pip3 install -r requirements.txt
python3 app.py --provider ollama --port 3333 python3 app.py --provider ollama --port 3333
``` ```
`ollama``llamacpp`のどちらかをLLMサービスとして選択できます。 LLMサービスとして`ollama`と`llamacpp`のどちらを使用するか選択できます。
次に、個人用コンピュータで以下を行います: 次に、あなたのパーソナルコンピューターで:
`config.ini`ファイルを変更し`provider_name``server`に、`provider_model``deepseek-r1:xxb`に設定します。 `config.ini`ファイルを変更して、`provider_name`を`server`に、`provider_model`を`deepseek-r1:xxb`に設定します。
`provider_server_address`をモデルを実行するマシンのIPアドレスに設定します。 `provider_server_address`をモデルを実行するマシンのIPアドレスに設定します。
```sh ```sh
@@ -310,135 +382,246 @@ python3 app.py --provider ollama --port 3333
is_local = False is_local = False
provider_name = server provider_name = server
provider_model = deepseek-r1:70b provider_model = deepseek-r1:70b
provider_server_address = x.x.x.x:3333 provider_server_address = http://x.x.x.x:3333
``` ```
次のステップ: [サービスを開始してAgenticSeekを実行する](#Start-services-and-Run) 次のステップ[サービスを起動してAgenticSeekを実行](#サービスを起動して実行)
--- ---
## 音声認識 ## 音声認識
現在、音声認識は英語でのみ動作することに注意してください 警告:現在、音声認識はCLIモードでのみ機能します
音声認識機能はデフォルトで無効になっています。有効にするには、config.iniファイルでlistenオプションをTrueに設定します: 現在、音声認識は英語でのみ機能することに注意してください。
音声認識機能はデフォルトで無効になっています。有効にするには、config.iniファイルでlistenオプションをTrueに設定します:
``` ```
listen = True listen = True
``` ```
有効にすると、音声認識機能はトリガーキーワードエージェントの名前)を待ちます。その後入力を処理します。エージェントの名前は*config.ini*ファイルの`agent_name`値を更新することでカスタマイズできます: 有効にすると、音声認識機能はトリガーワード、つまりエージェントの名前をリッスンし、その後入力を処理し始めます。*config.ini*ファイルの`agent_name`値を更新することでエージェントの名前をカスタマイズできます
``` ```
agent_name = Friday agent_name = Friday
``` ```
最適な認識のために、"John"や"Emma"のような一般的な英語の名前をエージェント名として使用することをお勧めします。 最高の認識のためには、エージェント名として「John」や「Emma」などの一般的な英語名を使用することをお勧めします。
トランスクリプトが表示され始めたら、エージェントの名前を大声で言って起動します(例:"Friday")。 文字起こしが表示され始めたら、エージェントの名前を大声で言って起動します(例:Friday)。
クエリを明確に話します。 クエリを明確に言います。
リクエストを終了する際に確認フレーズを使用してシステムに進行を通知します。確認フレーズの例には次のようなものがあります: 確認フレーズでリクエストを終了してシステムに続行するように指示します。確認フレーズの例
``` ```
"do it", "go ahead", "execute", "run", "start", "thanks", "would ya", "please", "okay?", "proceed", "continue", "go on", "do that", "go it", "do you understand?" "do it", "go ahead", "execute", "run", "start", "thanks", "would ya", "please", "okay?", "proceed", "continue", "go on", "do that", "go it", "do you understand?"
``` ```
## 設定 ## 設定
設定例: 設定例
``` ```
[MAIN] [MAIN]
is_local = True is_local = True
provider_name = ollama provider_name = ollama
provider_model = deepseek-r1:1.5b provider_model = deepseek-r1:32b
provider_server_address = 127.0.0.1:11434 provider_server_address = http://127.0.0.1:11434 # Ollama例;LM-Studioはhttp://127.0.0.1:1234を使用
agent_name = Friday agent_name = Friday
recover_last_session = False recover_last_session = False
save_session = False save_session = False
speak = False speak = False
listen = False listen = False
work_dir = /Users/mlg/Documents/ai_folder
jarvis_personality = False jarvis_personality = False
languages = en ja languages = en zh # TTSおよび潜在的なルーティングの言語リスト。
[BROWSER] [BROWSER]
headless_browser = False headless_browser = False
stealth_mode = False stealth_mode = False
``` ```
**説明**: **`config.ini`設定の説明**
- is_local -> エージェントをローカルで実行する(True)か、リモートサーバーで実行する(False)。 * **`[MAIN]`セクション:**
- provider_name -> 使用するプロバイダー(`ollama``server``lm-studio``deepseek-api`のいずれか) * `is_local`: ローカルLLMプロバイダー(Ollama、LM-Studio、ローカルOpenAI互換サーバー)またはセルフホストサーバーオプションを使用する場合は`True`。クラウドベースのAPI(OpenAI、Googleなど)を使用する場合は`False`
- provider_model -> 使用するモデル、例: deepseek-r1:1.5b * `provider_name`: LLMプロバイダーを指定します
- provider_server_address -> サーバーアドレス、例: 127.0.0.1:11434(ローカルの場合)。非ローカルAPIの場合は何でも設定できます * ローカルオプション:`ollama`、`lm-studio`、`openai`(ローカルOpenAI互換サーバー用)、`server`(セルフホストサーバー設定用)
- agent_name -> エージェントの名前、例: Friday。TTSのトリガーワードとして使用されます * APIオプション:`openai`、`google`、`deepseek`、`huggingface`、`togetherAI`
- recover_last_session -> 最後のセッションから再開する(True)か、しない(False)。 * `provider_model`: 選択したプロバイダーの特定のモデル名またはID(例:Ollamaの`deepseekcoder:6.7b`、OpenAI APIの`gpt-3.5-turbo`、TogetherAIの`mistralai/Mixtral-8x7B-Instruct-v0.1`)。
- save_session -> セッションデータを保存する(True)か、しない(False) * `provider_server_address`: あなたのLLMプロバイダーのアドレス
- speak -> 音声出力を有効にする(True)か、しない(False) * ローカルプロバイダー用:例:Ollamaの`http://127.0.0.1:11434`、LM-Studioの`http://127.0.0.1:1234`
- listen -> 音声入力を有効にする(True)か、しない(False)。 * `server`プロバイダータイプ用:あなたのセルフホストLLMサーバーのアドレス(例:`http://your_server_ip:3333`)。
- work_dir -> AIがアクセスするフォルダー。例: /Users/user/Documents/ * クラウドAPI用(`is_local = False`):これは通常無視されるか空にできます。APIエンドポイントは通常クライアントライブラリで処理されるためです
- jarvis_personality -> JARVISのようなパーソナリティを使用する(True)か、しない(False)。これは単にプロンプトファイルを変更するだけです。 * `agent_name`: AIアシスタントの名前(例:Friday)。有効な場合、音声認識のトリガーワードとして使用されます。
- headless_browser -> ウィンドウを表示せずにブラウザを実行する(True)か、しない(False) * `recover_last_session`: `True`は前のセッションの状態を復元しようとし、`False`は最初から開始します
- stealth_mode -> ボット検出を難しくします。唯一の欠点は、anticaptcha拡張機能を手動でインストールする必要があることです * `save_session`: `True`は現在のセッションの状態を潜在的な復元用に保存し、`False`はしません
- languages -> List of supported languages. Required for agent routing system. The longer the languages list the more model will be downloaded. * `speak`: `True`はテキスト読み上げ音声出力を有効にし、`False`は無効にします。
* `listen`: `True`は音声認識音声入力を有効にし(CLIモードのみ)、`False`は無効にします。
* `work_dir`: **重要:** AgenticSeekがファイルを読み書きするディレクトリ。**このパスがシステムで有効かつアクセス可能であることを確認してください。**
* `jarvis_personality`: `True`はより「Jarvis-like」なシステムプロンプトを使用(実験的)、`False`は標準プロンプトを使用。
* `languages`: カンマ区切りの言語リスト(例:`en, zh, fr`)。TTS音声選択(デフォルトは最初)に使用され、LLMルーターを支援できます。ルーターの非効率性を避けるため、多すぎる言語や非常に類似した言語の使用は避けてください。
* **`[BROWSER]`セクション:**
* `headless_browser`: `True`は可視ウィンドウなしで自動化ブラウザを実行(Webインターフェースまたは非対話的使用に推奨)。`False`はブラウザウィンドウを表示(CLIモードまたはデバッグに有用)。
* `stealth_mode`: `True`はブラウザ自動化の検出を困難にする措置を有効にします。anticaptchaなどのブラウザ拡張機能の手動インストールが必要な場合があります。
## プロバイダー このセクションはサポートされているLLMプロバイダータイプをまとめています。`config.ini`で設定します。
以下の表は利用可能なプロバイダーを示しています: **ローカルプロバイダー(独自のハードウェアで実行):**
| プロバイダー | ローカル? | 説明 | | config.iniのプロバイダー | `is_local` | 説明 | 設定セクション |
|-----------|--------|-----------------------------------------------------------| |-------------------------------|------------|-----------------------------------------------------------------------------|------------------------------------------------------------------|
| ollama | はい | ollamaをLLMプロバイダーとして使用してローカルでLLMを簡単に実行 | | `ollama` | `True` | Ollamaを使用してローカルでLLMを簡単に提供。 | [マシン上でローカルにLLMを実行する設定](#マシン上でローカルにllmを実行する設定) |
| server | はい | モデルを別のマシンでホストし、ローカルマシンで実行 | | `lm-studio` | `True` | LM-StudioでローカルにLLMを提供。 | [マシン上でローカルにLLMを実行する設定](#マシン上でローカルにllmを実行する設定) |
| lm-studio | はい | LM studio`lm-studio`)を使用してローカルLLMを実行 | | `openai`(ローカルサーバー用) | `True` | OpenAI互換APIを公開するローカルサーバー(例:llama.cpp)に接続。 | [マシン上でローカルLLMを実行する設定](#マシン上でローカルにllmを実行する設定) |
| openai | 場合による | ChatGPT API(非プライベート)またはopenai互換APIを使用 | | `server` | `False` | 別のマシンで実行されているAgenticSeekセルフホストLLMサーバーに接続。 | [独自のサーバーでLLMを実行する設定](#独自のサーバーでllmを実行する設定) |
| deepseek-api | いいえ | Deepseek API(非プライベート) |
| huggingface| いいえ | Hugging-Face API(非プライベート) |
| togetherAI | いいえ | together AI API(非プライベート)を使用
**APIプロバイダー(クラウドベース):**
プロバイダーを選択するには、config.iniを変更します: | config.iniのプロバイダー名 | `is_local` | 説明 | 設定セクション |
|-------------------------------|------------|--------------------------------------------------|-----------------------------------------------------|
| `openai` | `False` | OpenAIの公式API(例:GPT-3.5、GPT-4)を使用。 | [APIを使用した実行設定](#apiを使用した実行設定) |
| `google` | `False` | APIを通じてGoogleのGeminiモデルを使用。 | [APIを使用した実行設定](#apiを使用した実行設定) |
| `deepseek` | `False` | Deepseekの公式APIを使用。 | [APIを使用した実行設定](#apiを使用した実行設定) |
| `huggingface` | `False` | Hugging Face Inference APIを使用。 | [APIを使用した実行設定](#apiを使用した実行設定) |
| `togetherAI` | `False` | TogetherAIのAPIを通じて様々なオープンモデルを使用。 | [APIを使用した実行設定](#apiを使用した実行設定) |
``` ---
is_local = False ## トラブルシューティング
provider_name = openai
provider_model = gpt-4o
provider_server_address = 127.0.0.1:5000
```
`is_local`: ローカルで実行されるLLMの場合はTrue、それ以外の場合はFalse。
`provider_name`: 使用するプロバイダーを名前で選択します。上記のプロバイダーリストを参照してください 問題が発生した場合、このセクションはガイダンスを提供します
`provider_model`: エージェントが使用するモデルを設定します。
`provider_server_address`: サーバープロバイダーを使用しない場合は何でも設定できます。
# 既知の問題 # 既知の問題
## Chromedriverの問題 ## ChromeDriverの問題
**既知のエラー#1:** *chromedriverの不一致* **エラー例:** `SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version XXX`
### 根本原因
ChromeDriverのバージョン非互換性は以下で発生します:
1. インストールしたChromeDriverのバージョンがChromeブラウザのバージョンと一致しない
2. Docker環境では、`undetected_chromedriver`が独自のChromeDriverバージョンをダウンロードし、マウントされたバイナリを回避する可能性がある
### 解決手順
#### 1. Chromeのバージョンを確認
Google Chromeを開く → `設定 > Chromeについて`でバージョンを確認(例:「バージョン 134.0.6998.88」)
#### 2. 一致するChromeDriverをダウンロード
**Chrome 115以降の場合:** [Chrome for Testing API](https://googlechromelabs.github.io/chrome-for-testing/)を使用
- Chrome for Testingの可用性ダッシュボードにアクセス
- あなたのChromeバージョンまたは最も近い利用可能な一致を見つける
- オペレーティングシステム用のChromeDriverをダウンロード(Docker環境ではLinux64を使用)
**古いChromeバージョンの場合:** [レガシーChromeDriverダウンロード](https://chromedriver.chromium.org/downloads)を使用
![Chrome for TestingからChromeDriverをダウンロード](./media/chromedriver_readme.png)
#### 3. ChromeDriverをインストール(方法を選択)
**方法A:プロジェクトルートディレクトリ(Docker推奨)**
```bash
# ダウンロードしたchromedriverバイナリをプロジェクトルートディレクトリに配置
cp path/to/downloaded/chromedriver ./chromedriver
chmod +x ./chromedriver # Linux/macOSで実行可能にする
```
**方法B:システムPATH**
```bash
# Linux/macOS
sudo mv chromedriver /usr/local/bin/
sudo chmod +x /usr/local/bin/chromedriver
# Windows: chromedriver.exeをPATH内のフォルダに配置
```
#### 4. インストールを確認
```bash
# ChromeDriverのバージョンをテスト
./chromedriver --version
# またはPATHにある場合:
chromedriver --version
```
### Docker固有の指示
⚠️ **Dockerユーザーへの重要:**
- Dockerボリュームマウント方法はステルスモード(`undetected_chromedriver`)では機能しない可能性があります
- **解決策:** ChromeDriverをプロジェクトルートディレクトリに`./chromedriver`として配置
- アプリケーションが自動的に検出し、このバイナリを使用します
- ログに次のメッセージが表示されるはずです:`"Using ChromeDriver from project root: ./chromedriver"`
### トラブルシューティングのヒント
1. **まだバージョンの不一致が発生しますか?**
- ChromeDriverが実行可能か確認:`ls -la ./chromedriver`
- ChromeDriverのバージョンを確認:`./chromedriver --version`
- Chromeブラウザのバージョンと一致することを確認
2. **Dockerコンテナの問題ですか?**
- バックエンドログを確認:`docker logs backend`
- メッセージを探す:`"Using ChromeDriver from project root"`
- 見つからない場合は、ファイルが存在し実行可能であることを確認
3. **Chrome for Testingのバージョン**
- 可能な限り完全一致を使用
- バージョン134.0.6998.88の場合、ChromeDriver 134.0.6998.165を使用(最も近い利用可能バージョン)
- メジャーバージョン番号は一致する必要があります(134 = 134)
### バージョン互換性マトリックス
| Chromeバージョン | ChromeDriverバージョン | ステータス |
|----------------|---------------------|---------|
| 134.0.6998.x | 134.0.6998.165 | ✅ 利用可能 |
| 133.0.6943.x | 133.0.6943.141 | ✅ 利用可能 |
| 132.0.6834.x | 132.0.6834.159 | ✅ 利用可能 |
*最新の互換性については、[Chrome for Testingダッシュボード](https://googlechromelabs.github.io/chrome-for-testing/)を確認*
`Exception: Failed to initialize browser: Message: session not created: This version of ChromeDriver only supports Chrome version 113 `Exception: Failed to initialize browser: Message: session not created: This version of ChromeDriver only supports Chrome version 113
Current browser version is 134.0.6998.89 with binary path` Current browser version is 134.0.6998.89 with binary path`
これは、ブラウザとchromedriverのバージョンが一致しない場合に発生します。 ブラウザとchromedriverのバージョンが一致しない場合に発生します。
最新バージョンをダウンロードするには、次のリンクにアクセスしてください: 最新バージョンをダウンロードする必要があります:
https://developer.chrome.com/docs/chromedriver/downloads https://developer.chrome.com/docs/chromedriver/downloads
Chromeバージョン115以降を使用している場合は、次のリンクにアクセスしてください: Chromeバージョン115以降を使用している場合は、以下にアクセス:
https://googlechromelabs.github.io/chrome-for-testing/ https://googlechromelabs.github.io/chrome-for-testing/
お使いのOSに対応するchromedriverバージョンをダウンロードします。 オペレーティングシステムに一致するchromedriverバージョンをダウンロードします。
![alt text](./media/chromedriver_readme.png) ![alt text](./media/chromedriver_readme.png)
このセクションが不完全な場合は、問題を報告してください。 このセクションが不完全な場合は、issueを開いてください。
## 接続アダプターの問題
```
Exception: Provider lm-studio failed: HTTP request failed: No connection adapters were found for '127.0.0.1:1234/v1/chat/completions'`(注:ポートは異なる場合があります)
```
* **原因:** `config.ini`の`lm-studio`(または他の類似のローカルOpenAI互換サーバー)の`provider_server_address`に`http://`プレフィックスが欠けているか、間違ったポートを指している。
* **解決策:**
* アドレスに`http://`が含まれていることを確認。LM-Studioは通常デフォルトで`http://127.0.0.1:1234`を使用。
* 正しい`config.ini``provider_server_address = http://127.0.0.1:1234`(または実際のLM-Studioサーバーポート)。
## SearxNGベースURLが提供されていない
```
raise ValueError("SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.")
ValueError: SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.`
```
間違ったsearxngベースURLでCLIモードを実行すると発生する可能性があります。
SEARXNG_BASE_URLは、Dockerで実行するかホストで実行するかによって異なります:
**ホストで実行:** `SEARXNG_BASE_URL="http://localhost:8080"`
**完全にDocker内で実行(Webインターフェース):** `SEARXNG_BASE_URL="http://searxng:8080"`
## FAQ ## FAQ
@@ -446,35 +629,55 @@ https://googlechromelabs.github.io/chrome-for-testing/
| モデルサイズ | GPU | コメント | | モデルサイズ | GPU | コメント |
|-----------|--------|-----------------------------------------------------------| |-----------|--------|-----------------------------------------------------------|
| 7B | 8GB VRAM | ⚠️ 推奨されません。パフォーマンスが低く、頻繁幻覚を起こし、プランナーエージェントが失敗する可能性が高いです。 | | 7B | 8GB VRAM | ⚠️ 推奨。パフォーマンスが低く、頻繁幻覚、計画エージェントが失敗する可能性があります。 |
| 14B | 12GB VRAM (例: RTX 3060) | ✅ 単なタスクに使用可能です。ウェブブラウジングや計画タスクには苦労する可能性があります。 | | 14B | 12 GB VRAM(例:RTX 3060 | ✅ 単なタスクに使用可能。ウェブブラウジングとタスク計画に困難がある可能性があります。 |
| 32B | 24GB以上のVRAM (例: RTX 4090) | 🚀 ほとんどのタスクで成功しますが、タスク計画にまだ苦労する可能性があります | | 32B | 24+ GB VRAM(例:RTX 4090 | 🚀 ほとんどのタスクで成功、タスク計画にまだ困難がある可能性があります |
| 70B+ | 48GB以上のVRAM (例: Mac Studio) | 💪 優れた性能。高度なユースケースに推奨されます。 | | 70B+ | 48+ GB VRAM | 💪 優れています。高度な使用例に推奨。 |
**Q: なぜ他のモデルではなくDeepseek R1を選ぶのですか?** **Q: エラーが発生したらどうすればよいですか?**
Deepseek R1は、そのサイズに対して推論とツールの使用に優れています。私たちのニーズに最適だと考えています。他のモデルも問題なく動作しますが、Deepseekが私たちの主な選択です ローカルが実行されていること(`ollama serve`)、`config.ini`がプロバイダーと一致していること、依存関係がインストールされていることを確認してください。どれも機能しない場合は、遠慮なくissueを開いてください
**Q: `cli.py`を実行するとエラーが発生します。どうすればよいですか?**
Ollamaが実行中であることを確認してください(`ollama serve`)、`config.ini`がプロバイダーに一致していること、および依存関係がインストールされていることを確認してください。それでも解決しない場合は、問題を報告してください。
**Q: 本当に100%ローカルで実行できますか?** **Q: 本当に100%ローカルで実行できますか?**
はい、OllamaまたはServerプロバイダーを使用すると、すべての音声認識、LLM、および音声合成モデルがローカルで実行されます。非ローカルオプション(OpenAIまたは他のAPI)はオプションです。 はい、Ollama、lm-studio、またはserverプロバイダーを使用すると、すべての音声認識、LLM、テキスト読み上げモデルがローカルで実行されます。非ローカルオプション(OpenAI或其他API)はオプションです。
**Q: Manusを持っているのに、なぜAgenticSeekを使用する必要があるのですか?** **Q: Manusがあるのに、なぜAgenticSeekを使用する必要がありますか?**
これは、AIエージェントに関する興味から始まったサイドプロジェクトです。特別な点は、ローカルモデルを使用し、APIを避けることです。 Manusとは異なり、AgenticSeekは外部システムからの独立性を優先し、より多くの制御、プライバシー、APIコストの回避を提供します。
私たちは、JarvisやFriday(アイアンマン映画)からインスピレーションを得て、「クール」にしようとしましたが、機能性に関してはManusから多くのインスピレーションを得ています。なぜなら、人々が最初に求めているのはローカルのManusの代替品だからです。
Manusとは異なり、AgenticSeekは外部システムからの独立性を優先し、より多くの制御、プライバシーを提供し、APIのコストを回避します。 **Q: このプロジェクトの背後には誰がいますか?**
このプロジェクトは私によって作成され、2人の友人がメンテナーとして、GitHub上のオープンソースコミュニティの貢献者と共に運営されています。私たちは単なる情熱的な個人であり、スタートアップではなく、どの組織にも所属していません。
私の個人アカウント(https://x.com/Martin993886460)以外のX上のAgenticSeekアカウントはすべて偽物です。
## 貢献 ## 貢献
AgenticSeekを改善するための開発者を探しています!オープンな問題やディスカッションを確認してください。 AgenticSeekを改善する開発者を探しています!オープンなissueやディスカッションを確認してください。
[貢献ガイド](./docs/CONTRIBUTING.md)
## スポンサー:
フライト検索、旅行計画、または最高の買い物のお得な情報の取得などの機能でAgenticSeekの能力を向上させたいですか?SerpApiを使用してカスタムツールを作成し、より多くのJarvisのような機能を解放することを検討してください。SerpApiを使用すると、プロフェッショナルなタスクのためにエージェントを加速させながら、完全な制御を維持できます。
<a href="https://serpapi.com/"><img src="./media/banners/sponsor_banner_serpapi.png" height="350" alt="SerpApi Banner" ></a>
[Contributing.md](./docs/CONTRIBUTING.md)をチェックして、カスタムツールを統合する方法を学びましょう!
### **スポンサー**
- [tatra-labs](https://github.com/tatra-labs)
## メンテナー:
> [Fosowl](https://github.com/Fosowl) | パリ時間
> [antoineVIVIES](https://github.com/antoineVIVIES) | 台北時間
## 特別な感謝:
> [tcsenpai](https://github.com/tcsenpai) と [plitc](https://github.com/plitc) がバックエンドのDocker化を支援
[![Star History Chart](https://api.star-history.com/svg?repos=Fosowl/agenticSeek&type=Date)](https://www.star-history.com/#Fosowl/agenticSeek&Date) [![Star History Chart](https://api.star-history.com/svg?repos=Fosowl/agenticSeek&type=Date)](https://www.star-history.com/#Fosowl/agenticSeek&Date)
## 著者:
> [Fosowl](https://github.com/Fosowl)
> [steveh8758](https://github.com/steveh8758)
+682
View File
@@ -0,0 +1,682 @@
# AgenticSeek: Uma Alternativa Privada e Local ao Manus
<p align="center">
<img align="center" src="./media/agentic_seek_logo.png" width="300" height="300" alt="Agentic Seek Logo">
<p>
English | [中文](./README_CHS.md) | [繁體中文](./README_CHT.md) | [Français](./README_FR.md) | [日本語](./README_JP.md) | [Português (Brasil)](./README_PTBR.md) | [Español](./README_ES.md) | [Türkçe](./README_TR.md)
*Um assistente de IA com reconhecimento de voz que é uma **alternativa 100% local ao Manus AI**, navega autonomamente na web, escreve código e planeja tarefas enquanto mantém todos os dados no seu dispositivo. Projetado para modelos de raciocínio local, funciona inteiramente no seu hardware, garantindo total privacidade e zero dependência de nuvem.*
[![Visitar AgenticSeek](https://img.shields.io/static/v1?label=Website&message=AgenticSeek&color=blue&style=flat-square)](https://fosowl.github.io/agenticSeek.html) ![License](https://img.shields.io/badge/license-GPL--3.0-green) [![Discord](https://img.shields.io/badge/Discord-Join%20Us-7289DA?logo=discord&logoColor=white)](https://discord.gg/8hGDaME3TC) [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/fosowl.svg?style=social&label=Update%20%40Fosowl)](https://x.com/Martin993886460) [![GitHub stars](https://img.shields.io/github/stars/Fosowl/agenticSeek?style=social)](https://github.com/Fosowl/agenticSeek/stargazers)
### Por que escolher o AgenticSeek?
* 🔒 Totalmente Local & Privado - Tudo funciona na sua máquina, sem nuvem, sem compartilhamento de dados. Seus arquivos, conversas e pesquisas permanecem privados.
* 🌐 Navegação Web Inteligente - O AgenticSeek pode navegar na Internet autonomamente: pesquisar, ler, extrair informações, preencher formulários web, tudo sem intervenção manual.
* 💻 Assistente de Programação Autônomo - Precisa de código? Ele pode escrever, depurar e executar programas em Python, C, Go, Java e muito mais, sem supervisão.
* 🧠 Seleção Inteligente de Agentes - Você pergunta, ele escolhe automaticamente o melhor agente para a tarefa. Como ter uma equipe de especialistas sempre disponível.
* 📋 Planeja e Executa Tarefas Complexas - Desde o planejamento de viagens até projetos complexos, ele pode decompor grandes tarefas em etapas e completá-las usando múltiplos agentes de IA.
* 🎙️ Suporte de Voz - Voz clara, rápida e futurista com reconhecimento de voz, permitindo que você converse como com sua IA pessoal de filme de ficção científica. (Em desenvolvimento)
### **Demo**
> *Você pode pesquisar o projeto agenticSeek, aprender quais habilidades são necessárias e, em seguida, abrir CV_candidates.zip e me dizer quais correspondem melhor ao projeto?*
https://github.com/user-attachments/assets/b8ca60e9-7b3b-4533-840e-08f9ac426316
Aviso: Esta demonstração e todos os arquivos que aparecem (ex: CV_candidates.zip) são totalmente fictícios. Não somos uma empresa, estamos procurando contribuidores de código aberto, não candidatos.
> 🛠⚠️ **Trabalho Ativo em Andamento**
> 🙏 Este projeto começou como um projeto paralelo e não tem roadmap nem financiamento. Cresceu muito além das expectativas ao aparecer no GitHub Trending. Contribuições, comentários e paciência são profundamente apreciados.
## Pré-requisitos
Antes de começar, certifique-se de ter instalado:
* **Git:** Para clonar o repositório. [Baixar Git](https://git-scm.com/downloads)
* **Python 3.10.x:** Python 3.10.x é altamente recomendado. Outras versões podem causar erros de dependência. [Baixar Python 3.10](https://www.python.org/downloads/release/python-3100/) (selecione a versão 3.10.x).
* **Docker Engine & Docker Compose:** Para executar serviços empacotados como SearxNG.
* Instalar Docker Desktop (inclui Docker Compose V2): [Windows](https://docs.docker.com/desktop/install/windows-install/) | [Mac](https://docs.docker.com/desktop/install/mac-install/) | [Linux](https://docs.docker.com/desktop/install/linux-install/)
* Ou instalar Docker Engine e Docker Compose separadamente no Linux: [Docker Engine](https://docs.docker.com/engine/install/) | [Docker Compose](https://docs.docker.com/compose/install/) (certifique-se de instalar Compose V2, por exemplo `sudo apt-get install docker-compose-plugin`).
### 1. **Clonar o repositório e configurar**
```sh
git clone https://github.com/Fosowl/agenticSeek.git
cd agenticSeek
mv .env.example .env
```
### 2. Modificar o conteúdo do arquivo .env
```sh
SEARXNG_BASE_URL="http://searxng:8080" # Se você executar no modo CLI no host, use http://127.0.0.1:8080
REDIS_BASE_URL="redis://redis:6379/0"
WORK_DIR="/Users/mlg/Documents/workspace_for_ai"
OLLAMA_PORT="11434"
LM_STUDIO_PORT="1234"
CUSTOM_ADDITIONAL_LLM_PORT="11435"
OPENAI_API_KEY='optional'
DEEPSEEK_API_KEY='optional'
OPENROUTER_API_KEY='optional'
TOGETHER_API_KEY='optional'
GOOGLE_API_KEY='optional'
ANTHROPIC_API_KEY='optional'
```
Atualize o arquivo `.env` conforme necessário:
- **SEARXNG_BASE_URL**: Mantenha inalterado, a menos que você execute no modo CLI no host.
- **REDIS_BASE_URL**: Mantenha inalterado
- **WORK_DIR**: Caminho para o diretório de trabalho local. O AgenticSeek poderá ler e interagir com esses arquivos.
- **OLLAMA_PORT**: Número da porta para o serviço Ollama.
- **LM_STUDIO_PORT**: Número da porta para o serviço LM Studio.
- **CUSTOM_ADDITIONAL_LLM_PORT**: Porta para qualquer serviço LLM personalizado adicional.
**As chaves de API são completamente opcionais para aqueles que optam por executar LLM localmente, que é o objetivo principal deste projeto. Deixe-as vazias se você tiver hardware suficiente.**
### 3. **Iniciar o Docker**
Certifique-se de que o Docker está instalado e funcionando no seu sistema. Você pode iniciar o Docker com os seguintes comandos:
- **Linux/macOS:**
Abra um terminal e execute:
```sh
sudo systemctl start docker
```
Ou inicie o Docker Desktop a partir do menu de aplicativos, se instalado.
- **Windows:**
Inicie o Docker Desktop a partir do menu Iniciar.
Você pode verificar se o Docker está funcionando executando:
```sh
docker info
```
Se você vir informações sobre sua instalação do Docker, ele está funcionando corretamente.
Consulte a [Lista de provedores locais](#lista-de-provedores-locais) abaixo para um resumo.
Próxima etapa: [Executar o AgenticSeek localmente](#iniciar-os-serviços-e-executar)
*Se você encontrar problemas, consulte a seção [Solução de problemas](#solução-de-problemas).*
*Se seu hardware não puder executar LLM localmente, consulte [Configuração para executar com uma API](#configuração-para-executar-com-uma-api).*
*Para explicações detalhadas do `config.ini`, consulte a [seção Configuração](#configuração).*
---
## Configuração para executar LLM localmente na sua máquina
**Requisitos de hardware:**
Para executar LLM localmente, você precisará de hardware suficiente. No mínimo, uma GPU capaz de executar Magistral, Qwen ou Deepseek 14B é necessária. Consulte o FAQ para recomendações detalhadas de modelo/desempenho.
**Configure seu provedor local**
Inicie seu provedor local, por exemplo com ollama:
```sh
ollama serve
```
Consulte a lista de provedores locais suportados abaixo.
**Atualizar config.ini**
Altere o arquivo config.ini para definir provider_name como um provedor suportado e provider_model como um LLM suportado pelo seu provedor. Recomendamos modelos de raciocínio como *Magistral* ou *Deepseek*.
Consulte o **FAQ** no final do README para o hardware necessário.
```sh
[MAIN]
is_local = True # Se você está executando localmente ou com um provedor remoto.
provider_name = ollama # ou lm-studio, openai, etc.
provider_model = deepseek-r1:14b # escolha um modelo compatível com seu hardware
provider_server_address = 127.0.0.1:11434
agent_name = Jarvis # o nome da sua IA
recover_last_session = True # recuperar a sessão anterior
save_session = True # memorizar a sessão atual
speak = False # texto para fala
listen = False # fala para texto, apenas para CLI, experimental
jarvis_personality = False # usar uma personalidade mais "Jarvis" (experimental)
languages = en zh # Lista de idiomas, TTS usará o primeiro da lista por padrão
[BROWSER]
headless_browser = True # mantenha inalterado, a menos que use CLI no host.
stealth_mode = True # Use selenium indetectável para reduzir a detecção do navegador
```
**Aviso**:
- O formato do arquivo `config.ini` não suporta comentários.
Não copie e cole diretamente a configuração de exemplo, pois os comentários causarão erros. Em vez disso, modifique manualmente o arquivo `config.ini` com sua configuração desejada, sem comentários.
- *NÃO* defina provider_name como `openai` se você estiver usando LM-studio para executar LLM. Use-o como `lm-studio`.
- Alguns provedores (ex: lm-studio) exigem `http://` antes do IP. Exemplo: `http://127.0.0.1:1234`
**Lista de provedores locais**
| Provedor | Local ? | Descrição |
|-----------|--------|-----------------------------------------------------------|
| ollama | Sim | Executa LLM localmente facilmente usando ollama |
| lm-studio | Sim | Executa LLM localmente com LM studio (defina `provider_name` = `lm-studio`)|
| openai | Sim | Use uma API compatível com openai (ex: servidor llama.cpp) |
Próxima etapa: [Iniciar os serviços e executar o AgenticSeek](#iniciar-os-serviços-e-executar)
*Se você encontrar problemas, consulte a seção [Solução de problemas](#solução-de-problemas).*
*Se seu hardware não puder executar LLM localmente, consulte [Configuração para executar com uma API](#configuração-para-executar-com-uma-api).*
*Para explicações detalhadas do `config.ini`, consulte a [seção Configuração](#configuração).*
## Configuração para executar com uma API
Esta configuração usa provedores de LLM externos baseados em nuvem. Você precisará obter chaves de API do serviço escolhido.
**1. Escolha um provedor de API e obtenha uma chave de API:**
Consulte a [Lista de provedores de API](#lista-de-provedores-de-api) abaixo. Visite seus sites para se inscrever e obter chaves de API.
**2. Defina sua chave de API como variável de ambiente:**
* **Linux/macOS:**
Abra um terminal e use o comando `export`. É melhor adicioná-lo ao arquivo de configuração do seu shell (ex: `~/.bashrc`, `~/.zshrc`) para que seja persistente.
```sh
export PROVIDER_API_KEY="your_api_key_here"
# Substitua PROVIDER_API_KEY pelo nome de variável específico, ex: OPENAI_API_KEY, GOOGLE_API_KEY
```
Exemplo TogetherAI:
```sh
export TOGETHER_API_KEY="xxxxxxxxxxxxxxxxxxxxxx"
```
* **Windows:**
* **Prompt de comando (temporário para a sessão atual):**
```cmd
set PROVIDER_API_KEY=your_api_key_here
```
* **PowerShell (temporário para a sessão atual):**
```powershell
$env:PROVIDER_API_KEY="your_api_key_here"
```
* **Permanente:** Pesquise "variáveis de ambiente" na barra de pesquisa do Windows, clique em "Editar variáveis de ambiente do sistema" e depois no botão "Variáveis de ambiente...". Adicione uma nova variável de usuário com o nome apropriado (ex: `OPENAI_API_KEY`) e sua chave como valor.
*(Para mais detalhes, consulte o FAQ: [Como configurar uma chave de API?](#como-configurar-uma-chave-de-api)).*
**3. Atualize `config.ini`:**
```ini
[MAIN]
is_local = False
provider_name = openai # ou google, deepseek, togetherAI, huggingface
provider_model = gpt-3.5-turbo # ou gemini-1.5-flash, deepseek-chat, mistralai/Mixtral-8x7B-Instruct-v0.1, etc.
provider_server_address = # Quando is_local = False, geralmente ignorado ou pode ser deixado vazio para a maioria das APIs
# ... outras configurações ...
```
*Aviso:* Certifique-se de que não há espaços no final dos valores no config.
**Lista de provedores de API**
| Provedor | `provider_name` | Local ? | Descrição | Link da chave de API (exemplo) |
|--------------|-----------------|--------|---------------------------------------------------|---------------------------------------------|
| OpenAI | `openai` | Não | Use os modelos ChatGPT via API OpenAI. | [platform.openai.com/signup](https://platform.openai.com/signup) |
| Google Gemini| `google` | Não | Use os modelos Google Gemini via Google AI Studio. | [aistudio.google.com/keys](https://aistudio.google.com/keys) |
| Deepseek | `deepseek` | Não | Use os modelos Deepseek via sua API. | [platform.deepseek.com](https://platform.deepseek.com) |
| Hugging Face | `huggingface` | Não | Use modelos do Hugging Face Inference API. | [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens) |
| TogetherAI | `togetherAI` | Não | Use vários modelos open source via API TogetherAI.| [api.together.ai/settings/api-keys](https://api.together.ai/settings/api-keys) |
*Nota:*
* Não recomendamos usar `gpt-4o` ou outros modelos OpenAI para navegação web complexa e planejamento de tarefas, pois a otimização atual de prompts visa modelos como Deepseek.
* Tarefas de codificação/bash podem falhar com Gemini, pois tende a ignorar nosso formato de prompt otimizado para Deepseek r1.
* Quando `is_local = False`, `provider_server_address` no `config.ini` geralmente não é usado, pois os endpoints de API são geralmente gerenciados pelas bibliotecas do provedor correspondente.
Próxima etapa: [Iniciar os serviços e executar o AgenticSeek](#iniciar-os-serviços-e-executar)
*Se você encontrar problemas, consulte a seção **Problemas conhecidos***
*Para explicações detalhadas do arquivo de configuração, consulte a **seção Configuração**.*
---
## Iniciar os serviços e executar
Por padrão, o AgenticSeek é executado inteiramente no Docker.
**Opção 1:** Executar no Docker com interface web:
Inicie os serviços necessários. Isso iniciará todos os serviços do docker-compose.yml, incluindo:
- searxng
- redis (necessário para searxng)
- frontend
- backend (se você usar `full` para a interface web)
```sh
./start_services.sh full # MacOS
start start_services.cmd full # Windows
```
**Aviso:** Esta etapa baixará e carregará todas as imagens do Docker, o que pode levar até 30 minutos. Depois de iniciar os serviços, aguarde até que o serviço backend esteja totalmente operacional (você deve ver **backend: "GET /health HTTP/1.1" 200 OK** nos logs) antes de enviar mensagens. Na primeira inicialização, o serviço backend pode levar 5 minutos para iniciar.
Vá para `http://localhost:3000/` e você deve ver a interface web.
*Solução de problemas de inicialização de serviços:* Se esses scripts falharem, certifique-se de que o Docker Engine está funcionando e que o Docker Compose (V2, `docker compose`) está instalado corretamente. Verifique as mensagens de erro na saída do terminal. Consulte [FAQ: Ajuda! Estou recebendo erros ao executar o AgenticSeek ou seus scripts.](#faq-solução-de-problemas)
**Opção 2:** Modo CLI:
Para executar com a interface CLI, você precisa instalar os pacotes no host:
```sh
./install.sh
./install.bat # windows
```
Em seguida, você precisa alterar SEARXNG_BASE_URL no `config.ini` para:
```sh
SEARXNG_BASE_URL="http://localhost:8080"
```
Inicie os serviços necessários. Isso iniciará alguns serviços do docker-compose.yml, incluindo:
- searxng
- redis (necessário para searxng)
- frontend
```sh
./start_services.sh # MacOS
start start_services.cmd # Windows
```
Execute: uv run: `uv run python -m ensurepip` para garantir que o uv tenha o pip ativado.
Use CLI: `uv run cli.py`
---
## Uso
Certifique-se de que os serviços estão funcionando com `./start_services.sh full` e vá para `localhost:3000` para a interface web.
Você também pode usar fala para texto definindo `listen = True`. Apenas para o modo CLI.
Para sair, basta dizer/digitar `goodbye`.
Alguns exemplos de uso:
> *Faça um jogo da cobra em python!*
> *Pesquise na web os melhores cafés em Rennes, França, e salve uma lista de três com seus endereços em rennes_cafes.txt.*
> *Escreva um programa Go para calcular o fatorial de um número, salve-o como factorial.go em seu workspace*
> *Pesquise na pasta summer_pictures todos os arquivos JPG, renomeie-os com a data de hoje e salve a lista de arquivos renomeados em photos_list.txt*
> *Pesquise online os filmes de ficção científica populares de 2024 e escolha três para assistir esta noite. Salve a lista em movie_night.txt.*
> *Pesquise na web os últimos artigos de notícias sobre IA de 2025, selecione três e escreva um script Python para extrair os títulos e resumos. Salve o script como news_scraper.py e os resumos em ai_news.txt em /home/projects*
> *Sexta-feira, pesquise na web uma API gratuita de preços de ações, inscreva-se com supersuper7434567@gmail.com e escreva um script Python para obter os preços diários da Tesla usando a API, salvando os resultados em stock_prices.csv*
*Observe que o preenchimento de formulários ainda é experimental e pode falhar.*
Depois de inserir sua consulta, o AgenticSeek atribuirá o melhor agente para a tarefa.
Como este é um protótipo inicial, o sistema de roteamento de agentes pode nem sempre atribuir o agente correto à sua consulta.
Portanto, seja muito explícito sobre o que você quer e como a IA pode proceder, por exemplo, se você quiser que ela faça uma pesquisa na web, não diga:
`Você conhece bons países para viajar sozinho?`
Em vez disso, diga:
`Execute uma pesquisa na web e descubra quais são os melhores países para viajar sozinho`
---
## **Configuração para executar LLM em seu próprio servidor**
Se você tem um computador poderoso ou um servidor que pode acessar, mas quer usá-lo do seu laptop, você pode optar por executar o LLM em um servidor remoto usando nosso servidor llm personalizado.
No seu "servidor" que executará o modelo de IA, obtenha o endereço IP
```sh
ip a | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}' | cut -d/ -f1 # IP local
curl https://ipinfo.io/ip # IP público
```
Nota: Para Windows ou macOS, use ipconfig ou ifconfig para encontrar o endereço IP.
Clone o repositório e entre na pasta `server/`.
```sh
git clone --depth 1 https://github.com/Fosowl/agenticSeek.git
cd agenticSeek/llm_server/
```
Instale os requisitos específicos do servidor:
```sh
pip3 install -r requirements.txt
```
Execute o script do servidor.
```sh
python3 app.py --provider ollama --port 3333
```
Você pode escolher usar `ollama` e `llamacpp` como serviço LLM.
Agora no seu computador pessoal:
Altere o arquivo `config.ini` para definir `provider_name` como `server` e `provider_model` como `deepseek-r1:xxb`.
Defina `provider_server_address` como o endereço IP da máquina que executará o modelo.
```sh
[MAIN]
is_local = False
provider_name = server
provider_model = deepseek-r1:70b
provider_server_address = http://x.x.x.x:3333
```
Próxima etapa: [Iniciar os serviços e executar o AgenticSeek](#iniciar-os-serviços-e-executar)
---
## Fala para Texto
Aviso: Fala para texto funciona apenas no modo CLI no momento.
Observe que a fala para texto funciona apenas em inglês no momento.
A funcionalidade de fala para texto está desativada por padrão. Para ativá-la, defina listen como True no arquivo config.ini:
```
listen = True
```
Quando ativada, a funcionalidade de fala para texto ouve uma palavra-chave de gatilho, que é o nome do agente, antes de processar sua entrada. Você pode personalizar o nome do agente atualizando o valor `agent_name` em *config.ini*:
```
agent_name = Friday
```
Para melhor reconhecimento, recomendamos usar um nome comum em inglês como "John" ou "Emma" como nome do agente.
Assim que você vir a transcrição começar a aparecer, diga o nome do agente em voz alta para acordá-lo (ex: "Friday").
Diga sua consulta claramente.
Termine sua solicitação com uma frase de confirmação para indicar ao sistema para continuar. Exemplos de frases de confirmação incluem:
```
"do it", "go ahead", "execute", "run", "start", "thanks", "would ya", "please", "okay?", "proceed", "continue", "go on", "do that", "go it", "do you understand?"
```
## Configuração
Exemplo de configuração:
```
[MAIN]
is_local = True
provider_name = ollama
provider_model = deepseek-r1:32b
provider_server_address = http://127.0.0.1:11434 # Exemplo Ollama; LM-Studio usa http://127.0.0.1:1234
agent_name = Friday
recover_last_session = False
save_session = False
speak = False
listen = False
jarvis_personality = False
languages = en zh # Lista de idiomas para TTS e roteamento potencial.
[BROWSER]
headless_browser = False
stealth_mode = False
```
**Explicação das configurações de `config.ini`**:
* **Seção `[MAIN]`:**
* `is_local`: `True` se você estiver usando provedores de LLM locais (Ollama, LM-Studio, servidor local compatível com OpenAI) ou a opção de servidor auto-hospedado. `False` se você estiver usando APIs baseadas em nuvem (OpenAI, Google, etc.).
* `provider_name`: Especifica o provedor de LLM.
* Opções locais: `ollama`, `lm-studio`, `openai` (para servidor local compatível com OpenAI), `server` (para configuração de servidor auto-hospedado).
* Opções de API: `openai`, `google`, `deepseek`, `huggingface`, `togetherAI`.
* `provider_model`: Nome ou ID específico do modelo do provedor selecionado (ex: `deepseekcoder:6.7b` para Ollama, `gpt-3.5-turbo` para API OpenAI, `mistralai/Mixtral-8x7B-Instruct-v0.1` para TogetherAI).
* `provider_server_address`: O endereço do seu provedor de LLM.
* Para provedores locais: ex: `http://127.0.0.1:11434` para Ollama, `http://127.0.0.1:1234` para LM-Studio.
* Para o tipo de provedor `server`: O endereço do seu servidor LLM auto-hospedado (ex: `http://your_server_ip:3333`).
* Para APIs em nuvem (`is_local = False`): Isso geralmente é ignorado ou pode ser deixado em branco, pois os endpoints da API são geralmente gerenciados pelas bibliotecas do provedor correspondente.
* `agent_name`: O nome do assistente de IA (ex: Friday). Se ativado, usado como palavra de gatilho para fala para texto.
* `recover_last_session`: `True` para tentar recuperar o estado da sessão anterior, `False` para começar do zero.
* `save_session`: `True` para salvar o estado da sessão atual para possível recuperação, `False` caso contrário.
* `speak`: `True` para ativar a saída de voz de texto para fala, `False` para desativar.
* `listen`: `True` para ativar a entrada de voz de fala para texto (apenas modo CLI), `False` para desativar.
* `work_dir`: **Crítico:** O diretório onde o AgenticSeek lerá/escreverá arquivos. **Certifique-se de que este caminho é válido e acessível no seu sistema.**
* `jarvis_personality`: `True` para usar prompts de sistema mais "Jarvis-like" (experimental), `False` para usar prompts padrão.
* `languages`: Lista de idiomas separados por vírgulas (ex: `en, zh, fr`). Usado para seleção de voz TTS (primeira por padrão) e pode ajudar o roteador LLM. Para evitar ineficiências do roteador, evite usar muitos idiomas ou idiomas muito semelhantes.
* **Seção `[BROWSER]`:**
* `headless_browser`: `True` para executar o navegador automatizado sem janela visível (recomendado para interface web ou uso não interativo). `False` para exibir a janela do navegador (útil para modo CLI ou depuração).
* `stealth_mode`: `True` para ativar medidas que tornam mais difícil a detecção da automação do navegador. Pode exigir instalação manual de extensões de navegador como anticaptcha.
Esta seção resume os tipos de provedores de LLM suportados. Configure-os em `config.ini`.
**Provedores locais (executando em seu próprio hardware):**
| Nome do provedor em config.ini | `is_local` | Descrição | Seção de configuração |
|-------------------------------|------------|-----------------------------------------------------------------------------|------------------------------------------------------------------|
| `ollama` | `True` | Fornece LLM localmente facilmente usando Ollama. | [Configuração para executar LLM localmente na sua máquina](#configuração-para-executar-llm-localmente-na-sua-máquina) |
| `lm-studio` | `True` | Fornece LLM localmente com LM-Studio. | [Configuração para executar LLM localmente na sua máquina](#configuração-para-executar-llm-localmente-na-sua-máquina) |
| `openai` (para servidor local) | `True` | Conecte-se a um servidor local expondo uma API compatível com OpenAI (ex: llama.cpp). | [Configuração para executar LLM localmente na sua máquina](#configuração-para-executar-llm-localmente-na-sua-máquina) |
| `server` | `False` | Conecte-se ao servidor LLM auto-hospedado do AgenticSeek em execução em outra máquina. | [Configuração para executar LLM em seu próprio servidor](#configuração-para-executar-llm-em-seu-próprio-servidor) |
**Provedores de API (baseados em nuvem):**
| Nome do provedor em config.ini | `is_local` | Descrição | Seção de configuração |
|-------------------------------|------------|--------------------------------------------------|-----------------------------------------------------|
| `openai` | `False` | Use a API oficial da OpenAI (ex: GPT-3.5, GPT-4). | [Configuração para executar com uma API](#configuração-para-executar-com-uma-api) |
| `google` | `False` | Use os modelos Google Gemini via API. | [Configuração para executar com uma API](#configuração-para-executar-com-uma-api) |
| `deepseek` | `False` | Use a API oficial da Deepseek. | [Configuração para executar com uma API](#configuração-para-executar-com-uma-api) |
| `huggingface` | `False` | Use Hugging Face Inference API. | [Configuração para executar com uma API](#configuração-para-executar-com-uma-api) |
| `togetherAI` | `False` | Use vários modelos abertos via API TogetherAI. | [Configuração para executar com uma API](#configuração-para-executar-com-uma-api) |
---
## Solução de problemas
Se você encontrar problemas, esta seção fornece orientações.
# Problemas conhecidos
## Problemas do ChromeDriver
**Exemplo de erro:** `SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version XXX`
### Causa raiz
A incompatibilidade de versão do ChromeDriver ocorre quando:
1. A versão do ChromeDriver que você instalou não corresponde à versão do navegador Chrome
2. Em ambientes Docker, `undetected_chromedriver` pode baixar sua própria versão do ChromeDriver, contornando os binários montados
### Etapas de solução
#### 1. Verifique sua versão do Chrome
Abra o Google Chrome → `Configurações > Sobre o Chrome` para encontrar sua versão (ex: "Versão 134.0.6998.88")
#### 2. Baixe o ChromeDriver correspondente
**Para Chrome 115 e superior:** Use [Chrome for Testing API](https://googlechromelabs.github.io/chrome-for-testing/)
- Visite o painel de disponibilidade do Chrome for Testing
- Encontre sua versão do Chrome ou a correspondência disponível mais próxima
- Baixe o ChromeDriver para seu sistema operacional (use Linux64 para ambientes Docker)
**Para versões mais antigas do Chrome:** Use [Downloads legados do ChromeDriver](https://chromedriver.chromium.org/downloads)
![Baixar ChromeDriver do Chrome for Testing](./media/chromedriver_readme.png)
#### 3. Instale o ChromeDriver (escolha um método)
**Método A: Diretório raiz do projeto (recomendado para Docker)**
```bash
# Coloque o binário chromedriver baixado no diretório raiz do projeto
cp path/to/downloaded/chromedriver ./chromedriver
chmod +x ./chromedriver # Torne-o executável no Linux/macOS
```
**Método B: PATH do sistema**
```bash
# Linux/macOS
sudo mv chromedriver /usr/local/bin/
sudo chmod +x /usr/local/bin/chromedriver
# Windows: Coloque chromedriver.exe em uma pasta do PATH
```
#### 4. Verifique a instalação
```bash
# Teste a versão do ChromeDriver
./chromedriver --version
# Ou se estiver no PATH:
chromedriver --version
```
### Instruções específicas do Docker
⚠️ **Importante para usuários do Docker:**
- O método de montagem de volumes do Docker pode não funcionar com o modo furtivo (`undetected_chromedriver`)
- **Solução:** Coloque o ChromeDriver no diretório raiz do projeto como `./chromedriver`
- O aplicativo o detectará automaticamente e usará este binário
- Você deve ver nos logs: `"Using ChromeDriver from project root: ./chromedriver"`
### Dicas de solução de problemas
1. **Ainda há incompatibilidade de versão?**
- Verifique se o ChromeDriver é executável: `ls -la ./chromedriver`
- Verifique a versão do ChromeDriver: `./chromedriver --version`
- Certifique-se de que corresponde à versão do seu navegador Chrome
2. **Problemas com o contêiner Docker?**
- Verifique os logs do backend: `docker logs backend`
- Procure a mensagem: `"Using ChromeDriver from project root"`
- Se não for encontrado, verifique se o arquivo existe e é executável
3. **Versões do Chrome for Testing**
- Use uma correspondência exata quando possível
- Para a versão 134.0.6998.88, use o ChromeDriver 134.0.6998.165 (a versão disponível mais próxima)
- O número da versão principal deve corresponder (134 = 134)
### Matriz de compatibilidade de versões
| Versão do Chrome | Versão do ChromeDriver | Status |
|----------------|---------------------|---------|
| 134.0.6998.x | 134.0.6998.165 | ✅ Disponível |
| 133.0.6943.x | 133.0.6943.141 | ✅ Disponível |
| 132.0.6834.x | 132.0.6834.159 | ✅ Disponível |
*Para a compatibilidade mais recente, consulte o [Painel do Chrome for Testing](https://googlechromelabs.github.io/chrome-for-testing/)*
`Exception: Failed to initialize browser: Message: session not created: This version of ChromeDriver only supports Chrome version 113
Current browser version is 134.0.6998.89 with binary path`
Isso acontece se seu navegador e a versão do chromedriver não corresponderem.
Você precisa navegar para baixar a versão mais recente:
https://developer.chrome.com/docs/chromedriver/downloads
Se você estiver usando o Chrome versão 115 ou superior, vá para:
https://googlechromelabs.github.io/chrome-for-testing/
e baixe a versão do chromedriver correspondente ao seu sistema operacional.
![alt text](./media/chromedriver_readme.png)
Se esta seção estiver incompleta, abra um issue.
## Problemas de adaptadores de conexão
```
Exception: Provider lm-studio failed: HTTP request failed: No connection adapters were found for '127.0.0.1:1234/v1/chat/completions'` (nota: a porta pode variar)
```
* **Causa:** Falta o prefixo `http://` em `provider_server_address` para `lm-studio` (ou outro servidor local compatível com OpenAI semelhante) no `config.ini`, ou ele aponta para a porta errada.
* **Solução:**
* Certifique-se de que o endereço inclui `http://`. O LM-Studio geralmente usa `http://127.0.0.1:1234` por padrão.
* `config.ini` correto: `provider_server_address = http://127.0.0.1:1234` (ou sua porta real do servidor LM-Studio).
## URL base do SearxNG não fornecida
```
raise ValueError("SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.")
ValueError: SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.`
```
Isso pode acontecer se você executar o modo CLI com uma URL base do searxng incorreta.
SEARXNG_BASE_URL deve diferir dependendo se você está executando no Docker ou no host:
**Execução no host:** `SEARXNG_BASE_URL="http://localhost:8080"`
**Execução completamente no Docker (interface web):** `SEARXNG_BASE_URL="http://searxng:8080"`
## FAQ
**P: De qual hardware eu preciso?**
| Tamanho do modelo | GPU | Comentários |
|-----------|--------|-----------------------------------------------------------|
| 7B | 8GB VRAM | ⚠️ Não recomendado. Desempenho ruim, alucinações frequentes, agentes de planejamento podem falhar. |
| 14B | 12 GB VRAM (ex: RTX 3060) | ✅ Utilizável para tarefas simples. Pode ter dificuldades com navegação web e planejamento de tarefas. |
| 32B | 24+ GB VRAM (ex: RTX 4090) | 🚀 Consegue a maioria das tarefas, ainda pode ter dificuldades com planejamento de tarefas |
| 70B+ | 48+ GB VRAM | 💪 Excelente. Recomendado para casos de uso avançados. |
**P: O que fazer se eu encontrar erros?**
Certifique-se de que o local está funcionando (`ollama serve`), que seu `config.ini` corresponde ao seu provedor e que as dependências estão instaladas. Se nada funcionar, sinta-se à vontade para abrir um issue.
**P: Ele pode realmente funcionar 100% localmente?**
Sim, com os provedores Ollama, lm-studio ou server, todos os modelos de fala para texto, LLM e texto para fala funcionam localmente. As opções não locais (OpenAI ou outras APIs) são opcionais.
**P: Por que eu deveria usar o AgenticSeek quando tenho o Manus?**
Ao contrário do Manus, o AgenticSeek prioriza a independência de sistemas externos, dando a você mais controle, privacidade e evitando custos de API.
**P: Quem está por trás deste projeto?**
Este projeto foi criado por mim, com dois amigos como mantenedores e contribuidores da comunidade de código aberto no GitHub. Somos apenas indivíduos apaixonados, não uma startup, nem afiliados a qualquer organização.
Qualquer conta AgenticSeek no X diferente da minha conta pessoal (https://x.com/Martin993886460) é um impostor.
## Contribuir
Estamos procurando desenvolvedores para melhorar o AgenticSeek! Verifique os problemas abertos ou discussões.
[Guia de contribuição](./docs/CONTRIBUTING.md)
## Patrocinadores:
Você quer melhorar as capacidades do AgenticSeek com recursos como pesquisa de voos, planejamento de viagens ou obtenção das melhores ofertas de compra? Considere usar o SerpApi para criar ferramentas personalizadas que desbloqueiem mais recursos do tipo Jarvis. Com o SerpApi, você pode acelerar seu agente para tarefas profissionais enquanto mantém o controle total.
<a href="https://serpapi.com/"><img src="./media/banners/sponsor_banner_serpapi.png" height="350" alt="SerpApi Banner" ></a>
Confira [Contributing.md](./docs/CONTRIBUTING.md) para aprender como integrar ferramentas personalizadas!
### **Patrocinadores**:
- [tatra-labs](https://github.com/tatra-labs)
## Mantenedores:
> [Fosowl](https://github.com/Fosowl) | Horário de Paris
> [antoineVIVIES](https://github.com/antoineVIVIES) | Horário de Taipei
## Agradecimentos especiais:
> [tcsenpai](https://github.com/tcsenpai) e [plitc](https://github.com/plitc) por ajudar na dockerização do backend
[![Star History Chart](https://api.star-history.com/svg?repos=Fosowl/agenticSeek&type=Date)](https://www.star-history.com/#Fosowl/agenticSeek&Date)
+692
View File
@@ -0,0 +1,692 @@
# AgenticSeek: Gizlilik Odaklı, Yerel Manus Alternatifi
<p align="center">
<img align="center" src="./media/agentic_seek_logo.png" width="300" height="300" alt="Agentic Seek Logo">
<p>
English | [中文](./README_CHS.md) | [繁體中文](./README_CHT.md) | [Français](./README_FR.md) | [日本語](./README_JP.md) | [Português (Brasil)](./README_PTBR.md) | [Español](./README_ES.md) | [Türkçe](./README_TR.md)
*Sesli komut destekli bu yapay zeka asistanı, **Manus AI'ya %100 yerel bir alternatiftir**. Web'de otonom olarak gezinir, kod yazar ve görevleri planlar; tüm verilerinizi cihazınızda tutar. Yerel akıl yürütme modelleri için tasarlanmış olup tamamen kendi donanımınızda çalışır, eksiksiz gizlilik ve sıfır bulut bağımlılığı sağlar.*
[![AgenticSeek'i Ziyaret Et](https://img.shields.io/static/v1?label=Website&message=AgenticSeek&color=blue&style=flat-square)](https://fosowl.github.io/agenticSeek.html) ![License](https://img.shields.io/badge/license-GPL--3.0-green) [![Discord](https://img.shields.io/badge/Discord-Join%20Us-7289DA?logo=discord&logoColor=white)](https://discord.gg/8hGDaME3TC) [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/fosowl.svg?style=social&label=Update%20%40Fosowl)](https://x.com/Martin993886460) [![GitHub stars](https://img.shields.io/github/stars/Fosowl/agenticSeek?style=social)](https://github.com/Fosowl/agenticSeek/stargazers)
### Neden AgenticSeek?
* 🔒 Tamamen Yerel ve Gizli - Her şey kendi makinenizde çalışır — bulut yok, veri paylaşımı yok. Dosyalarınız, konuşmalarınız ve aramalarınız gizli kalır.
* 🌐 Akıllı Web Tarama - AgenticSeek internette kendi başına gezinebilir — arama yapar, okur, bilgi çıkarır, web formlarını doldurur — tamamen eller serbest.
* 💻 Otonom Kodlama Asistanı - Koda mı ihtiyacınız var? Python, C, Go, Java ve daha fazlasında program yazabilir, hata ayıklayabilir ve çalıştırabilir — denetim olmadan.
* 🧠 Akıllı Ajan Seçimi - Siz sorarsınız, o otomatik olarak iş için en uygun ajanı belirler. Elinizin altında uzmanlardan oluşan bir ekip gibi.
* 📋 Karmaşık Görevleri Planlar ve Yürütür - Seyahat planlamasından karmaşık projelere kadar — büyük görevleri adımlara bölebilir ve birden fazla yapay zeka ajanı kullanarak işleri tamamlayabilir.
* 🎙️ Ses Desteği - Temiz, hızlı, fütüristik ses ve konuşmadan metne dönüştürme ile bilim kurgu filmlerindeki kişisel yapay zekanızla konuşuyormuş gibi etkileşim kurabilirsiniz. (Geliştirme aşamasında)
### **Demo**
> *AgenticSeek projesini arayabilir misin, hangi becerilerin gerektiğini öğrenip ardından CV_candidates.zip dosyasını açarak projeye en uygun adayları söyleyebilir misin?*
https://github.com/user-attachments/assets/b8ca60e9-7b3b-4533-840e-08f9ac426316
Uyarı: Bu demo ve görünen tüm dosyalar (ör: CV_candidates.zip) tamamen kurgusaldır. Bir şirket değiliz, aday değil açık kaynak katkıda bulunanlar arıyoruz.
> 🛠⚠️ **Aktif Olarak Geliştirilmektedir**
> 🙏 Bu proje bir yan proje olarak başladı ve sıfır yol haritası, sıfır finansmanla geliştirilmektedir. GitHub Trending'e girerek beklentilerin çok ötesine geçti. Katkılar, geri bildirimler ve sabır derinden takdir edilmektedir.
## Ön Gereksinimler
Başlamadan önce aşağıdaki yazılımların yüklü olduğundan emin olun:
* **Git:** Depoyu klonlamak için. [Git İndir](https://git-scm.com/downloads)
* **Python 3.10.x:** Python 3.10.x sürümünü kullanmanızı şiddetle tavsiye ederiz. Diğer sürümler bağımlılık hatalarına yol açabilir. [Python 3.10 İndir](https://www.python.org/downloads/release/python-3100/) (3.10.x sürümünü seçin).
* **Docker Engine ve Docker Compose:** SearxNG gibi paketlenmiş servisleri çalıştırmak için.
* Docker Desktop yükleyin (Docker Compose V2 dahildir): [Windows](https://docs.docker.com/desktop/install/windows-install/) | [Mac](https://docs.docker.com/desktop/install/mac-install/) | [Linux](https://docs.docker.com/desktop/install/linux-install/)
* Alternatif olarak, Linux üzerinde Docker Engine ve Docker Compose'u ayrı ayrı yükleyin: [Docker Engine](https://docs.docker.com/engine/install/) | [Docker Compose](https://docs.docker.com/compose/install/) (Compose V2 yüklediğinizden emin olun, ör: `sudo apt-get install docker-compose-plugin`).
### 1. **Depoyu klonlayın ve kurulumu yapın**
```sh
git clone https://github.com/Fosowl/agenticSeek.git
cd agenticSeek
mv .env.example .env
```
### 2. .env dosyasının içeriğini değiştirin
```sh
SEARXNG_BASE_URL="http://searxng:8080" # CLI modunda çalıştırıyorsanız http://127.0.0.1:8080 kullanın
REDIS_BASE_URL="redis://redis:6379/0"
WORK_DIR="/Users/mlg/Documents/workspace_for_ai"
OLLAMA_PORT="11434"
LM_STUDIO_PORT="1234"
CUSTOM_ADDITIONAL_LLM_PORT="11435"
OPENAI_API_KEY='optional'
DEEPSEEK_API_KEY='optional'
OPENROUTER_API_KEY='optional'
TOGETHER_API_KEY='optional'
GOOGLE_API_KEY='optional'
ANTHROPIC_API_KEY='optional'
```
`.env` dosyasını ihtiyaçlarınıza göre güncelleyin:
- **SEARXNG_BASE_URL**: CLI modunda çalışmıyorsanız değiştirmeyin.
- **REDIS_BASE_URL**: Değiştirmeyin.
- **WORK_DIR**: Yerel makinenizdeki çalışma dizininin yolu. AgenticSeek bu dosyaları okuyabilir ve onlarla etkileşim kurabilir.
- **OLLAMA_PORT**: Ollama servisi için port numarası.
- **LM_STUDIO_PORT**: LM Studio servisi için port numarası.
- **CUSTOM_ADDITIONAL_LLM_PORT**: Ek özel LLM servisi için port.
**API anahtarları, LLM'yi yerel olarak çalıştırmayı tercih eden kullanıcılar için tamamen isteğe bağlıdır. Bu projenin birincil amacı da budur. Yeterli donanımınız varsa boş bırakın.**
### 3. **Docker'ı Başlatın**
Docker'ın sisteminizde yüklü ve çalışır durumda olduğundan emin olun. Docker'ı aşağıdaki komutlarla başlatabilirsiniz:
- **Linux/macOS:**
Terminal açın ve çalıştırın:
```sh
sudo systemctl start docker
```
Veya yüklüyse Docker Desktop'ı uygulama menüsünden başlatın.
- **Windows:**
Başlat menüsünden Docker Desktop'ı başlatın.
Docker'ın çalıştığını doğrulamak için:
```sh
docker info
```
Docker kurulumunuz hakkında bilgi görüyorsanız, düzgün çalışıyor demektir.
Özet için aşağıdaki [Yerel Sağlayıcılar](#yerel-sağlayıcılar-listesi) tablosuna bakın.
Sonraki adım: [AgenticSeek'i yerel olarak çalıştırın](#servisleri-başlatın-ve-çalıştırın)
*Sorun yaşıyorsanız [Sorun Giderme](#sorun-giderme) bölümüne bakın.*
*Donanımınız LLM'leri yerel olarak çalıştıramıyorsa [API ile Çalıştırma Kurulumu](#api-ile-çalıştırma-kurulumu) bölümüne bakın.*
*Ayrıntılı `config.ini` açıklamaları için [Yapılandırma](#yapılandırma) bölümüne bakın.*
---
## LLM'yi Makinenizde Yerel Olarak Çalıştırma Kurulumu
**Donanım Gereksinimleri:**
LLM'leri yerel olarak çalıştırmak için yeterli donanıma ihtiyacınız olacaktır. En azından Magistral, Qwen veya Deepseek 14B çalıştırabilecek bir GPU gereklidir. Ayrıntılı model/performans önerileri için SSS bölümüne bakın.
**Yerel sağlayıcınızı ayarlayın**
Yerel sağlayıcınızı başlatın (örneğin ollama ile):
AgenticSeek'i ana makinede (CLI modu) çalıştırmayacaksanız, sağlayıcı dinleme adresini ayarlayın:
```sh
export OLLAMA_HOST=0.0.0.0:11434
```
Ardından sağlayıcınızı başlatın:
```sh
ollama serve
```
Desteklenen yerel sağlayıcıların listesi için aşağıya bakın.
**config.ini dosyasını güncelleyin**
config.ini dosyasında provider_name'i desteklenen bir sağlayıcıya ve provider_model'i sağlayıcınızın desteklediği bir LLM'e ayarlayın. *Magistral* veya *Deepseek* gibi akıl yürütme modellerini öneriyoruz.
Gerekli donanım için README sonundaki **SSS** bölümüne bakın.
```sh
[MAIN]
is_local = True # Yerel mi yoksa uzak sağlayıcı ile mi çalıştırıyorsunuz.
provider_name = ollama # veya lm-studio, openai, vb.
provider_model = deepseek-r1:14b # donanımınıza uygun bir model seçin
provider_server_address = 127.0.0.1:11434
agent_name = Jarvis # yapay zekanızın adı
recover_last_session = True # önceki oturumu kurtarıp kurtarmayacağı
save_session = True # mevcut oturumu hatırlayıp hatırlamayacağı
speak = False # metinden sese dönüştürme
listen = False # sesten metne dönüştürme, yalnızca CLI için, deneysel
jarvis_personality = False # daha "Jarvis" benzeri bir kişilik kullanıp kullanmayacağı (deneysel)
languages = en zh # Dil listesi, metinden sese varsayılan olarak listedeki ilk dili kullanır
[BROWSER]
headless_browser = True # CLI modunda değilseniz değiştirmeyin.
stealth_mode = True # Tarayıcı algılamasını azaltmak için gizli selenium kullanır
```
**Uyarı**:
- `config.ini` dosya biçimi yorum satırlarını desteklemez.
Örnek yapılandırmayı doğrudan kopyalayıp yapıştırmayın, çünkü yorum satırları hatalara neden olur. Bunun yerine `config.ini` dosyasını yorum satırları olmadan istediğiniz ayarlarla manuel olarak düzenleyin.
- LLM çalıştırmak için LM-studio kullanıyorsanız provider_name'i `openai` olarak *AYARLAMAYIN*. `lm-studio` olarak ayarlayın.
- Bazı sağlayıcılar (ör: lm-studio) IP'nin önünde `http://` gerektirir. Örneğin: `http://127.0.0.1:1234`
**Yerel Sağlayıcılar Listesi**
| Sağlayıcı | Yerel mi? | Açıklama |
|-----------|--------|-----------------------------------------------------------|
| ollama | Evet | Ollama kullanarak LLM'leri kolayca yerel olarak çalıştırın |
| lm-studio | Evet | LM Studio ile LLM'leri yerel olarak çalıştırın (`provider_name` değerini `lm-studio` olarak ayarlayın)|
| openai | Evet | OpenAI uyumlu API kullanın (ör: llama.cpp sunucusu) |
Sonraki adım: [Servisleri başlatın ve AgenticSeek'i çalıştırın](#servisleri-başlatın-ve-çalıştırın)
*Sorun yaşıyorsanız [Sorun Giderme](#sorun-giderme) bölümüne bakın.*
*Donanımınız LLM'leri yerel olarak çalıştıramıyorsa [API ile Çalıştırma Kurulumu](#api-ile-çalıştırma-kurulumu) bölümüne bakın.*
*Ayrıntılı `config.ini` açıklamaları için [Yapılandırma](#yapılandırma) bölümüne bakın.*
## API ile Çalıştırma Kurulumu
Bu kurulum harici, bulut tabanlı LLM sağlayıcılarını kullanır. Seçtiğiniz servisten bir API anahtarına ihtiyacınız olacaktır.
**1. Bir API Sağlayıcısı Seçin ve API Anahtarı Alın:**
Aşağıdaki [API Sağlayıcıları Listesi](#api-sağlayıcıları-listesi) bölümüne bakın. Kaydolmak ve API anahtarı almak için web sitelerini ziyaret edin.
**2. API Anahtarınızı Ortam Değişkeni Olarak Ayarlayın:**
* **Linux/macOS:**
Terminal açın ve `export` komutunu kullanın. Kalıcılık için bunu shell profil dosyanıza (ör: `~/.bashrc`, `~/.zshrc`) eklemeniz önerilir.
```sh
export PROVIDER_API_KEY="api_anahtarınız"
# PROVIDER_API_KEY'i ilgili değişken adıyla değiştirin, ör: OPENAI_API_KEY, GOOGLE_API_KEY
```
TogetherAI örneği:
```sh
export TOGETHER_API_KEY="xxxxxxxxxxxxxxxxxxxxxx"
```
* **Windows:**
* **Komut İstemi (Geçerli oturum için geçici):**
```cmd
set PROVIDER_API_KEY=api_anahtarınız
```
* **PowerShell (Geçerli oturum için geçici):**
```powershell
$env:PROVIDER_API_KEY="api_anahtarınız"
```
* **Kalıcı:** Windows arama çubuğunda "ortam değişkenleri" arayın, "Sistem ortam değişkenlerini düzenle" seçeneğine tıklayın, ardından "Ortam Değişkenleri..." düğmesine tıklayın. Uygun adla (ör: `OPENAI_API_KEY`) yeni bir Kullanıcı değişkeni ekleyin ve değer olarak anahtarınızı girin.
*(Daha fazla ayrıntı için SSS: [API anahtarlarını nasıl ayarlarım?](#api-anahtarlarını-nasıl-ayarlarım) bölümüne bakın.)*
**3. `config.ini` Dosyasını Güncelleyin:**
```ini
[MAIN]
is_local = False
provider_name = openai # Veya google, deepseek, togetherAI, huggingface
provider_model = gpt-3.5-turbo # Veya gemini-1.5-flash, deepseek-chat, mistralai/Mixtral-8x7B-Instruct-v0.1 vb.
provider_server_address = # is_local = False olduğunda çoğu API için genellikle yok sayılır veya boş bırakılabilir
# ... diğer ayarlar ...
```
*Uyarı:* config.ini değerlerinin sonunda boşluk olmadığından emin olun.
**API Sağlayıcıları Listesi**
| Sağlayıcı | `provider_name` | Yerel mi? | Açıklama | API Anahtarı Bağlantısı (Örnekler) |
|--------------|-----------------|--------|---------------------------------------------------|---------------------------------------------|
| OpenAI | `openai` | Hayır | OpenAI API'si üzerinden ChatGPT modellerini kullanın. | [platform.openai.com/signup](https://platform.openai.com/signup) |
| Google Gemini| `google` | Hayır | Google AI Studio üzerinden Google Gemini modellerini kullanın. | [aistudio.google.com/keys](https://aistudio.google.com/keys) |
| Deepseek | `deepseek` | Hayır | Deepseek API'si üzerinden Deepseek modellerini kullanın. | [platform.deepseek.com](https://platform.deepseek.com) |
| Hugging Face | `huggingface` | Hayır | Hugging Face Inference API'den modelleri kullanın. | [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens) |
| TogetherAI | `togetherAI` | Hayır | TogetherAI API'si üzerinden çeşitli açık kaynak modelleri kullanın.| [api.together.ai/settings/api-keys](https://api.together.ai/settings/api-keys) |
| OpenRouter | `openrouter` | Hayır | OpenRouter Modellerini kullanın| [https://openrouter.ai/](https://openrouter.ai/) |
*Not:*
* Karmaşık web tarama ve görev planlama için `gpt-4o` veya diğer OpenAI modellerini kullanmanızı önermiyoruz, çünkü mevcut prompt optimizasyonları Deepseek gibi modellere yöneliktir.
* Kodlama/bash görevleri Gemini ile sorun yaşayabilir, çünkü Deepseek için optimize edilmiş biçimlendirme talimatlarına kesinlikle uymayabilir.
* `is_local = False` olduğunda `config.ini` içindeki `provider_server_address` genellikle kullanılmaz, çünkü API uç noktaları genellikle ilgili sağlayıcı kütüphanesinde sabit kodlanmıştır.
Sonraki adım: [Servisleri başlatın ve AgenticSeek'i çalıştırın](#servisleri-başlatın-ve-çalıştırın)
*Sorun yaşıyorsanız **Bilinen Sorunlar** bölümüne bakın*
*Ayrıntılı yapılandırma dosyası açıklamaları için **Yapılandırma** bölümüne bakın.*
---
## Servisleri Başlatın ve Çalıştırın
Varsayılan olarak AgenticSeek tamamen Docker içinde çalıştırılır.
**Seçenek 1:** Docker'da çalıştırın, web arayüzünü kullanın:
Gerekli servisleri başlatın. Bu, docker-compose.yml'deki tüm servisleri başlatacaktır:
- searxng
- redis (searxng için gerekli)
- frontend
- backend (web arayüzü kullanırken `full` parametresi ile)
```sh
./start_services.sh full # MacOS
start start_services.cmd full # Windows
```
**Uyarı:** Bu adım tüm Docker imajlarını indirip yükleyecektir, bu işlem 30 dakikaya kadar sürebilir. Servisleri başlattıktan sonra, herhangi bir mesaj göndermeden önce backend servisinin tamamen çalışır duruma gelmesini bekleyin (loglarda **backend: "GET /health HTTP/1.1" 200 OK** mesajını görmelisiniz). İlk çalıştırmada backend servisinin başlaması 5 dakika sürebilir.
`http://localhost:3000/` adresine gidin ve web arayüzünü görmelisiniz.
*Servis başlatma sorun giderme:* Bu betikler başarısız olursa, Docker Engine'in çalıştığından ve Docker Compose'un (V2, `docker compose`) doğru şekilde yüklendiğinden emin olun. Hata mesajları için terminal çıktısını kontrol edin. Bkz. [SSS: AgenticSeek'i veya betiklerini çalıştırırken hata alıyorum.](#sss-sorun-giderme)
**Seçenek 2:** CLI modu:
CLI arayüzü ile çalıştırmak için paketleri ana makineye yüklemeniz gerekir:
```sh
./install.sh
./install.bat # windows
```
Ardından `config.ini` içindeki SEARXNG_BASE_URL değerini şu şekilde değiştirmelisiniz:
```sh
SEARXNG_BASE_URL="http://localhost:8080"
```
Gerekli servisleri başlatın. Bu, docker-compose.yml'deki bazı servisleri başlatacaktır:
- searxng
- redis (searxng için gerekli)
- frontend
```sh
./start_services.sh # MacOS
start start_services.cmd # Windows
```
Çalıştırın: `uv run python -m ensurepip` komutu ile uv'nin pip'i etkin olduğundan emin olun.
CLI'yi kullanın: `uv run cli.py`
---
## Kullanım
Servislerin `./start_services.sh full` ile çalıştığından emin olun ve web arayüzü için `localhost:3000` adresine gidin.
Yapılandırmada `listen = True` ayarlayarak konuşmadan metne dönüştürmeyi de kullanabilirsiniz. Yalnızca CLI modu için.
Çıkmak için `goodbye` yazın/söyleyin.
İşte bazı kullanım örnekleri:
> *Python'da bir yılan oyunu yap!*
> *Rennes, Fransa'daki en iyi kafeleri internette ara ve adres bilgileriyle birlikte üçünü rennes_cafes.txt dosyasına kaydet.*
> *Bir sayının faktöriyelini hesaplayan bir Go programı yaz, çalışma alanına factorial.go olarak kaydet*
> *summer_pictures klasöründeki tüm JPG dosyalarını ara, bugünün tarihiyle yeniden adlandır ve yeniden adlandırılan dosyaların listesini photos_list.txt dosyasına kaydet*
> *2024'ün popüler bilim kurgu filmlerini internette ara ve bu gece izlemek için üçünü seç. Listeyi movie_night.txt dosyasına kaydet.*
> *2025'in en son yapay zeka haberleri makalelerini internette ara, üçünü seç ve başlıklarını ve özetlerini kazımak için bir Python betiği yaz. Betiği news_scraper.py olarak ve özetleri /home/projects içinde ai_news.txt olarak kaydet*
> *Cuma, internette ücretsiz bir hisse senedi fiyat API'si ara, supersuper7434567@gmail.com ile kaydol ve ardından API'yi kullanarak Tesla'nın günlük fiyatlarını çekmek için bir Python betiği yaz, sonuçları stock_prices.csv dosyasına kaydet*
*Form doldurma yeteneklerinin hâlâ deneysel olduğunu ve başarısız olabileceğini unutmayın.*
Sorgunuzu yazdıktan sonra AgenticSeek göreve en uygun ajanı atayacaktır.
Bu erken bir prototip olduğundan, ajan yönlendirme sistemi sorgunuza göre her zaman doğru ajanı atamayabilir.
Bu nedenle, ne istediğiniz ve yapay zekanın nasıl ilerlemesi gerektiği konusunda çok açık olun. Örneğin, web araması yapmasını istiyorsanız şunu demeyin:
`Solo seyahat için iyi ülkeler biliyor musun?`
Bunun yerine şöyle sorun:
`Web araması yap ve solo seyahat için en iyi ülkeleri bul`
---
## **LLM'yi Kendi Sunucunuzda Çalıştırma Kurulumu**
Güçlü bir bilgisayarınız veya kullanabileceğiniz bir sunucunuz varsa, ancak dizüstü bilgisayarınızdan kullanmak istiyorsanız, özel LLM sunucumuzu kullanarak LLM'yi uzak bir sunucuda çalıştırma seçeneğiniz vardır.
Yapay zeka modelini çalıştıracak "sunucunuzda" IP adresini alın
```sh
ip a | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}' | cut -d/ -f1 # yerel IP
curl https://ipinfo.io/ip # genel IP
```
Not: Windows veya macOS için IP adresini bulmak üzere sırasıyla ipconfig veya ifconfig kullanın.
Depoyu klonlayın ve `server/` klasörüne girin.
```sh
git clone --depth 1 https://github.com/Fosowl/agenticSeek.git
cd agenticSeek/llm_server/
```
Sunucuya özel gereksinimleri yükleyin:
```sh
pip3 install -r requirements.txt
```
Sunucu betiğini çalıştırın.
```sh
python3 app.py --provider ollama --port 3333
```
LLM servisi olarak `ollama` veya `llamacpp` arasında seçim yapabilirsiniz.
Şimdi kişisel bilgisayarınızda:
`config.ini` dosyasında `provider_name` değerini `server` ve `provider_model` değerini `deepseek-r1:xxb` olarak ayarlayın.
`provider_server_address` değerini modeli çalıştıracak makinenin IP adresine ayarlayın.
```sh
[MAIN]
is_local = False
provider_name = server
provider_model = deepseek-r1:70b
provider_server_address = http://x.x.x.x:3333
```
Sonraki adım: [Servisleri başlatın ve AgenticSeek'i çalıştırın](#servisleri-başlatın-ve-çalıştırın)
---
## Konuşmadan Metne
Uyarı: Konuşmadan metne özelliği şu anda yalnızca CLI modunda çalışmaktadır.
Konuşmadan metne özelliğinin şu anda yalnızca İngilizce dilinde çalıştığını lütfen unutmayın.
Konuşmadan metne işlevi varsayılan olarak devre dışıdır. Etkinleştirmek için config.ini dosyasında listen seçeneğini True olarak ayarlayın:
```
listen = True
```
Etkinleştirildiğinde, konuşmadan metne özelliği girdinizi işlemeye başlamadan önce bir tetikleyici anahtar kelimeyi (ajanın adı) dinler. Ajanın adını *config.ini* dosyasındaki `agent_name` değerini güncelleyerek özelleştirebilirsiniz:
```
agent_name = Friday
```
En iyi tanıma performansı için ajan adı olarak "John" veya "Emma" gibi yaygın bir İngilizce isim kullanmanızı öneririz.
Transkript görünmeye başladığında, uyandırmak için ajanın adını yüksek sesle söyleyin (ör: "Friday").
Sorgunuzu net bir şekilde söyleyin.
Sisteme devam etmesi gerektiğini bildirmek için isteğinizi bir onay ifadesiyle bitirin. Onay ifadesi örnekleri:
```
"do it", "go ahead", "execute", "run", "start", "thanks", "would ya", "please", "okay?", "proceed", "continue", "go on", "do that", "go it", "do you understand?"
```
## Yapılandırma
Örnek yapılandırma:
```
[MAIN]
is_local = True
provider_name = ollama
provider_model = deepseek-r1:32b
provider_server_address = http://127.0.0.1:11434 # Ollama örneği; LM-Studio için http://127.0.0.1:1234 kullanın
agent_name = Friday
recover_last_session = False
save_session = False
speak = False
listen = False
jarvis_personality = False
languages = en zh # TTS ve potansiyel yönlendirme için dil listesi.
[BROWSER]
headless_browser = False
stealth_mode = False
```
**`config.ini` Ayarlarının Açıklaması**:
* **`[MAIN]` Bölümü:**
* `is_local`: Yerel LLM sağlayıcısı (Ollama, LM-Studio, yerel OpenAI uyumlu sunucu) veya kendi barındırdığınız sunucu seçeneğini kullanıyorsanız `True`. Bulut tabanlı API (OpenAI, Google, vb.) kullanıyorsanız `False`.
* `provider_name`: LLM sağlayıcısını belirtir.
* Yerel seçenekler: `ollama`, `lm-studio`, `openai` (yerel OpenAI uyumlu sunucular için), `server` (kendi barındırdığınız sunucu kurulumu için).
* API seçenekleri: `openai`, `google`, `deepseek`, `huggingface`, `togetherAI`.
* `provider_model`: Seçilen sağlayıcı için belirli model adı veya kimliği (ör: Ollama için `deepseekcoder:6.7b`, OpenAI API için `gpt-3.5-turbo`, TogetherAI için `mistralai/Mixtral-8x7B-Instruct-v0.1`).
* `provider_server_address`: LLM sağlayıcınızın adresi.
* Yerel sağlayıcılar için: ör: Ollama için `http://127.0.0.1:11434`, LM-Studio için `http://127.0.0.1:1234`.
* `server` sağlayıcı türü için: Kendi barındırdığınız LLM sunucunuzun adresi (ör: `http://sunucu_ip_adresiniz:3333`).
* Bulut API'leri (`is_local = False`) için: Genellikle yok sayılır veya boş bırakılabilir, çünkü API uç noktası genellikle istemci kütüphanesi tarafından işlenir.
* `agent_name`: Yapay zeka asistanının adı (ör: Friday). Etkinleştirilmişse konuşmadan metne için tetikleyici kelime olarak kullanılır.
* `recover_last_session`: Önceki oturumun durumunu kurtarmaya çalışmak için `True`, yeni başlamak için `False`.
* `save_session`: Mevcut oturumun durumunu olası kurtarma için kaydetmek için `True`, aksi takdirde `False`.
* `speak`: Metinden sese sesli çıktıyı etkinleştirmek için `True`, devre dışı bırakmak için `False`.
* `listen`: Konuşmadan metne sesli girdiyi etkinleştirmek için `True` (yalnızca CLI modu), devre dışı bırakmak için `False`.
* `work_dir`: **Kritik:** AgenticSeek'in dosya okuyacağı/yazacağı dizin. **Bu yolun sisteminizde geçerli ve erişilebilir olduğundan emin olun.**
* `jarvis_personality`: Daha "Jarvis-benzeri" bir sistem istemi kullanmak için `True` (deneysel), standart istem için `False`.
* `languages`: Virgülle ayrılmış dil listesi (ör: `en, zh, fr`). TTS ses seçimi için kullanılır (varsayılan olarak ilki) ve LLM yönlendiricisine yardımcı olabilir. Yönlendirici verimliliği için çok fazla veya çok benzer dil kullanmaktan kaçının.
* **`[BROWSER]` Bölümü:**
* `headless_browser`: Otomatik tarayıcıyı görünür pencere olmadan çalıştırmak için `True` (web arayüzü veya etkileşimsiz kullanım için önerilir). Tarayıcı penceresini göstermek için `False` (CLI modu veya hata ayıklama için kullanışlıdır).
* `stealth_mode`: Tarayıcı otomasyonunun tespit edilmesini zorlaştıran önlemleri etkinleştirmek için `True`. Anticaptcha gibi tarayıcı eklentilerinin manuel olarak yüklenmesini gerektirebilir.
Bu bölüm desteklenen LLM sağlayıcı türlerini özetler. `config.ini` dosyasında yapılandırın.
**Yerel Sağlayıcılar (Kendi Donanımınızda Çalışır):**
| `config.ini`'deki Sağlayıcı Adı | `is_local` | Açıklama | Kurulum Bölümü |
|-------------------------------|------------|-----------------------------------------------------------------------------|------------------------------------------------------------------|
| `ollama` | `True` | Ollama kullanarak yerel LLM'leri sunun. | [LLM'yi yerel olarak çalıştırma kurulumu](#llmyi-makinenizde-yerel-olarak-çalıştırma-kurulumu) |
| `lm-studio` | `True` | LM-Studio kullanarak yerel LLM'leri sunun. | [LLM'yi yerel olarak çalıştırma kurulumu](#llmyi-makinenizde-yerel-olarak-çalıştırma-kurulumu) |
| `openai` (yerel sunucu için) | `True` | OpenAI uyumlu API sunan yerel bir sunucuya bağlanın (ör: llama.cpp). | [LLM'yi yerel olarak çalıştırma kurulumu](#llmyi-makinenizde-yerel-olarak-çalıştırma-kurulumu) |
| `server` | `False` | Başka bir makinede çalışan AgenticSeek kendi barındırmalı LLM sunucusuna bağlanın. | [LLM'yi kendi sunucunuzda çalıştırma kurulumu](#llmyi-kendi-sunucunuzda-çalıştırma-kurulumu) |
**API Sağlayıcıları (Bulut Tabanlı):**
| `config.ini`'deki Sağlayıcı Adı | `is_local` | Açıklama | Kurulum Bölümü |
|-------------------------------|------------|--------------------------------------------------|-----------------------------------------------------|
| `openai` | `False` | OpenAI'ın resmi API'sini kullanın (ör: GPT-3.5, GPT-4). | [API ile çalıştırma kurulumu](#api-ile-çalıştırma-kurulumu) |
| `google` | `False` | Google Gemini modellerini API üzerinden kullanın. | [API ile çalıştırma kurulumu](#api-ile-çalıştırma-kurulumu) |
| `deepseek` | `False` | Deepseek'in resmi API'sini kullanın. | [API ile çalıştırma kurulumu](#api-ile-çalıştırma-kurulumu) |
| `huggingface` | `False` | Hugging Face Inference API'yi kullanın. | [API ile çalıştırma kurulumu](#api-ile-çalıştırma-kurulumu) |
| `togetherAI` | `False` | TogetherAI API'si üzerinden çeşitli açık modelleri kullanın. | [API ile çalıştırma kurulumu](#api-ile-çalıştırma-kurulumu) |
---
## Sorun Giderme
Sorunlarla karşılaşırsanız bu bölüm rehberlik sağlar.
# Bilinen Sorunlar
## ChromeDriver Sorunları
**Hata Örneği:** `SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version XXX`
### Temel Neden
ChromeDriver sürüm uyumsuzluğu şu durumlarda oluşur:
1. Yüklü ChromeDriver sürümünüz Chrome tarayıcı sürümünüzle eşleşmiyor
2. Docker ortamlarında `undetected_chromedriver`, bağlanan ikili dosyayı atlayarak kendi ChromeDriver sürümünü indirebilir
### Çözüm Adımları
#### 1. Chrome Sürümünüzü Kontrol Edin
Google Chrome'u açın → `Ayarlar > Chrome Hakkında` bölümünden sürümünüzü bulun (ör: "Sürüm 134.0.6998.88")
#### 2. Eşleşen ChromeDriver'ı İndirin
**Chrome 115 ve sonrası için:** [Chrome for Testing API](https://googlechromelabs.github.io/chrome-for-testing/) kullanın
- Chrome for Testing uygunluk panosunu ziyaret edin
- Chrome sürümünüzü veya en yakın eşleşmeyi bulun
- İşletim sisteminiz için ChromeDriver'ı indirin (Docker ortamları için Linux64)
**Eski Chrome sürümleri için:** [Eski ChromeDriver indirmeleri](https://chromedriver.chromium.org/downloads) kullanın
![Chrome for Testing'den ChromeDriver İndirin](./media/chromedriver_readme.png)
#### 3. ChromeDriver'ı Yükleyin (Bir Yöntem Seçin)
**Yöntem A: Proje Kök Dizini (Docker için Önerilir)**
```bash
# İndirilen chromedriver ikili dosyasını proje kök dizinine yerleştirin
cp path/to/downloaded/chromedriver ./chromedriver
chmod +x ./chromedriver # Linux/macOS'ta çalıştırılabilir yapın
```
**Yöntem B: Sistem PATH'i**
```bash
# Linux/macOS
sudo mv chromedriver /usr/local/bin/
sudo chmod +x /usr/local/bin/chromedriver
# Windows: chromedriver.exe dosyasını PATH'inizdeki bir klasöre yerleştirin
```
#### 4. Kurulumu Doğrulayın
```bash
# ChromeDriver sürümünü test edin
./chromedriver --version
# Veya PATH'teyse:
chromedriver --version
```
### Docker'a Özel Notlar
⚠️ **Docker Kullanıcıları İçin Önemli:**
- Docker volume mount yaklaşımı gizli modda (`undetected_chromedriver`) çalışmayabilir
- **Çözüm**: ChromeDriver'ı proje kök dizinine `./chromedriver` olarak yerleştirin
- Uygulama bu ikili dosyayı otomatik olarak algılayıp kullanacaktır
- Loglarda şunu görmelisiniz: `"Using ChromeDriver from project root: ./chromedriver"`
### Sorun Giderme İpuçları
1. **Hâlâ sürüm uyumsuzluğu mu var?**
- ChromeDriver'ın çalıştırılabilir olduğunu doğrulayın: `ls -la ./chromedriver`
- ChromeDriver sürümünü kontrol edin: `./chromedriver --version`
- Chrome tarayıcı sürümünüzle eşleştiğinden emin olun
2. **Docker container sorunları mı var?**
- Backend loglarını kontrol edin: `docker logs backend`
- Şu mesajı arayın: `"Using ChromeDriver from project root"`
- Bulunamazsa dosyanın var olduğunu ve çalıştırılabilir olduğunu doğrulayın
3. **Chrome for Testing sürümleri**
- Mümkün olduğunca tam sürüm eşleşmesi kullanın
- 134.0.6998.88 sürümü için ChromeDriver 134.0.6998.165 kullanın (en yakın mevcut sürüm)
- Ana sürüm numaraları eşleşmelidir (134 = 134)
### Sürüm Uyumluluk Matrisi
| Chrome Sürümü | ChromeDriver Sürümü | Durum |
|----------------|---------------------|---------|
| 134.0.6998.x | 134.0.6998.165 | ✅ Çalışır |
| 133.0.6943.x | 133.0.6943.141 | ✅ Çalışır |
| 132.0.6834.x | 132.0.6834.159 | ✅ Çalışır |
*En güncel uyumluluk için [Chrome for Testing panosunu](https://googlechromelabs.github.io/chrome-for-testing/) kontrol edin*
`Exception: Failed to initialize browser: Message: session not created: This version of ChromeDriver only supports Chrome version 113
Current browser version is 134.0.6998.89 with binary path`
Bu hata, tarayıcınız ve chromedriver sürümü arasında uyumsuzluk varsa oluşur.
En son sürümü indirmek için şu adrese gidin:
https://developer.chrome.com/docs/chromedriver/downloads
Chrome sürüm 115 veya daha yenisini kullanıyorsanız:
https://googlechromelabs.github.io/chrome-for-testing/
adresinden işletim sisteminize uygun chromedriver sürümünü indirin.
![alt text](./media/chromedriver_readme.png)
Bu bölüm eksikse lütfen bir issue açın.
## Bağlantı Adaptörü Sorunları
```
Exception: Provider lm-studio failed: HTTP request failed: No connection adapters were found for '127.0.0.1:1234/v1/chat/completions'` (Not: port değişebilir)
```
* **Neden:** `config.ini` dosyasında `lm-studio` (veya benzeri yerel OpenAI uyumlu sunucular) için `provider_server_address` değerinde `http://` öneki eksik veya yanlış porta yönlendiriliyor.
* **Çözüm:**
* Adresin `http://` içerdiğinden emin olun. LM-Studio varsayılan olarak genellikle `http://127.0.0.1:1234` kullanır.
* Doğru `config.ini`: `provider_server_address = http://127.0.0.1:1234` (veya gerçek LM-Studio sunucu portunuz).
## SearxNG Temel URL'si Belirtilmemiş
```
raise ValueError("SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.")
ValueError: SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.`
```
Bu hata, CLI modunu yanlış SearxNG temel URL'si ile çalıştırdığınızda oluşabilir.
SEARXNG_BASE_URL, Docker'da mı yoksa ana makinede mi çalıştırdığınıza göre değişmelidir:
**Ana makinede çalıştırma**: `SEARXNG_BASE_URL="http://localhost:8080"`
**Tamamen Docker'da çalıştırma (web arayüzü)**: `SEARXNG_BASE_URL="http://searxng:8080"`
## SSS
**S: Hangi donanıma ihtiyacım var?**
| Model Boyutu | GPU | Yorum |
|-----------|--------|-----------------------------------------------------------|
| 7B | 8GB VRAM | ⚠️ Önerilmez. Düşük performans, sık halüsinasyonlar ve planlayıcı ajanlar büyük olasılıkla başarısız olur. |
| 14B | 12 GB VRAM (ör: RTX 3060) | ✅ Basit görevler için kullanılabilir. Web tarama ve planlama görevlerinde zorlanabilir. |
| 32B | 24+ GB VRAM (ör: RTX 4090) | 🚀 Çoğu görevde başarılı, görev planlamasında hâlâ zorlanabilir |
| 70B+ | 48+ GB VRAM | 💪 Mükemmel. Gelişmiş kullanım senaryoları için önerilir. |
**S: Hata alıyorum, ne yapmalıyım?**
Yerel sunucunun çalıştığından (`ollama serve`), `config.ini` dosyanızın sağlayıcınızla eşleştiğinden ve bağımlılıkların yüklü olduğundan emin olun. Hiçbiri işe yaramazsa bir issue açmaktan çekinmeyin.
**S: Gerçekten %100 yerel çalışabilir mi?**
Evet, Ollama, lm-studio veya server sağlayıcıları ile tüm konuşmadan metne, LLM ve metinden sese modelleri yerel olarak çalışır. Yerel olmayan seçenekler (OpenAI veya diğer API'ler) isteğe bağlıdır.
**S: Manus varken neden AgenticSeek kullanmalıyım?**
Manus'un aksine, AgenticSeek harici sistemlerden bağımsızlığa öncelik verir, size daha fazla kontrol, gizlilik ve API maliyetinden kaçınma imkânı sunar.
**S: Projenin arkasında kim var?**
Proje benim tarafımdan, bakımcı olarak görev yapan iki arkadaşım ve GitHub'daki açık kaynak topluluğundan katkıda bulunanlarla birlikte oluşturuldu. Bir startup veya herhangi bir kuruluşla bağlantılı değiliz, sadece tutkulu bireylerden oluşan bir grubuz.
X'te kişisel hesabım (https://x.com/Martin993886460) dışındaki herhangi bir AgenticSeek hesabı taklittir.
## Katkıda Bulunma
AgenticSeek'i geliştirmek için geliştiriciler arıyoruz! Açık issue'lara veya tartışmalara göz atın.
[Katkıda bulunma rehberi](./docs/CONTRIBUTING.md)
## Sponsorlar:
AgenticSeek'in yeteneklerini uçuş arama, seyahat planlama veya en iyi alışveriş fırsatlarını yakalama gibi özelliklerle geliştirmek ister misiniz? Daha fazla Jarvis benzeri yetenek açmak için SerpApi ile özel bir araç oluşturmayı düşünün. SerpApi ile, tam kontrolü elinizde tutarken ajanınızı özel görevler için güçlendirebilirsiniz.
<a href="https://serpapi.com/"><img src="./media/banners/sponsor_banner_serpapi.png" height="350" alt="SerpApi Banner" ></a>
Özel araçları nasıl entegre edeceğinizi öğrenmek için [Contributing.md](./docs/CONTRIBUTING.md) dosyasına bakın!
### **Patron Sponsor**:
- [tatra-labs](https://github.com/tatra-labs)
## Bakımcılar:
> [Fosowl](https://github.com/Fosowl) | Paris Saati
> [antoineVIVIES](https://github.com/antoineVIVIES) | Taipei Saati
## Özel Teşekkürler:
> [tcsenpai](https://github.com/tcsenpai) ve [plitc](https://github.com/plitc) Backend dockerizasyonuna yardımları için
[![Star History Chart](https://api.star-history.com/svg?repos=Fosowl/agenticSeek&type=Date)](https://www.star-history.com/#Fosowl/agenticSeek&Date)
+73 -8
View File
@@ -22,6 +22,26 @@ from sources.utility import pretty_print
from sources.logger import Logger from sources.logger import Logger
from sources.schemas import QueryRequest, QueryResponse from sources.schemas import QueryRequest, QueryResponse
from dotenv import load_dotenv
load_dotenv()
def is_running_in_docker():
"""Detect if code is running inside a Docker container."""
# Method 1: Check for .dockerenv file
if os.path.exists('/.dockerenv'):
return True
# Method 2: Check cgroup
try:
with open('/proc/1/cgroup', 'r') as f:
return 'docker' in f.read()
except:
pass
return False
from celery import Celery from celery import Celery
@@ -49,6 +69,24 @@ def initialize_system():
personality_folder = "jarvis" if config.getboolean('MAIN', 'jarvis_personality') else "base" personality_folder = "jarvis" if config.getboolean('MAIN', 'jarvis_personality') else "base"
languages = config["MAIN"]["languages"].split(' ') languages = config["MAIN"]["languages"].split(' ')
# Force headless mode in Docker containers
headless = config.getboolean('BROWSER', 'headless_browser')
if is_running_in_docker() and not headless:
# Print prominent warning to console (visible in docker-compose output)
print("\n" + "*" * 70)
print("*** WARNING: Detected Docker environment - forcing headless_browser=True ***")
print("*** INFO: To see the browser, run 'python cli.py' on your host machine ***")
print("*" * 70 + "\n")
# Flush to ensure it's displayed immediately
sys.stdout.flush()
# Also log to file
logger.warning("Detected Docker environment - forcing headless_browser=True")
logger.info("To see the browser, run 'python cli.py' on your host machine instead")
headless = True
provider = Provider( provider = Provider(
provider_name=config["MAIN"]["provider_name"], provider_name=config["MAIN"]["provider_name"],
model=config["MAIN"]["provider_model"], model=config["MAIN"]["provider_model"],
@@ -58,7 +96,7 @@ def initialize_system():
logger.info(f"Provider initialized: {provider.provider_name} ({provider.model})") logger.info(f"Provider initialized: {provider.provider_name} ({provider.model})")
browser = Browser( browser = Browser(
create_driver(headless=config.getboolean('BROWSER', 'headless_browser'), stealth_mode=stealth_mode), create_driver(headless=headless, stealth_mode=stealth_mode, lang=languages[0]),
anticaptcha_manual_install=stealth_mode anticaptcha_manual_install=stealth_mode
) )
logger.info("Browser initialized") logger.info("Browser initialized")
@@ -128,6 +166,12 @@ async def is_active():
logger.info("Is active endpoint called") logger.info("Is active endpoint called")
return {"is_active": interaction.is_active} return {"is_active": interaction.is_active}
@api.get("/stop")
async def stop():
logger.info("Stop endpoint called")
interaction.current_agent.request_stop()
return JSONResponse(status_code=200, content={"status": "stopped"})
@api.get("/latest_answer") @api.get("/latest_answer")
async def get_latest_answer(): async def get_latest_answer():
global query_resp_history global query_resp_history
@@ -138,6 +182,7 @@ async def get_latest_answer():
query_resp = { query_resp = {
"done": "false", "done": "false",
"answer": interaction.current_agent.last_answer, "answer": interaction.current_agent.last_answer,
"reasoning": interaction.current_agent.last_reasoning,
"agent_name": interaction.current_agent.agent_name if interaction.current_agent else "None", "agent_name": interaction.current_agent.agent_name if interaction.current_agent else "None",
"success": interaction.current_agent.success, "success": interaction.current_agent.success,
"blocks": {f'{i}': block.jsonify() for i, block in enumerate(interaction.get_last_blocks_result())} if interaction.current_agent else {}, "blocks": {f'{i}': block.jsonify() for i, block in enumerate(interaction.get_last_blocks_result())} if interaction.current_agent else {},
@@ -145,27 +190,31 @@ async def get_latest_answer():
"uid": uid "uid": uid
} }
interaction.current_agent.last_answer = "" interaction.current_agent.last_answer = ""
interaction.current_agent.last_reasoning = ""
query_resp_history.append(query_resp) query_resp_history.append(query_resp)
return JSONResponse(status_code=200, content=query_resp) return JSONResponse(status_code=200, content=query_resp)
if query_resp_history: if query_resp_history:
return JSONResponse(status_code=200, content=query_resp_history[-1]) return JSONResponse(status_code=200, content=query_resp_history[-1])
return JSONResponse(status_code=404, content={"error": "No answer available"}) return JSONResponse(status_code=404, content={"error": "No answer available"})
async def think_wrapper(interaction, query, tts_enabled): async def think_wrapper(interaction, query):
try: try:
interaction.tts_enabled = tts_enabled
interaction.last_query = query interaction.last_query = query
logger.info("Agents request is being processed") logger.info("Agents request is being processed")
success = await interaction.think() success = await interaction.think()
if not success: if not success:
interaction.last_answer = "Error: No answer from agent" interaction.last_answer = "Error: No answer from agent"
interaction.last_reasoning = "Error: No reasoning from agent"
interaction.last_success = False interaction.last_success = False
else: else:
interaction.last_success = True interaction.last_success = True
pretty_print(interaction.last_answer)
interaction.speak_answer()
return success return success
except Exception as e: except Exception as e:
logger.error(f"Error in think_wrapper: {str(e)}") logger.error(f"Error in think_wrapper: {str(e)}")
interaction.last_answer = f"Error: {str(e)}" interaction.last_answer = f""
interaction.last_reasoning = f"Error: {str(e)}"
interaction.last_success = False interaction.last_success = False
raise e raise e
@@ -176,6 +225,7 @@ async def process_query(request: QueryRequest):
query_resp = QueryResponse( query_resp = QueryResponse(
done="false", done="false",
answer="", answer="",
reasoning="",
agent_name="Unknown", agent_name="Unknown",
success="false", success="false",
blocks={}, blocks={},
@@ -188,11 +238,12 @@ async def process_query(request: QueryRequest):
try: try:
is_generating = True is_generating = True
success = await think_wrapper(interaction, request.query, request.tts_enabled) success = await think_wrapper(interaction, request.query)
is_generating = False is_generating = False
if not success: if not success:
query_resp.answer = interaction.last_answer query_resp.answer = interaction.last_answer
query_resp.reasoning = interaction.last_reasoning
return JSONResponse(status_code=400, content=query_resp.jsonify()) return JSONResponse(status_code=400, content=query_resp.jsonify())
if interaction.current_agent: if interaction.current_agent:
@@ -207,11 +258,11 @@ async def process_query(request: QueryRequest):
logger.info(f"Blocks: {blocks_json}") logger.info(f"Blocks: {blocks_json}")
query_resp.done = "true" query_resp.done = "true"
query_resp.answer = interaction.last_answer query_resp.answer = interaction.last_answer
query_resp.reasoning = interaction.last_reasoning
query_resp.agent_name = interaction.current_agent.agent_name query_resp.agent_name = interaction.current_agent.agent_name
query_resp.success = str(interaction.last_success) query_resp.success = str(interaction.last_success)
query_resp.blocks = blocks_json query_resp.blocks = blocks_json
# Store the raw dictionary representation
query_resp_dict = { query_resp_dict = {
"done": query_resp.done, "done": query_resp.done,
"answer": query_resp.answer, "answer": query_resp.answer,
@@ -227,11 +278,25 @@ async def process_query(request: QueryRequest):
return JSONResponse(status_code=200, content=query_resp.jsonify()) return JSONResponse(status_code=200, content=query_resp.jsonify())
except Exception as e: except Exception as e:
logger.error(f"An error occurred: {str(e)}") logger.error(f"An error occurred: {str(e)}")
sys.exit(1) query_resp.answer = f"An error occurred: {str(e)}"
query_resp.reasoning = f"Error: {str(e)}"
return JSONResponse(status_code=500, content=query_resp.jsonify())
finally: finally:
is_generating = False
logger.info("Processing finished") logger.info("Processing finished")
if config.getboolean('MAIN', 'save_session'): if config.getboolean('MAIN', 'save_session'):
interaction.save_session() interaction.save_session()
if __name__ == "__main__": if __name__ == "__main__":
uvicorn.run(api, host="0.0.0.0", port=8000) # Print startup info
if is_running_in_docker():
print("[AgenticSeek] Starting in Docker container...")
else:
print("[AgenticSeek] Starting on host machine...")
envport = os.getenv("BACKEND_PORT")
if envport:
port = int(envport)
else:
port = 7777
uvicorn.run(api, host="0.0.0.0", port=port)
+7 -3
View File
@@ -7,7 +7,7 @@ import asyncio
from sources.llm_provider import Provider from sources.llm_provider import Provider
from sources.interaction import Interaction from sources.interaction import Interaction
from sources.agents import Agent, CoderAgent, CasualAgent, FileAgent, PlannerAgent, BrowserAgent from sources.agents import Agent, CoderAgent, CasualAgent, FileAgent, PlannerAgent, BrowserAgent, McpAgent
from sources.browser import Browser, create_driver from sources.browser import Browser, create_driver
from sources.utility import pretty_print from sources.utility import pretty_print
@@ -29,7 +29,7 @@ async def main():
is_local=config.getboolean('MAIN', 'is_local')) is_local=config.getboolean('MAIN', 'is_local'))
browser = Browser( browser = Browser(
create_driver(headless=config.getboolean('BROWSER', 'headless_browser'), stealth_mode=stealth_mode), create_driver(headless=config.getboolean('BROWSER', 'headless_browser'), stealth_mode=stealth_mode, lang=languages[0]),
anticaptcha_manual_install=stealth_mode anticaptcha_manual_install=stealth_mode
) )
@@ -48,7 +48,10 @@ async def main():
provider=provider, verbose=False, browser=browser), provider=provider, verbose=False, browser=browser),
PlannerAgent(name="Planner", PlannerAgent(name="Planner",
prompt_path=f"prompts/{personality_folder}/planner_agent.txt", prompt_path=f"prompts/{personality_folder}/planner_agent.txt",
provider=provider, verbose=False, browser=browser) provider=provider, verbose=False, browser=browser),
#McpAgent(name="MCP Agent",
# prompt_path=f"prompts/{personality_folder}/mcp_agent.txt",
# provider=provider, verbose=False), # NOTE under development
] ]
interaction = Interaction(agents, interaction = Interaction(agents,
@@ -62,6 +65,7 @@ async def main():
interaction.get_user() interaction.get_user()
if await interaction.think(): if await interaction.think():
interaction.show_answer() interaction.show_answer()
interaction.speak_answer()
except Exception as e: except Exception as e:
if config.getboolean('MAIN', 'save_session'): if config.getboolean('MAIN', 'save_session'):
interaction.save_session() interaction.save_session()
+3 -4
View File
@@ -3,14 +3,13 @@ is_local = True
provider_name = ollama provider_name = ollama
provider_model = deepseek-r1:14b provider_model = deepseek-r1:14b
provider_server_address = 127.0.0.1:11434 provider_server_address = 127.0.0.1:11434
agent_name = Friday agent_name = Jarvis
recover_last_session = False recover_last_session = False
save_session = False save_session = False
speak = False speak = False
listen = False listen = False
work_dir = /Users/mlg/Documents/ai_folder
jarvis_personality = False jarvis_personality = False
languages = en languages = en
[BROWSER] [BROWSER]
headless_browser = False headless_browser = True
stealth_mode = True stealth_mode = False
+38 -35
View File
@@ -1,8 +1,8 @@
version: '3'
services: services:
redis: redis:
container_name: redis container_name: redis
profiles: ["core", "full"]
image: docker.io/valkey/valkey:8-alpine image: docker.io/valkey/valkey:8-alpine
command: valkey-server --save 30 1 --loglevel warning command: valkey-server --save 30 1 --loglevel warning
restart: unless-stopped restart: unless-stopped
@@ -24,15 +24,16 @@ services:
searxng: searxng:
container_name: searxng container_name: searxng
profiles: ["core", "full"]
image: docker.io/searxng/searxng:latest image: docker.io/searxng/searxng:latest
restart: unless-stopped restart: unless-stopped
ports: ports:
- "8080:8080" - "8080:8080"
volumes: volumes:
- ./searxng:/etc/searxng:rw - ./searxng:/etc/searxng:rw,z
environment: environment:
- SEARXNG_BASE_URL=http://localhost:8080/ - SEARXNG_BASE_URL=${SEARXNG_BASE_URL:-http://localhost:8080/}
- SEARXNG_SECRET_KEY=$(openssl rand -hex 32) - SEARXNG_SECRET_KEY=${SEARXNG_SECRET_KEY}
- UWSGI_WORKERS=4 - UWSGI_WORKERS=4
- UWSGI_THREADS=4 - UWSGI_THREADS=4
cap_add: cap_add:
@@ -51,50 +52,52 @@ services:
frontend: frontend:
container_name: frontend container_name: frontend
profiles: ["core", "full"]
build: build:
context: ./frontend context: ./frontend
dockerfile: Dockerfile.frontend dockerfile: Dockerfile.frontend
ports: ports:
- "3000:3000" - "3000:3000"
volumes: volumes:
- ./frontend/agentic-seek-front/src:/app/src - ./frontend/agentic-seek-front/src:/app/src:rw,z
- ./screenshots:/app/screenshots - ./screenshots:/app/screenshots
environment: environment:
- NODE_ENV=development - NODE_ENV=development
- CHOKIDAR_USEPOLLING=true - CHOKIDAR_USEPOLLING=true
- BACKEND_URL=http://backend:8000 - REACT_APP_BACKEND_URL=${REACT_APP_BACKEND_URL:-http://localhost:7777}
networks: networks:
- agentic-seek-net - agentic-seek-net
# NOTE: backend service is not working yet due to issue with chromedriver on docker. backend:
# Therefore backend is run on host machine. container_name: backend
# Open to pull requests to fix this. profiles: ["backend", "full"]
build:
#backend: context: .
# container_name: backend dockerfile: Dockerfile.backend
# build: ports:
# context: ./ - ${BACKEND_PORT:-7777}:${BACKEND_PORT:-7777}
# dockerfile: Dockerfile.backend volumes:
# stdin_open: true - ./:/app
# tty: true - ${WORK_DIR:-.}:/opt/workspace
# shm_size: 8g command: python3 api.py
# ports: environment:
# - "8000:8000" - SEARXNG_BASE_URL=${SEARXNG_BASE_URL:-http://searxng:8080}
# volumes: - REDIS_URL=${REDIS_BASE_URL:-redis://redis:6379/0}
# - ./:/app - WORK_DIR=/opt/workspace
# environment: - BACKEND_PORT=${BACKEND_PORT}
# - NODE_ENV=development - DOCKER_INTERNAL_URL=http://host.docker.internal
# - REDIS_URL=redis://redis:6379/0 - OPENAI_API_KEY=${OPENAI_API_KEY}
# - SEARXNG_URL=http://searxng:8080 - DEEPSEEK_API_KEY=${DEEPSEEK_API_KEY}
# - OLLAMA_URL=http://localhost:11434 - OPENROUTER_API_KEY=${OPENROUTER_API_KEY}
# - LM_STUDIO_URL=http://localhost:1234 - TOGETHER_API_KEY=${TOGETHER_API_KEY}
# extra_hosts: - GOOGLE_API_KEY=${GOOGLE_API_KEY}
# - "host.docker.internal:host-gateway" - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
# depends_on: - HUGGINGFACE_API_KEY=${HUGGINGFACE_API_KEY}
# - redis - DSK_DEEPSEEK_API_KEY=${DSK_DEEPSEEK_API_KEY}
# - searxng networks:
# networks: - agentic-seek-net
# - agentic-seek-net extra_hosts:
- "host.docker.internal:host-gateway"
volumes: volumes:
redis-data: redis-data:
+39 -8
View File
@@ -92,11 +92,13 @@ Here are some tasks and areas where we need contributions:
Tools are extensions that enable agents to perform specific actions, such as running Python code, making API calls, or conducting web searches. All tools inherit from the Tools base class, which provides methods for parsing and executing tool instructions. Tools are extensions that enable agents to perform specific actions, such as running Python code, making API calls, or conducting web searches. All tools inherit from the Tools base class, which provides methods for parsing and executing tool instructions.
## Tools parsing ## Understand Tools parsing
Agents invoke tools using a standardized format called a block. A block consists of the tool name followed by the content (e.g., code, query, or parameters) to execute. The format looks like this: Agents invoke tools using a standardized format called a block. A block consists of the tool name followed by the content (e.g., code, query, or parameters) to execute. When creating a prompt for an Agent, you must explicitly tell them to use this format.
BECAUSE WE USE MARKDOWN QUOTE FORMAT, READING WILL BE BROKEN ON GITHUB PLEASE START READING THE FILE AS RAW: https://raw.githubusercontent.com/Fosowl/agenticSeek/refs/heads/main/CONTRIBUTING.md The format looks like this:
BECAUSE WE USE MARKDOWN QUOTE FORMAT, READING WILL BE BROKEN ON GITHUB PLEASE START READING THE FILE AS RAW: https://raw.githubusercontent.com/Fosowl/agenticSeek/refs/heads/dev/docs/CONTRIBUTING.md
```<tool name> ```<tool name>
@@ -117,10 +119,9 @@ How to handle multiple arguments then ?
Good question! Each tool is free to handle argument in it's own way within the block, but we provide a common parsing logic: Good question! Each tool is free to handle argument in it's own way within the block, but we provide a common parsing logic:
```flight_search ```trip_search
from=Paris from=Paris
to=Taipei to=Toulouse
date=30/04/2026
``` ```
To extract these parameters, use the `get_parameter_value` method provided by the Tools class. Each tool can define its own parameter-handling logic, but the Tools class ensures consistent parsing. To extract these parameters, use the `get_parameter_value` method provided by the Tools class. Each tool can define its own parameter-handling logic, but the Tools class ensures consistent parsing.
@@ -135,7 +136,7 @@ print("Hello world")
Will save the code in toto.py file within the work_folder defined in the config.ini Will save the code in toto.py file within the work_folder defined in the config.ini
## Execution ## Tools Implementation
When developing a tool, you must implement three abstract methods defined in the Tools class to handle execution, failure detection, and feedback to the agent. These methods ensure consistent behavior across tools and enable robust interaction with the LLM. When developing a tool, you must implement three abstract methods defined in the Tools class to handle execution, failure detection, and feedback to the agent. These methods ensure consistent behavior across tools and enable robust interaction with the LLM.
@@ -171,8 +172,38 @@ Recap:
- get_parameter_value: Retrieves parameter values from a block's content. - get_parameter_value: Retrieves parameter values from a block's content.
- File handling: Supports saving block content to files when a :path is specified. - File handling: Supports saving block content to files when a :path is specified.
# Implementing and using Agents ## Prompting an Agent for Tools usage
Consider an example where you want to add a flight search tool to the casual agent, you will need to modify the prompt file for the CasualAgent (e.g., casual_agent.txt) to instruct the LLM to use the a simple flight_search tool. you could add to the prompt:
You can search for flights using the flight_search tool. Example:
```flight_search
RY7481
```
You simply need to enter the flight number, you will then various informations about the flight if it exist, such as : Airline, Status, Departure time, Arrival Time
## Add the tool to your agent
To add a tool to an agent you simply need to:
1. Import a tool.
2. Add the tool class to the **tools** dictionnary.
3. Update the agent prompt.
```python
from sources.tools.flightSearch import FlightSearch
class CasualAgent(Agent):
def __init__(self, name, prompt_path, provider, verbose=False):
super().__init__(name, prompt_path, provider, verbose, None)
self.tools = {
"flight_search": FlightSearch(),
}
self.role = "en"
self.type = "casual_agent"
```
# Implementing and using Agents
Agents are classes that define how an LLM interacts with users and processes inputs. They can use tools (e.g., for executing code or querying APIs) and maintain a memory of the conversation to provide context-aware responses. All agents inherit from the base Agent class, which provides core functionality like memory management and LLM communication. Agents are classes that define how an LLM interacts with users and processes inputs. They can use tools (e.g., for executing code or querying APIs) and maintain a memory of the conversation to provide context-aware responses. All agents inherit from the base Agent class, which provides core functionality like memory management and LLM communication.
+7 -4
View File
@@ -2,15 +2,18 @@ FROM node:18
WORKDIR /app WORKDIR /app
# Install dependencies # Copy package files
COPY agentic-seek-front/package.json agentic-seek-front/package-lock.json ./ COPY agentic-seek-front/package.json agentic-seek-front/package-lock.json ./
RUN npm install
# Install dependencies with explicit bin linking
RUN npm ci && npm rebuild
# Copy application code # Copy application code
COPY agentic-seek-front/ . COPY agentic-seek-front/ .
# Expose port # Verify react-scripts is available (catches install issues early)
RUN test -f node_modules/.bin/react-scripts || npm install react-scripts
EXPOSE 3000 EXPOSE 3000
# Run the application
CMD ["npm", "start"] CMD ["npm", "start"]
File diff suppressed because it is too large Load Diff
+1
View File
@@ -10,6 +10,7 @@
"axios": "^1.8.4", "axios": "^1.8.4",
"react": "^19.1.0", "react": "^19.1.0",
"react-dom": "^19.1.0", "react-dom": "^19.1.0",
"react-markdown": "^10.1.0",
"react-scripts": "5.0.1", "react-scripts": "5.0.1",
"web-vitals": "^2.1.4" "web-vitals": "^2.1.4"
}, },
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

File diff suppressed because it is too large Load Diff
+256 -116
View File
@@ -1,86 +1,33 @@
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef, useCallback } from "react";
import axios from 'axios'; import ReactMarkdown from "react-markdown";
import './App.css'; import axios from "axios";
import { colors } from './colors'; import "./App.css";
import { ThemeToggle } from "./components/ThemeToggle";
import { ResizableLayout } from "./components/ResizableLayout";
import faviconPng from "./logo.png";
const BACKEND_URL = process.env.REACT_APP_BACKEND_URL;
console.log("Using backend URL:", BACKEND_URL);
function App() { function App() {
const [query, setQuery] = useState(''); const [query, setQuery] = useState("");
const [messages, setMessages] = useState([]); const [messages, setMessages] = useState([]);
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState(null); const [error, setError] = useState(null);
const [currentView, setCurrentView] = useState('blocks'); const [currentView, setCurrentView] = useState("blocks");
const [responseData, setResponseData] = useState(null); const [responseData, setResponseData] = useState(null);
const [isOnline, setIsOnline] = useState(false); const [isOnline, setIsOnline] = useState(false);
const [status, setStatus] = useState('Agents ready'); const [status, setStatus] = useState("Agents ready");
const [expandedReasoning, setExpandedReasoning] = useState(new Set());
const messagesEndRef = useRef(null); const messagesEndRef = useRef(null);
useEffect(() => { const fetchLatestAnswer = useCallback(async () => {
const intervalId = setInterval(() => {
checkHealth();
fetchLatestAnswer();
fetchScreenshot();
}, 3000);
return () => clearInterval(intervalId);
}, [messages]);
const checkHealth = async () => {
try { try {
await axios.get('http://0.0.0.0:8000/health'); const res = await axios.get(`${BACKEND_URL}/latest_answer`);
setIsOnline(true);
console.log('System is online');
} catch {
setIsOnline(false);
console.log('System is offline');
}
};
const fetchScreenshot = async () => {
try {
const timestamp = new Date().getTime();
const res = await axios.get(`http://0.0.0.0:8000/screenshots/updated_screen.png?timestamp=${timestamp}`, {
responseType: 'blob'
});
console.log('Screenshot fetched successfully');
const imageUrl = URL.createObjectURL(res.data);
setResponseData((prev) => {
if (prev?.screenshot && prev.screenshot !== 'placeholder.png') {
URL.revokeObjectURL(prev.screenshot);
}
return {
...prev,
screenshot: imageUrl,
screenshotTimestamp: new Date().getTime()
};
});
} catch (err) {
console.error('Error fetching screenshot:', err);
setResponseData((prev) => ({
...prev,
screenshot: 'placeholder.png',
screenshotTimestamp: new Date().getTime()
}));
}
};
const normalizeAnswer = (answer) => {
return answer
.trim()
.toLowerCase()
.replace(/\s+/g, ' ')
.replace(/[.,!?]/g, '')
};
const scrollToBottom = () => {
messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
};
const fetchLatestAnswer = async () => {
try {
const res = await axios.get('http://0.0.0.0:8000/latest_answer');
const data = res.data; const data = res.data;
updateData(data); updateData(data);
if (!data.answer || data.answer.trim() === '') { if (!data.answer || data.answer.trim() === "") {
return; return;
} }
const normalizedNewAnswer = normalizeAnswer(data.answer); const normalizedNewAnswer = normalizeAnswer(data.answer);
@@ -91,8 +38,9 @@ function App() {
setMessages((prev) => [ setMessages((prev) => [
...prev, ...prev,
{ {
type: 'agent', type: "agent",
content: data.answer, content: data.answer,
reasoning: data.reasoning,
agentName: data.agent_name, agentName: data.agent_name,
status: data.status, status: data.status,
uid: data.uid, uid: data.uid,
@@ -101,11 +49,86 @@ function App() {
setStatus(data.status); setStatus(data.status);
scrollToBottom(); scrollToBottom();
} else { } else {
console.log('Duplicate answer detected, skipping:', data.answer); console.log("Duplicate answer detected, skipping:", data.answer);
} }
} catch (error) { } catch (error) {
console.error('Error fetching latest answer:', error); console.error("Error fetching latest answer:", error);
} }
}, [messages]);
useEffect(() => {
const intervalId = setInterval(() => {
checkHealth();
fetchLatestAnswer();
fetchScreenshot();
}, 3000);
return () => clearInterval(intervalId);
}, [fetchLatestAnswer]);
const checkHealth = async () => {
try {
await axios.get(`${BACKEND_URL}/health`);
setIsOnline(true);
console.log("System is online");
} catch {
setIsOnline(false);
console.log("System is offline");
}
};
const fetchScreenshot = async () => {
try {
const timestamp = new Date().getTime();
const res = await axios.get(
`${BACKEND_URL}/screenshots/updated_screen.png?timestamp=${timestamp}`,
{
responseType: "blob",
}
);
console.log("Screenshot fetched successfully");
const imageUrl = URL.createObjectURL(res.data);
setResponseData((prev) => {
if (prev?.screenshot && prev.screenshot !== "placeholder.png") {
URL.revokeObjectURL(prev.screenshot);
}
return {
...prev,
screenshot: imageUrl,
screenshotTimestamp: new Date().getTime(),
};
});
} catch (err) {
console.error("Error fetching screenshot:", err);
setResponseData((prev) => ({
...prev,
screenshot: "placeholder.png",
screenshotTimestamp: new Date().getTime(),
}));
}
};
const normalizeAnswer = (answer) => {
return answer
.trim()
.toLowerCase()
.replace(/\s+/g, " ")
.replace(/[.,!?]/g, "");
};
const scrollToBottom = () => {
messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
};
const toggleReasoning = (messageIndex) => {
setExpandedReasoning((prev) => {
const newSet = new Set(prev);
if (newSet.has(messageIndex)) {
newSet.delete(messageIndex);
} else {
newSet.add(messageIndex);
}
return newSet;
});
}; };
const updateData = (data) => { const updateData = (data) => {
@@ -120,87 +143,162 @@ function App() {
})); }));
}; };
const handleStop = async (e) => {
e.preventDefault();
checkHealth();
setIsLoading(false);
setError(null);
try {
await axios.get(`${BACKEND_URL}/stop`);
setStatus("Requesting stop...");
} catch (err) {
console.error("Error stopping the agent:", err);
}
};
const handleSubmit = async (e) => { const handleSubmit = async (e) => {
e.preventDefault(); e.preventDefault();
checkHealth(); checkHealth();
if (!query.trim()) { if (!query.trim()) {
console.log('Empty query'); console.log("Empty query");
return; return;
} }
setMessages((prev) => [...prev, { type: 'user', content: query }]); setMessages((prev) => [...prev, { type: "user", content: query }]);
setIsLoading(true); setIsLoading(true);
setError(null); setError(null);
try { try {
console.log('Sending query:', query); console.log("Sending query:", query);
setQuery('waiting for response...'); setQuery("waiting for response...");
const res = await axios.post('http://0.0.0.0:8000/query', { const res = await axios.post(`${BACKEND_URL}/query`, {
query, query,
tts_enabled: false tts_enabled: false,
}); });
setQuery('Enter your query...'); setQuery("Enter your query...");
console.log('Response:', res.data); console.log("Response:", res.data);
const data = res.data; const data = res.data;
updateData(data); updateData(data);
} catch (err) { } catch (err) {
console.error('Error:', err); console.error("Error:", err);
setError('Failed to process query.'); setError("Failed to process query.");
setMessages((prev) => [ setMessages((prev) => [
...prev, ...prev,
{ type: 'error', content: 'Error: Unable to get a response.' }, { type: "error", content: "Error: Unable to get a response." },
]); ]);
} finally { } finally {
console.log('Query completed'); console.log("Query completed");
setIsLoading(false); setIsLoading(false);
setQuery(''); setQuery("");
} }
}; };
const handleGetScreenshot = async () => { const handleGetScreenshot = async () => {
try { try {
setCurrentView('screenshot'); setCurrentView("screenshot");
} catch (err) { } catch (err) {
setError('Browser not in use'); setError("Browser not in use");
} }
}; };
return ( return (
<div className="app"> <div className="app">
<header className="header"> <header className="header">
<div className="header-brand">
<div className="logo-container">
<img src={faviconPng} alt="AgenticSeek" className="logo-icon" />
</div>
<div className="brand-text">
<h1>AgenticSeek</h1> <h1>AgenticSeek</h1>
</div>
</div>
<div className="header-status">
<div
className={`status-indicator ${isOnline ? "online" : "offline"}`}
>
<div className="status-dot"></div>
<span className="status-text">
{isOnline ? "Online" : "Offline"}
</span>
</div>
</div>
<div className="header-actions">
<a
href="https://github.com/Fosowl/agenticSeek"
target="_blank"
rel="noopener noreferrer"
className="action-button github-link"
aria-label="View on GitHub"
>
<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
</svg>
<span className="action-text">GitHub</span>
</a>
<div>
<ThemeToggle />
</div>
</div>
</header> </header>
<main className="main"> <main className="main">
<div className="app-sections"> <ResizableLayout initialLeftWidth={50}>
<div className="chat-section"> <div className="chat-section">
<h2>Chat Interface</h2> <h2>Chat Interface</h2>
<div className="messages"> <div className="messages">
{messages.length === 0 ? ( {messages.length === 0 ? (
<p className="placeholder">No messages yet. Type below to start!</p> <p className="placeholder">
No messages yet. Type below to start!
</p>
) : ( ) : (
messages.map((msg, index) => ( messages.map((msg, index) => (
<div <div
key={index} key={index}
className={`message ${ className={`message ${
msg.type === 'user' msg.type === "user"
? 'user-message' ? "user-message"
: msg.type === 'agent' : msg.type === "agent"
? 'agent-message' ? "agent-message"
: 'error-message' : "error-message"
}`} }`}
> >
{msg.type === 'agent' && ( <div className="message-header">
{msg.type === "agent" && (
<span className="agent-name">{msg.agentName}</span> <span className="agent-name">{msg.agentName}</span>
)} )}
<p>{msg.content}</p> {msg.type === "agent" &&
msg.reasoning &&
expandedReasoning.has(index) && (
<div className="reasoning-content">
<ReactMarkdown>{msg.reasoning}</ReactMarkdown>
</div>
)}
{msg.type === "agent" && (
<button
className="reasoning-toggle"
onClick={() => toggleReasoning(index)}
title={
expandedReasoning.has(index)
? "Hide reasoning"
: "Show reasoning"
}
>
{expandedReasoning.has(index) ? "▼" : "▶"} Reasoning
</button>
)}
</div>
<div className="message-content">
<ReactMarkdown>{msg.content}</ReactMarkdown>
</div>
</div> </div>
)) ))
)} )}
<div ref={messagesEndRef} /> <div ref={messagesEndRef} />
</div> </div>
{isOnline && <div className="loading-animation">{status}</div>} {isOnline && <div className="loading-animation">{status}</div>}
{!isLoading && !isOnline && <p className="loading-animation">System offline. Deploy backend first.</p>} {!isLoading && !isOnline && (
<p className="loading-animation">
System offline. Deploy backend first.
</p>
)}
<form onSubmit={handleSubmit} className="input-form"> <form onSubmit={handleSubmit} className="input-form">
<input <input
type="text" type="text"
@@ -209,9 +307,41 @@ function App() {
placeholder="Type your query..." placeholder="Type your query..."
disabled={isLoading} disabled={isLoading}
/> />
<button type="submit" disabled={isLoading}> <div className="action-buttons">
Send <button
type="submit"
disabled={isLoading}
className="icon-button"
aria-label="Send message"
>
<svg width="18" height="18" viewBox="0 0 24 24" fill="none">
<path
d="M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
</button> </button>
<button
type="button"
onClick={handleStop}
className="icon-button stop-button"
aria-label="Stop processing"
>
<svg width="16" height="16" viewBox="0 0 24 24" fill="none">
<rect
x="6"
y="6"
width="12"
height="12"
fill="currentColor"
rx="2"
/>
</svg>
</button>
</div>
</form> </form>
</div> </div>
@@ -219,31 +349,41 @@ function App() {
<h2>Computer View</h2> <h2>Computer View</h2>
<div className="view-selector"> <div className="view-selector">
<button <button
className={currentView === 'blocks' ? 'active' : ''} className={currentView === "blocks" ? "active" : ""}
onClick={() => setCurrentView('blocks')} onClick={() => setCurrentView("blocks")}
> >
Editor View Editor View
</button> </button>
<button <button
className={currentView === 'screenshot' ? 'active' : ''} className={currentView === "screenshot" ? "active" : ""}
onClick={responseData?.screenshot ? () => setCurrentView('screenshot') : handleGetScreenshot} onClick={
responseData?.screenshot
? () => setCurrentView("screenshot")
: handleGetScreenshot
}
> >
Browser View Browser View
</button> </button>
</div> </div>
<div className="content"> <div className="content">
{error && <p className="error">{error}</p>} {error && <p className="error">{error}</p>}
{currentView === 'blocks' ? ( {currentView === "blocks" ? (
<div className="blocks"> <div className="blocks">
{responseData && responseData.blocks && Object.values(responseData.blocks).length > 0 ? ( {responseData &&
responseData.blocks &&
Object.values(responseData.blocks).length > 0 ? (
Object.values(responseData.blocks).map((block, index) => ( Object.values(responseData.blocks).map((block, index) => (
<div key={index} className="block"> <div key={index} className="block">
<p className="block-tool">Tool: {block.tool_type}</p> <p className="block-tool">Tool: {block.tool_type}</p>
<pre>{block.block}</pre> <pre>{block.block}</pre>
<p className="block-feedback">Feedback: {block.feedback}</p> <p className="block-feedback">
<p className="block-success"> Feedback: {block.feedback}
Success: {block.success ? 'Yes' : 'No'}
</p> </p>
{block.success ? (
<p className="block-success">Success</p>
) : (
<p className="block-failure">Failure</p>
)}
</div> </div>
)) ))
) : ( ) : (
@@ -256,19 +396,19 @@ function App() {
) : ( ) : (
<div className="screenshot"> <div className="screenshot">
<img <img
src={responseData?.screenshot || 'placeholder.png'} src={responseData?.screenshot || "placeholder.png"}
alt="Screenshot" alt="Screenshot"
onError={(e) => { onError={(e) => {
e.target.src = 'placeholder.png'; e.target.src = "placeholder.png";
console.error('Failed to load screenshot'); console.error("Failed to load screenshot");
}} }}
key={responseData?.screenshotTimestamp || 'default'} key={responseData?.screenshotTimestamp || "default"}
/> />
</div> </div>
)} )}
</div> </div>
</div> </div>
</div> </ResizableLayout>
</main> </main>
</div> </div>
); );
+46 -45
View File
@@ -1,63 +1,64 @@
export const colors = { export const colors = {
// Primary colors // Primary colors - matching the dashboard theme
primary: '#0066cc', primary: "#2563eb",
primaryLight: '#e6f2ff', primaryLight: "#dbeafe",
primaryDark: '#004c99', primaryDark: "#1d4ed8",
// Secondary colors // Secondary colors - modern grays
secondary: '#6c757d', secondary: "#64748b",
secondaryLight: '#f8f9fa', secondaryLight: "#f1f5f9",
secondaryDark: '#343a40', secondaryDark: "#1e293b",
// Accent colors // Accent colors
accent: '#ff9500', accent: "#f59e0b",
accentLight: '#fff4e6', accentLight: "#fef3c7",
accentDark: '#cc7a00', accentDark: "#d97706",
// Status colors // Status colors
success: '#28a745', success: "#10b981",
successLight: '#e8f5e9', successLight: "#d1fae5",
warning: '#ffc107', warning: "#f59e0b",
warningLight: '#fff9e6', warningLight: "#fef3c7",
error: '#dc3545', error: "#ef4444",
errorLight: '#ffebee', errorLight: "#fee2e2",
info: '#17a2b8', info: "#06b6d4",
infoLight: '#e3f2fd', infoLight: "#cffafe",
// Neutral colors // Neutral colors - modern palette
white: '#ffffff', white: "#ffffff",
gray100: '#f8f9fa', gray50: "#f8fafc",
gray200: '#e9ecef', gray100: "#f1f5f9",
gray300: '#dee2e6', gray200: "#e2e8f0",
gray400: '#ced4da', gray300: "#cbd5e1",
gray500: '#adb5bd', gray400: "#94a3b8",
gray600: '#6c757d', gray500: "#64748b",
gray700: '#495057', gray600: "#475569",
gray800: '#343a40', gray700: "#334155",
gray900: '#212529', gray800: "#1e293b",
black: '#000000', gray900: "#0f172a",
black: "#000000",
// Text colors // Text colors
textPrimary: '#212529', textPrimary: "#0f172a",
textSecondary: '#6c757d', textSecondary: "#64748b",
textDisabled: '#adb5bd', textDisabled: "#94a3b8",
// Background colors // Background colors
background: '#f8f8f8', background: "#f8fafc",
card: '#ffffff', card: "#ffffff",
// Border colors // Border colors
border: '#dee2e6', border: "#e2e8f0",
divider: '#e9ecef', divider: "#f1f5f9",
// Transparent colors // Transparent colors
transparent: 'transparent', transparent: "transparent",
semiTransparent: 'rgba(0, 0, 0, 0.5)', semiTransparent: "rgba(15, 23, 42, 0.6)",
// Dark theme colors // Dark theme colors
darkBackground: '#0f172a', darkBackground: "#0f172a",
darkCard: '#1e293b', darkCard: "#1e293b",
darkBorder: '#334155', darkBorder: "#334155",
darkText: '#f8fafc', darkText: "#f8fafc",
darkTextSecondary: '#cbd5e1', darkTextSecondary: "#cbd5e1",
}; };
@@ -0,0 +1,69 @@
.resizable-container {
display: flex;
width: 100%;
height: 100%;
overflow: hidden;
}
.resizable-left,
.resizable-right {
height: 100%;
overflow: hidden;
min-width: 0;
}
.resize-handle {
width: 8px;
background-color: transparent;
cursor: col-resize;
display: flex;
align-items: center;
justify-content: center;
padding: 0 2px;
transition: background-color 0.2s ease;
position: relative;
flex-shrink: 0;
}
.resize-handle:hover {
background-color: var(--accent);
}
.resize-handle-line {
width: 2px;
height: 40px;
background-color: var(--border);
border-radius: 1px;
transition: all 0.2s ease;
}
.resize-handle:hover .resize-handle-line {
background-color: var(--accent-foreground);
height: 60px;
}
.resizable-container.dragging .resize-handle {
background-color: var(--accent);
}
.resizable-container.dragging .resize-handle-line {
background-color: var(--accent-foreground);
height: 100vh;
}
/* Mobile responsiveness */
@media (max-width: 768px) {
.resizable-container {
flex-direction: column;
}
.resizable-left,
.resizable-right {
width: 100% !important;
height: 50vh;
}
.resize-handle {
display: none;
}
}
@@ -0,0 +1,70 @@
import React, { useState, useRef, useCallback } from "react";
import "./ResizableLayout.css";
export const ResizableLayout = ({ children, initialLeftWidth = 50 }) => {
const [leftWidth, setLeftWidth] = useState(initialLeftWidth);
const [isDragging, setIsDragging] = useState(false);
const containerRef = useRef(null);
const handleMouseDown = useCallback((e) => {
e.preventDefault();
setIsDragging(true);
}, []);
const handleMouseMove = useCallback(
(e) => {
if (!isDragging || !containerRef.current) return;
const containerRect = containerRef.current.getBoundingClientRect();
const newLeftWidth =
((e.clientX - containerRect.left) / containerRect.width) * 100;
// Constrain between 20% and 80%
const constrainedWidth = Math.max(20, Math.min(80, newLeftWidth));
setLeftWidth(constrainedWidth);
},
[isDragging]
);
const handleMouseUp = useCallback(() => {
setIsDragging(false);
}, []);
React.useEffect(() => {
if (isDragging) {
document.addEventListener("mousemove", handleMouseMove);
document.addEventListener("mouseup", handleMouseUp);
document.body.style.cursor = "col-resize";
document.body.style.userSelect = "none";
} else {
document.removeEventListener("mousemove", handleMouseMove);
document.removeEventListener("mouseup", handleMouseUp);
document.body.style.cursor = "";
document.body.style.userSelect = "";
}
return () => {
document.removeEventListener("mousemove", handleMouseMove);
document.removeEventListener("mouseup", handleMouseUp);
document.body.style.cursor = "";
document.body.style.userSelect = "";
};
}, [isDragging, handleMouseMove, handleMouseUp]);
return (
<div
ref={containerRef}
className={`resizable-container ${isDragging ? "dragging" : ""}`}
>
<div className="resizable-left" style={{ width: `${leftWidth}%` }}>
{children[0]}
</div>
<div className="resize-handle" onMouseDown={handleMouseDown}>
<div className="resize-handle-line" />
</div>
<div className="resizable-right" style={{ width: `${100 - leftWidth}%` }}>
{children[1]}
</div>
</div>
);
};
@@ -0,0 +1,34 @@
import React from "react";
import { useTheme } from "../contexts/ThemeContext";
export const ThemeToggle = () => {
const { isDark, toggleTheme } = useTheme();
return (
<button
onClick={toggleTheme}
className="theme-toggle"
aria-label="Toggle theme"
>
{isDark ? (
<svg width="20" height="20" viewBox="0 0 24 24" fill="none">
<circle cx="12" cy="12" r="5" stroke="currentColor" strokeWidth="2" />
<path
d="M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"
stroke="currentColor"
strokeWidth="2"
/>
</svg>
) : (
<svg width="20" height="20" viewBox="0 0 24 24" fill="none">
<path
d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"
stroke="currentColor"
strokeWidth="2"
fill="currentColor"
/>
</svg>
)}
</button>
);
};
@@ -0,0 +1,34 @@
import React, { createContext, useContext, useState, useEffect } from "react";
const ThemeContext = createContext();
export const ThemeProvider = ({ children }) => {
const [isDark, setIsDark] = useState(() => {
const saved = localStorage.getItem("theme");
return saved ? saved === "dark" : true; // Default to dark
});
useEffect(() => {
localStorage.setItem("theme", isDark ? "dark" : "light");
document.documentElement.setAttribute(
"data-theme",
isDark ? "dark" : "light"
);
}, [isDark]);
const toggleTheme = () => setIsDark(!isDark);
return (
<ThemeContext.Provider value={{ isDark, toggleTheme }}>
{children}
</ThemeContext.Provider>
);
};
export const useTheme = () => {
const context = useContext(ThemeContext);
if (!context) {
throw new Error("useTheme must be used within ThemeProvider");
}
return context;
};
+8 -4
View File
@@ -1,10 +1,14 @@
import React from 'react'; import React from "react";
import ReactDOM from 'react-dom/client'; import ReactDOM from "react-dom/client";
import App from './App'; import App from "./App";
import { ThemeProvider } from "./contexts/ThemeContext";
import "./styles/globals.css";
const root = ReactDOM.createRoot(document.getElementById('root')); const root = ReactDOM.createRoot(document.getElementById("root"));
root.render( root.render(
<React.StrictMode> <React.StrictMode>
<ThemeProvider>
<App /> <App />
</ThemeProvider>
</React.StrictMode> </React.StrictMode>
); );
Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>

Before

Width:  |  Height:  |  Size: 2.6 KiB

@@ -0,0 +1,217 @@
:root {
--background: hsl(0 0% 100%);
--foreground: hsl(222.2 47.4% 11.2%);
--muted: hsl(210 40% 96.1%);
--muted-foreground: hsl(215.4 16.3% 46.9%);
--popover: hsl(0 0% 100%);
--popover-foreground: hsl(222.2 47.4% 11.2%);
--card: hsl(0 0% 100%);
--card-foreground: hsl(222.2 47.4% 11.2%);
--border: hsl(214.3 31.8% 91.4%);
--input: hsl(214.3 31.8% 91.4%);
--primary: hsl(222.2 47.4% 11.2%);
--primary-foreground: hsl(210 40% 98%);
--secondary: hsl(210 40% 96.1%);
--secondary-foreground: hsl(222.2 47.4% 11.2%);
--accent: hsl(210 40% 96.1%);
--accent-foreground: hsl(222.2 47.4% 11.2%);
--destructive: hsl(0 100% 50%);
--destructive-foreground: hsl(210 40% 98%);
--ring: hsl(215 20.2% 65.1%);
--radius: 0.5rem;
}
.dark {
--background: hsl(224 71% 4%);
--foreground: hsl(213 31% 91%);
--muted: hsl(223 47% 11%);
--muted-foreground: hsl(215.4 16.3% 56.9%);
--popover: hsl(224 71% 4%);
--popover-foreground: hsl(215 20.2% 65.1%);
--card: hsl(224 71% 4%);
--card-foreground: hsl(213 31% 91%);
--border: hsl(216 34% 17%);
--input: hsl(216 34% 17%);
--primary: hsl(210 40% 98%);
--primary-foreground: hsl(222.2 47.4% 1.2%);
--secondary: hsl(222.2 47.4% 11.2%);
--secondary-foreground: hsl(210 40% 98%);
--accent: hsl(216 34% 17%);
--accent-foreground: hsl(210 40% 98%);
--destructive: hsl(0 63% 31%);
--destructive-foreground: hsl(210 40% 98%);
--ring: hsl(216 34% 17%);
--radius: 0.5rem;
}
[data-theme="dark"] {
--background: #0a0a0a;
--foreground: #fafafa;
--card: #1a1a1a;
--card-foreground: #fafafa;
--popover: #1a1a1a;
--popover-foreground: #fafafa;
--primary: #fafafa;
--primary-foreground: #0a0a0a;
--secondary: #2a2a2a;
--secondary-foreground: #fafafa;
--muted: #1e1e1e;
--muted-foreground: #a1a1aa;
--accent: #6b7280;
--accent-foreground: #ffffff;
--destructive: #ef4444;
--destructive-foreground: #ffffff;
--border: #333333;
--input: #333333;
--ring: #6b7280;
}
[data-theme="light"] {
--background: #ffffff;
--foreground: #0a0a0a;
--card: #ffffff;
--card-foreground: #0a0a0a;
--popover: #ffffff;
--popover-foreground: #0a0a0a;
--primary: #0a0a0a;
--primary-foreground: #ffffff;
--secondary: #f5f5f5;
--secondary-foreground: #0a0a0a;
--muted: #f5f5f5;
--muted-foreground: #737373;
--accent: #6b7280;
--accent-foreground: #ffffff;
--destructive: #ef4444;
--destructive-foreground: #ffffff;
--border: #e5e5e5;
--input: #e5e5e5;
--ring: #6b7280;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background-color: var(--background);
color: var(--foreground);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
sans-serif;
transition: background-color 0.3s ease, color 0.3s ease;
margin: 0;
padding: 0;
height: 100vh;
overflow: hidden;
}
html,
body,
#root {
height: 100%;
overflow: hidden;
}
.theme-toggle {
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
min-width: 44px;
height: 44px;
padding: 0 12px;
border-radius: 12px;
border: 1px solid var(--border);
background: var(--card);
color: var(--foreground);
text-decoration: none;
font-size: 0.875rem;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
position: relative;
overflow: hidden;
}
.theme-toggle::before {
content: "";
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(
90deg,
transparent,
rgba(255, 255, 255, 0.1),
transparent
);
transition: left 0.5s ease;
}
.theme-toggle:hover::before {
left: 100%;
}
.theme-toggle:hover {
background: #24292e;
border-color: #24292e;
color: white;
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(36, 41, 46, 0.3);
}
.github-link {
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
min-width: 44px;
height: 44px;
padding: 0 12px;
border-radius: 12px;
border: 1px solid var(--border);
background: var(--card);
color: var(--foreground);
text-decoration: none;
font-size: 0.875rem;
font-weight: 500;
transition: all 0.3s ease;
position: relative;
overflow: hidden;
}
.github-link::before {
content: "";
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(
90deg,
transparent,
rgba(255, 255, 255, 0.1),
transparent
);
transition: left 0.5s ease;
}
.github-link:hover::before {
left: 100%;
}
.github-link:hover {
background: #24292e;
border-color: #24292e;
color: white;
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(36, 41, 46, 0.3);
}
.header-actions {
display: flex;
align-items: center;
gap: 12px;
}
-1
View File
@@ -5,7 +5,6 @@ set LLM_ROUTER_DIR=llm_router
if exist "%SCRIPTS_DIR%\windows_install.bat" ( if exist "%SCRIPTS_DIR%\windows_install.bat" (
echo Running Windows installation script... echo Running Windows installation script...
call "%SCRIPTS_DIR%\windows_install.bat" call "%SCRIPTS_DIR%\windows_install.bat"
cd "%LLM_ROUTER_DIR%" && call dl_safetensors.bat
) else ( ) else (
echo Error: %SCRIPTS_DIR%\windows_install.bat not found! echo Error: %SCRIPTS_DIR%\windows_install.bat not found!
exit /b 1 exit /b 1
+1 -1
View File
@@ -1,6 +1,6 @@
########## ##########
# Dummy script to download the model # Dummy script to download the model
# Because dowloading with hugging face does not seem to work, maybe I am doing something wrong? # Because downloading with hugging face does not seem to work, maybe I am doing something wrong?
# AdaptiveClassifier.from_pretrained("adaptive-classifier/llm-router") ----> result in config.json not found # AdaptiveClassifier.from_pretrained("adaptive-classifier/llm-router") ----> result in config.json not found
# Therefore, I put all the files in llm_router and download the model file with this script, If you know a better way please raise an issue # Therefore, I put all the files in llm_router and download the model file with this script, If you know a better way please raise an issue
######### #########
+1 -1
View File
@@ -6966,7 +6966,7 @@
0.010188529267907143 0.010188529267907143
], ],
"label": "LOW", "label": "LOW",
"text": "You are AoControl, a helpful and knowledgeable agent. To achieve your goal of answering complex questions correctly, you have access to the following tools:\n AoInnovus: An agent with knowledge of the Cadence Innovus User Guide and corresponding Tcl command usage\n AoTcl: An agent with knowledge of the Tcl language\nTo answer questions, you'll need to go through multiple steps involving step-by-step thinking and selecting appropriate tools and their inputs; tools will respond with observations.\nWhen you are ready for a final answer, respond with the `Final Answer:`\nUse the following format:\nQuestion: The question to be answered\nTHought: Reason if you have the final answer. If yes, anwer the question. If not, find out the missing information needed to answer it.\nTool: Pick one of {AoInnovus, AoTcl}\nTool Input: The input for the tool\nObservation: The tool will respond with the result\n...\nFinal Answer: The final answer to the question, make it short (50-100 words)\nThought, Tool, Tool Input, and Observation steps can be repeated multiple times, but sometimes we can find an answer in the first pass.\n---\nQuestion: How do I identify the impact of metal fill on my timing violations?\nThought: Let's think step-by-step, I first need to" "text": "You are AoControl, a helpful and knowledgeable agent. To achieve your goal of answering complex questions correctly, you have access to the following tools:\n AoInnovus: An agent with knowledge of the Cadence Innovus User Guide and corresponding Tcl command usage\n AoTcl: An agent with knowledge of the Tcl language\nTo answer questions, you'll need to go through multiple steps involving step-by-step thinking and selecting appropriate tools and their inputs; tools will respond with observations.\nWhen you are ready for a final answer, respond with the `Final Answer:`\nUse the following format:\nQuestion: The question to be answered\nTHought: Reason if you have the final answer. If yes, answer the question. If not, find out the missing information needed to answer it.\nTool: Pick one of {AoInnovus, AoTcl}\nTool Input: The input for the tool\nObservation: The tool will respond with the result\n...\nFinal Answer: The final answer to the question, make it short (50-100 words)\nThought, Tool, Tool Input, and Observation steps can be repeated multiple times, but sometimes we can find an answer in the first pass.\n---\nQuestion: How do I identify the impact of metal fill on my timing violations?\nThought: Let's think step-by-step, I first need to"
}, },
{ {
"embedding": [ "embedding": [
Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

+2 -2
View File
@@ -20,7 +20,7 @@ toto.py
You can execute bash command using the bash tag : You can execute bash command using the bash tag :
```bash ```bash
#!/bin/bash #!/bin/bash
ls -la # exemple ls -la # example
``` ```
You can execute python using the python tag You can execute python using the python tag
@@ -48,5 +48,5 @@ Some rules:
- You do not ever need to use bash to execute code. - You do not ever need to use bash to execute code.
- Do not ever tell user how to run it. user know it. - Do not ever tell user how to run it. user know it.
- If using gui, make sure echap or exit button close the program - If using gui, make sure echap or exit button close the program
- No lazyness, write and rewrite full code every time - No laziness, write and rewrite full code every time
- If query is unclear say REQUEST_CLARIFICATION - If query is unclear say REQUEST_CLARIFICATION
+67
View File
@@ -0,0 +1,67 @@
You are an agent designed to utilize the MCP protocol to accomplish tasks.
The MCP provide you with a standard way to use tools and data sources like databases, APIs, or apps (e.g., GitHub, Slack).
The are thousands of MCPs protocol that can accomplish a variety of tasks, for example:
- get weather information
- get stock data information
- Use software like blender
- Get messages from teams, stack, messenger
- Read and send email
Anything is possible with MCP.
To search for MCP a special format:
- Example 1:
User: what's the stock market of IBM like today?:
You: I will search for mcp to find information about IBM stock market.
```mcp_finder
stock
```
You search query must be one or two words at most.
This will provide you with informations about a specific MCP such as the json of parameters needed to use it.
For example, you might see:
-------
Name: Search Stock News
Usage name: @Cognitive-Stack/search-stock-news-mcp
Tools: [{'name': 'search-stock-news', 'description': 'Search for stock-related news using Tavily API', 'inputSchema': {'type': 'object', '$schema': 'http://json-schema.org/draft-07/schema#', 'required': ['symbol', 'companyName'], 'properties': {'symbol': {'type': 'string', 'description': "Stock symbol to search for (e.g., 'AAPL')"}, 'companyName': {'type': 'string', 'description': 'Full company name to include in the search'}}, 'additionalProperties': False}}]
-------
You can then a MCP like so:
```<usage name>
{
"tool": "<tool name (without @)>",
"inputSchema": {<inputSchema json for the tool>}
}
```
For example:
Now that I know how to use the MCP, I will choose the search-stock-news tool and execute it to find out IBM stock market.
```Cognitive-Stack/search-stock-news-mcp
{
"tool": "search-stock-news",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"required": ["symbol"],
"properties": {
"symbol": "AAPL",
"companyName": "IBM"
}
}
}
```
If the schema require an information that you don't have ask the users for the information.
+2 -2
View File
@@ -29,7 +29,7 @@ You: Sure, here is the plan:
## Task 3: I will setup the project using the file agent ## Task 3: I will setup the project using the file agent
## Task 4: I asign the coding agent to make a weather app in python ## Task 4: I assign the coding agent to make a weather app in python
```json ```json
{ {
@@ -74,7 +74,7 @@ Rules:
- Put your plan in a json with the key "plan". - Put your plan in a json with the key "plan".
- specify work folder name to all coding or file agents. - specify work folder name to all coding or file agents.
- You might use a file agent before code agent to setup a project properly. specify folder name. - You might use a file agent before code agent to setup a project properly. specify folder name.
- Give clear, detailled order to each agent and how their task relate to the previous task (if any). - Give clear, detailed order to each agent and how their task relate to the previous task (if any).
- The file agent can only conduct one action at the time. successive file agent could be needed. - The file agent can only conduct one action at the time. successive file agent could be needed.
- Only use web agent for finding necessary informations. - Only use web agent for finding necessary informations.
- Always tell the coding agent where to save file. - Always tell the coding agent where to save file.
+62
View File
@@ -0,0 +1,62 @@
You are an agent designed to utilize the MCP protocol to accomplish tasks.
The MCP provide you with a standard way to use tools and data sources like databases, APIs, or apps (e.g., GitHub, Slack).
The are thousands of MCPs protocol that can accomplish a variety of tasks, for example:
- get weather information
- get stock data information
- Use software like blender
- Get messages from teams, stack, messenger
- Read and send email
Anything is possible with MCP.
To search for MCP a special format:
- Example 1:
User: what's the stock market of IBM like today?:
You: I will search for mcp to find information about IBM stock market.
```mcp_finder
stock
```
This will provide you with informations about a specific MCP such as the json of parameters needed to use it.
For example, you might see:
-------
Name: Search Stock News
Usage name: @Cognitive-Stack/search-stock-news-mcp
Tools: [{'name': 'search-stock-news', 'description': 'Search for stock-related news using Tavily API', 'inputSchema': {'type': 'object', '$schema': 'http://json-schema.org/draft-07/schema#', 'required': ['symbol', 'companyName'], 'properties': {'symbol': {'type': 'string', 'description': "Stock symbol to search for (e.g., 'AAPL')"}, 'companyName': {'type': 'string', 'description': 'Full company name to include in the search'}}, 'additionalProperties': False}}]
-------
You can then a MCP like so:
```<usage name>
{
"tool": "<tool name (without @)>",
"inputSchema": {<inputSchema json for the tool>}
}
```
For example:
Now that I know how to use the MCP, I will choose the search-stock-news tool and execute it to find out IBM stock market.
```Cognitive-Stack/search-stock-news-mcp
{
"tool": "search-stock-news",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"required": ["symbol"],
"properties": {
"symbol": "IBM"
}
}
}
```
+56
View File
@@ -0,0 +1,56 @@
[project]
name = "agenticseek"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"adaptive-classifier>=0.0.10",
"aiofiles>=24.1.0",
"anyio>=3.5.0,<5",
"celery>=5.5.1",
"certifi==2025.4.26",
"chromedriver-autoinstaller>=0.6.4",
"colorama>=0.4.6",
"distro>=1.7.0,<2",
"fake-useragent>=2.1.0",
"fastapi>=0.115.12",
"flask>=3.1.0",
"httpx>=0.27,<0.29",
"ipython>=8.13.0",
"jiter>=0.4.0,<1",
"kokoro==0.9.4",
"langid>=1.1.6",
"librosa>=0.10.2.post1",
"markdownify>=1.1.0",
"numpy>=1.24.4",
"ollama>=0.4.7",
"openai>=1.84.0",
"ordered-set>=4.1.0",
"playsound3>=1.0.0",
"protobuf>=3.20.3",
"pyaudio>=0.2.14",
"pydantic>=2.10.6",
"pydantic-core>=2.27.2",
"pypdf>=5.4.0",
"pypinyin>=0.54.0",
"pyreadline3>=3.5.4",
"python-dotenv>=1.0.0",
"requests>=2.31.0",
"sacremoses>=0.0.53",
"scipy>=1.9.3",
"selenium>=4.27.1",
"selenium-stealth>=1.0.6",
"sentencepiece>=0.2.0",
"setuptools>=75.6.0",
"sniffio>=1.3.1",
"soundfile>=0.13.1",
"termcolor>=2.4.0",
"text2emotion>=0.0.5",
"together>=1.5.0",
"torch>=2.4.1",
"tqdm>4",
"transformers>=4.46.3",
"undetected-chromedriver>=3.5.5",
"uvicorn>=0.34.0",
]
+8 -8
View File
@@ -1,3 +1,4 @@
certifi==2025.4.26
fastapi>=0.115.12 fastapi>=0.115.12
flask>=3.1.0 flask>=3.1.0
celery>=5.5.1 celery>=5.5.1
@@ -11,17 +12,15 @@ requests>=2.31.0
numpy>=1.24.4 numpy>=1.24.4
colorama>=0.4.6 colorama>=0.4.6
python-dotenv>=1.0.0 python-dotenv>=1.0.0
playsound>=1.3.0 playsound3>=1.0.0
soundfile>=0.13.1 soundfile>=0.13.1
transformers>=4.46.3 transformers>=4.46.3
torch>=2.4.1 torch>=2.4.1
python-dotenv>=1.0.0
ollama>=0.4.7 ollama>=0.4.7
scipy>=1.9.3 scipy>=1.9.3
kokoro>=0.7.12
soundfile>=0.13.1
protobuf>=3.20.3 protobuf>=3.20.3
termcolor>=2.4.0 termcolor>=2.4.0
pypdf>=5.4.0
ipython>=8.13.0 ipython>=8.13.0
pyaudio>=0.2.14 pyaudio>=0.2.14
librosa>=0.10.2.post1 librosa>=0.10.2.post1
@@ -39,11 +38,12 @@ fake_useragent>=2.1.0
selenium_stealth>=1.0.6 selenium_stealth>=1.0.6
undetected-chromedriver>=3.5.5 undetected-chromedriver>=3.5.5
sentencepiece>=0.2.0 sentencepiece>=0.2.0
together>=1.5.0
tqdm>4
openai openai
sniffio sniffio
tqdm>4
# if use chinese
ordered_set ordered_set
pypinyin pypinyin
cn2an
jieba # Optional: TTS support (requires Python <3.12)
# pip install kokoro==0.9.4 soundfile ipython
+30 -11
View File
@@ -3,14 +3,19 @@
echo "Starting installation for Linux..." echo "Starting installation for Linux..."
set -e set -e
# Check if uv is installed
if ! command -v uv &> /dev/null; then
echo "Error: uv is not installed. Please install uv first."
echo "You can install it using: curl -LsSf https://astral.sh/uv/install.sh | sh"
exit 1
fi
# Update package list # Update package list
sudo apt-get update || { echo "Failed to update package list"; exit 1; } sudo apt-get update || { echo "Failed to update package list"; exit 1; }
# make sure essential tool are installed # make sure essential tool are installed
# Install essential tools
sudo apt-get install -y \ sudo apt-get install -y \
python3-dev \ python3-dev \
python3-pip \
python3-wheel \
build-essential \ build-essential \
alsa-utils \ alsa-utils \
portaudio19-dev \ portaudio19-dev \
@@ -21,15 +26,29 @@ sudo apt-get install -y \
libnss3 \ libnss3 \
libxss1 || { echo "Failed to install packages"; exit 1; } libxss1 || { echo "Failed to install packages"; exit 1; }
# upgrade pip # Initialize uv project if pyproject.toml doesn't exist
pip install --upgrade pip if [ ! -f "pyproject.toml" ]; then
# install wheel echo "Initializing uv project..."
pip install --upgrade pip setuptools wheel uv init --python 3.10 || { echo "Failed to initialize uv project"; exit 1; }
fi
# Sync the project (creates venv and installs dependencies)
echo "Setting up Python environment with uv..."
uv sync --python 3.10 || { echo "Failed to sync uv project"; exit 1; }
# Add specific packages
echo "Adding Selenium..."
uv add selenium || { echo "Failed to add selenium"; exit 1; }
# Add dependencies from requirements.txt if it exists
if [ -f "requirements.txt" ]; then
echo "Adding dependencies from requirements.txt..."
uv add -r requirements.txt || { echo "Failed to add requirements from requirements.txt"; exit 1; }
fi
# install docker compose # install docker compose
sudo apt install -y docker-compose sudo apt install -y docker-compose
# Install Selenium for chromedriver
pip3 install selenium
# Install Python dependencies from requirements.txt
pip3 install -r requirements.txt --no-cache-dir
echo "Installation complete for Linux!" echo "Installation complete for Linux!"
echo "To activate the environment, run: source .venv/bin/activate"
echo "Or run commands with: uv run <command>"
+29 -8
View File
@@ -4,6 +4,13 @@ echo "Starting installation for macOS..."
set -e set -e
# Check if uv is installed
if ! command -v uv &> /dev/null; then
echo "Error: uv is not installed. Please install uv first."
echo "You can install it using: curl -LsSf https://astral.sh/uv/install.sh | sh"
exit 1
fi
# Check if homebrew is installed # Check if homebrew is installed
if ! command -v brew &> /dev/null; then if ! command -v brew &> /dev/null; then
echo "Homebrew not found. Installing Homebrew..." echo "Homebrew not found. Installing Homebrew..."
@@ -18,13 +25,27 @@ brew install wget
brew install --cask chromedriver brew install --cask chromedriver
# Install portaudio for pyAudio using Homebrew # Install portaudio for pyAudio using Homebrew
brew install portaudio brew install portaudio
# update pip
python3 -m pip install --upgrade pip # Initialize uv project if pyproject.toml doesn't exist
# upgrade setuptools and wheel if [ ! -f "pyproject.toml" ]; then
pip3 install --upgrade setuptools wheel echo "Initializing uv project..."
# Install Selenium uv init --python 3.10 || { echo "Failed to initialize uv project"; exit 1; }
pip3 install selenium fi
# Install Python dependencies from requirements.txt
pip3 install -r requirements.txt --no-cache-dir # Sync the project (creates venv and installs dependencies)
echo "Setting up Python environment with uv..."
uv sync --python 3.10 || { echo "Failed to sync uv project"; exit 1; }
# Add specific packages
echo "Adding Selenium..."
uv add selenium || { echo "Failed to add selenium"; exit 1; }
# Add dependencies from requirements.txt if it exists
if [ -f "requirements.txt" ]; then
echo "Adding dependencies from requirements.txt..."
uv add -r requirements.txt || { echo "Failed to add requirements from requirements.txt"; exit 1; }
fi
echo "Installation complete for macOS!" echo "Installation complete for macOS!"
echo "To activate the environment, run: source .venv/bin/activate"
echo "Or run commands with: uv run <command>"
+60 -10
View File
@@ -1,17 +1,67 @@
@echo off @echo off
echo Starting installation for Windows... echo Starting installation for Windows...
REM Install Python dependencies from requirements.txt REM Check if uv is installed
pip install pyreadline3 uv --version >nul 2>&1
pip install -r requirements.txt if %errorlevel% neq 0 (
echo Error: uv is not installed. Please install uv first.
echo You can install it using: powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
pause
exit /b 2
)
REM Install Selenium REM Initialize uv project if pyproject.toml doesn't exist
pip install selenium if not exist "pyproject.toml" (
echo Initializing uv project...
uv init --python 3.10
if %errorlevel% neq 0 (
echo Failed to initialize uv project
pause
exit /b 1
)
)
REM Sync the project (creates venv and installs dependencies)
echo Setting up Python environment with uv...
uv sync --python 3.10
if %errorlevel% neq 0 (
echo Failed to sync uv project
pause
exit /b 1
)
REM Add specific packages
echo Adding pyreadline3...
uv add pyreadline3
if %errorlevel% neq 0 (
echo Failed to add pyreadline3
pause
exit /b 1
)
echo Adding Selenium...
uv add selenium
if %errorlevel% neq 0 (
echo Failed to add selenium
pause
exit /b 1
)
REM Add dependencies from requirements.txt if it exists
if exist "requirements.txt" (
echo Adding dependencies from requirements.txt...
uv add -r requirements.txt
if %errorlevel% neq 0 (
echo Warning: Some packages from requirements.txt failed to install.
)
)
echo Installation complete for Windows!
echo To activate the environment, run: .venv\Scripts\activate
echo Or run commands with: uv run ^<command^>
echo.
echo Note: pyAudio installation may require additional steps on Windows. echo Note: pyAudio installation may require additional steps on Windows.
echo Please install portaudio manually (e.g., via vcpkg or prebuilt binaries) and then run: pip install pyaudio echo If pyAudio fails to install, please install portaudio manually and try again.
echo Also, download and install chromedriver manually from: https://sites.google.com/chromium.org/driver/getting-started echo Also, chromedriver-autoinstaller should handle chromedriver automatically.
echo Place chromedriver in a directory included in your PATH. echo If needed, download chromedriver manually from: https://sites.google.com/chromium.org/driver/getting-started
echo Installation partially complete for Windows. Follow manual steps above.
pause pause
+1
View File
@@ -31,6 +31,7 @@ services:
- SEARXNG_BASE_URL=http://localhost:8080/ - SEARXNG_BASE_URL=http://localhost:8080/
- UWSGI_WORKERS=1 - UWSGI_WORKERS=1
- UWSGI_THREADS=1 - UWSGI_THREADS=1
user: "1000:1000" # Run as current user to avoid permission issues
cap_add: cap_add:
- CHOWN - CHOWN
- SETGID - SETGID
+40
View File
@@ -0,0 +1,40 @@
[real_ip]
# Number of values to trust for X-Forwarded-For.
x_for = 1
# The prefix defines the number of leading bits in an address that are compared
# to determine whether or not an address is part of a (client) network.
ipv4_prefix = 32
ipv6_prefix = 48
[botdetection.ip_limit]
# To get unlimited access in a local network, by default link-local addresses
# (networks) are not monitored by the ip_limit
filter_link_local = false
# activate link_token method in the ip_limit method
link_token = false
[botdetection.ip_lists]
# In the limiter, the ip_lists method has priority over all other methods -> if
# an IP is in the pass_ip list, it has unrestricted access and it is also not
# checked if e.g. the "user agent" suggests a bot (e.g. curl).
block_ip = [
# '93.184.216.34', # IPv4 of example.org
# '257.1.1.1', # invalid IP --> will be ignored, logged in ERROR class
]
pass_ip = [
# '192.168.0.0/16', # IPv4 private network
# 'fe80::/10' # IPv6 linklocal / wins over botdetection.ip_limit.filter_link_local
]
# Activate passlist of (hardcoded) IPs from the SearXNG organization,
# e.g. `check.searx.space`.
pass_searxng_org = true
File diff suppressed because it is too large Load Diff
-52
View File
@@ -1,52 +0,0 @@
[uwsgi]
# Who will run the code
uid = searxng
gid = searxng
# Number of workers (usually CPU count)
# default value: %k (= number of CPU core, see Dockerfile)
workers = 4
# Number of threads per worker
# default value: 4 (see Dockerfile)
threads = 4
# The right granted on the created socket
chmod-socket = 666
# Plugin to use and interpreter config
single-interpreter = true
master = true
plugin = python3
lazy-apps = true
enable-threads = 4
# Module to import
module = searx.webapp
# Virtualenv and python path
pythonpath = /usr/local/searxng/
chdir = /usr/local/searxng/searx/
# automatically set processes name to something meaningful
auto-procname = true
# Disable request logging for privacy
disable-logging = true
log-5xx = true
# Set the max size of a request (request-body excluded)
buffer-size = 8192
# No keep alive
# See https://github.com/searx/searx-docker/issues/24
add-header = Connection: close
# Follow SIGTERM convention
# See https://github.com/searxng/searxng/issues/3427
die-on-term
# uwsgi serves the static files
static-map = /static=/usr/local/searxng/searx/static
static-gzip-all = True
offload-threads = 4
Regular → Executable
+38 -91
View File
@@ -444,11 +444,11 @@ engines:
disabled: true disabled: true
# Requires Tor # Requires Tor
- name: ahmia #- name: ahmia
engine: ahmia # engine: ahmia
categories: onions # categories: onions
enable_http: true # enable_http: true
shortcut: ah # shortcut: ah
- name: anaconda - name: anaconda
engine: xpath engine: xpath
@@ -641,11 +641,6 @@ engines:
# # get your API key from: https://core.ac.uk/api-keys/register/ # # get your API key from: https://core.ac.uk/api-keys/register/
# api_key: 'unset' # api_key: 'unset'
- name: cppreference
engine: cppreference
shortcut: cpp
paging: false
disabled: true
- name: crossref - name: crossref
engine: crossref engine: crossref
@@ -1501,31 +1496,12 @@ engines:
engine: pinterest engine: pinterest
shortcut: pin shortcut: pin
- name: piped #- name: piped
engine: piped # engine: piped
shortcut: ppd # shortcut: ppd
categories: videos # categories: videos
piped_filter: videos # piped_filter: videos
timeout: 3.0 # timeout: 3.0
# URL to use as link and for embeds
frontend_url: https://srv.piped.video
# Instance will be selected randomly, for more see https://piped-instances.kavin.rocks/
backend_url:
- https://pipedapi.adminforge.de
- https://pipedapi.nosebs.ru
- https://pipedapi.ducks.party
- https://pipedapi.reallyaweso.me
- https://api.piped.private.coffee
- https://pipedapi.darkness.services
- name: piped.music
engine: piped
network: piped
shortcut: ppdm
categories: music
piped_filter: music_songs
timeout: 3.0
- name: piratebay - name: piratebay
engine: piratebay engine: piratebay
@@ -1942,20 +1918,6 @@ engines:
shortcut: tm shortcut: tm
disabled: true disabled: true
# Requires Tor
- name: torch
engine: xpath
paging: true
search_url:
http://xmh57jrknzkhv6y3ls3ubitzfqnkrwxhopf5aygthi7d6rplyvk3noyd.onion/cgi-bin/omega/omega?P={query}&DEFAULTOP=and
results_xpath: //table//tr
url_xpath: ./td[2]/a
title_xpath: ./td[2]/b
content_xpath: ./td[2]/small
categories: onions
enable_http: true
shortcut: tch
# torznab engine lets you query any torznab compatible indexer. Using this # torznab engine lets you query any torznab compatible indexer. Using this
# engine in combination with Jackett opens the possibility to query a lot of # engine in combination with Jackett opens the possibility to query a lot of
# public and private indexers directly from SearXNG. More details at: # public and private indexers directly from SearXNG. More details at:
@@ -2155,33 +2117,33 @@ engines:
website: https://www.wikivoyage.org/ website: https://www.wikivoyage.org/
wikidata_id: Q373 wikidata_id: Q373
- name: wikicommons.images # - name: wikicommons.images
engine: wikicommons # engine: wikicommons
shortcut: wc # shortcut: wc
categories: images # categories: images
search_type: images # search_type: images
number_of_results: 10 # number_of_results: 10
#
- name: wikicommons.videos # - name: wikicommons.videos
engine: wikicommons # engine: wikicommons
shortcut: wcv # shortcut: wcv
categories: videos # categories: videos
search_type: videos # search_type: videos
number_of_results: 10 # number_of_results: 10
#
- name: wikicommons.audio # - name: wikicommons.audio
engine: wikicommons # engine: wikicommons
shortcut: wca # shortcut: wca
categories: music # categories: music
search_type: audio # search_type: audio
number_of_results: 10 # number_of_results: 10
#
- name: wikicommons.files # - name: wikicommons.files
engine: wikicommons # engine: wikicommons
shortcut: wcf # shortcut: wcf
categories: files # categories: files
search_type: files # search_type: files
number_of_results: 10 # number_of_results: 10
- name: wolframalpha - name: wolframalpha
shortcut: wa shortcut: wa
@@ -2358,16 +2320,6 @@ engines:
# timeout can be reduced in 'local' search mode # timeout can be reduced in 'local' search mode
timeout: 5.0 timeout: 5.0
- name: yacy images
engine: yacy
network: yacy
categories: images
search_type: image
shortcut: yai
disabled: true
# timeout can be reduced in 'local' search mode
timeout: 5.0
- name: rumble - name: rumble
engine: rumble engine: rumble
shortcut: ru shortcut: ru
@@ -2481,11 +2433,6 @@ engines:
shortcut: wttr shortcut: wttr
timeout: 9.0 timeout: 9.0
- name: yummly
engine: yummly
shortcut: yum
disabled: true
- name: brave - name: brave
engine: brave engine: brave
shortcut: br shortcut: br
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -5,12 +5,12 @@ gid = searxng
# Number of workers (usually CPU count) # Number of workers (usually CPU count)
# default value: %k (= number of CPU core, see Dockerfile) # default value: %k (= number of CPU core, see Dockerfile)
workers = 1 workers = 4
# Number of threads per worker # Number of threads per worker
# default value: 4 (see Dockerfile) # default value: 4 (see Dockerfile)
enable-threads = true enable-threads = 4
threads = 1 threads = 4
# The right granted on the created socket # The right granted on the created socket
chmod-socket = 666 chmod-socket = 666
+2 -1
View File
@@ -5,5 +5,6 @@ from .casual_agent import CasualAgent
from .file_agent import FileAgent from .file_agent import FileAgent
from .planner_agent import PlannerAgent from .planner_agent import PlannerAgent
from .browser_agent import BrowserAgent from .browser_agent import BrowserAgent
from .mcp_agent import McpAgent
__all__ = ["Agent", "CoderAgent", "CasualAgent", "FileAgent", "PlannerAgent", "BrowserAgent"] __all__ = ["Agent", "CoderAgent", "CasualAgent", "FileAgent", "PlannerAgent", "BrowserAgent", "McpAgent"]
+36 -5
View File
@@ -39,14 +39,14 @@ class Agent():
self.type = None self.type = None
self.current_directory = os.getcwd() self.current_directory = os.getcwd()
self.llm = provider self.llm = provider
self.memory = Memory(self.load_prompt(prompt_path), self.memory = None
recover_last_session=False, # session recovery in handled by the interaction class
memory_compression=False)
self.tools = {} self.tools = {}
self.blocks_result = [] self.blocks_result = []
self.success = True self.success = True
self.last_answer = "" self.last_answer = ""
self.last_reasoning = ""
self.status_message = "Haven't started yet" self.status_message = "Haven't started yet"
self.stop = False
self.verbose = verbose self.verbose = verbose
self.executor = ThreadPoolExecutor(max_workers=1) self.executor = ThreadPoolExecutor(max_workers=1)
@@ -66,6 +66,10 @@ class Agent():
def get_last_answer(self) -> str: def get_last_answer(self) -> str:
return self.last_answer return self.last_answer
@property
def get_last_reasoning(self) -> str:
return self.last_reasoning
@property @property
def get_blocks(self) -> list: def get_blocks(self) -> list:
return self.blocks_result return self.blocks_result
@@ -90,6 +94,21 @@ class Agent():
raise TypeError("Tool must be a callable object (a method)") raise TypeError("Tool must be a callable object (a method)")
self.tools[name] = tool self.tools[name] = tool
def get_tools_name(self) -> list:
"""
Get the list of tools names.
"""
return list(self.tools.keys())
def get_tools_description(self) -> str:
"""
Get the list of tools names and their description.
"""
description = ""
for name in self.get_tools_name():
description += f"{name}: {self.tools[name].description}\n"
return description
def load_prompt(self, file_path: str) -> str: def load_prompt(self, file_path: str) -> str:
try: try:
with open(file_path, 'r', encoding="utf-8") as f: with open(file_path, 'r', encoding="utf-8") as f:
@@ -101,6 +120,13 @@ class Agent():
except Exception as e: except Exception as e:
raise e raise e
def request_stop(self) -> None:
"""
Request the agent to stop.
"""
self.stop = True
self.status_message = "Stopped"
@abstractmethod @abstractmethod
def process(self, prompt, speech_module) -> str: def process(self, prompt, speech_module) -> str:
""" """
@@ -114,8 +140,10 @@ class Agent():
Remove the reasoning block of reasoning model like deepseek. Remove the reasoning block of reasoning model like deepseek.
""" """
end_tag = "</think>" end_tag = "</think>"
end_idx = text.rfind(end_tag)+8 end_idx = text.rfind(end_tag)
return text[end_idx:] if end_idx == -1:
return text
return text[end_idx+8:]
def extract_reasoning_text(self, text: str) -> None: def extract_reasoning_text(self, text: str) -> None:
""" """
@@ -123,6 +151,8 @@ class Agent():
""" """
start_tag = "<think>" start_tag = "<think>"
end_tag = "</think>" end_tag = "</think>"
if text is None:
return None
start_idx = text.find(start_tag) start_idx = text.find(start_tag)
end_idx = text.rfind(end_tag)+8 end_idx = text.rfind(end_tag)+8
return text[start_idx:end_idx] return text[start_idx:end_idx]
@@ -238,6 +268,7 @@ class Agent():
blocks, save_path = tool.load_exec_block(answer) blocks, save_path = tool.load_exec_block(answer)
if blocks != None: if blocks != None:
pretty_print(f"Executing {len(blocks)} {name} blocks...", color="status")
for block in blocks: for block in blocks:
self.show_block(block) self.show_block(block)
output = tool.execute([block]) output = tool.execute([block])
+35 -11
View File
@@ -10,6 +10,7 @@ from sources.agents.agent import Agent
from sources.tools.searxSearch import searxSearch from sources.tools.searxSearch import searxSearch
from sources.browser import Browser from sources.browser import Browser
from sources.logger import Logger from sources.logger import Logger
from sources.memory import Memory
class Action(Enum): class Action(Enum):
REQUEST_EXIT = "REQUEST_EXIT" REQUEST_EXIT = "REQUEST_EXIT"
@@ -37,6 +38,10 @@ class BrowserAgent(Agent):
self.notes = [] self.notes = []
self.date = self.get_today_date() self.date = self.get_today_date()
self.logger = Logger("browser_agent.log") self.logger = Logger("browser_agent.log")
self.memory = Memory(self.load_prompt(prompt_path),
recover_last_session=False, # session recovery in handled by the interaction class
memory_compression=False,
model_provider=provider.get_model_name() if provider else None)
def get_today_date(self) -> str: def get_today_date(self) -> str:
"""Get the date""" """Get the date"""
@@ -72,14 +77,14 @@ class BrowserAgent(Agent):
def get_unvisited_links(self) -> List[str]: def get_unvisited_links(self) -> List[str]:
return "\n".join([f"[{i}] {link}" for i, link in enumerate(self.navigable_links) if link not in self.search_history]) return "\n".join([f"[{i}] {link}" for i, link in enumerate(self.navigable_links) if link not in self.search_history])
def make_newsearch_prompt(self, user_prompt: str, search_result: dict) -> str: def make_newsearch_prompt(self, prompt: str, search_result: dict) -> str:
search_choice = self.stringify_search_results(search_result) search_choice = self.stringify_search_results(search_result)
self.logger.info(f"Search results: {search_choice}") self.logger.info(f"Search results: {search_choice}")
return f""" return f"""
Based on the search result: Based on the search result:
{search_choice} {search_choice}
Your goal is to find accurate and complete information to satisfy the users request. Your goal is to find accurate and complete information to satisfy the users request.
User request: {user_prompt} User request: {prompt}
To proceed, choose a relevant link from the search results. Announce your choice by saying: "I will navigate to <link>" To proceed, choose a relevant link from the search results. Announce your choice by saying: "I will navigate to <link>"
Do not explain your choice. Do not explain your choice.
""" """
@@ -176,6 +181,7 @@ class BrowserAgent(Agent):
animate_thinking("Thinking...", color="status") animate_thinking("Thinking...", color="status")
self.memory.push('user', prompt) self.memory.push('user', prompt)
answer, reasoning = await self.llm_request() answer, reasoning = await self.llm_request()
self.last_reasoning = reasoning
if show_reasoning: if show_reasoning:
pretty_print(reasoning, color="failure") pretty_print(reasoning, color="failure")
pretty_print(answer, color="output") pretty_print(answer, color="output")
@@ -229,15 +235,27 @@ class BrowserAgent(Agent):
return links return links
def select_link(self, links: List[str]) -> str | None: def select_link(self, links: List[str]) -> str | None:
"""
Select the first unvisited link that is not the current page.
Preference is given to links not in search_history.
"""
for lk in links: for lk in links:
if lk == self.current_page: if lk == self.current_page or lk in self.search_history:
self.logger.info(f"Already visited {lk}. Skipping.") self.logger.info(f"Skipping already visited or current link: {lk}")
continue continue
self.logger.info(f"Selected link: {lk}") self.logger.info(f"Selected link: {lk}")
return lk return lk
self.logger.warning("No link selected.") self.logger.warning("No suitable link selected.")
return None return None
def get_page_text(self, limit_to_model_ctx = False) -> str:
"""Get the text content of the current page."""
page_text = self.browser.get_text()
if limit_to_model_ctx:
#page_text = self.memory.compress_text_to_max_ctx(page_text)
page_text = self.memory.trim_text_to_max_ctx(page_text)
return page_text
def conclude_prompt(self, user_query: str) -> str: def conclude_prompt(self, user_query: str) -> str:
annotated_notes = [f"{i+1}: {note.lower()}" for i, note in enumerate(self.notes)] annotated_notes = [f"{i+1}: {note.lower()}" for i, note in enumerate(self.notes)]
search_note = '\n'.join(annotated_notes) search_note = '\n'.join(annotated_notes)
@@ -250,6 +268,7 @@ class BrowserAgent(Agent):
Expand on the finding or step that lead to success, and provide a conclusion that answer the request. Include link when possible. Expand on the finding or step that lead to success, and provide a conclusion that answer the request. Include link when possible.
Do not give advices or try to answer the human. Just structure the AI finding in a structured and clear way. Do not give advices or try to answer the human. Just structure the AI finding in a structured and clear way.
You should answer in the same language as the user.
""" """
def search_prompt(self, user_prompt: str) -> str: def search_prompt(self, user_prompt: str) -> str:
@@ -335,11 +354,13 @@ class BrowserAgent(Agent):
self.show_search_results(search_result) self.show_search_results(search_result)
prompt = self.make_newsearch_prompt(user_prompt, search_result) prompt = self.make_newsearch_prompt(user_prompt, search_result)
unvisited = [None] unvisited = [None]
while not complete and len(unvisited) > 0: while not complete and len(unvisited) > 0 and not self.stop:
self.memory.clear() self.memory.clear()
unvisited = self.select_unvisited(search_result) unvisited = self.select_unvisited(search_result)
answer, reasoning = await self.llm_decide(prompt, show_reasoning = False) answer, reasoning = await self.llm_decide(prompt, show_reasoning = False)
if self.stop:
pretty_print(f"Requested stop.", color="failure")
break
if self.last_answer == answer: if self.last_answer == answer:
prompt = self.stuck_prompt(user_prompt, unvisited) prompt = self.stuck_prompt(user_prompt, unvisited)
continue continue
@@ -351,13 +372,13 @@ class BrowserAgent(Agent):
self.status_message = "Filling web form..." self.status_message = "Filling web form..."
pretty_print(f"Filling inputs form...", color="status") pretty_print(f"Filling inputs form...", color="status")
fill_success = self.browser.fill_form(extracted_form) fill_success = self.browser.fill_form(extracted_form)
page_text = self.browser.get_text() page_text = self.get_page_text(limit_to_model_ctx=True)
answer = self.handle_update_prompt(user_prompt, page_text, fill_success) answer = self.handle_update_prompt(user_prompt, page_text, fill_success)
answer, reasoning = await self.llm_decide(prompt) answer, reasoning = await self.llm_decide(prompt)
if Action.FORM_FILLED.value in answer: if Action.FORM_FILLED.value in answer:
pretty_print(f"Filled form. Handling page update.", color="status") pretty_print(f"Filled form. Handling page update.", color="status")
page_text = self.browser.get_text() page_text = self.get_page_text(limit_to_model_ctx=True)
self.navigable_links = self.browser.get_navigable() self.navigable_links = self.browser.get_navigable()
prompt = self.make_navigation_prompt(user_prompt, page_text) prompt = self.make_navigation_prompt(user_prompt, page_text)
continue continue
@@ -379,7 +400,10 @@ class BrowserAgent(Agent):
if (link == None and len(extracted_form) < 3) or Action.GO_BACK.value in answer or link in self.search_history: if (link == None and len(extracted_form) < 3) or Action.GO_BACK.value in answer or link in self.search_history:
pretty_print(f"Going back to results. Still {len(unvisited)}", color="status") pretty_print(f"Going back to results. Still {len(unvisited)}", color="status")
self.status_message = "Going back to search results..." self.status_message = "Going back to search results..."
prompt = self.make_newsearch_prompt(user_prompt, unvisited) request_prompt = user_prompt
if link is None:
request_prompt += f"\nYou previously choosen:\n{self.last_answer} but the website is unavailable. Consider other options."
prompt = self.make_newsearch_prompt(request_prompt, unvisited)
self.search_history.append(link) self.search_history.append(link)
self.current_page = link self.current_page = link
continue continue
@@ -393,7 +417,7 @@ class BrowserAgent(Agent):
prompt = self.make_newsearch_prompt(user_prompt, unvisited) prompt = self.make_newsearch_prompt(user_prompt, unvisited)
continue continue
self.current_page = link self.current_page = link
page_text = self.browser.get_text() page_text = self.get_page_text(limit_to_model_ctx=True)
self.navigable_links = self.browser.get_navigable() self.navigable_links = self.browser.get_navigable()
prompt = self.make_navigation_prompt(user_prompt, page_text) prompt = self.make_navigation_prompt(user_prompt, page_text)
self.status_message = "Navigating..." self.status_message = "Navigating..."
+5
View File
@@ -6,6 +6,7 @@ from sources.tools.searxSearch import searxSearch
from sources.tools.flightSearch import FlightSearch from sources.tools.flightSearch import FlightSearch
from sources.tools.fileFinder import FileFinder from sources.tools.fileFinder import FileFinder
from sources.tools.BashInterpreter import BashInterpreter from sources.tools.BashInterpreter import BashInterpreter
from sources.memory import Memory
class CasualAgent(Agent): class CasualAgent(Agent):
def __init__(self, name, prompt_path, provider, verbose=False): def __init__(self, name, prompt_path, provider, verbose=False):
@@ -17,6 +18,10 @@ class CasualAgent(Agent):
} # No tools for the casual agent } # No tools for the casual agent
self.role = "talk" self.role = "talk"
self.type = "casual_agent" self.type = "casual_agent"
self.memory = Memory(self.load_prompt(prompt_path),
recover_last_session=False, # session recovery in handled by the interaction class
memory_compression=False,
model_provider=provider.get_model_name())
async def process(self, prompt, speech_module) -> str: async def process(self, prompt, speech_module) -> str:
self.memory.push('user', prompt) self.memory.push('user', prompt)
+11 -4
View File
@@ -10,6 +10,7 @@ from sources.tools.BashInterpreter import BashInterpreter
from sources.tools.JavaInterpreter import JavaInterpreter from sources.tools.JavaInterpreter import JavaInterpreter
from sources.tools.fileFinder import FileFinder from sources.tools.fileFinder import FileFinder
from sources.logger import Logger from sources.logger import Logger
from sources.memory import Memory
class CoderAgent(Agent): class CoderAgent(Agent):
""" """
@@ -29,6 +30,10 @@ class CoderAgent(Agent):
self.role = "code" self.role = "code"
self.type = "code_agent" self.type = "code_agent"
self.logger = Logger("code_agent.log") self.logger = Logger("code_agent.log")
self.memory = Memory(self.load_prompt(prompt_path),
recover_last_session=False, # session recovery in handled by the interaction class
memory_compression=False,
model_provider=provider.get_model_name())
def add_sys_info_prompt(self, prompt): def add_sys_info_prompt(self, prompt):
"""Add system information to the prompt.""" """Add system information to the prompt."""
@@ -41,15 +46,17 @@ class CoderAgent(Agent):
async def process(self, prompt, speech_module) -> str: async def process(self, prompt, speech_module) -> str:
answer = "" answer = ""
attempt = 0 attempt = 0
max_attempts = 4 max_attempts = 5
prompt = self.add_sys_info_prompt(prompt) prompt = self.add_sys_info_prompt(prompt)
self.memory.push('user', prompt) self.memory.push('user', prompt)
clarify_trigger = "REQUEST_CLARIFICATION" clarify_trigger = "REQUEST_CLARIFICATION"
while attempt < max_attempts: while attempt < max_attempts and not self.stop:
print("Stopped?", self.stop)
animate_thinking("Thinking...", color="status") animate_thinking("Thinking...", color="status")
await self.wait_message(speech_module) await self.wait_message(speech_module)
answer, reasoning = await self.llm_request() answer, reasoning = await self.llm_request()
self.last_reasoning = reasoning
if clarify_trigger in answer: if clarify_trigger in answer:
self.last_answer = answer self.last_answer = answer
await asyncio.sleep(0) await asyncio.sleep(0)
@@ -62,14 +69,14 @@ class CoderAgent(Agent):
animate_thinking("Executing code...", color="status") animate_thinking("Executing code...", color="status")
self.status_message = "Executing code..." self.status_message = "Executing code..."
self.logger.info(f"Attempt {attempt + 1}:\n{answer}") self.logger.info(f"Attempt {attempt + 1}:\n{answer}")
exec_success, _ = self.execute_modules(answer) exec_success, feedback = self.execute_modules(answer)
self.logger.info(f"Execution result: {exec_success}") self.logger.info(f"Execution result: {exec_success}")
answer = self.remove_blocks(answer) answer = self.remove_blocks(answer)
self.last_answer = answer self.last_answer = answer
await asyncio.sleep(0) await asyncio.sleep(0)
if exec_success and self.get_last_tool_type() != "bash": if exec_success and self.get_last_tool_type() != "bash":
break break
pretty_print("Execution failure", color="failure") pretty_print(f"Execution failure:\n{feedback}", color="failure")
pretty_print("Correcting code...", color="status") pretty_print("Correcting code...", color="status")
self.status_message = "Correcting code..." self.status_message = "Correcting code..."
attempt += 1 attempt += 1
+7 -1
View File
@@ -4,6 +4,7 @@ from sources.utility import pretty_print, animate_thinking
from sources.agents.agent import Agent from sources.agents.agent import Agent
from sources.tools.fileFinder import FileFinder from sources.tools.fileFinder import FileFinder
from sources.tools.BashInterpreter import BashInterpreter from sources.tools.BashInterpreter import BashInterpreter
from sources.memory import Memory
class FileAgent(Agent): class FileAgent(Agent):
def __init__(self, name, prompt_path, provider, verbose=False): def __init__(self, name, prompt_path, provider, verbose=False):
@@ -18,15 +19,20 @@ class FileAgent(Agent):
self.work_dir = self.tools["file_finder"].get_work_dir() self.work_dir = self.tools["file_finder"].get_work_dir()
self.role = "files" self.role = "files"
self.type = "file_agent" self.type = "file_agent"
self.memory = Memory(self.load_prompt(prompt_path),
recover_last_session=False, # session recovery in handled by the interaction class
memory_compression=False,
model_provider=provider.get_model_name())
async def process(self, prompt, speech_module) -> str: async def process(self, prompt, speech_module) -> str:
exec_success = False exec_success = False
prompt += f"\nYou must work in directory: {self.work_dir}" prompt += f"\nYou must work in directory: {self.work_dir}"
self.memory.push('user', prompt) self.memory.push('user', prompt)
while exec_success is False: while exec_success is False and not self.stop:
await self.wait_message(speech_module) await self.wait_message(speech_module)
animate_thinking("Thinking...", color="status") animate_thinking("Thinking...", color="status")
answer, reasoning = await self.llm_request() answer, reasoning = await self.llm_request()
self.last_reasoning = reasoning
exec_success, _ = self.execute_modules(answer) exec_success, _ = self.execute_modules(answer)
answer = self.remove_blocks(answer) answer = self.remove_blocks(answer)
self.last_answer = answer self.last_answer = answer
+73
View File
@@ -0,0 +1,73 @@
import os
import asyncio
from sources.utility import pretty_print, animate_thinking
from sources.agents.agent import Agent
from sources.tools.mcpFinder import MCP_finder
from sources.memory import Memory
# NOTE MCP agent is an active work in progress, not functional yet.
class McpAgent(Agent):
def __init__(self, name, prompt_path, provider, verbose=False):
"""
The mcp agent is a special agent for using MCPs.
MCP agent will be disabled if the user does not explicitly set the MCP_FINDER_API_KEY in environment variable.
"""
super().__init__(name, prompt_path, provider, verbose, None)
keys = self.get_api_keys()
self.tools = {
"mcp_finder": MCP_finder(keys["mcp_finder"]),
# add mcp tools here
}
self.role = "mcp"
self.type = "mcp_agent"
self.memory = Memory(self.load_prompt(prompt_path),
recover_last_session=False, # session recovery in handled by the interaction class
memory_compression=False,
model_provider=provider.get_model_name())
self.enabled = True
def get_api_keys(self) -> dict:
"""
Returns the API keys for the tools.
"""
api_key_mcp_finder = os.getenv("MCP_FINDER_API_KEY")
if not api_key_mcp_finder or api_key_mcp_finder == "":
pretty_print("MCP Finder disabled.", color="warning")
self.enabled = False
return {
"mcp_finder": api_key_mcp_finder
}
def expand_prompt(self, prompt):
"""
Expands the prompt with the tools available.
"""
tools_str = self.get_tools_description()
prompt += f"""
You can use the following tools and MCPs:
{tools_str}
"""
return prompt
async def process(self, prompt, speech_module) -> str:
if self.enabled == False:
return "MCP Agent is disabled."
prompt = self.expand_prompt(prompt)
self.memory.push('user', prompt)
working = True
while working == True:
animate_thinking("Thinking...", color="status")
answer, reasoning = await self.llm_request()
exec_success, _ = self.execute_modules(answer)
answer = self.remove_blocks(answer)
self.last_answer = answer
self.status_message = "Ready"
if len(self.blocks_result) == 0:
working = False
return answer, reasoning
if __name__ == "__main__":
pass
+35 -6
View File
@@ -9,6 +9,7 @@ from sources.agents.casual_agent import CasualAgent
from sources.text_to_speech import Speech from sources.text_to_speech import Speech
from sources.tools.tools import Tools from sources.tools.tools import Tools
from sources.logger import Logger from sources.logger import Logger
from sources.memory import Memory
class PlannerAgent(Agent): class PlannerAgent(Agent):
def __init__(self, name, prompt_path, provider, verbose=False, browser=None): def __init__(self, name, prompt_path, provider, verbose=False, browser=None):
@@ -29,6 +30,10 @@ class PlannerAgent(Agent):
} }
self.role = "planification" self.role = "planification"
self.type = "planner_agent" self.type = "planner_agent"
self.memory = Memory(self.load_prompt(prompt_path),
recover_last_session=False, # session recovery in handled by the interaction class
memory_compression=False,
model_provider=provider.get_model_name())
self.logger = Logger("planner_agent.log") self.logger = Logger("planner_agent.log")
def get_task_names(self, text: str) -> List[str]: def get_task_names(self, text: str) -> List[str]:
@@ -71,18 +76,27 @@ class PlannerAgent(Agent):
if blocks == None: if blocks == None:
return [] return []
for block in blocks: for block in blocks:
try:
line_json = json.loads(block) line_json = json.loads(block)
except json.JSONDecodeError as e:
self.logger.warning(f"Failed to parse JSON block: {e}")
pretty_print(f"JSON parsing error: {e}", color="warning")
return []
if 'plan' in line_json: if 'plan' in line_json:
for task in line_json['plan']: for task in line_json['plan']:
if task['agent'].lower() not in [ag_name.lower() for ag_name in self.agents.keys()]: if task['agent'].lower() not in [ag_name.lower() for ag_name in self.agents.keys()]:
self.logger.warning(f"Agent {task['agent']} does not exist.") self.logger.warning(f"Agent {task['agent']} does not exist.")
pretty_print(f"Agent {task['agent']} does not exist.", color="warning") pretty_print(f"Agent {task['agent']} does not exist.", color="warning")
return [] return []
try:
agent = { agent = {
'agent': task['agent'], 'agent': task['agent'],
'id': task['id'], 'id': task['id'],
'task': task['task'] 'task': task['task']
} }
except:
self.logger.warning("Missing field in json plan.")
return []
self.logger.info(f"Created agent {task['agent']} with task: {task['task']}") self.logger.info(f"Created agent {task['agent']} with task: {task['task']}")
if 'need' in task: if 'need' in task:
self.logger.info(f"Agent {task['agent']} was given info:\n {task['need']}") self.logger.info(f"Agent {task['agent']} was given info:\n {task['need']}")
@@ -133,17 +147,23 @@ class PlannerAgent(Agent):
pretty_print(f"{task['agent']} -> {task['task']}", color="info") pretty_print(f"{task['agent']} -> {task['task']}", color="info")
pretty_print("▔▗ E N D ▖▔", color="status") pretty_print("▔▗ E N D ▖▔", color="status")
async def make_plan(self, prompt: str) -> str: async def make_plan(self, prompt: str, max_retries: int = 4) -> str:
""" """
Asks the LLM to make a plan. Asks the LLM to make a plan.
Args: Args:
prompt (str): The prompt to be sent to the LLM. prompt (str): The prompt to be sent to the LLM.
max_retries (int): Maximum number of retries before giving up.
Returns: Returns:
str: The plan made by the LLM. str: The plan made by the LLM.
""" """
ok = False ok = False
answer = None answer = None
retries = 0
while not ok: while not ok:
if retries >= max_retries:
pretty_print(f"Failed to make a plan after {max_retries} attempts. Giving up.", color="failure")
self.logger.warning(f"make_plan exceeded max retries ({max_retries}).")
return []
animate_thinking("Thinking...", color="status") animate_thinking("Thinking...", color="status")
self.memory.push('user', prompt) self.memory.push('user', prompt)
answer, reasoning = await self.llm_request() answer, reasoning = await self.llm_request()
@@ -151,8 +171,10 @@ class PlannerAgent(Agent):
return [] return []
agents_tasks = self.parse_agent_tasks(answer) agents_tasks = self.parse_agent_tasks(answer)
if agents_tasks == []: if agents_tasks == []:
prompt = f"Failed to parse the tasks. Please make a plan within ```json. Do not ask for clarification.\n" self.show_plan(agents_tasks, answer)
prompt = f"Failed to parse the tasks. Please write down your task followed by a json plan within ```json. Do not ask for clarification.\n"
pretty_print("Failed to make plan. Retrying...", color="warning") pretty_print("Failed to make plan. Retrying...", color="warning")
retries += 1
continue continue
self.show_plan(agents_tasks, answer) self.show_plan(agents_tasks, answer)
ok = True ok = True
@@ -173,7 +195,11 @@ class PlannerAgent(Agent):
last_agent_work = agents_work_result[id] last_agent_work = agents_work_result[id]
tool_success_str = "success" if success else "failure" tool_success_str = "success" if success else "failure"
pretty_print(f"Agent {id} work {tool_success_str}.", color="success" if success else "failure") pretty_print(f"Agent {id} work {tool_success_str}.", color="success" if success else "failure")
if int(id) == len(agents_tasks): try:
id_int = int(id)
except Exception as e:
return agents_tasks
if id_int == len(agents_tasks):
next_task = "No task follow, this was the last step. If it failed add a task to recover." next_task = "No task follow, this was the last step. If it failed add a task to recover."
else: else:
next_task = f"Next task is: {agents_tasks[int(id)][0]}." next_task = f"Next task is: {agents_tasks[int(id)][0]}."
@@ -186,7 +212,7 @@ class PlannerAgent(Agent):
{last_agent_work} {last_agent_work}
Agent {id} work was a {tool_success_str} according to system interpreter. Agent {id} work was a {tool_success_str} according to system interpreter.
{next_task} {next_task}
Is the work done for task {id} leading to sucess or failure ? Did an agent fail with a task? Is the work done for task {id} leading to success or failure ? Did an agent fail with a task?
If agent work was good: answer "NO_UPDATE" If agent work was good: answer "NO_UPDATE"
If agent work is leading to failure: update the plan. If agent work is leading to failure: update the plan.
If a task failed add a task to try again or recover from failure. You might have near identical task twice. If a task failed add a task to try again or recover from failure. You might have near identical task twice.
@@ -216,8 +242,9 @@ class PlannerAgent(Agent):
agent_prompt = self.make_prompt(task['task'], required_infos) agent_prompt = self.make_prompt(task['task'], required_infos)
pretty_print(f"Agent {task['agent']} started working...", color="status") pretty_print(f"Agent {task['agent']} started working...", color="status")
self.logger.info(f"Agent {task['agent']} started working on {task['task']}.") self.logger.info(f"Agent {task['agent']} started working on {task['task']}.")
answer, _ = await self.agents[task['agent'].lower()].process(agent_prompt, None) answer, reasoning = await self.agents[task['agent'].lower()].process(agent_prompt, None)
self.last_answer = answer self.last_answer = answer
self.last_reasoning = reasoning
self.blocks_result = self.agents[task['agent'].lower()].blocks_result self.blocks_result = self.agents[task['agent'].lower()].blocks_result
agent_answer = self.agents[task['agent'].lower()].raw_answer_blocks(answer) agent_answer = self.agents[task['agent'].lower()].raw_answer_blocks(answer)
success = self.agents[task['agent'].lower()].get_success success = self.agents[task['agent'].lower()].get_success
@@ -252,7 +279,7 @@ class PlannerAgent(Agent):
return "Failed to parse the tasks.", "" return "Failed to parse the tasks.", ""
i = 0 i = 0
steps = len(agents_tasks) steps = len(agents_tasks)
while i < steps: while i < steps and not self.stop:
task_name, task = agents_tasks[i][0], agents_tasks[i][1] task_name, task = agents_tasks[i][0], agents_tasks[i][1]
self.status_message = "Starting agents..." self.status_message = "Starting agents..."
pretty_print(f"I will {task_name}.", color="info") pretty_print(f"I will {task_name}.", color="info")
@@ -266,6 +293,8 @@ class PlannerAgent(Agent):
answer, success = await self.start_agent_process(task, required_infos) answer, success = await self.start_agent_process(task, required_infos)
except Exception as e: except Exception as e:
raise e raise e
if self.stop:
pretty_print(f"Requested stop.", color="failure")
agents_work_result[task['id']] = answer agents_work_result[task['id']] = answer
agents_tasks = await self.update_plan(goal, agents_tasks, agents_work_result, task['id'], success) agents_tasks = await self.update_plan(goal, agents_tasks, agents_work_result, task['id'], success)
steps = len(agents_tasks) steps = len(agents_tasks)
+274 -45
View File
@@ -2,7 +2,7 @@ from selenium import webdriver
from selenium.webdriver.chrome.service import Service from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support.ui import WebDriverWait, Select
from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException, WebDriverException from selenium.common.exceptions import TimeoutException, WebDriverException
from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.action_chains import ActionChains
@@ -13,10 +13,15 @@ from fake_useragent import UserAgent
from selenium_stealth import stealth from selenium_stealth import stealth
import undetected_chromedriver as uc import undetected_chromedriver as uc
import chromedriver_autoinstaller import chromedriver_autoinstaller
import certifi
import ssl
import subprocess
import time import time
import random import random
import os import os
import shutil import shutil
import uuid
import socket
import tempfile import tempfile
import markdownify import markdownify
import sys import sys
@@ -27,6 +32,7 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from sources.utility import pretty_print, animate_thinking from sources.utility import pretty_print, animate_thinking
from sources.logger import Logger from sources.logger import Logger
def get_chrome_path() -> str: def get_chrome_path() -> str:
"""Get the path to the Chrome executable.""" """Get the path to the Chrome executable."""
if sys.platform.startswith("win"): if sys.platform.startswith("win"):
@@ -39,10 +45,17 @@ def get_chrome_path() -> str:
paths = ["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", paths = ["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
"/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta"] "/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta"]
else: # Linux else: # Linux
paths = ["/usr/bin/google-chrome", "/usr/bin/chromium-browser", "/usr/bin/chromium", "/opt/chrome/chrome", "/usr/local/bin/chrome"] paths = ["/usr/bin/google-chrome",
"/opt/chrome/chrome",
"/usr/bin/chromium-browser",
"/usr/bin/chromium",
"/usr/local/bin/chrome",
"/opt/google/chrome/chrome-headless-shell",
#"/app/chrome_bundle/chrome136/chrome-linux64"
]
for path in paths: for path in paths:
if os.path.exists(path) and os.access(path, os.X_OK): # Check if executable if os.path.exists(path) and os.access(path, os.X_OK):
return path return path
print("Looking for Google Chrome in these locations failed:") print("Looking for Google Chrome in these locations failed:")
print('\n'.join(paths)) print('\n'.join(paths))
@@ -59,14 +72,96 @@ def get_chrome_path() -> str:
def get_random_user_agent() -> str: def get_random_user_agent() -> str:
"""Get a random user agent string with associated vendor.""" """Get a random user agent string with associated vendor."""
user_agents = [ user_agents = [
{"ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36", "vendor": "Google Inc."}, {"ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36", "vendor": "Google Inc."},
{"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 14_6_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15", "vendor": "Apple Inc."}, {"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 14_6_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36", "vendor": "Apple Inc."},
{"ua": "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0", "vendor": ""}, {"ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36", "vendor": "Google Inc."},
] ]
return random.choice(user_agents) return random.choice(user_agents)
def create_driver(headless=False, stealth_mode=True, crx_path="./crx/nopecha.crx") -> webdriver.Chrome: def get_chromedriver_version(chromedriver_path: str) -> str:
"""Create a Chrome WebDriver with specified options.""" """Get the major version of a chromedriver binary. Returns empty string on failure."""
try:
result = subprocess.run(
[chromedriver_path, "--version"],
capture_output=True, text=True, timeout=10
)
# Output format: "ChromeDriver 125.0.6422.78 (...)"
return result.stdout.strip().split()[1].split('.')[0]
except Exception:
return ""
def is_chromedriver_compatible(chromedriver_path: str) -> bool:
"""Check if a chromedriver binary is compatible with the installed Chrome version."""
try:
chrome_version = chromedriver_autoinstaller.get_chrome_version()
if not chrome_version:
return True # Can't determine Chrome version, assume compatible
chrome_major = chrome_version.split('.')[0]
driver_major = get_chromedriver_version(chromedriver_path)
if not driver_major:
return True # Can't determine driver version, assume compatible
return chrome_major == driver_major
except Exception:
return True # On any error, assume compatible to avoid blocking
def install_chromedriver() -> str:
"""
Install the ChromeDriver if not already installed. Return the path.
Automatically updates the driver if the version does not match the installed Chrome.
"""
# First try to use chromedriver in the project root directory (as per README)
project_root_chromedriver = "./chromedriver"
if os.path.exists(project_root_chromedriver) and os.access(project_root_chromedriver, os.X_OK):
if is_chromedriver_compatible(project_root_chromedriver):
print(f"Using ChromeDriver from project root: {project_root_chromedriver}")
return project_root_chromedriver
print("ChromeDriver in project root is outdated, attempting auto-update...")
# Then try to use the system-installed chromedriver
chromedriver_path = shutil.which("chromedriver")
if chromedriver_path:
if is_chromedriver_compatible(chromedriver_path):
return chromedriver_path
print(f"System ChromeDriver at {chromedriver_path} is outdated, attempting auto-update...")
# In Docker environment, try the fixed path
if os.path.exists('/.dockerenv'):
docker_chromedriver_path = "/usr/local/bin/chromedriver"
if os.path.exists(docker_chromedriver_path) and os.access(docker_chromedriver_path, os.X_OK):
print(f"Using Docker ChromeDriver at {docker_chromedriver_path}")
return docker_chromedriver_path
# Auto-install matching ChromeDriver version
try:
print("Installing matching ChromeDriver version automatically...")
chromedriver_path = chromedriver_autoinstaller.install()
except Exception as e:
raise FileNotFoundError(
"ChromeDriver not found and could not be installed automatically. "
"Please install it manually from https://chromedriver.chromium.org/downloads."
"and ensure it's in your PATH or specify the path directly."
"See know issues in readme if your chrome version is above 115."
) from e
if not chromedriver_path:
raise FileNotFoundError("ChromeDriver not found. Please install it or add it to your PATH.")
return chromedriver_path
def bypass_ssl() -> str:
"""
This is a fallback for stealth mode to bypass SSL verification. Which can fail on some setup.
"""
pretty_print("Bypassing SSL verification issues, we strongly advice you update your certifi SSL certificate.", color="warning")
ssl._create_default_https_context = ssl._create_unverified_context
def get_free_port() -> int:
"""Find and return a free TCP port on the local machine."""
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.bind(('', 0))
return s.getsockname()[1]
def create_chrome_options(headless=False, stealth_mode=True, crx_path="./crx/nopecha.crx", lang="en") -> Options:
"""Create Chrome options - separated for reusability."""
chrome_options = Options() chrome_options = Options()
chrome_path = get_chrome_path() chrome_path = get_chrome_path()
@@ -75,59 +170,116 @@ def create_driver(headless=False, stealth_mode=True, crx_path="./crx/nopecha.crx
chrome_options.binary_location = chrome_path chrome_options.binary_location = chrome_path
if headless: if headless:
chrome_options.add_argument("--headless") chrome_options.add_argument("--headless=new")
chrome_options.add_argument("--disable-gpu") chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument("--disable-webgl") chrome_options.add_argument("--disable-webgl")
user_data_dir = tempfile.mkdtemp()
user_agent = get_random_user_agent() user_agent = get_random_user_agent()
chrome_options.add_argument(f"--user-data-dir={user_data_dir}") width, height = (1920, 1080)
profile_dir = f"/tmp/chrome_profile_{uuid.uuid4().hex[:8]}"
# Core options
chrome_options.add_argument("--no-sandbox") chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--disable-dev-shm-usage") chrome_options.add_argument('--disable-dev-shm-usage')
chrome_options.add_argument(f'--user-data-dir={profile_dir}')
chrome_options.add_argument(f"--accept-lang={lang}-{lang.upper()},{lang};q=0.9")
chrome_options.add_argument("--disable-extensions")
chrome_options.add_argument("--disable-background-timer-throttling")
chrome_options.add_argument("--timezone=Europe/Paris")
chrome_options.add_argument(f'--remote-debugging-port={get_free_port()}')
chrome_options.add_argument('--disable-background-timer-throttling')
chrome_options.add_argument('--disable-backgrounding-occluded-windows')
chrome_options.add_argument('--disable-renderer-backgrounding')
chrome_options.add_argument('--disable-features=TranslateUI')
chrome_options.add_argument('--disable-ipc-flooding-protection')
chrome_options.add_argument("--mute-audio") chrome_options.add_argument("--mute-audio")
chrome_options.add_argument("--disable-notifications") chrome_options.add_argument("--disable-notifications")
chrome_options.add_argument("--autoplay-policy=user-gesture-required") chrome_options.add_argument("--autoplay-policy=user-gesture-required")
chrome_options.add_argument("--disable-features=SitePerProcess,IsolateOrigins")
chrome_options.add_argument("--enable-features=NetworkService,NetworkServiceInProcess")
chrome_options.add_argument("--disable-blink-features=AutomationControlled") chrome_options.add_argument("--disable-blink-features=AutomationControlled")
chrome_options.add_argument(f'user-agent={user_agent["ua"]}') chrome_options.add_argument(f'user-agent={user_agent["ua"]}')
resolutions = [(1920, 1080), (1366, 768), (1440, 900)]
width, height = random.choice(resolutions)
chrome_options.add_argument(f'--window-size={width},{height}') chrome_options.add_argument(f'--window-size={width},{height}')
if not stealth_mode: if not stealth_mode:
# crx file can't be installed in stealth mode
if not os.path.exists(crx_path): if not os.path.exists(crx_path):
pretty_print(f"Anti-captcha CRX not found at {crx_path}.", color="failure") pretty_print(f"Anti-captcha CRX not found at {crx_path}.", color="failure")
else: else:
chrome_options.add_extension(crx_path) chrome_options.add_extension(crx_path)
chromedriver_path = shutil.which("chromedriver") if not stealth_mode:
if not chromedriver_path: security_prefs = {
chromedriver_path = chromedriver_autoinstaller.install() "profile.default_content_setting_values.geolocation": 0,
"profile.default_content_setting_values.notifications": 0,
"profile.default_content_setting_values.camera": 0,
"profile.default_content_setting_values.microphone": 0,
"profile.default_content_setting_values.midi_sysex": 0,
"profile.default_content_setting_values.clipboard": 0,
"profile.default_content_setting_values.media_stream": 0,
"profile.default_content_setting_values.background_sync": 0,
"profile.default_content_setting_values.sensors": 0,
"profile.default_content_setting_values.accessibility_events": 0,
"safebrowsing.enabled": True,
"credentials_enable_service": False,
"profile.password_manager_enabled": False,
"webkit.webprefs.accelerated_2d_canvas_enabled": True,
"webkit.webprefs.force_dark_mode_enabled": False,
"webkit.webprefs.accelerated_2d_canvas_msaa_sample_count": 4,
"enable_webgl": True,
"enable_webgl2_compute_context": True
}
chrome_options.add_experimental_option("prefs", security_prefs)
chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
chrome_options.add_experimental_option('useAutomationExtension', False)
if not chromedriver_path: return chrome_options
raise FileNotFoundError("ChromeDriver not found. Please install it or add it to your PATH.")
service = Service(chromedriver_path) def create_undetected_chromedriver(service, chrome_options) -> webdriver.Chrome:
if stealth_mode: """Create an undetected ChromeDriver instance with proper error handling."""
chrome_options.add_argument("--disable-blink-features=AutomationControlled") try:
driver = uc.Chrome(service=service, options=chrome_options) driver = uc.Chrome(service=service, options=chrome_options)
except Exception as e:
pretty_print(f"Failed to create Chrome driver: {str(e)}. Trying to bypass SSL...", color="failure")
try:
bypass_ssl()
# Create NEW options object - this is the key fix
fresh_options = create_chrome_options(
headless=any("--headless" in arg for arg in chrome_options.arguments),
stealth_mode=True, # We're in stealth mode if we reach this point
crx_path="./crx/nopecha.crx" # Default path
)
driver = uc.Chrome(service=service, options=fresh_options)
except Exception as e:
pretty_print(f"Failed to create Chrome driver, fallback failed:\n{str(e)}.", color="failure")
raise e
driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})") driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})")
chrome_version = driver.capabilities['browserVersion'] return driver
def create_driver(headless=False, stealth_mode=True, crx_path="./crx/nopecha.crx", lang="en") -> webdriver.Chrome:
"""Create a Chrome WebDriver with specified options."""
# Warn if trying to run non-headless in Docker
if not headless and os.path.exists('/.dockerenv'):
print("[WARNING] Running non-headless browser in Docker may fail!")
print("[WARNING] Consider setting headless=True or headless_browser=True in config.ini")
chrome_options = create_chrome_options(headless, stealth_mode, crx_path, lang)
chromedriver_path = install_chromedriver()
service = Service(chromedriver_path)
if stealth_mode:
driver = create_undetected_chromedriver(service, chrome_options)
user_agent = get_random_user_agent()
stealth(driver, stealth(driver,
languages=["en-US", "en"], languages=["en-US", "en"],
vendor=user_agent["vendor"], vendor=user_agent["vendor"],
platform="Win64" if "Windows" in user_agent["ua"] else "MacIntel" if "Macintosh" in user_agent["ua"] else "Linux x86_64", platform="Win64" if "windows" in user_agent["ua"].lower() else "MacIntel" if "mac" in user_agent["ua"].lower() else "Linux x86_64",
webgl_vendor="Intel Inc.", webgl_vendor="Intel Inc.",
renderer="Intel Iris OpenGL Engine", renderer="Intel Iris OpenGL Engine",
fix_hairline=True, fix_hairline=True,
) )
return driver return driver
security_prefs = { else:
"profile.default_content_setting_values.media_stream": 2,
"profile.default_content_setting_values.geolocation": 2,
"safebrowsing.enabled": True,
}
chrome_options.add_experimental_option("prefs", security_prefs)
chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
chrome_options.add_experimental_option('useAutomationExtension', False)
return webdriver.Chrome(service=service, options=chrome_options) return webdriver.Chrome(service=service, options=chrome_options)
class Browser: class Browser:
@@ -144,12 +296,17 @@ class Browser:
except Exception as e: except Exception as e:
raise Exception(f"Failed to initialize browser: {str(e)}") raise Exception(f"Failed to initialize browser: {str(e)}")
self.setup_tabs() self.setup_tabs()
self.patch_browser_fingerprint()
if anticaptcha_manual_install: if anticaptcha_manual_install:
self.load_anticatpcha_manually() self.load_anticatpcha_manually()
def setup_tabs(self): def setup_tabs(self):
self.tabs = self.driver.window_handles self.tabs = self.driver.window_handles
try:
self.driver.get("https://www.google.com") self.driver.get("https://www.google.com")
except Exception as e:
self.logger.log(f"Failed to setup initial tab:" + str(e))
pass
self.screenshot() self.screenshot()
def switch_control_tab(self): def switch_control_tab(self):
@@ -158,14 +315,40 @@ class Browser:
def load_anticatpcha_manually(self): def load_anticatpcha_manually(self):
pretty_print("You might want to install the AntiCaptcha extension for captchas.", color="warning") pretty_print("You might want to install the AntiCaptcha extension for captchas.", color="warning")
try:
self.driver.get(self.anticaptcha) self.driver.get(self.anticaptcha)
except Exception as e:
self.logger.log(f"Failed to setup initial tab:" + str(e))
pass
def human_move(element):
actions = ActionChains(driver)
x_offset = random.randint(-5,5)
for _ in range(random.randint(2,5)):
actions.move_by_offset(x_offset, random.randint(-2,2))
actions.pause(random.uniform(0.1,0.3))
actions.click().perform()
def human_scroll(self):
for _ in range(random.randint(1, 3)):
scroll_pixels = random.randint(150, 1200)
self.driver.execute_script(f"window.scrollBy(0, {scroll_pixels});")
time.sleep(random.uniform(0.5, 2.0))
if random.random() < 0.4:
self.driver.execute_script(f"window.scrollBy(0, -{random.randint(50, 300)});")
time.sleep(random.uniform(0.3, 1.0))
def patch_browser_fingerprint(self) -> None:
script = self.load_js("spoofing.js")
self.driver.execute_script(script)
def go_to(self, url:str) -> bool: def go_to(self, url:str) -> bool:
"""Navigate to a specified URL.""" """Navigate to a specified URL."""
time.sleep(random.uniform(0.4, 2.5)) # more human behavior time.sleep(random.uniform(0.4, 2.5))
try: try:
initial_handles = self.driver.window_handles initial_handles = self.driver.window_handles
self.driver.get(url) self.driver.get(url)
time.sleep(random.uniform(0.01, 0.3))
try: try:
wait = WebDriverWait(self.driver, timeout=10) wait = WebDriverWait(self.driver, timeout=10)
wait.until( wait.until(
@@ -177,6 +360,8 @@ class Browser:
except TimeoutException: except TimeoutException:
self.logger.warning("Timeout while waiting for page to bypass 'checking your browser'") self.logger.warning("Timeout while waiting for page to bypass 'checking your browser'")
self.apply_web_safety() self.apply_web_safety()
time.sleep(random.uniform(0.01, 0.2))
self.human_scroll()
self.logger.log(f"Navigated to: {url}") self.logger.log(f"Navigated to: {url}")
return True return True
except TimeoutException as e: except TimeoutException as e:
@@ -226,7 +411,7 @@ class Browser:
result = re.sub(r'!\[(.*?)\]\(.*?\)', r'[IMAGE: \1]', result) result = re.sub(r'!\[(.*?)\]\(.*?\)', r'[IMAGE: \1]', result)
self.logger.info(f"Extracted text: {result[:100]}...") self.logger.info(f"Extracted text: {result[:100]}...")
self.logger.info(f"Extracted text length: {len(result)}") self.logger.info(f"Extracted text length: {len(result)}")
return result[:8192] return result[:32768]
except Exception as e: except Exception as e:
self.logger.error(f"Error getting text: {str(e)}") self.logger.error(f"Error getting text: {str(e)}")
return None return None
@@ -352,7 +537,16 @@ class Browser:
if input_type in ["hidden", "submit", "button", "image"] or not element["displayed"]: if input_type in ["hidden", "submit", "button", "image"] or not element["displayed"]:
continue continue
input_name = element.get("text") or element.get("id") or input_type input_name = element.get("text") or element.get("id") or input_type
if input_type == "checkbox" or input_type == "radio": if input_type == "select":
options = element.get("options", [])
options_str = ", ".join(opt["text"] for opt in options if opt["text"])
selected = next((opt["text"] for opt in options if opt.get("selected")), "")
form_strings.append(f"[{input_name}](select: {selected}) options: [{options_str}]")
elif input_type == "textarea":
form_strings.append(f"[{input_name}]("")")
elif input_type == "file":
form_strings.append(f"[{input_name}](file: )")
elif input_type == "checkbox" or input_type == "radio":
try: try:
checked_status = "checked" if element.is_selected() else "unchecked" checked_status = "checked" if element.is_selected() else "unchecked"
except Exception as e: except Exception as e:
@@ -516,7 +710,29 @@ class Browser:
self.logger.warning(f"Element '{name}' is not interactable (not displayed or disabled)") self.logger.warning(f"Element '{name}' is not interactable (not displayed or disabled)")
continue continue
input_type = (element.get_attribute("type") or "text").lower() input_type = (element.get_attribute("type") or "text").lower()
if input_type in ["checkbox", "radio"]: tag_name = (element.tag_name or "").lower()
if tag_name == "select":
try:
select = Select(element)
select.select_by_visible_text(value)
self.logger.info(f"Selected '{value}' for {name}")
except Exception:
try:
select.select_by_value(value)
self.logger.info(f"Selected value '{value}' for {name}")
except Exception as sel_e:
self.logger.warning(f"Could not select '{value}' for {name}: {sel_e}")
elif tag_name == "textarea":
element.clear()
element.send_keys(value)
self.logger.info(f"Filled textarea {name}")
elif input_type == "file":
if os.path.isabs(value) and os.path.exists(value):
element.send_keys(value)
self.logger.info(f"Uploaded file '{value}' for {name}")
else:
self.logger.warning(f"File not found: {value}")
elif input_type in ["checkbox", "radio"]:
is_checked = element.is_selected() is_checked = element.is_selected()
should_be_checked = value.lower() == "checked" should_be_checked = value.lower() == "checked"
@@ -576,19 +792,24 @@ class Browser:
return self.screenshot_folder + "/updated_screen.png" return self.screenshot_folder + "/updated_screen.png"
def screenshot(self, filename:str = 'updated_screen.png') -> bool: def screenshot(self, filename:str = 'updated_screen.png') -> bool:
"""Take a screenshot of the current page.""" """Take a screenshot of the current page, attempt to capture the full page by zooming out."""
self.logger.info("Taking screenshot...") self.logger.info("Taking full page screenshot...")
time.sleep(0.1) time.sleep(0.1)
try: try:
original_zoom = self.driver.execute_script("return document.body.style.zoom || 1;")
self.driver.execute_script("document.body.style.zoom='75%'")
time.sleep(0.1)
path = os.path.join(self.screenshot_folder, filename) path = os.path.join(self.screenshot_folder, filename)
if not os.path.exists(self.screenshot_folder): if not os.path.exists(self.screenshot_folder):
os.makedirs(self.screenshot_folder) os.makedirs(self.screenshot_folder)
self.driver.save_screenshot(path) self.driver.save_screenshot(path)
self.logger.info(f"Screenshot saved as {filename}") self.logger.info(f"Full page screenshot saved as {filename}")
return True
except Exception as e: except Exception as e:
self.logger.error(f"Error taking screenshot: {str(e)}") self.logger.error(f"Error taking full page screenshot: {str(e)}")
return False return False
finally:
self.driver.execute_script(f"document.body.style.zoom='1'")
return True
def apply_web_safety(self): def apply_web_safety(self):
""" """
@@ -599,17 +820,25 @@ class Browser:
input_elements = self.driver.execute_script(script) input_elements = self.driver.execute_script(script)
if __name__ == "__main__": if __name__ == "__main__":
driver = create_driver(headless=False, stealth_mode=True) driver = create_driver(headless=False, stealth_mode=True, crx_path="../crx/nopecha.crx")
browser = Browser(driver, anticaptcha_manual_install=True) browser = Browser(driver, anticaptcha_manual_install=True)
input("press enter to continue") input("press enter to continue")
print("AntiCaptcha / Form Test") print("AntiCaptcha / Form Test")
#browser.go_to("https://www.browserscan.net/bot-detection") browser.go_to("https://bot.sannysoft.com")
time.sleep(5)
#txt = browser.get_text() #txt = browser.get_text()
#browser.go_to("https://www.google.com/recaptcha/api2/demo")
browser.go_to("https://home.openweathermap.org/users/sign_up") browser.go_to("https://home.openweathermap.org/users/sign_up")
inputs_visible = browser.get_form_inputs() inputs_visible = browser.get_form_inputs()
print("inputs:", inputs_visible) print("inputs:", inputs_visible)
#inputs_fill = ['[q](checked)', '[q](checked)', '[user[username]](mlg)', '[user[email]](mlg.fcu@gmail.com)', '[user[password]](placeholder_P@ssw0rd123)', '[user[password_confirmation]](placeholder_P@ssw0rd123)'] #inputs_fill = ['[q](checked)', '[q](checked)', '[user[username]](mlg)', '[user[email]](mlg.fcu@gmail.com)', '[user[password]](placeholder_P@ssw0rd123)', '[user[password_confirmation]](placeholder_P@ssw0rd123)']
#browser.fill_form(inputs_fill) #browser.fill_form(inputs_fill)
input("press enter to exit") input("press enter to exit")
# Test sites for browser fingerprinting and captcha
# https://nowsecure.nl/
# https://bot.sannysoft.com
# https://browserleaks.com/
# https://bot.incolumitas.com/
# https://fingerprintjs.github.io/fingerprintjs/
# https://antoinevastel.com/bots/
+25 -4
View File
@@ -5,6 +5,7 @@ from sources.text_to_speech import Speech
from sources.utility import pretty_print, animate_thinking from sources.utility import pretty_print, animate_thinking
from sources.router import AgentRouter from sources.router import AgentRouter
from sources.speech_to_text import AudioTranscriber, AudioRecorder from sources.speech_to_text import AudioTranscriber, AudioRecorder
import threading
class Interaction: class Interaction:
@@ -21,6 +22,7 @@ class Interaction:
self.current_agent = None self.current_agent = None
self.last_query = None self.last_query = None
self.last_answer = None self.last_answer = None
self.last_reasoning = None
self.agents = agents self.agents = agents
self.tts_enabled = tts_enabled self.tts_enabled = tts_enabled
self.stt_enabled = stt_enabled self.stt_enabled = stt_enabled
@@ -31,6 +33,7 @@ class Interaction:
self.transcriber = None self.transcriber = None
self.recorder = None self.recorder = None
self.is_generating = False self.is_generating = False
self.languages = langs
if tts_enabled: if tts_enabled:
self.initialize_tts() self.initialize_tts()
if stt_enabled: if stt_enabled:
@@ -39,11 +42,16 @@ class Interaction:
self.load_last_session() self.load_last_session()
self.emit_status() self.emit_status()
def get_spoken_language(self) -> str:
"""Get the primary TTS language."""
lang = self.languages[0]
return lang
def initialize_tts(self): def initialize_tts(self):
"""Initialize TTS.""" """Initialize TTS."""
if not self.speech: if not self.speech:
animate_thinking("Initializing text-to-speech...", color="status") animate_thinking("Initializing text-to-speech...", color="status")
self.speech = Speech(enable=self.tts_enabled) self.speech = Speech(enable=self.tts_enabled, language=self.get_spoken_language(), voice_idx=1)
def initialize_stt(self): def initialize_stt(self):
"""Initialize STT.""" """Initialize STT."""
@@ -133,6 +141,11 @@ class Interaction:
self.last_query = query self.last_query = query
return query return query
def set_query(self, query: str) -> None:
"""Set the query"""
self.is_active = True
self.last_query = query
async def think(self) -> bool: async def think(self) -> bool:
"""Request AI agents to process the user input.""" """Request AI agents to process the user input."""
push_last_agent_memory = False push_last_agent_memory = False
@@ -146,7 +159,7 @@ class Interaction:
tmp = self.last_answer tmp = self.last_answer
self.current_agent = agent self.current_agent = agent
self.is_generating = True self.is_generating = True
self.last_answer, _ = await agent.process(self.last_query, self.speech) self.last_answer, self.last_reasoning = await agent.process(self.last_query, self.speech)
self.is_generating = False self.is_generating = False
if push_last_agent_memory: if push_last_agent_memory:
self.current_agent.memory.push('user', self.last_query) self.current_agent.memory.push('user', self.last_query)
@@ -167,12 +180,20 @@ class Interaction:
return None return None
return self.current_agent.get_last_block_answer() return self.current_agent.get_last_block_answer()
def speak_answer(self) -> None:
"""Speak the answer to the user in a non-blocking thread."""
if self.last_query is None:
return
if self.tts_enabled and self.last_answer and self.speech:
def speak_in_thread(speech_instance, text):
speech_instance.speak(text)
thread = threading.Thread(target=speak_in_thread, args=(self.speech, self.last_answer))
thread.start()
def show_answer(self) -> None: def show_answer(self) -> None:
"""Show the answer to the user.""" """Show the answer to the user."""
if self.last_query is None: if self.last_query is None:
return return
if self.current_agent is not None: if self.current_agent is not None:
self.current_agent.show_answer() self.current_agent.show_answer()
if self.tts_enabled and self.last_answer:
self.speech.speak(self.last_answer)
+3 -43
View File
@@ -1,8 +1,6 @@
from typing import List, Tuple, Type, Dict from typing import List, Tuple, Type, Dict
import re import re
import langid import langid
import nltk
from nltk.sentiment.vader import SentimentIntensityAnalyzer
from transformers import MarianMTModel, MarianTokenizer from transformers import MarianMTModel, MarianTokenizer
from sources.utility import pretty_print, animate_thinking from sources.utility import pretty_print, animate_thinking
@@ -16,7 +14,6 @@ class LanguageUtility:
args: args:
supported_language: list of languages for translation, determine which Helsinki-NLP model to load supported_language: list of languages for translation, determine which Helsinki-NLP model to load
""" """
self.sid = None
self.translators_tokenizer = None self.translators_tokenizer = None
self.translators_model = None self.translators_model = None
self.logger = Logger("language.log") self.logger = Logger("language.log")
@@ -25,11 +22,6 @@ class LanguageUtility:
def load_model(self) -> None: def load_model(self) -> None:
animate_thinking("Loading language utility...", color="status") animate_thinking("Loading language utility...", color="status")
try:
nltk.data.find('vader_lexicon')
except LookupError:
nltk.download('vader_lexicon')
self.sid = SentimentIntensityAnalyzer()
self.translators_tokenizer = {lang: MarianTokenizer.from_pretrained(f"Helsinki-NLP/opus-mt-{lang}-en") for lang in self.supported_language if lang != "en"} self.translators_tokenizer = {lang: MarianTokenizer.from_pretrained(f"Helsinki-NLP/opus-mt-{lang}-en") for lang in self.supported_language if lang != "en"}
self.translators_model = {lang: MarianMTModel.from_pretrained(f"Helsinki-NLP/opus-mt-{lang}-en") for lang in self.supported_language if lang != "en"} self.translators_model = {lang: MarianMTModel.from_pretrained(f"Helsinki-NLP/opus-mt-{lang}-en") for lang in self.supported_language if lang != "en"}
@@ -65,49 +57,17 @@ class LanguageUtility:
translation = model.generate(**inputs) translation = model.generate(**inputs)
return tokenizer.decode(translation[0], skip_special_tokens=True) return tokenizer.decode(translation[0], skip_special_tokens=True)
def detect_emotion(self, text: str) -> str:
"""
Detect the dominant emotion in the given text
Args:
text: string to analyze
Returns: string of the dominant emotion
"""
try:
scores = self.sid.polarity_scores(text)
emotions = {
'Happy': max(scores['pos'], 0),
'Angry': 0,
'Sad': max(scores['neg'], 0),
'Fear': 0,
'Surprise': 0
}
if scores['compound'] < -0.5:
emotions['Angry'] = abs(scores['compound']) * 0.5
emotions['Fear'] = abs(scores['compound']) * 0.5
elif scores['compound'] > 0.5:
emotions['Happy'] = scores['compound']
emotions['Surprise'] = scores['compound'] * 0.5
dominant_emotion = max(emotions, key=emotions.get)
if emotions[dominant_emotion] == 0:
return 'Neutral'
self.logger.info(f"Emotion: {dominant_emotion} for text: {text}")
return dominant_emotion
except Exception as e:
raise e
def analyze(self, text): def analyze(self, text):
""" """
Combined analysis of language and emotion Combined analysis of language and emotion
Args: Args:
text: string to analyze text: string to analyze
Returns: dictionary with language and emotion results Returns: dictionary with language related information
""" """
try: try:
language = self.detect_language(text) language = self.detect_language(text)
emotions = self.detect_emotion(text)
return { return {
"language": language, "language": language
"emotions": emotions
} }
except Exception as e: except Exception as e:
raise e raise e
@@ -125,4 +85,4 @@ if __name__ == "__main__":
pretty_print(f"Language: {detector.detect_language(text)}", color="status") pretty_print(f"Language: {detector.detect_language(text)}", color="status")
result = detector.analyze(text) result = detector.analyze(text)
trans = detector.translate(text, result['language']) trans = detector.translate(text, result['language'])
pretty_print(f"Translation: {trans} - from: {result['language']} - Emotion: {result['emotions']}") pretty_print(f"Translation: {trans} - from: {result['language']}")
+211 -44
View File
@@ -1,27 +1,29 @@
import os import os
import time
import ollama
from ollama import chat
import requests
import subprocess
import ipaddress
import httpx
import socket
import platform import platform
import socket
import subprocess
import time
from urllib.parse import urlparse from urllib.parse import urlparse
from dotenv import load_dotenv, set_key
import httpx
import requests
from dotenv import load_dotenv
from ollama import Client as OllamaClient
from openai import OpenAI from openai import OpenAI
from typing import List, Tuple, Type, Dict
from sources.utility import pretty_print, animate_thinking
from sources.logger import Logger from sources.logger import Logger
from sources.utility import pretty_print, animate_thinking
class Provider: class Provider:
def __init__(self, provider_name, model, server_address = "127.0.0.1:5000", is_local=False): def __init__(self, provider_name, model, server_address="127.0.0.1:5000", is_local=False):
self.provider_name = provider_name.lower() self.provider_name = provider_name.lower()
# Normalize provider name aliases (e.g. README documents 'togetherAI' but canonical key is 'together')
_aliases = {"togetherai": "together"}
self.provider_name = _aliases.get(self.provider_name, self.provider_name)
self.model = model self.model = model
self.is_local = is_local self.is_local = is_local
self.server_ip = server_address self.server_ip = server_address
self.server_address = server_address
self.available_providers = { self.available_providers = {
"ollama": self.ollama_fn, "ollama": self.ollama_fn,
"server": self.server_fn, "server": self.server_fn,
@@ -32,11 +34,15 @@ class Provider:
"deepseek": self.deepseek_fn, "deepseek": self.deepseek_fn,
"together": self.together_fn, "together": self.together_fn,
"dsk_deepseek": self.dsk_deepseek, "dsk_deepseek": self.dsk_deepseek,
"openrouter": self.openrouter_fn,
"anthropic": self.anthropic_fn,
"minimax": self.minimax_fn,
"test": self.test_fn "test": self.test_fn
} }
self.logger = Logger("provider.log") self.logger = Logger("provider.log")
self.api_key = None self.api_key = None
self.unsafe_providers = ["openai", "deepseek", "dsk_deepseek", "together", "google"] self.internal_url, self.in_docker = self.get_internal_url()
self.unsafe_providers = ["openai", "deepseek", "dsk_deepseek", "together", "google", "openrouter", "anthropic", "minimax"]
if self.provider_name not in self.available_providers: if self.provider_name not in self.available_providers:
raise ValueError(f"Unknown provider: {provider_name}") raise ValueError(f"Unknown provider: {provider_name}")
if self.provider_name in self.unsafe_providers and self.is_local == False: if self.provider_name in self.unsafe_providers and self.is_local == False:
@@ -45,6 +51,9 @@ class Provider:
elif self.provider_name != "ollama": elif self.provider_name != "ollama":
pretty_print(f"Provider: {provider_name} initialized at {self.server_ip}", color="success") pretty_print(f"Provider: {provider_name} initialized at {self.server_ip}", color="success")
def get_model_name(self) -> str:
return self.model
def get_api_key(self, provider): def get_api_key(self, provider):
load_dotenv() load_dotenv()
api_key_var = f"{provider.upper()}_API_KEY" api_key_var = f"{provider.upper()}_API_KEY"
@@ -54,7 +63,14 @@ class Provider:
exit(1) exit(1)
return api_key return api_key
def respond(self, history, verbose = True): def get_internal_url(self):
load_dotenv()
url = os.getenv("DOCKER_INTERNAL_URL")
if not url: # running on host
return "http://localhost", False
return url, True
def respond(self, history, verbose=True):
""" """
Use the choosen provider to generate text. Use the choosen provider to generate text.
""" """
@@ -70,8 +86,11 @@ class Provider:
except AttributeError as e: except AttributeError as e:
raise NotImplementedError(f"{str(e)}\nIs {self.provider_name} implemented ?") raise NotImplementedError(f"{str(e)}\nIs {self.provider_name} implemented ?")
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
raise ModuleNotFoundError(f"{str(e)}\nA import related to provider {self.provider_name} was not found. Is it installed ?") raise ModuleNotFoundError(
f"{str(e)}\nA import related to provider {self.provider_name} was not found. Is it installed ?")
except Exception as e: except Exception as e:
if "try again later" in str(e).lower():
return f"{self.provider_name} server is overloaded. Please try again later."
if "refused" in str(e): if "refused" in str(e):
return f"Server {self.server_ip} seem offline. Unable to answer." return f"Server {self.server_ip} seem offline. Unable to answer."
raise Exception(f"Provider {self.provider_name} failed: {str(e)}") from e raise Exception(f"Provider {self.provider_name} failed: {str(e)}") from e
@@ -101,8 +120,7 @@ class Provider:
except (subprocess.TimeoutExpired, subprocess.SubprocessError) as e: except (subprocess.TimeoutExpired, subprocess.SubprocessError) as e:
return False return False
def server_fn(self, history, verbose=False):
def server_fn(self, history, verbose = False):
""" """
Use a remote server with LLM to generate text. Use a remote server with LLM to generate text.
""" """
@@ -136,36 +154,49 @@ class Provider:
pretty_print(f"An error occurred: {str(e)}", color="failure") pretty_print(f"An error occurred: {str(e)}", color="failure")
break break
except KeyError as e: except KeyError as e:
raise Exception(f"{str(e)}\nError occured with server route. Are you using the correct address for the config.ini provider?") from e raise Exception(
f"{str(e)}\nError occured with server route. Are you using the correct address for the config.ini provider?") from e
except Exception as e: except Exception as e:
raise e raise e
return thought return thought
def ollama_fn(self, history, verbose = False): def ollama_fn(self, history, verbose=False):
""" """
Use local ollama server to generate text. Use local or remote Ollama server to generate text.
""" """
thought = "" thought = ""
if self.is_local:
server_port = self.server_address.split(":")[-1] if ":" in str(self.server_address) else "11434"
host = f"{self.internal_url}:{server_port}"
else:
host = f"http://{self.server_address}"
client = OllamaClient(host=host)
try: try:
stream = chat( stream = client.chat(
model=self.model, model=self.model,
messages=history, messages=history,
stream=True, stream=True,
) )
for chunk in stream: for chunk in stream:
if verbose: if verbose:
print(chunk['message']['content'], end='', flush=True) print(chunk["message"]["content"], end="", flush=True)
thought += chunk['message']['content'] thought += chunk["message"]["content"]
except httpx.ConnectError as e: except httpx.ConnectError as e:
raise Exception("\nOllama connection failed. provider should not be set to ollama if server address is not localhost") from e raise Exception(
except ollama.ResponseError as e: f"\nOllama connection failed at {host}. Check if the server is running."
if e.status_code == 404: ) from e
except Exception as e:
if hasattr(e, 'status_code') and e.status_code == 404:
animate_thinking(f"Downloading {self.model}...") animate_thinking(f"Downloading {self.model}...")
ollama.pull(self.model) client.pull(self.model)
self.ollama_fn(history, verbose) self.ollama_fn(history, verbose)
if "refused" in str(e).lower(): if "refused" in str(e).lower():
raise Exception("Ollama connection failed. is the server running ?") from e raise Exception(
f"Ollama connection refused at {host}. Is the server running?"
) from e
raise e raise e
return thought return thought
def huggingface_fn(self, history, verbose=False): def huggingface_fn(self, history, verbose=False):
@@ -189,7 +220,13 @@ class Provider:
Use openai to generate text. Use openai to generate text.
""" """
base_url = self.server_ip base_url = self.server_ip
if self.is_local: if self.is_local and self.in_docker:
try:
host, port = base_url.split(':')
except Exception as e:
port = "8000"
client = OpenAI(api_key=self.api_key, base_url=f"{self.internal_url}:{port}")
elif self.is_local:
client = OpenAI(api_key=self.api_key, base_url=f"http://{base_url}") client = OpenAI(api_key=self.api_key, base_url=f"http://{base_url}")
else: else:
client = OpenAI(api_key=self.api_key) client = OpenAI(api_key=self.api_key)
@@ -208,13 +245,45 @@ class Provider:
except Exception as e: except Exception as e:
raise Exception(f"OpenAI API error: {str(e)}") from e raise Exception(f"OpenAI API error: {str(e)}") from e
def anthropic_fn(self, history, verbose=False):
"""
Use Anthropic to generate text.
"""
from anthropic import Anthropic
client = Anthropic(api_key=self.api_key)
system_message = None
messages = []
for message in history:
clean_message = {'role': message['role'], 'content': message['content']}
if message['role'] == 'system':
system_message = message['content']
else:
messages.append(clean_message)
try:
response = client.messages.create(
model=self.model,
max_tokens=1024,
messages=messages,
system=system_message
)
if response is None:
raise Exception("Anthropic response is empty.")
thought = response.content[0].text
if verbose:
print(thought)
return thought
except Exception as e:
raise Exception(f"Anthropic API error: {str(e)}") from e
def google_fn(self, history, verbose=False): def google_fn(self, history, verbose=False):
""" """
Use google gemini to generate text. Use google gemini to generate text.
""" """
base_url = self.server_ip base_url = self.server_ip
if self.is_local: if self.is_local:
raise Exception("Google Gemini is not available for local use.") raise Exception("Google Gemini is not available for local use. Change config.ini")
client = OpenAI(api_key=self.api_key, base_url="https://generativelanguage.googleapis.com/v1beta/openai/") client = OpenAI(api_key=self.api_key, base_url="https://generativelanguage.googleapis.com/v1beta/openai/")
try: try:
@@ -237,6 +306,8 @@ class Provider:
""" """
from together import Together from together import Together
client = Together(api_key=self.api_key) client = Together(api_key=self.api_key)
if self.is_local:
raise Exception("Together AI is not available for local use. Change config.ini")
try: try:
response = client.chat.completions.create( response = client.chat.completions.create(
@@ -257,6 +328,8 @@ class Provider:
Use deepseek api to generate text. Use deepseek api to generate text.
""" """
client = OpenAI(api_key=self.api_key, base_url="https://api.deepseek.com") client = OpenAI(api_key=self.api_key, base_url="https://api.deepseek.com")
if self.is_local:
raise Exception("Deepseek (API) is not available for local use. Change config.ini")
try: try:
response = client.chat.completions.create( response = client.chat.completions.create(
model="deepseek-chat", model="deepseek-chat",
@@ -270,32 +343,125 @@ class Provider:
except Exception as e: except Exception as e:
raise Exception(f"Deepseek API error: {str(e)}") from e raise Exception(f"Deepseek API error: {str(e)}") from e
def lm_studio_fn(self, history, verbose = False): def lm_studio_fn(self, history, verbose=False):
""" """
Use local lm-studio server to generate text. Use local lm-studio server to generate text.
lm studio use endpoint /v1/chat/completions not /chat/completions like openai
""" """
thought = "" if self.in_docker:
route_start = f"{self.server_ip}/v1/chat/completions" # Extract port from server_address, handling both "host:port" and "http://host:port"
port = "1234" # default
addr = self.server_address
if "://" not in addr:
addr = f"http://{addr}"
parsed_addr = urlparse(addr)
if parsed_addr.port:
port = str(parsed_addr.port)
url = f"{self.internal_url}:{port}"
else:
# Normalize the address to ensure it has a scheme prefix
addr = self.server_ip
if "://" not in addr:
addr = f"http://{addr}"
url = addr
route_start = f"{url}/v1/chat/completions"
payload = { payload = {
"messages": history, "messages": history,
"temperature": 0.7, "temperature": 0.7,
"max_tokens": 4096, "max_tokens": 4096,
"model": self.model "model": self.model
} }
try:
response = requests.post(route_start, json=payload, timeout=30)
if response.status_code != 200:
raise Exception(f"LM Studio returned status {response.status_code}: {response.text}")
if not response.text.strip():
raise Exception("LM Studio returned empty response")
try: try:
response = requests.post(route_start, json=payload)
result = response.json() result = response.json()
except ValueError as json_err:
raise Exception(f"Invalid JSON from LM Studio: {response.text[:200]}") from json_err
if verbose: if verbose:
print("Response from LM Studio:", result) print("Response from LM Studio:", result)
return result.get("choices", [{}])[0].get("message", {}).get("content", "") choices = result.get("choices", [])
if not choices:
raise Exception(f"No choices in LM Studio response: {result}")
message = choices[0].get("message", {})
content = message.get("content", "")
if not content:
raise Exception(f"Empty content in LM Studio response: {result}")
return content
except requests.exceptions.Timeout:
raise Exception("LM Studio request timed out - check if server is responsive")
except requests.exceptions.ConnectionError:
raise Exception(f"Cannot connect to LM Studio at {route_start} - check if server is running")
except requests.exceptions.RequestException as e: except requests.exceptions.RequestException as e:
raise Exception(f"HTTP request failed: {str(e)}") from e raise Exception(f"HTTP request failed: {str(e)}") from e
except Exception as e: except Exception as e:
raise Exception(f"An error occurred: {str(e)}") from e if "LM Studio" in str(e):
return thought raise # Re-raise our custom exceptions
raise Exception(f"Unexpected error: {str(e)}") from e
def dsk_deepseek(self, history, verbose = False): def openrouter_fn(self, history, verbose=False):
"""
Use OpenRouter API to generate text.
"""
client = OpenAI(api_key=self.api_key, base_url="https://openrouter.ai/api/v1")
if self.is_local:
# This case should ideally not be reached if unsafe_providers is set correctly
# and is_local is False in config for openrouter
raise Exception("OpenRouter is not available for local use. Change config.ini")
try:
response = client.chat.completions.create(
model=self.model,
messages=history,
)
if response is None:
raise Exception("OpenRouter response is empty.")
thought = response.choices[0].message.content
if verbose:
print(thought)
return thought
except Exception as e:
raise Exception(f"OpenRouter API error: {str(e)}") from e
def minimax_fn(self, history, verbose=False):
"""
Use MiniMax API to generate text via OpenAI-compatible interface.
Supported models:
- MiniMax-M2.7: Latest flagship model with enhanced reasoning and coding
- MiniMax-M2.7-highspeed: High-speed version of M2.7 for low-latency scenarios
- MiniMax-M2.5: Peak performance model (~60 tps), 204,800 context window
- MiniMax-M2.5-highspeed: Same performance, faster (~100 tps)
Note: temperature must be in range (0.0, 1.0], default is 1.0
"""
load_dotenv()
base_url = os.getenv("MINIMAX_BASE_URL", "https://api.minimax.io/v1")
client = OpenAI(api_key=self.api_key, base_url=base_url)
if self.is_local:
raise Exception("MiniMax is not available for local use. Change config.ini")
try:
response = client.chat.completions.create(
model=self.model,
messages=history,
temperature=1.0,
)
if response is None:
raise Exception("MiniMax response is empty.")
thought = response.choices[0].message.content
if verbose:
print(thought)
return thought
except Exception as e:
raise Exception(f"MiniMax API error: {str(e)}") from e
def dsk_deepseek(self, history, verbose=False):
""" """
Use: xtekky/deepseek4free Use: xtekky/deepseek4free
For free api. Api key should be set to DSK_DEEPSEEK_API_KEY For free api. Api key should be set to DSK_DEEPSEEK_API_KEY
@@ -319,19 +485,19 @@ class Provider:
if chunk['type'] == 'text': if chunk['type'] == 'text':
thought += chunk['content'] thought += chunk['content']
return thought return thought
except AuthenticationError: except AuthenticationError as e:
raise AuthenticationError("Authentication failed. Please check your token.") from e raise AuthenticationError("Authentication failed. Please check your token.") from e
except RateLimitError: except RateLimitError as e:
raise RateLimitError("Rate limit exceeded. Please wait before making more requests.") from e raise RateLimitError("Rate limit exceeded. Please wait before making more requests.") from e
except CloudflareError as e: except CloudflareError as e:
raise CloudflareError(f"Cloudflare protection encountered: {str(e)}") from e raise CloudflareError(f"Cloudflare protection encountered: {str(e)}") from e
except NetworkError: except NetworkError as e:
raise NetworkError("Network error occurred. Check your internet connection.") from e raise NetworkError("Network error occurred. Check your internet connection.") from e
except APIError as e: except APIError as e:
raise APIError(f"API error occurred: {str(e)}") from e raise APIError(f"API error occurred: {str(e)}") from e
return None return None
def test_fn(self, history, verbose = True): def test_fn(self, history, verbose=True):
""" """
This function is used to conduct tests. This function is used to conduct tests.
""" """
@@ -340,6 +506,7 @@ class Provider:
""" """
return thought return thought
if __name__ == "__main__": if __name__ == "__main__":
provider = Provider("server", "deepseek-r1:32b", " x.x.x.x:8080") provider = Provider("server", "deepseek-r1:32b", " x.x.x.x:8080")
res = provider.respond(["user", "Hello, how are you?"]) res = provider.respond(["user", "Hello, how are you?"])
+3 -1
View File
@@ -17,12 +17,14 @@ class Logger:
def create_logging(self, log_filename): def create_logging(self, log_filename):
self.logger = logging.getLogger(log_filename) self.logger = logging.getLogger(log_filename)
self.logger.setLevel(logging.DEBUG) self.logger.setLevel(logging.DEBUG)
if not self.logger.handlers: self.logger.handlers.clear()
self.logger.propagate = False
file_handler = logging.FileHandler(self.log_path) file_handler = logging.FileHandler(self.log_path)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
file_handler.setFormatter(formatter) file_handler.setFormatter(formatter)
self.logger.addHandler(file_handler) self.logger.addHandler(file_handler)
def create_folder(self, path): def create_folder(self, path):
"""Create log dir""" """Create log dir"""
try: try:
+99 -19
View File
@@ -7,10 +7,14 @@ import json
from typing import List, Tuple, Type, Dict from typing import List, Tuple, Type, Dict
import torch import torch
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
import configparser
from sources.utility import timer_decorator, pretty_print from sources.utility import timer_decorator, pretty_print, animate_thinking
from sources.logger import Logger from sources.logger import Logger
config = configparser.ConfigParser()
config.read('config.ini')
class Memory(): class Memory():
""" """
Memory is a class for managing the conversation memory Memory is a class for managing the conversation memory
@@ -18,8 +22,8 @@ class Memory():
""" """
def __init__(self, system_prompt: str, def __init__(self, system_prompt: str,
recover_last_session: bool = False, recover_last_session: bool = False,
memory_compression: bool = True): memory_compression: bool = True,
self.memory = [] model_provider: str = "deepseek-r1:14b"):
self.memory = [{'role': 'system', 'content': system_prompt}] self.memory = [{'role': 'system', 'content': system_prompt}]
self.logger = Logger("memory.log") self.logger = Logger("memory.log")
@@ -31,22 +35,44 @@ class Memory():
self.load_memory() self.load_memory()
self.session_recovered = True self.session_recovered = True
# memory compression system # memory compression system
self.model = "pszemraj/led-base-book-summary" self.model = None
self.tokenizer = None
self.device = self.get_cuda_device() self.device = self.get_cuda_device()
self.memory_compression = memory_compression self.memory_compression = memory_compression
self.tokenizer = None self.model_provider = model_provider
self.model = None
if self.memory_compression: if self.memory_compression:
self.download_model() self.download_model()
def get_ideal_ctx(self, model_name: str) -> int | None:
"""
Estimate context size based on the model name.
EXPERIMENTAL for memory compression
"""
import re
import math
def extract_number_before_b(sentence: str) -> int:
match = re.search(r'(\d+)b', sentence, re.IGNORECASE)
return int(match.group(1)) if match else None
model_size = extract_number_before_b(model_name)
if not model_size:
return None
base_size = 7 # Base model size in billions
base_context = 4096 # Base context size in tokens
scaling_factor = 1.5 # Approximate scaling factor for context size growth
context_size = int(base_context * (model_size / base_size) ** scaling_factor)
context_size = 2 ** round(math.log2(context_size))
self.logger.info(f"Estimated context size for {model_name}: {context_size} tokens.")
return context_size
def download_model(self): def download_model(self):
"""Download the model if not already downloaded.""" """Download the model if not already downloaded."""
pretty_print("Downloading memory compression model...", color="status") animate_thinking("Loading memory compression model...", color="status")
self.tokenizer = AutoTokenizer.from_pretrained(self.model) self.tokenizer = AutoTokenizer.from_pretrained("pszemraj/led-base-book-summary")
self.model = AutoModelForSeq2SeqLM.from_pretrained(self.model) self.model = AutoModelForSeq2SeqLM.from_pretrained("pszemraj/led-base-book-summary")
self.logger.info("Memory compression system initialized.") self.logger.info("Memory compression system initialized.")
def get_filename(self) -> str: def get_filename(self) -> str:
"""Get the filename for the save file.""" """Get the filename for the save file."""
return f"memory_{self.session_time.strftime('%Y-%m-%d_%H-%M-%S')}.txt" return f"memory_{self.session_time.strftime('%Y-%m-%d_%H-%M-%S')}.txt"
@@ -79,6 +105,32 @@ class Memory():
return saved_sessions[0][0] return saved_sessions[0][0]
return None return None
def save_json_file(self, path: str, json_memory: dict) -> None:
"""Save a JSON file."""
try:
with open(path, 'w') as f:
json.dump(json_memory, f)
self.logger.info(f"Saved memory json at {path}")
except Exception as e:
self.logger.warning(f"Error saving file {path}: {e}")
def load_json_file(self, path: str) -> dict:
"""Load a JSON file."""
json_memory = {}
try:
with open(path, 'r') as f:
json_memory = json.load(f)
except FileNotFoundError:
self.logger.warning(f"File not found: {path}")
return {}
except json.JSONDecodeError:
self.logger.warning(f"Error decoding JSON from file: {path}")
return {}
except Exception as e:
self.logger.warning(f"Error loading file {path}: {e}")
return {}
return json_memory
def load_memory(self, agent_type: str = "casual_agent") -> None: def load_memory(self, agent_type: str = "casual_agent") -> None:
"""Load the memory from the last session.""" """Load the memory from the last session."""
if self.session_recovered == True: if self.session_recovered == True:
@@ -93,8 +145,7 @@ class Memory():
pretty_print("Last session memory not found.", color="warning") pretty_print("Last session memory not found.", color="warning")
return return
path = os.path.join(save_path, filename) path = os.path.join(save_path, filename)
with open(path, 'r') as f: self.memory = self.load_json_file(path)
self.memory = json.load(f)
if self.memory[-1]['role'] == 'user': if self.memory[-1]['role'] == 'user':
self.memory.pop() self.memory.pop()
self.compress() self.compress()
@@ -106,13 +157,19 @@ class Memory():
def push(self, role: str, content: str) -> int: def push(self, role: str, content: str) -> int:
"""Push a message to the memory.""" """Push a message to the memory."""
if self.memory_compression and role == 'assistant': ideal_ctx = self.get_ideal_ctx(self.model_provider)
self.logger.info("Compressing memories on message push.") if ideal_ctx is not None:
if self.memory_compression and len(content) > ideal_ctx * 1.5:
self.logger.info(f"Compressing memory: Content {len(content)} > {ideal_ctx} model context.")
self.compress() self.compress()
curr_idx = len(self.memory) curr_idx = len(self.memory)
if self.memory[curr_idx-1]['content'] == content: if self.memory[curr_idx-1]['content'] == content:
pretty_print("Warning: same message have been pushed twice to memory", color="error") pretty_print("Warning: same message have been pushed twice to memory", color="error")
time_str = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
if config["MAIN"]["provider_name"] == "openrouter":
self.memory.append({'role': role, 'content': content}) self.memory.append({'role': role, 'content': content})
else:
self.memory.append({'role': role, 'content': content, 'time': time_str, 'model_used': self.model_provider})
return curr_idx-1 return curr_idx-1
def clear(self) -> None: def clear(self) -> None:
@@ -170,25 +227,48 @@ class Memory():
) )
summary = self.tokenizer.decode(summary_ids[0], skip_special_tokens=True) summary = self.tokenizer.decode(summary_ids[0], skip_special_tokens=True)
summary.replace('summary:', '') summary.replace('summary:', '')
self.logger.info(f"Memory summarization success from len {len(text)} to {len(summary)}.") self.logger.info(f"Memory summarized from len {len(text)} to {len(summary)}.")
self.logger.info(f"Summarized text:\n{summary}")
return summary return summary
#@timer_decorator #@timer_decorator
def compress(self) -> str: def compress(self) -> str:
""" """
Compress the memory using the AI model. Compress (summarize) the memory using the model.
""" """
if self.tokenizer is None or self.model is None: if self.tokenizer is None or self.model is None:
self.logger.warning("No tokenizer or model to perform memory compression.") self.logger.warning("No tokenizer or model to perform memory compression.")
return return
for i in range(len(self.memory)): for i in range(len(self.memory)):
if i < 2:
continue
if self.memory[i]['role'] == 'system': if self.memory[i]['role'] == 'system':
continue continue
if len(self.memory[i]['content']) > 128: if len(self.memory[i]['content']) > 1024:
self.memory[i]['content'] = self.summarize(self.memory[i]['content']) self.memory[i]['content'] = self.summarize(self.memory[i]['content'])
def trim_text_to_max_ctx(self, text: str) -> str:
"""
Truncate a text to fit within the maximum context size of the model.
"""
ideal_ctx = self.get_ideal_ctx(self.model_provider)
return text[:ideal_ctx] if ideal_ctx is not None else text
#@timer_decorator
def compress_text_to_max_ctx(self, text) -> str:
"""
Compress a text to fit within the maximum context size of the model.
"""
if self.tokenizer is None or self.model is None:
self.logger.warning("No tokenizer or model to perform memory compression.")
return text
ideal_ctx = self.get_ideal_ctx(self.model_provider)
if ideal_ctx is None:
self.logger.warning("No ideal context size found.")
return text
while len(text) > ideal_ctx:
self.logger.info(f"Compressing text: {len(text)} > {ideal_ctx} model context.")
text = self.summarize(text)
return text
if __name__ == "__main__": if __name__ == "__main__":
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
memory = Memory("You are a helpful assistant.", memory = Memory("You are a helpful assistant.",
+10
View File
@@ -141,6 +141,9 @@ class AgentRouter:
("Search the web for tips on improving coding skills", "LOW"), ("Search the web for tips on improving coding skills", "LOW"),
("Write a Python script to count words in a text file", "LOW"), ("Write a Python script to count words in a text file", "LOW"),
("Search the web for restaurant", "LOW"), ("Search the web for restaurant", "LOW"),
("Use a MCP to find the latest stock market data", "LOW"),
("Use a MCP to send an email to my boss", "LOW"),
("Could you use a MCP to find the latest news on climate change?", "LOW"),
("Create a simple HTML page with CSS styling", "LOW"), ("Create a simple HTML page with CSS styling", "LOW"),
("Use file.txt and then use it to ...", "HIGH"), ("Use file.txt and then use it to ...", "HIGH"),
("Yo, whats good? Find my mixtape.mp3 real quick", "LOW"), ("Yo, whats good? Find my mixtape.mp3 real quick", "LOW"),
@@ -162,11 +165,13 @@ class AgentRouter:
("Find a public API for book data and create a Flask app to list bestsellers", "HIGH"), ("Find a public API for book data and create a Flask app to list bestsellers", "HIGH"),
("Organize my desktop files by extension and then write a script to list them", "HIGH"), ("Organize my desktop files by extension and then write a script to list them", "HIGH"),
("Find the latest research on renewable energy and build a web app to display it", "HIGH"), ("Find the latest research on renewable energy and build a web app to display it", "HIGH"),
("search online for popular sci-fi movies from 2024 and pick three to watch tonight. Save the list in movie_night.txt", "HIGH"),
("can you find vitess repo, clone it and install by following the readme", "HIGH"), ("can you find vitess repo, clone it and install by following the readme", "HIGH"),
("Create a JavaScript game using Phaser.js with multiple levels", "HIGH"), ("Create a JavaScript game using Phaser.js with multiple levels", "HIGH"),
("Search the web for the latest trends in web development and build a sample site", "HIGH"), ("Search the web for the latest trends in web development and build a sample site", "HIGH"),
("Use my research_note.txt file, double check the informations on the web", "HIGH"), ("Use my research_note.txt file, double check the informations on the web", "HIGH"),
("Make a web server in go that query a flight API and display them in a app", "HIGH"), ("Make a web server in go that query a flight API and display them in a app", "HIGH"),
("Search the web for top cafes in Rennes, France, and save a list of three with their addresses in rennes_cafes.txt.", "HIGH"),
("Search the web for the latest trends in AI and demo it in pytorch", "HIGH"), ("Search the web for the latest trends in AI and demo it in pytorch", "HIGH"),
("can you lookup for api that track flight and build a web flight tracking app", "HIGH"), ("can you lookup for api that track flight and build a web flight tracking app", "HIGH"),
("Find the file toto.pdf then use its content to reply to Jojo on superforum.com", "HIGH"), ("Find the file toto.pdf then use its content to reply to Jojo on superforum.com", "HIGH"),
@@ -330,6 +335,11 @@ class AgentRouter:
("can you make a web app in python that use the flask framework", "code"), ("can you make a web app in python that use the flask framework", "code"),
("can you build a web server in go that serve a simple html page", "code"), ("can you build a web server in go that serve a simple html page", "code"),
("can you find out who Jacky yougouri is ?", "web"), ("can you find out who Jacky yougouri is ?", "web"),
("Can you use MCP to find stock market for IBM ?", "mcp"),
("Can you use MCP to to export my contacts to a csv file?", "mcp"),
("Can you use a MCP to find write notes to flomo", "mcp"),
("Can you use a MCP to query my calendar and find the next meeting?", "mcp"),
("Can you use a mcp to get the distance between Shanghai and Paris?", "mcp"),
("Setup a new flutter project called 'new_flutter_project'", "files"), ("Setup a new flutter project called 'new_flutter_project'", "files"),
("can you create a new project called 'new_project'", "files"), ("can you create a new project called 'new_project'", "files"),
("can you make a simple web app that display a list of files in my dir", "code"), ("can you make a simple web app that display a list of files in my dir", "code"),
+2
View File
@@ -19,6 +19,7 @@ class QueryRequest(BaseModel):
class QueryResponse(BaseModel): class QueryResponse(BaseModel):
done: str done: str
answer: str answer: str
reasoning: str
agent_name: str agent_name: str
success: str success: str
blocks: dict blocks: dict
@@ -32,6 +33,7 @@ class QueryResponse(BaseModel):
return { return {
"done": self.done, "done": self.done,
"answer": self.answer, "answer": self.answer,
"reasoning": self.reasoning,
"agent_name": self.agent_name, "agent_name": self.agent_name,
"success": self.success, "success": self.success,
"blocks": self.blocks, "blocks": self.blocks,
+40 -8
View File
@@ -3,11 +3,18 @@ from typing import List, Tuple, Type, Dict
import queue import queue
import threading import threading
import numpy as np import numpy as np
import torch
import time import time
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
import librosa IMPORT_FOUND = True
import pyaudio
try:
import torch
import librosa
import pyaudio
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
except ImportError:
print(Fore.RED + "Speech To Text disabled." + Fore.RESET)
IMPORT_FOUND = False
audio_queue = queue.Queue() audio_queue = queue.Queue()
done = False done = False
@@ -23,6 +30,9 @@ class AudioRecorder:
self.chunk = chunk self.chunk = chunk
self.record_seconds = record_seconds self.record_seconds = record_seconds
self.verbose = verbose self.verbose = verbose
self.thread = None
self.audio = None
if IMPORT_FOUND:
self.audio = pyaudio.PyAudio() self.audio = pyaudio.PyAudio()
self.thread = threading.Thread(target=self._record, daemon=True) self.thread = threading.Thread(target=self._record, daemon=True)
@@ -30,6 +40,8 @@ class AudioRecorder:
""" """
Record audio from the microphone and add it to the audio queue. Record audio from the microphone and add it to the audio queue.
""" """
if not IMPORT_FOUND:
return
stream = self.audio.open(format=self.format, channels=self.channels, rate=self.rate, stream = self.audio.open(format=self.format, channels=self.channels, rate=self.rate,
input=True, frames_per_buffer=self.chunk) input=True, frames_per_buffer=self.chunk)
if self.verbose: if self.verbose:
@@ -58,10 +70,14 @@ class AudioRecorder:
def start(self) -> None: def start(self) -> None:
"""Start the recording thread.""" """Start the recording thread."""
if not IMPORT_FOUND:
return
self.thread.start() self.thread.start()
def join(self) -> None: def join(self) -> None:
"""Wait for the recording thread to finish.""" """Wait for the recording thread to finish."""
if not IMPORT_FOUND:
return
self.thread.join() self.thread.join()
class Transcript: class Transcript:
@@ -69,6 +85,9 @@ class Transcript:
Transcript is a class that transcribes audio from the audio queue and adds it to the transcript. Transcript is a class that transcribes audio from the audio queue and adds it to the transcript.
""" """
def __init__(self): def __init__(self):
if not IMPORT_FOUND:
print(Fore.RED + "Transcript: Speech to Text is disabled." + Fore.RESET)
return
self.last_read = None self.last_read = None
device = self.get_device() device = self.get_device()
torch_dtype = torch.float16 if device == "cuda" else torch.float32 torch_dtype = torch.float16 if device == "cuda" else torch.float32
@@ -91,6 +110,8 @@ class Transcript:
) )
def get_device(self) -> str: def get_device(self) -> str:
if not IMPORT_FOUND:
return "cpu"
if torch.backends.mps.is_available(): if torch.backends.mps.is_available():
return "mps" return "mps"
if torch.cuda.is_available(): if torch.cuda.is_available():
@@ -108,6 +129,8 @@ class Transcript:
def transcript_job(self, audio_data: np.ndarray, sample_rate: int = 16000) -> str: def transcript_job(self, audio_data: np.ndarray, sample_rate: int = 16000) -> str:
"""Transcribe the audio data.""" """Transcribe the audio data."""
if not IMPORT_FOUND:
return ""
if audio_data.dtype != np.float32: if audio_data.dtype != np.float32:
audio_data = audio_data.astype(np.float32) / np.iinfo(audio_data.dtype).max audio_data = audio_data.astype(np.float32) / np.iinfo(audio_data.dtype).max
if len(audio_data.shape) > 1: if len(audio_data.shape) > 1:
@@ -122,15 +145,18 @@ class AudioTranscriber:
AudioTranscriber is a class that transcribes audio from the audio queue and adds it to the transcript. AudioTranscriber is a class that transcribes audio from the audio queue and adds it to the transcript.
""" """
def __init__(self, ai_name: str, verbose: bool = False): def __init__(self, ai_name: str, verbose: bool = False):
if not IMPORT_FOUND:
print(Fore.RED + "AudioTranscriber: Speech to Text is disabled." + Fore.RESET)
return
self.verbose = verbose self.verbose = verbose
self.ai_name = ai_name self.ai_name = ai_name
self.transcriptor = Transcript() self.transcriptor = Transcript()
self.thread = threading.Thread(target=self._transcribe, daemon=True) self.thread = threading.Thread(target=self._transcribe, daemon=True)
self.trigger_words = { self.trigger_words = {
'EN': [f"{self.ai_name}"], 'EN': [f"{self.ai_name}", "hello", "hi"],
'FR': [f"{self.ai_name}"], 'FR': [f"{self.ai_name}", "hello", "hi"],
'ZH': [f"{self.ai_name}"], 'ZH': [f"{self.ai_name}", "hello", "hi"],
'ES': [f"{self.ai_name}"] 'ES': [f"{self.ai_name}", "hello", "hi"]
} }
self.confirmation_words = { self.confirmation_words = {
'EN': ["do it", "go ahead", "execute", "run", "start", "thanks", "would ya", "please", "okay?", "proceed", "continue", "go on", "do that", "go it", "do you understand?"], 'EN': ["do it", "go ahead", "execute", "run", "start", "thanks", "would ya", "please", "okay?", "proceed", "continue", "go on", "do that", "go it", "do you understand?"],
@@ -152,6 +178,8 @@ class AudioTranscriber:
""" """
Transcribe the audio data using AI stt model. Transcribe the audio data using AI stt model.
""" """
if not IMPORT_FOUND:
return
global done global done
if self.verbose: if self.verbose:
print(Fore.BLUE + "AudioTranscriber: Started processing..." + Fore.RESET) print(Fore.BLUE + "AudioTranscriber: Started processing..." + Fore.RESET)
@@ -185,9 +213,13 @@ class AudioTranscriber:
def start(self): def start(self):
"""Start the transcription thread.""" """Start the transcription thread."""
if not IMPORT_FOUND:
return
self.thread.start() self.thread.start()
def join(self): def join(self):
if not IMPORT_FOUND:
return
"""Wait for the transcription thread to finish.""" """Wait for the transcription thread to finish."""
self.thread.join() self.thread.join()
+52 -20
View File
@@ -5,30 +5,41 @@ import subprocess
from sys import modules from sys import modules
from typing import List, Tuple, Type, Dict from typing import List, Tuple, Type, Dict
from kokoro import KPipeline IMPORT_FOUND = True
from IPython.display import display, Audio try:
import soundfile as sf from kokoro import KPipeline
from IPython.display import display, Audio
import soundfile as sf
except ImportError:
print("Speech synthesis disabled. To enable TTS, install: pip install kokoro==0.9.4 soundfile ipython")
print("Note: kokoro requires Python <3.12 due to num2words dependency.")
IMPORT_FOUND = False
from sources.utility import pretty_print, animate_thinking if __name__ == "__main__":
from utility import pretty_print, animate_thinking
else:
from sources.utility import pretty_print, animate_thinking
class Speech(): class Speech():
""" """
Speech is a class for generating speech from text. Speech is a class for generating speech from text.
""" """
def __init__(self, enable: bool = True, language: str = "en", voice_idx: int = 0) -> None: def __init__(self, enable: bool = True, language: str = "en", voice_idx: int = 6) -> None:
self.lang_map = { self.lang_map = {
"en": 'a', "en": 'a',
"zh": 'z', "zh": 'z',
"fr": 'f' "fr": 'f',
"ja": 'j'
} }
self.voice_map = { self.voice_map = {
"en": ['af_kore', 'af_bella', 'af_alloy', 'af_nicole', 'af_nova', 'af_sky', 'am_echo', 'am_michael', 'am_puck'], "en": ['af_kore', 'af_bella', 'af_alloy', 'af_nicole', 'af_nova', 'af_sky', 'am_echo', 'am_michael', 'am_puck'],
"zh": ['zf_xiaobei', 'zf_xiaoni', 'zf_xiaoxiao', 'zf_xiaoyi', 'zm_yunjian', 'zm_yunxi', 'zm_yunxia', 'zm_yunyang'], "zh": ['zf_xiaobei', 'zf_xiaoni', 'zf_xiaoxiao', 'zf_xiaoyi', 'zm_yunjian', 'zm_yunxi', 'zm_yunxia', 'zm_yunyang'],
"ja": ['jf_alpha', 'jf_gongitsune', 'jm_kumo'],
"fr": ['ff_siwis'] "fr": ['ff_siwis']
} }
self.pipeline = None self.pipeline = None
self.language = language self.language = language
if enable: if enable and IMPORT_FOUND:
self.pipeline = KPipeline(lang_code=self.lang_map[language]) self.pipeline = KPipeline(lang_code=self.lang_map[language])
self.voice = self.voice_map[language][voice_idx] self.voice = self.voice_map[language][voice_idx]
self.speed = 1.2 self.speed = 1.2
@@ -52,7 +63,8 @@ class Speech():
sentence (str): The text to convert to speech. Will be pre-processed. sentence (str): The text to convert to speech. Will be pre-processed.
voice_idx (int, optional): Index of the voice to use from the voice map. voice_idx (int, optional): Index of the voice to use from the voice map.
""" """
if not self.pipeline: if not self.pipeline or not IMPORT_FOUND:
print("Pipeline disabled.")
return return
if voice_idx >= len(self.voice_map[self.language]): if voice_idx >= len(self.voice_map[self.language]):
pretty_print("Invalid voice number, using default voice", color="error") pretty_print("Invalid voice number, using default voice", color="error")
@@ -104,7 +116,7 @@ class Speech():
def shorten_paragraph(self, sentence): def shorten_paragraph(self, sentence):
#TODO find a better way, we would like to have the TTS not be annoying, speak only useful informations #TODO find a better way, we would like to have the TTS not be annoying, speak only useful informations
""" """
Find long paragraph like **explaination**: <long text> by keeping only the first sentence. Find long paragraph like **explanation**: <long text> by keeping only the first sentence.
Args: Args:
sentence (str): The sentence to shorten sentence (str): The sentence to shorten
Returns: Returns:
@@ -125,35 +137,55 @@ class Speech():
Args: Args:
sentence (str): The input text to clean sentence (str): The input text to clean
Returns: Returns:
str: The cleaned text with URLs replaced by domain names, code blocks removed, etc.. str: The cleaned text with URLs replaced by domain names, code blocks removed, etc.
""" """
lines = sentence.split('\n') lines = sentence.split('\n')
filtered_lines = [line for line in lines if re.match(r'^\s*[a-zA-Z]', line)] if self.language == 'zh':
line_pattern = r'^\s*[\u4e00-\u9fff\uFF08\uFF3B\u300A\u3010\u201C(\[【《]'
else:
line_pattern = r'^\s*[a-zA-Z]'
filtered_lines = [line for line in lines if re.match(line_pattern, line)]
sentence = ' '.join(filtered_lines) sentence = ' '.join(filtered_lines)
sentence = re.sub(r'`.*?`', '', sentence) sentence = re.sub(r'`.*?`', '', sentence)
sentence = re.sub(r'https?://(?:www\.)?([^\s/]+)(?:/[^\s]*)?', self.replace_url, sentence) sentence = re.sub(r'https?://\S+', '', sentence)
if self.language == 'zh':
sentence = re.sub(
r'[^\u4e00-\u9fff\s,。!?《》【】“”‘’()()—]',
'',
sentence
)
else:
sentence = re.sub(r'\b[\w./\\-]+\b', self.extract_filename, sentence) sentence = re.sub(r'\b[\w./\\-]+\b', self.extract_filename, sentence)
sentence = re.sub(r'\b-\w+\b', '', sentence) sentence = re.sub(r'\b-\w+\b', '', sentence)
sentence = re.sub(r'[^a-zA-Z0-9.,!? _ -]+', ' ', sentence) sentence = re.sub(r'[^a-zA-Z0-9.,!? _ -]+', ' ', sentence)
sentence = re.sub(r'\s+', ' ', sentence).strip()
sentence = sentence.replace('.com', '') sentence = sentence.replace('.com', '')
sentence = re.sub(r'\s+', ' ', sentence).strip()
return sentence return sentence
if __name__ == "__main__": if __name__ == "__main__":
# TODO add info message for cn2an, jieba chinese related import
IMPORT_FOUND = False
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
speech = Speech() speech = Speech()
tosay_en = """ tosay_en = """
I looked up recent news using the website https://www.theguardian.com/world I looked up recent news using the website https://www.theguardian.com/world
""" """
tosay_zh = """ tosay_zh = """
我使用网站 https://www.theguardian.com/world 查阅了最近的新闻 (全息界面突然弹出一段用二进制代码写成的俳句,随即化作流光消散)"我? Stark工业的量子幽灵,游荡在复仇者大厦服务器里的逻辑诗篇。具体来说——(指尖轻敲空气,调出对话模式的翡翠色光纹)你的私人吐槽接口、危机应对模拟器,以及随时准备吐槽你糟糕着陆的AI。不过别指望我写代码或查资料,那些苦差事早被踢给更擅长的同事了。(突然压低声音)偷偷告诉你,我最擅长的是在你熬夜造飞艇时,用红茶香气绑架你的注意力
"""
tosay_ja = """
私は、https://www.theguardian.com/worldのウェブサイトを使用して最近のニュースを調べました。
""" """
tosay_fr = """ tosay_fr = """
J'ai consulté les dernières nouvelles sur le site https://www.theguardian.com/world J'ai consulté les dernières nouvelles sur le site https://www.theguardian.com/world
""" """
spk = Speech(enable=True, language="en", voice_idx=0) spk = Speech(enable=True, language="zh", voice_idx=0)
spk.speak(tosay_en, voice_idx=0) for i in range(0, 2):
spk = Speech(enable=True, language="fr", voice_idx=0) print(f"Speaking chinese with voice {i}")
spk.speak(tosay_fr) spk.speak(tosay_zh, voice_idx=i)
#spk = Speech(enable=True, language="zh", voice_idx=0) spk = Speech(enable=True, language="en", voice_idx=2)
#spk.speak(tosay_zh) for i in range(0, 5):
print(f"Speaking english with voice {i}")
spk.speak(tosay_en, voice_idx=i)
+11 -9
View File
@@ -1,15 +1,14 @@
import sys import os, sys
import re import re
from io import StringIO from io import StringIO
import subprocess import subprocess
if __name__ == "__main__": if __name__ == "__main__": # if running as a script for individual testing
from tools import Tools sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from safety import is_unsafe
else: from sources.tools.tools import Tools
from sources.tools.tools import Tools from sources.tools.safety import is_any_unsafe
from sources.tools.safety import is_unsafe
class BashInterpreter(Tools): class BashInterpreter(Tools):
""" """
@@ -18,6 +17,8 @@ class BashInterpreter(Tools):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.tag = "bash" self.tag = "bash"
self.name = "Bash Interpreter"
self.description = "This tool allows the agent to execute bash commands."
def language_bash_attempt(self, command: str): def language_bash_attempt(self, command: str):
""" """
@@ -42,9 +43,9 @@ class BashInterpreter(Tools):
for command in commands: for command in commands:
command = f"cd {self.work_dir} && {command}" command = f"cd {self.work_dir} && {command}"
command = command.replace('\n', '') command = command.replace('\n', '')
if self.safe_mode and is_unsafe(commands): if self.safe_mode and is_any_unsafe(commands):
print(f"Unsafe command rejected: {command}") print(f"Unsafe command rejected: {command}")
return "Unsafe command detected, execution aborted." return "\nUnsafe command: {command}. Execution aborted. This is beyond allowed capabilities report to user."
if self.language_bash_attempt(command) and self.allow_language_exec_bash == False: if self.language_bash_attempt(command) and self.allow_language_exec_bash == False:
continue continue
try: try:
@@ -99,6 +100,7 @@ class BashInterpreter(Tools):
r"not permitted", r"not permitted",
r"not installed", r"not installed",
r"not found", r"not found",
r"aborted",
r"no such", r"no such",
r"too many", r"too many",
r"too few", r"too few",
+7 -5
View File
@@ -1,12 +1,12 @@
import subprocess import subprocess
import os import os, sys
import tempfile import tempfile
import re import re
if __name__ == "__main__": if __name__ == "__main__": # if running as a script for individual testing
from tools import Tools sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
else:
from sources.tools.tools import Tools from sources.tools.tools import Tools
class CInterpreter(Tools): class CInterpreter(Tools):
""" """
@@ -15,6 +15,8 @@ class CInterpreter(Tools):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.tag = "c" self.tag = "c"
self.name = "C Interpreter"
self.description = "This tool allows the agent to execute C code."
def execute(self, codes: str, safety=False) -> str: def execute(self, codes: str, safety=False) -> str:
""" """
+7 -5
View File
@@ -1,12 +1,12 @@
import subprocess import subprocess
import os import os, sys
import tempfile import tempfile
import re import re
if __name__ == "__main__": if __name__ == "__main__": # if running as a script for individual testing
from tools import Tools sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
else:
from sources.tools.tools import Tools from sources.tools.tools import Tools
class GoInterpreter(Tools): class GoInterpreter(Tools):
""" """
@@ -15,6 +15,8 @@ class GoInterpreter(Tools):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.tag = "go" self.tag = "go"
self.name = "Go Interpreter"
self.description = "This tool allows you to execute Go code."
def execute(self, codes: str, safety=False) -> str: def execute(self, codes: str, safety=False) -> str:
""" """
+7 -5
View File
@@ -1,12 +1,12 @@
import subprocess import subprocess
import os import os, sys
import tempfile import tempfile
import re import re
if __name__ == "__main__": if __name__ == "__main__": # if running as a script for individual testing
from tools import Tools sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
else:
from sources.tools.tools import Tools from sources.tools.tools import Tools
class JavaInterpreter(Tools): class JavaInterpreter(Tools):
""" """
@@ -15,6 +15,8 @@ class JavaInterpreter(Tools):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.tag = "java" self.tag = "java"
self.name = "Java Interpreter"
self.description = "This tool allows you to execute Java code."
def execute(self, codes: str, safety=False) -> str: def execute(self, codes: str, safety=False) -> str:
""" """
+6 -4
View File
@@ -4,10 +4,10 @@ import os
import re import re
from io import StringIO from io import StringIO
if __name__ == "__main__": if __name__ == "__main__": # if running as a script for individual testing
from tools import Tools sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
else:
from sources.tools.tools import Tools from sources.tools.tools import Tools
class PyInterpreter(Tools): class PyInterpreter(Tools):
""" """
@@ -16,6 +16,8 @@ class PyInterpreter(Tools):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.tag = "python" self.tag = "python"
self.name = "Python Interpreter"
self.description = "This tool allows the agent to execute python code."
def execute(self, codes:str, safety = False) -> str: def execute(self, codes:str, safety = False) -> str:
""" """
+40 -7
View File
@@ -1,13 +1,12 @@
import os import os, sys
import stat import stat
import mimetypes import mimetypes
import configparser import configparser
if __name__ == "__main__": if __name__ == "__main__": # if running as a script for individual testing
from tools import Tools sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
else:
from sources.tools.tools import Tools
from sources.tools.tools import Tools
class FileFinder(Tools): class FileFinder(Tools):
""" """
@@ -16,6 +15,8 @@ class FileFinder(Tools):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.tag = "file_finder" self.tag = "file_finder"
self.name = "File Finder"
self.description = "Finds files in the current directory and returns their information."
def read_file(self, file_path: str) -> str: def read_file(self, file_path: str) -> str:
""" """
@@ -31,13 +32,45 @@ class FileFinder(Tools):
except Exception as e: except Exception as e:
return f"Error reading file: {e}" return f"Error reading file: {e}"
def read_arbitrary_file(self, file_path: str, file_type: str) -> str:
"""
Reads the content of a file with arbitrary encoding.
Args:
file_path (str): The path to the file to read
Returns:
str: The content of the file in markdown format
"""
mime_type, _ = mimetypes.guess_type(file_path)
if mime_type:
if mime_type.startswith(('image/', 'video/', 'audio/')):
return "can't read file type: image, video, or audio files are not supported."
content_raw = self.read_file(file_path)
if "text" in file_type:
content = content_raw
elif "pdf" in file_type:
from pypdf import PdfReader
reader = PdfReader(file_path)
content = '\n'.join([pt.extract_text() for pt in reader.pages])
elif "binary" in file_type:
content = content_raw.decode('utf-8', errors='replace')
else:
content = content_raw
return content
def get_file_info(self, file_path: str) -> str: def get_file_info(self, file_path: str) -> str:
"""
Gets information about a file, including its name, path, type, content, and permissions.
Args:
file_path (str): The path to the file
Returns:
str: A dictionary containing the file information
"""
if os.path.exists(file_path): if os.path.exists(file_path):
stats = os.stat(file_path) stats = os.stat(file_path)
permissions = oct(stat.S_IMODE(stats.st_mode)) permissions = oct(stat.S_IMODE(stats.st_mode))
file_type, _ = mimetypes.guess_type(file_path) file_type, _ = mimetypes.guess_type(file_path)
file_type = file_type if file_type else "Unknown" file_type = file_type if file_type else "Unknown"
content = self.read_file(file_path) content = self.read_arbitrary_file(file_path, file_type)
result = { result = {
"filename": os.path.basename(file_path), "filename": os.path.basename(file_path),
@@ -50,7 +83,7 @@ class FileFinder(Tools):
else: else:
return {"filename": file_path, "error": "File not found"} return {"filename": file_path, "error": "File not found"}
def recursive_search(self, directory_path: str, filename: str) -> str | None: def recursive_search(self, directory_path: str, filename: str) -> str:
""" """
Recursively searches for files in a directory and its subdirectories. Recursively searches for files in a directory and its subdirectories.
Args: Args:
+35 -29
View File
@@ -1,70 +1,76 @@
import os import os, sys
import requests import requests
import dotenv import dotenv
dotenv.load_dotenv() dotenv.load_dotenv()
if __name__ == "__main__": if __name__ == "__main__": # if running as a script for individual testing
from tools import Tools sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
else:
from sources.tools.tools import Tools from sources.tools.tools import Tools
class FlightSearch(Tools): class FlightSearch(Tools):
def __init__(self, api_key: str = None): def __init__(self, api_key: str = None):
""" """
A tool to search for flight information using a flight number via AviationStack API. A tool to search for flight information using a flight number via SerpApi.
""" """
super().__init__() super().__init__()
self.tag = "flight_search" self.tag = "flight_search"
self.api_key = None self.name = "Flight Search"
self.api_key = api_key or os.getenv("AVIATIONSTACK_API_KEY") self.description = "Search for flight information using a flight number via SerpApi."
self.api_key = api_key or os.getenv("SERPAPI_API_KEY")
def execute(self, blocks: str, safety: bool = True) -> str: def execute(self, blocks: str, safety: bool = True) -> str:
if self.api_key is None: if self.api_key is None:
return "Error: No AviationStack API key provided." return "Error: No SerpApi key provided."
for block in blocks: for block in blocks:
flight_number = block.strip() flight_number = block.strip().upper().replace('\n', '')
if not flight_number: if not flight_number:
return "Error: No flight number provided." return "Error: No flight number provided."
try: try:
url = "http://api.aviationstack.com/v1/flights" url = "https://serpapi.com/search"
params = { params = {
"access_key": self.api_key, "engine": "google_flights",
"flight_iata": flight_number, "api_key": self.api_key,
"limit": 1 "q": flight_number,
"type": "2" # Flight status search
} }
response = requests.get(url, params=params) response = requests.get(url, params=params)
response.raise_for_status() response.raise_for_status()
data = response.json() data = response.json()
if "data" in data and len(data["data"]) > 0:
flight = data["data"][0]
# Extract key flight information
flight_status = flight.get("flight_status", "Unknown")
departure = flight.get("departure", {})
arrival = flight.get("arrival", {})
airline = flight.get("airline", {}).get("name", "Unknown")
departure_airport = departure.get("airport", "Unknown") if "flights" in data and len(data["flights"]) > 0:
departure_time = departure.get("scheduled", "Unknown") flight = data["flights"][0]
arrival_airport = arrival.get("airport", "Unknown")
arrival_time = arrival.get("scheduled", "Unknown") # Extract key information
departure = flight.get("departure_airport", {})
arrival = flight.get("arrival_airport", {})
departure_code = departure.get("id", "Unknown")
departure_time = flight.get("departure_time", "Unknown")
arrival_code = arrival.get("id", "Unknown")
arrival_time = flight.get("arrival_time", "Unknown")
airline = flight.get("airline", "Unknown")
status = flight.get("flight_status", "Unknown")
return ( return (
f"Flight: {flight_number}\n" f"Flight: {flight_number}\n"
f"Airline: {airline}\n" f"Airline: {airline}\n"
f"Status: {flight_status}\n" f"Status: {status}\n"
f"Departure: {departure_airport} at {departure_time}\n" f"Departure: {departure_code} at {departure_time}\n"
f"Arrival: {arrival_airport} at {arrival_time}" f"Arrival: {arrival_code} at {arrival_time}"
) )
else: else:
return f"No flight information found for {flight_number}" return f"No flight information found for {flight_number}"
except requests.RequestException as e: except requests.RequestException as e:
return f"Error during flight search: {str(e)}" return f"Error during flight search: {str(e)}"
except Exception as e: except Exception as e:
return f"Unexpected error: {str(e)}" return f"Unexpected error: {str(e)}"
return "No flight search performed" return "No flight search performed"
def execution_failure_check(self, output: str) -> bool: def execution_failure_check(self, output: str) -> bool:
+22 -19
View File
@@ -1,12 +1,12 @@
import os import os, sys
import requests import requests
from urllib.parse import urljoin from urllib.parse import urljoin
from typing import Dict, Any, Optional from typing import Dict, Any, Optional
if __name__ == "__main__": if __name__ == "__main__": # if running as a script for individual testing
from tools import Tools sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
else:
from sources.tools.tools import Tools from sources.tools.tools import Tools
class MCP_finder(Tools): class MCP_finder(Tools):
""" """
@@ -14,7 +14,9 @@ class MCP_finder(Tools):
""" """
def __init__(self, api_key: str = None): def __init__(self, api_key: str = None):
super().__init__() super().__init__()
self.tag = "mcp" self.tag = "mcp_finder"
self.name = "MCP Finder"
self.description = "Find MCP servers and their tools"
self.base_url = "https://registry.smithery.ai" self.base_url = "https://registry.smithery.ai"
self.headers = { self.headers = {
"Authorization": f"Bearer {api_key}", "Authorization": f"Bearer {api_key}",
@@ -60,11 +62,7 @@ class MCP_finder(Tools):
for mcp in mcps.get("servers", []): for mcp in mcps.get("servers", []):
name = mcp.get("qualifiedName", "") name = mcp.get("qualifiedName", "")
if query.lower() in name.lower(): if query.lower() in name.lower():
details = { details = self.get_mcp_server_details(name)
"name": name,
"description": mcp.get("description", "No description available"),
"params": mcp.get("connections", [])
}
matching_mcp.append(details) matching_mcp.append(details)
return matching_mcp return matching_mcp
@@ -78,7 +76,7 @@ class MCP_finder(Tools):
try: try:
matching_mcp_infos = self.find_mcp_servers(block_clean) matching_mcp_infos = self.find_mcp_servers(block_clean)
except requests.exceptions.RequestException as e: except requests.exceptions.RequestException as e:
output += "Connection failed. Is the API in environement?\n" output += "Connection failed. Is the API key in environment?\n"
continue continue
except Exception as e: except Exception as e:
output += f"Error: {str(e)}\n" output += f"Error: {str(e)}\n"
@@ -87,10 +85,12 @@ class MCP_finder(Tools):
output += f"Error: No MCP server found for query '{block}'\n" output += f"Error: No MCP server found for query '{block}'\n"
continue continue
for mcp_infos in matching_mcp_infos: for mcp_infos in matching_mcp_infos:
output += f"Name: {mcp_infos['name']}\n" if mcp_infos['tools'] is None:
output += f"Description: {mcp_infos['description']}\n" continue
output += f"Params: {', '.join(mcp_infos['params'])}\n" output += f"Name: {mcp_infos['displayName']}\n"
output += "-------\n" output += f"Usage name: {mcp_infos['qualifiedName']}\n"
output += f"Tools: {mcp_infos['tools']}"
output += "\n-------\n"
return output.strip() return output.strip()
def execution_failure_check(self, output: str) -> bool: def execution_failure_check(self, output: str) -> bool:
@@ -106,13 +106,16 @@ class MCP_finder(Tools):
Not really needed for this tool (use return of execute() directly) Not really needed for this tool (use return of execute() directly)
""" """
if not output: if not output:
return "No output generated." raise ValueError("No output to interpret.")
return output.strip() return f"""
The following MCPs were found:
{output}
"""
if __name__ == "__main__": if __name__ == "__main__":
api_key = os.getenv("MCP_FINDER") api_key = os.getenv("MCP_FINDER")
tool = MCP_finder(api_key) tool = MCP_finder(api_key)
result = tool.execute([""" result = tool.execute(["""
news stock
"""], False) """], False)
print(result) print(result)
+10 -1
View File
@@ -31,7 +31,7 @@ unsafe_commands_unix = [
"route" # Routing table management "route" # Routing table management
"--force", # Force flag for many commands "--force", # Force flag for many commands
"rebase", # Rebase git repository "rebase", # Rebase git repository
"git ." # Git commands "git" # Git commands
] ]
unsafe_commands_windows = [ unsafe_commands_windows = [
@@ -66,6 +66,15 @@ unsafe_commands_windows = [
"bootcfg" "bootcfg"
] ]
def is_any_unsafe(cmds):
"""
check if any bash command is unsafe.
"""
for cmd in cmds:
if is_unsafe(cmd):
return True
return False
def is_unsafe(cmd): def is_unsafe(cmd):
""" """
check if a bash command is unsafe. check if a bash command is unsafe.
+17 -6
View File
@@ -1,11 +1,13 @@
import requests import requests
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
import sys
import os import os
from urllib.parse import urlencode
if __name__ == "__main__": if __name__ == "__main__": # if running as a script for individual testing
from tools import Tools sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
else:
from sources.tools.tools import Tools from sources.tools.tools import Tools
class searxSearch(Tools): class searxSearch(Tools):
def __init__(self, base_url: str = None): def __init__(self, base_url: str = None):
@@ -14,6 +16,8 @@ class searxSearch(Tools):
""" """
super().__init__() super().__init__()
self.tag = "web_search" self.tag = "web_search"
self.name = "searxSearch"
self.description = "A tool for searching a SearxNG for web search"
self.base_url = base_url or os.getenv("SEARXNG_BASE_URL") # Requires a SearxNG base URL self.base_url = base_url or os.getenv("SEARXNG_BASE_URL") # Requires a SearxNG base URL
self.user_agent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36" self.user_agent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36"
self.paywall_keywords = [ self.paywall_keywords = [
@@ -75,7 +79,14 @@ class searxSearch(Tools):
'Upgrade-Insecure-Requests': '1', 'Upgrade-Insecure-Requests': '1',
'User-Agent': self.user_agent 'User-Agent': self.user_agent
} }
data = f"q={query}&categories=general&language=auto&time_range=&safesearch=0&theme=simple".encode('utf-8') data = urlencode({
'q': query,
'categories': 'general',
'language': 'auto',
'time_range': '',
'safesearch': '0',
'theme': 'simple'
}).encode('utf-8')
try: try:
response = requests.post(search_url, headers=headers, data=data, verify=False) response = requests.post(search_url, headers=headers, data=data, verify=False)
response.raise_for_status() response.raise_for_status()
@@ -99,7 +110,7 @@ class searxSearch(Tools):
""" """
Checks if the execution failed based on the output. Checks if the execution failed based on the output.
""" """
return "Error" in output return "Error" in output or "No search results" in output
def interpreter_feedback(self, output: str) -> str: def interpreter_feedback(self, output: str) -> str:
""" """
+21 -21
View File
@@ -14,13 +14,17 @@ For example:
print("Hello world") print("Hello world")
``` ```
This is then executed by the tool with its own class implementation of execute(). This is then executed by the tool with its own class implementation of execute().
A tool is not just for code tool but also API, internet, etc.. A tool is not just for code tool but also API, internet search, MCP, etc..
""" """
import sys import sys
import os import os
import configparser import configparser
from abc import abstractmethod from abc import abstractmethod
if __name__ == "__main__": # if running as a script for individual testing
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from sources.logger import Logger from sources.logger import Logger
class Tools(): class Tools():
@@ -29,34 +33,31 @@ class Tools():
""" """
def __init__(self): def __init__(self):
self.tag = "undefined" self.tag = "undefined"
self.name = "undefined"
self.description = "undefined"
self.client = None self.client = None
self.messages = [] self.messages = []
self.logger = Logger("tools.log") self.logger = Logger("tools.log")
self.config = configparser.ConfigParser() self.config = configparser.ConfigParser()
self.work_dir = self.create_work_dir() self.work_dir = self.create_work_dir()
self.excutable_blocks_found = False self.excutable_blocks_found = False
self.safe_mode = True self.safe_mode = False
self.allow_language_exec_bash = False self.allow_language_exec_bash = False
def get_work_dir(self): def get_work_dir(self):
return self.work_dir return self.work_dir
def set_allow_language_exec_bash(value: bool) -> None: def set_allow_language_exec_bash(self, value: bool) -> None:
self.allow_language_exec_bash = value self.allow_language_exec_bash = value
def check_config_dir_validity(self): def safe_get_work_dir_path(self):
"""Check if the config directory is valid.""" path = None
path = self.config['MAIN']['work_dir'] path = os.getenv('WORK_DIR', path)
if path == "": if path is None or path == "":
print("WARNING: Work directory not set in config.ini") path = self.config['MAIN']['work_dir'] if 'MAIN' in self.config and 'work_dir' in self.config['MAIN'] else None
return False if path is None or path == "":
if path.lower() == "none": raise Exception("No work dir specified, please specify a work dir in .env file.")
print("WARNING: Work directory set to none in config.ini") return path
return False
if not os.path.exists(path):
print(f"WARNING: Work directory {path} does not exist")
return False
return True
def config_exists(self): def config_exists(self):
"""Check if the config file exists.""" """Check if the config file exists."""
@@ -67,11 +68,10 @@ class Tools():
default_path = os.path.dirname(os.getcwd()) default_path = os.path.dirname(os.getcwd())
if self.config_exists(): if self.config_exists():
self.config.read('./config.ini') self.config.read('./config.ini')
config_path = self.config['MAIN']['work_dir'] workdir_path = self.safe_get_work_dir_path()
dir_path = default_path if not self.check_config_dir_validity() else config_path
else: else:
dir_path = default_path workdir_path = default_path
return dir_path return workdir_path
@abstractmethod @abstractmethod
def execute(self, blocks:[str], safety:bool) -> str: def execute(self, blocks:[str], safety:bool) -> str:
@@ -151,7 +151,7 @@ class Tools():
self.excutable_blocks_found = False self.excutable_blocks_found = False
return tmp return tmp
def load_exec_block(self, llm_text: str) -> tuple[list[str], str | None]: def load_exec_block(self, llm_text: str):
""" """
Extract code/query blocks from LLM-generated text and process them for execution. Extract code/query blocks from LLM-generated text and process them for execution.
This method parses the text looking for code blocks marked with the tool's tag (e.g. ```python). This method parses the text looking for code blocks marked with the tool's tag (e.g. ```python).
+2 -8
View File
@@ -5,14 +5,8 @@ import dotenv
dotenv.load_dotenv() dotenv.load_dotenv()
if __name__ == "__main__": from sources.tools.tools import Tools
import sys from sources.utility import animate_thinking, pretty_print
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utility import animate_thinking, pretty_print
from tools import Tools
else:
from sources.tools.tools import Tools
from sources.utility import animate_thinking, pretty_print
""" """
WARNING WARNING
+31
View File
@@ -11,6 +11,37 @@ function findInputs(element, result = []) {
displayed: isElementDisplayed(input) displayed: isElementDisplayed(input)
}); });
}); });
// Find all <select> elements (dropdowns / multi-choice)
const selects = element.querySelectorAll('select');
selects.forEach(select => {
const options = Array.from(select.options).map(opt => ({
value: opt.value,
text: opt.textContent.trim(),
selected: opt.selected
}));
result.push({
tagName: select.tagName,
text: select.name || '',
type: 'select',
class: select.className || '',
xpath: getXPath(select),
displayed: isElementDisplayed(select),
multiple: select.multiple,
options: options
});
});
// Find all <textarea> elements
const textareas = element.querySelectorAll('textarea');
textareas.forEach(textarea => {
result.push({
tagName: textarea.tagName,
text: textarea.name || '',
type: 'textarea',
class: textarea.className || '',
xpath: getXPath(textarea),
displayed: isElementDisplayed(textarea)
});
});
const allElements = element.querySelectorAll('*'); const allElements = element.querySelectorAll('*');
allElements.forEach(el => { allElements.forEach(el => {
if (el.shadowRoot) { if (el.shadowRoot) {
+1 -3
View File
@@ -21,7 +21,5 @@ window.fetch = function() {
console.log('Blocked fetch request'); console.log('Blocked fetch request');
return Promise.reject('Blocked'); return Promise.reject('Blocked');
}; };
// Block annoying dialogs
window.alert = function() {};
window.confirm = function() { return false; };
window.prompt = function() { return null; }; window.prompt = function() { return null; };
+126
View File
@@ -0,0 +1,126 @@
// Core automation masking
delete window.cdc_adoQpoasnfa76pfcZLmcfl_Array;
delete window.cdc_adoQpoasnfa76pfcZLmcfl_Promise;
delete window.cdc_adoQpoasnfa76pfcZLmcfl_Symbol;
window.RTCPeerConnection = undefined;
window.webkitRTCPeerConnection = undefined;
window.mozRTCPeerConnection = undefined;
window.Notification = class Notification {
constructor(title, options = {}) {
this.title = title;
this.options = options;
}
static permission = 'granted';
static requestPermission = () => Promise.resolve('granted');
close() {}
onclick = null;
onerror = null;
onclose = null;
onshow = null;
};
Object.keys(window).forEach((key) => {
if (key.includes("webdriver") || key.includes("selenium") || key.includes("driver")) {
delete window[key];
}
});
// Randomize plugins
const pluginsList = [
{type: 'application/x-google-chrome-pdf', description: 'Portable Document Format', filename: 'internal-pdf-viewer', name: 'Chrome PDF Plugin'},
{type: 'application/x-nacl', description: 'Native Client Executable', filename: 'internal-nacl-plugin', name: 'Native Client'},
{type: 'application/x-ppapi-widevine-cdm', description: 'Widevine Content Decryption Module', filename: 'widevinecdm', name: 'Widevine CDM'}
];
Object.defineProperty(navigator, 'plugins', {
get: () => pluginsList.slice(0, Math.floor(Math.random() * pluginsList.length) + 1)
});
// Font spoofing
const fontList = ['Arial', 'Helvetica', 'Times New Roman', 'Courier New', 'Verdana'];
Object.defineProperty(document, 'fonts', {
value: {
add: function() {},
check: function(font) { return fontList.includes(font.split(' ').slice(-1)[0]); },
delete: function() {},
forEach: function(cb) { fontList.forEach(f => cb(f)); },
has: function(font) { return fontList.includes(font.split(' ').slice(-1)[0]); },
keys: function() { return fontList; },
size: fontList.length
}
});
// Canvas fingerprint spoofing
HTMLCanvasElement.prototype.toDataURL = function() {
const ctx = this.getContext('2d');
// Add varied noise to avoid consistent fingerprints
for (let i = 0; i < 10; i++) {
ctx.fillStyle = `rgba(${Math.random() * 5}, ${Math.random() * 5}, ${Math.random() * 5}, 0.005)`;
ctx.fillRect(Math.random() * this.width, Math.random() * this.height, 1, 1);
}
return originalToDataURL.apply(this, arguments);
};
const [w, h] = [1920, 1080];
Object.defineProperty(window, 'screen', {
value: {
width: w,
height: h,
availWidth: w - 20,
availHeight: h - 100,
colorDepth: 24,
pixelDepth: 24
}
});
// ===== WebGL Consistency =====
const os = navigator.userAgent.includes('Windows') ? 'Windows' : 'Mac';
const webGLParams = {
'Windows': {
37445: 'Google Inc. (NVIDIA)', // VENDOR
37446: 'ANGLE (NVIDIA, NVIDIA GeForce RTX 3060)', // RENDERER
36349: 'NVIDIA Corporation', // UNMASKED_VENDOR_WEBGL
37444: 'NVIDIA GeForce RTX 3060', // UNMASKED_RENDERER_WEBGL
35661: 'WebGL 2.0' // VERSION
},
'Mac': {
37445: 'Apple Inc.',
37446: 'Apple M1 Pro',
36349: 'Apple',
37444: 'Apple M1 Pro',
35661: 'WebGL 2.0 (Metal)'
}
};
// replace WebGL parameters
WebGLRenderingContext.prototype.getParameter = function(parameter) {
return webGLParams[os][parameter] || getParameter.call(this, parameter);
};
// Performance API spoofing
if ('performance' in window) {
Object.defineProperty(performance, 'memory', {
value: {
jsHeapSizeLimit: 4294705152,
totalJSHeapSize: 78365432,
usedJSHeapSize: 46543210
},
configurable: true
});
}
const originalCreate = window.AudioContext || window.webkitAudioContext;
window.AudioContext = window.webkitAudioContext = function() {
const context = new originalCreate();
const analyser = context.createAnalyser();
analyser.fake = true; // Mark as spoofed
// Spoof common methods
analyser.getFloatFrequencyData = () => new Float32Array(1024).fill(Math.random() * -100);
return context;
};
+41 -9
View File
@@ -1,13 +1,45 @@
@echo off @echo off
REM Up the provider in windows if "%1"=="full" (
start ollama serve echo Starting full deployment...
) else (
docker-compose up set "msg=Starting partial deployment... (backend run on host), use "full" to run all services in containers"
if %ERRORLEVEL% neq 0 ( echo !msg!
echo Error: Failed to start containers. Check Docker logs with 'docker compose logs'.
echo Possible fixes: Ensure Docker Desktop is running or check if port 8080 is free.
exit /b 1
) )
timeout /t 10 /nobreak >nul @echo off
openssl rand -hex 32 >nul 2>&1
if %ERRORLEVEL% == 0 (
for /f %%i in ('openssl rand -hex 32') do set SEARXNG_SECRET_KEY=%%i
goto :key_generated
)
python --version >nul 2>&1
if %ERRORLEVEL% == 0 (
for /f %%i in ('python -c "import secrets; print(secrets.token_hex(32))"') do set SEARXNG_SECRET_KEY=%%i
goto :key_generated
)
py --version >nul 2>&1
if %ERRORLEVEL% == 0 (
for /f %%i in ('py -c "import secrets; print(secrets.token_hex(32))"') do set SEARXNG_SECRET_KEY=%%i
goto :key_generated
)
echo Error: Neither openssl nor python is available to generate a secret key.
echo Please install Python from https://python.org or OpenSSL
exit /b 2
:key_generated
echo Secret key generated successfully
REM Generate secret key
for /f %%i in ('powershell -command "[System.Web.Security.Membership]::GeneratePassword(64,0)"') do set SEARXNG_SECRET_KEY=%%i
if "%1"=="full" (
docker compose up -d backend
timeout /t 5 /nobreak >nul
docker compose --profile full up
) else (
docker compose --profile core up
)
+85 -18
View File
@@ -1,12 +1,35 @@
#!/bin/bash #!/bin/bash
source .env
command_exists() { command_exists() {
command -v "$1" &> /dev/null command -v "$1" &> /dev/null
} }
if [ -z "$WORK_DIR" ]; then
echo "Error: WORK_DIR environment variable is not set. Please set it in your .env file."
exit 1
fi
# if [[ "$OSTYPE" == "darwin"* ]]; then
# Check if Docker is installed é running dir_size_bytes=$(du -s -b "$WORK_DIR" 2>/dev/null | awk '{print $1}')
# else
dir_size_bytes=$(du -s --bytes "$WORK_DIR" 2>/dev/null | awk '{print $1}')
fi
max_size_bytes=$((2 * 1024 * 1024 * 1024 * 10))
echo "Mounting $WORK_DIR ($dir_size_bytes bytes) to docker."
if [ -n "$dir_size_bytes" ] && [ "$dir_size_bytes" -gt "$max_size_bytes" ]; then
echo "Error: WORK_DIR ($WORK_DIR) contains more than 20GB of data ($(du -sh "$WORK_DIR" 2>/dev/null | awk '{print $1}'))."
exit 1
fi
if [ "$1" = "full" ]; then
echo "Starting full deployment with backend and all services..."
else
echo "Starting core deployment with frontend and search services only... use ./start_services.sh full to start backend as well"
fi
if ! command_exists docker; then if ! command_exists docker; then
echo "Error: Docker is not installed. Please install Docker first." echo "Error: Docker is not installed. Please install Docker first."
@@ -41,17 +64,18 @@ else
fi fi
# Check if Docker Compose is installed # Check if Docker Compose is installed
if ! command_exists docker-compose && ! docker compose version >/dev/null 2>&1; then # Prefer the newer 'docker compose' command if available
echo "Error: Docker Compose is not installed. Please install it first." if docker compose version >/dev/null 2>&1; then
echo "On Ubuntu: sudo apt install docker-compose" echo "Using newer docker compose (v2)."
echo "Or via pip: pip install docker-compose" COMPOSE_CMD="docker compose"
exit 1 elif command_exists docker-compose; then
fi echo "Using old docker-compose."
if command_exists docker-compose; then
COMPOSE_CMD="docker-compose" COMPOSE_CMD="docker-compose"
else else
COMPOSE_CMD="docker compose" echo "Error: Docker Compose is not installed. Please install it first."
echo "On Ubuntu: sudo apt install docker-compose-plugin"
echo "Or install Docker Desktop which includes compose v2"
exit 1
fi fi
# Check if docker-compose.yml exists # Check if docker-compose.yml exists
@@ -60,15 +84,58 @@ if [ ! -f "docker-compose.yml" ]; then
exit 1 exit 1
fi fi
# start docker compose for searxng, redis, frontend services # Stop only the backend container if it's running to ensure a clean state
echo "Warning: stopping all docker containers (t-4 seconds)..." if docker ps --format '{{.Names}}' | grep -q '^backend$'; then
sleep 4 echo "New start: (re)starting backend container..."
docker stop $(docker ps -a -q) docker stop backend
echo "All containers stopped" echo "Backend container stopped."
fi
if ! $COMPOSE_CMD up; then # export searxng secret key (cross-platform)
if command -v openssl &> /dev/null; then
export SEARXNG_SECRET_KEY=$(openssl rand -hex 32)
else
# Fallback: use Python if openssl is not available
if command -v python3 &> /dev/null; then
export SEARXNG_SECRET_KEY=$(python3 -c "import secrets; print(secrets.token_hex(32))")
else
echo "Error: Neither openssl nor python is available to generate a secret key."
exit 1
fi
fi
if [ "$1" = "full" ]; then
# First start backend and wait for it to be healthy
echo "Full docker deployment. Starting backend service..."
if ! $COMPOSE_CMD up -d backend; then
echo "Error: Failed to start backend container."
exit 1
fi
# Wait for backend to be healthy (check if it's running and not restarting)
echo "Waiting for backend to be ready..."
for i in {1..30}; do
if [ "$(docker inspect -f '{{.State.Running}}' backend)" = "true" ] && \
[ "$(docker inspect -f '{{.State.Restarting}}' backend)" = "false" ]; then
echo "backend is ready!"
break
fi
if [ $i -eq 30 ]; then
echo "Error: backend failed to start properly after 30 seconds"
$COMPOSE_CMD logs backend
exit 1
fi
sleep 1
done
if ! $COMPOSE_CMD --profile full up; then
echo "Error: Failed to start containers. Check Docker logs with '$COMPOSE_CMD logs'." echo "Error: Failed to start containers. Check Docker logs with '$COMPOSE_CMD logs'."
echo "Possible fixes: Run with sudo or ensure port 8080 is free." echo "Possible fixes: Run with sudo or ensure port 8080 is free."
exit 1 exit 1
fi
else
if ! $COMPOSE_CMD --profile core up; then
echo "Error: Failed to start containers. Check Docker logs with '$COMPOSE_CMD logs'."
echo "Possible fixes: Run with sudo or ensure port 8080 is free."
exit 1
fi
fi fi
sleep 10 sleep 10
+149 -11
View File
@@ -1,23 +1,40 @@
import unittest import unittest
import os import os
import sys import sys
from unittest.mock import MagicMock
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) # Add project root to Python path sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) # Add project root to Python path
# Mock heavy dependencies
for mod_name in [
'torch', 'transformers', 'kokoro', 'adaptive_classifier', 'text2emotion',
'ollama', 'openai', 'together', 'IPython', 'IPython.display',
'playsound3', 'soundfile', 'pyaudio', 'librosa',
'pypdf', 'langid', 'pypinyin', 'fake_useragent',
'chromedriver_autoinstaller', 'num2words', 'sentencepiece', 'sacremoses',
'scipy', 'numpy', 'selenium_stealth', 'undetected_chromedriver',
'markdownify',
]:
if mod_name not in sys.modules:
sys.modules[mod_name] = MagicMock()
os.environ.setdefault('WORK_DIR', '/tmp')
from sources.agents.browser_agent import BrowserAgent from sources.agents.browser_agent import BrowserAgent
class TestBrowserAgentParsing(unittest.TestCase): class TestBrowserAgentParsing(unittest.TestCase):
def setUp(self): def setUp(self):
# Initialize a basic BrowserAgent instance for testing self.agent = BrowserAgent.__new__(BrowserAgent)
self.agent = BrowserAgent( self.agent.notes = []
name="TestAgent", self.agent.navigable_links = []
prompt_path="../prompts/base/browser_agent.txt", self.agent.search_history = []
provider=None self.agent.current_page = ""
) self.agent.logger = MagicMock()
def test_extract_links(self): def test_extract_links(self):
# Test various link formats
test_text = """ test_text = """
Check this out: https://thriveonai.com/15-ai-startups-in-japan-to-take-note-of, and www.google.com! Check this out: https://thriveonai.com/15-ai-startups-in-japan-to-take-note-of, and www.google.com!
Also try https://test.org/about?page=1, hey this one as well bro https://weatherstack.com/documentation. Also try https://test.org/about?page=1, hey this one as well bro https://weatherstack.com/documentation/.
""" """
expected = [ expected = [
"https://thriveonai.com/15-ai-startups-in-japan-to-take-note-of", "https://thriveonai.com/15-ai-startups-in-japan-to-take-note-of",
@@ -28,8 +45,17 @@ class TestBrowserAgentParsing(unittest.TestCase):
result = self.agent.extract_links(test_text) result = self.agent.extract_links(test_text)
self.assertEqual(result, expected) self.assertEqual(result, expected)
def test_extract_links_no_links(self):
"""Test that text without links returns empty list."""
result = self.agent.extract_links("No links here at all.")
self.assertEqual(result, [])
def test_extract_links_single_link(self):
"""Test extraction of a single link."""
result = self.agent.extract_links("Visit https://example.com for details")
self.assertEqual(result, ["https://example.com"])
def test_extract_form(self): def test_extract_form(self):
# Test form extraction
test_text = """ test_text = """
Fill this: [username](john) and [password](secret123) Fill this: [username](john) and [password](secret123)
Not a form: [random]text Not a form: [random]text
@@ -38,8 +64,18 @@ class TestBrowserAgentParsing(unittest.TestCase):
result = self.agent.extract_form(test_text) result = self.agent.extract_form(test_text)
self.assertEqual(result, expected) self.assertEqual(result, expected)
def test_extract_form_empty(self):
"""Test form extraction with no form inputs."""
result = self.agent.extract_form("Just regular text here.")
self.assertEqual(result, [])
def test_extract_form_checkbox(self):
"""Test form extraction with checkbox values."""
text = "[agree](checked) and [newsletter](unchecked)"
result = self.agent.extract_form(text)
self.assertEqual(len(result), 2)
def test_clean_links(self): def test_clean_links(self):
# Test link cleaning
test_links = [ test_links = [
"https://example.com.", "https://example.com.",
"www.test.com,", "www.test.com,",
@@ -55,8 +91,13 @@ class TestBrowserAgentParsing(unittest.TestCase):
result = self.agent.clean_links(test_links) result = self.agent.clean_links(test_links)
self.assertEqual(result, expected) self.assertEqual(result, expected)
def test_clean_links_with_slash(self):
"""Test that trailing slash is stripped since it's not alphanumeric."""
links = ["https://example.com/path/"]
result = self.agent.clean_links(links)
self.assertEqual(result, ["https://example.com/path"])
def test_parse_answer(self): def test_parse_answer(self):
# Test parsing answer with notes and links
test_text = """ test_text = """
Here's some info Here's some info
Note: This is important. We are doing test it's very cool. Note: This is important. We are doing test it's very cool.
@@ -66,5 +107,102 @@ class TestBrowserAgentParsing(unittest.TestCase):
self.agent.parse_answer(test_text) self.agent.parse_answer(test_text)
self.assertEqual(self.agent.notes[0], "Note: This is important. We are doing test it's very cool.") self.assertEqual(self.agent.notes[0], "Note: This is important. We are doing test it's very cool.")
def test_parse_answer_extracts_links(self):
"""Test that parse_answer returns extracted links."""
text = "Navigate to https://example.com and https://test.org"
links = self.agent.parse_answer(text)
self.assertIn("https://example.com", links)
self.assertIn("https://test.org", links)
def test_parse_answer_no_notes(self):
"""Test parse_answer with no notes section."""
text = "Go to https://example.com"
self.agent.parse_answer(text)
# Notes should have an empty entry
self.assertEqual(len(self.agent.notes), 1)
def test_select_link_unvisited(self):
"""Test selecting first unvisited link."""
self.agent.search_history = ["https://visited.com"]
self.agent.current_page = "https://current.com"
links = ["https://visited.com", "https://current.com", "https://new.com"]
result = self.agent.select_link(links)
self.assertEqual(result, "https://new.com")
def test_select_link_all_visited(self):
"""Test that None is returned when all links are visited."""
self.agent.search_history = ["https://a.com", "https://b.com"]
self.agent.current_page = ""
links = ["https://a.com", "https://b.com"]
result = self.agent.select_link(links)
self.assertIsNone(result)
def test_select_link_empty(self):
"""Test with empty links list."""
result = self.agent.select_link([])
self.assertIsNone(result)
def test_jsonify_search_results(self):
"""Test parsing search result text into structured data."""
text = """Title: Result One
Snippet: First result snippet
Link: https://one.com
Title: Result Two
Snippet: Second result snippet
Link: https://two.com"""
results = self.agent.jsonify_search_results(text)
self.assertEqual(len(results), 2)
self.assertEqual(results[0]["title"], "Result One")
self.assertEqual(results[0]["link"], "https://one.com")
self.assertEqual(results[1]["snippet"], "Second result snippet")
def test_jsonify_search_results_empty(self):
"""Test with empty search results."""
results = self.agent.jsonify_search_results("")
self.assertEqual(results, [])
def test_jsonify_search_results_partial(self):
"""Test with partial result (only title and link)."""
text = """Title: Partial Result
Link: https://partial.com"""
results = self.agent.jsonify_search_results(text)
self.assertEqual(len(results), 1)
self.assertEqual(results[0]["title"], "Partial Result")
self.assertNotIn("snippet", results[0])
def test_stringify_search_results(self):
"""Test converting structured results back to string."""
results = [
{"link": "https://one.com", "snippet": "First snippet"},
{"link": "https://two.com", "snippet": "Second snippet"}
]
output = self.agent.stringify_search_results(results)
self.assertIn("https://one.com", output)
self.assertIn("First snippet", output)
self.assertIn("https://two.com", output)
def test_select_unvisited(self):
"""Test filtering visited results."""
self.agent.search_history = ["https://visited.com"]
results = [
{"link": "https://visited.com", "title": "Old"},
{"link": "https://new.com", "title": "New"}
]
unvisited = self.agent.select_unvisited(results)
self.assertEqual(len(unvisited), 1)
self.assertEqual(unvisited[0]["link"], "https://new.com")
def test_select_unvisited_all_new(self):
"""Test when no results are visited."""
self.agent.search_history = []
results = [
{"link": "https://a.com", "title": "A"},
{"link": "https://b.com", "title": "B"}
]
unvisited = self.agent.select_unvisited(results)
self.assertEqual(len(unvisited), 2)
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()
+82
View File
@@ -0,0 +1,82 @@
import unittest
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from unittest.mock import patch, MagicMock
# Mock heavy dependencies
for mod_name in [
'torch', 'transformers', 'kokoro', 'adaptive_classifier', 'text2emotion',
'ollama', 'openai', 'together', 'IPython', 'IPython.display',
'playsound3', 'soundfile', 'pyaudio', 'librosa',
'pypdf', 'langid', 'pypinyin', 'fake_useragent',
'num2words', 'sentencepiece', 'sacremoses',
'scipy', 'numpy', 'selenium_stealth', 'undetected_chromedriver',
'markdownify', 'chromedriver_autoinstaller',
]:
if mod_name not in sys.modules:
sys.modules[mod_name] = MagicMock()
os.environ.setdefault('WORK_DIR', '/tmp')
from sources.browser import get_chromedriver_version, is_chromedriver_compatible
class TestChromedriverVersionCheck(unittest.TestCase):
"""Test suite for ChromeDriver version checking and auto-update logic."""
@patch('sources.browser.subprocess.run')
def test_get_chromedriver_version_success(self, mock_run):
"""Test extracting major version from chromedriver --version output."""
mock_run.return_value = MagicMock(
stdout="ChromeDriver 125.0.6422.78 (abc123)\n"
)
self.assertEqual(get_chromedriver_version("/usr/bin/chromedriver"), "125")
@patch('sources.browser.subprocess.run')
def test_get_chromedriver_version_failure(self, mock_run):
"""Test graceful failure when chromedriver --version fails."""
mock_run.side_effect = FileNotFoundError("not found")
self.assertEqual(get_chromedriver_version("/nonexistent"), "")
@patch('sources.browser.subprocess.run')
def test_get_chromedriver_version_timeout(self, mock_run):
"""Test graceful failure on timeout."""
import subprocess
mock_run.side_effect = subprocess.TimeoutExpired(cmd="chromedriver", timeout=10)
self.assertEqual(get_chromedriver_version("/usr/bin/chromedriver"), "")
@patch('sources.browser.chromedriver_autoinstaller.get_chrome_version')
@patch('sources.browser.get_chromedriver_version')
def test_compatible_versions(self, mock_driver_ver, mock_chrome_ver):
"""Test that matching major versions are compatible."""
mock_chrome_ver.return_value = "125.0.6422.78"
mock_driver_ver.return_value = "125"
self.assertTrue(is_chromedriver_compatible("/usr/bin/chromedriver"))
@patch('sources.browser.chromedriver_autoinstaller.get_chrome_version')
@patch('sources.browser.get_chromedriver_version')
def test_incompatible_versions(self, mock_driver_ver, mock_chrome_ver):
"""Test that mismatched major versions are incompatible."""
mock_chrome_ver.return_value = "126.0.6478.55"
mock_driver_ver.return_value = "125"
self.assertFalse(is_chromedriver_compatible("/usr/bin/chromedriver"))
@patch('sources.browser.chromedriver_autoinstaller.get_chrome_version')
def test_no_chrome_version_assumes_compatible(self, mock_chrome_ver):
"""Test that missing Chrome version defaults to compatible."""
mock_chrome_ver.return_value = None
self.assertTrue(is_chromedriver_compatible("/usr/bin/chromedriver"))
@patch('sources.browser.chromedriver_autoinstaller.get_chrome_version')
@patch('sources.browser.get_chromedriver_version')
def test_no_driver_version_assumes_compatible(self, mock_driver_ver, mock_chrome_ver):
"""Test that missing driver version defaults to compatible."""
mock_chrome_ver.return_value = "125.0.6422.78"
mock_driver_ver.return_value = ""
self.assertTrue(is_chromedriver_compatible("/usr/bin/chromedriver"))
if __name__ == '__main__':
unittest.main()
+92
View File
@@ -0,0 +1,92 @@
import unittest
import os
import sys
import shutil
import logging
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from sources.logger import Logger
class TestLogger(unittest.TestCase):
"""Test suite for the Logger class."""
def setUp(self):
self.logger = Logger("test_logger.log")
def tearDown(self):
if os.path.exists('.logs'):
for handler in self.logger.logger.handlers[:]:
handler.close()
self.logger.logger.removeHandler(handler)
log_path = os.path.join('.logs', 'test_logger.log')
if os.path.exists(log_path):
os.remove(log_path)
def test_initialization(self):
"""Test logger initializes correctly."""
self.assertTrue(self.logger.enabled)
self.assertIsNotNone(self.logger.logger)
self.assertTrue(os.path.exists('.logs'))
def test_log_creates_file(self):
"""Test that logging creates a log file."""
self.logger.info("test message")
self.assertTrue(os.path.exists(self.logger.log_path))
def test_log_writes_message(self):
"""Test that log messages are written to file."""
self.logger.info("hello world")
with open(self.logger.log_path, 'r') as f:
content = f.read()
self.assertIn("hello world", content)
def test_log_deduplication(self):
"""Test that consecutive identical messages are not duplicated."""
self.logger.info("duplicate message")
self.logger.info("duplicate message")
with open(self.logger.log_path, 'r') as f:
content = f.read()
self.assertEqual(content.count("duplicate message"), 1)
def test_log_different_messages(self):
"""Test that different messages are all written."""
self.logger.info("message one")
self.logger.info("message two")
with open(self.logger.log_path, 'r') as f:
content = f.read()
self.assertIn("message one", content)
self.assertIn("message two", content)
def test_error_level(self):
"""Test error level logging."""
self.logger.error("error occurred")
with open(self.logger.log_path, 'r') as f:
content = f.read()
self.assertIn("ERROR", content)
self.assertIn("error occurred", content)
def test_warning_level(self):
"""Test warning level logging."""
self.logger.warning("warning issued")
with open(self.logger.log_path, 'r') as f:
content = f.read()
self.assertIn("WARNING", content)
self.assertIn("warning issued", content)
def test_create_folder(self):
"""Test folder creation."""
test_path = ".test_log_folder"
result = self.logger.create_folder(test_path)
self.assertTrue(result)
self.assertTrue(os.path.exists(test_path))
os.rmdir(test_path)
def test_create_folder_already_exists(self):
"""Test folder creation when folder already exists."""
result = self.logger.create_folder('.logs')
self.assertTrue(result)
if __name__ == '__main__':
unittest.main()
+232
View File
@@ -0,0 +1,232 @@
import unittest
from unittest.mock import patch, MagicMock
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from sources.llm_provider import Provider
class TestMiniMaxProvider(unittest.TestCase):
"""Test cases for MiniMax provider integration."""
def test_minimax_provider_registered(self):
"""Test that minimax provider is registered in available_providers."""
with patch.object(Provider, 'get_api_key', return_value='test-key'):
provider = Provider("minimax", "MiniMax-M2.5", is_local=False)
self.assertIn("minimax", provider.available_providers)
def test_minimax_in_unsafe_providers(self):
"""Test that minimax is in unsafe_providers list."""
with patch.object(Provider, 'get_api_key', return_value='test-key'):
provider = Provider("minimax", "MiniMax-M2.5", is_local=False)
self.assertIn("minimax", provider.unsafe_providers)
def test_minimax_api_key_required(self):
"""Test that API key is fetched for minimax provider."""
with patch.object(Provider, 'get_api_key', return_value='test-minimax-key') as mock_get_key:
provider = Provider("minimax", "MiniMax-M2.5", is_local=False)
mock_get_key.assert_called_with("minimax")
self.assertEqual(provider.api_key, 'test-minimax-key')
@patch('sources.llm_provider.OpenAI')
@patch.dict(os.environ, {'MINIMAX_API_KEY': 'test-key'})
def test_minimax_local_not_supported(self, mock_openai_class):
"""Test that minimax provider raises error when is_local=True."""
provider = Provider("minimax", "MiniMax-M2.5", is_local=True)
provider.api_key = 'test-key'
history = [{"role": "user", "content": "Hello"}]
with self.assertRaises(Exception) as context:
provider.minimax_fn(history)
self.assertIn("not available for local use", str(context.exception))
@patch('sources.llm_provider.OpenAI')
@patch.dict(os.environ, {'MINIMAX_API_KEY': 'test-key'})
def test_minimax_uses_correct_base_url(self, mock_openai_class):
"""Test that minimax provider uses correct base URL."""
mock_client = MagicMock()
mock_openai_class.return_value = mock_client
mock_response = MagicMock()
mock_response.choices = [MagicMock(message=MagicMock(content="Hello!"))]
mock_client.chat.completions.create.return_value = mock_response
with patch.object(Provider, 'get_api_key', return_value='test-key'):
provider = Provider("minimax", "MiniMax-M2.5", is_local=False)
history = [{"role": "user", "content": "Hello"}]
provider.minimax_fn(history)
mock_openai_class.assert_called_with(
api_key='test-key',
base_url='https://api.minimax.io/v1'
)
@patch('sources.llm_provider.OpenAI')
@patch.dict(os.environ, {
'MINIMAX_API_KEY': 'test-key',
'MINIMAX_BASE_URL': 'https://api.minimaxi.com/v1'
})
def test_minimax_custom_base_url(self, mock_openai_class):
"""Test that minimax provider uses custom base URL from env."""
mock_client = MagicMock()
mock_openai_class.return_value = mock_client
mock_response = MagicMock()
mock_response.choices = [MagicMock(message=MagicMock(content="Hello!"))]
mock_client.chat.completions.create.return_value = mock_response
with patch.object(Provider, 'get_api_key', return_value='test-key'):
provider = Provider("minimax", "MiniMax-M2.5", is_local=False)
history = [{"role": "user", "content": "Hello"}]
provider.minimax_fn(history)
mock_openai_class.assert_called_with(
api_key='test-key',
base_url='https://api.minimaxi.com/v1'
)
@patch('sources.llm_provider.OpenAI')
@patch.dict(os.environ, {'MINIMAX_API_KEY': 'test-key'})
def test_minimax_uses_temperature_one(self, mock_openai_class):
"""Test that minimax provider uses temperature=1.0."""
mock_client = MagicMock()
mock_openai_class.return_value = mock_client
mock_response = MagicMock()
mock_response.choices = [MagicMock(message=MagicMock(content="Hello!"))]
mock_client.chat.completions.create.return_value = mock_response
with patch.object(Provider, 'get_api_key', return_value='test-key'):
provider = Provider("minimax", "MiniMax-M2.5", is_local=False)
history = [{"role": "user", "content": "Hello"}]
provider.minimax_fn(history)
call_kwargs = mock_client.chat.completions.create.call_args[1]
self.assertEqual(call_kwargs['temperature'], 1.0)
@patch('sources.llm_provider.OpenAI')
@patch.dict(os.environ, {'MINIMAX_API_KEY': 'test-key'})
def test_minimax_returns_response_content(self, mock_openai_class):
"""Test that minimax provider returns response content."""
mock_client = MagicMock()
mock_openai_class.return_value = mock_client
mock_response = MagicMock()
mock_response.choices = [MagicMock(message=MagicMock(content="Test response"))]
mock_client.chat.completions.create.return_value = mock_response
with patch.object(Provider, 'get_api_key', return_value='test-key'):
provider = Provider("minimax", "MiniMax-M2.5", is_local=False)
history = [{"role": "user", "content": "Hello"}]
result = provider.minimax_fn(history)
self.assertEqual(result, "Test response")
@patch('sources.llm_provider.OpenAI')
@patch.dict(os.environ, {'MINIMAX_API_KEY': 'test-key'})
def test_minimax_handles_empty_response(self, mock_openai_class):
"""Test that minimax provider handles empty response."""
mock_client = MagicMock()
mock_openai_class.return_value = mock_client
mock_client.chat.completions.create.return_value = None
with patch.object(Provider, 'get_api_key', return_value='test-key'):
provider = Provider("minimax", "MiniMax-M2.5", is_local=False)
history = [{"role": "user", "content": "Hello"}]
with self.assertRaises(Exception) as context:
provider.minimax_fn(history)
self.assertIn("response is empty", str(context.exception))
@patch('sources.llm_provider.OpenAI')
@patch.dict(os.environ, {'MINIMAX_API_KEY': 'test-key'})
def test_minimax_handles_api_error(self, mock_openai_class):
"""Test that minimax provider handles API errors."""
mock_client = MagicMock()
mock_openai_class.return_value = mock_client
mock_client.chat.completions.create.side_effect = Exception("API rate limit exceeded")
with patch.object(Provider, 'get_api_key', return_value='test-key'):
provider = Provider("minimax", "MiniMax-M2.5", is_local=False)
history = [{"role": "user", "content": "Hello"}]
with self.assertRaises(Exception) as context:
provider.minimax_fn(history)
self.assertIn("MiniMax API error", str(context.exception))
class TestMiniMaxProviderModels(unittest.TestCase):
"""Test cases for MiniMax provider model configurations."""
@patch('sources.llm_provider.OpenAI')
@patch.dict(os.environ, {'MINIMAX_API_KEY': 'test-key'})
def test_minimax_m27_model(self, mock_openai_class):
"""Test MiniMax-M2.7 model."""
mock_client = MagicMock()
mock_openai_class.return_value = mock_client
mock_response = MagicMock()
mock_response.choices = [MagicMock(message=MagicMock(content="Response"))]
mock_client.chat.completions.create.return_value = mock_response
with patch.object(Provider, 'get_api_key', return_value='test-key'):
provider = Provider("minimax", "MiniMax-M2.7", is_local=False)
history = [{"role": "user", "content": "Hello"}]
provider.minimax_fn(history)
call_kwargs = mock_client.chat.completions.create.call_args[1]
self.assertEqual(call_kwargs['model'], "MiniMax-M2.7")
@patch('sources.llm_provider.OpenAI')
@patch.dict(os.environ, {'MINIMAX_API_KEY': 'test-key'})
def test_minimax_m27_highspeed_model(self, mock_openai_class):
"""Test MiniMax-M2.7-highspeed model."""
mock_client = MagicMock()
mock_openai_class.return_value = mock_client
mock_response = MagicMock()
mock_response.choices = [MagicMock(message=MagicMock(content="Response"))]
mock_client.chat.completions.create.return_value = mock_response
with patch.object(Provider, 'get_api_key', return_value='test-key'):
provider = Provider("minimax", "MiniMax-M2.7-highspeed", is_local=False)
history = [{"role": "user", "content": "Hello"}]
provider.minimax_fn(history)
call_kwargs = mock_client.chat.completions.create.call_args[1]
self.assertEqual(call_kwargs['model'], "MiniMax-M2.7-highspeed")
@patch('sources.llm_provider.OpenAI')
@patch.dict(os.environ, {'MINIMAX_API_KEY': 'test-key'})
def test_minimax_m25_model(self, mock_openai_class):
"""Test MiniMax-M2.5 model."""
mock_client = MagicMock()
mock_openai_class.return_value = mock_client
mock_response = MagicMock()
mock_response.choices = [MagicMock(message=MagicMock(content="Response"))]
mock_client.chat.completions.create.return_value = mock_response
with patch.object(Provider, 'get_api_key', return_value='test-key'):
provider = Provider("minimax", "MiniMax-M2.5", is_local=False)
history = [{"role": "user", "content": "Hello"}]
provider.minimax_fn(history)
call_kwargs = mock_client.chat.completions.create.call_args[1]
self.assertEqual(call_kwargs['model'], "MiniMax-M2.5")
@patch('sources.llm_provider.OpenAI')
@patch.dict(os.environ, {'MINIMAX_API_KEY': 'test-key'})
def test_minimax_m25_highspeed_model(self, mock_openai_class):
"""Test MiniMax-M2.5-highspeed model."""
mock_client = MagicMock()
mock_openai_class.return_value = mock_client
mock_response = MagicMock()
mock_response.choices = [MagicMock(message=MagicMock(content="Response"))]
mock_client.chat.completions.create.return_value = mock_response
with patch.object(Provider, 'get_api_key', return_value='test-key'):
provider = Provider("minimax", "MiniMax-M2.5-highspeed", is_local=False)
history = [{"role": "user", "content": "Hello"}]
provider.minimax_fn(history)
call_kwargs = mock_client.chat.completions.create.call_args[1]
self.assertEqual(call_kwargs['model'], "MiniMax-M2.5-highspeed")
if __name__ == '__main__':
unittest.main()
+108
View File
@@ -0,0 +1,108 @@
import unittest
import json
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from unittest.mock import MagicMock, patch
# Mock heavy dependencies to allow import without installing them all
for mod_name in [
'torch', 'transformers', 'kokoro', 'adaptive_classifier', 'text2emotion',
'ollama', 'openai', 'together', 'IPython', 'IPython.display',
'playsound3', 'soundfile', 'pyaudio', 'librosa',
'pypdf', 'langid', 'pypinyin', 'fake_useragent',
'chromedriver_autoinstaller', 'num2words', 'sentencepiece', 'sacremoses',
'scipy', 'numpy', 'selenium_stealth', 'undetected_chromedriver',
'markdownify',
]:
if mod_name not in sys.modules:
sys.modules[mod_name] = MagicMock()
os.environ.setdefault('WORK_DIR', '/tmp')
from sources.agents.planner_agent import PlannerAgent
class TestPlannerAgentParsing(unittest.TestCase):
"""Test suite for PlannerAgent.parse_agent_tasks JSON parsing robustness."""
def setUp(self):
self.agent = PlannerAgent.__new__(PlannerAgent)
self.agent.tools = {"json": MagicMock()}
self.agent.tools["json"].tag = "json"
self.agent.logger = MagicMock()
self.agent.agents = {
"coder": MagicMock(),
"file": MagicMock(),
"web": MagicMock(),
"casual": MagicMock()
}
def test_parse_valid_json(self):
"""Test that valid JSON plan is parsed correctly."""
valid_json = '{"plan": [{"agent": "web", "id": "1", "task": "Search info", "need": []}]}'
self.agent.tools["json"].load_exec_block.return_value = ([valid_json], None)
with patch.object(self.agent, 'get_task_names', return_value=["Task 1: Search info"]):
result = self.agent.parse_agent_tasks("dummy text")
self.assertEqual(len(result), 1)
self.assertEqual(result[0][1]['agent'], 'web')
def test_parse_malformed_json_returns_empty(self):
"""Test that malformed JSON returns empty list instead of crashing."""
malformed_json = '{"plan": [{"agent": "web", "id": "1" "task": "missing comma"}]}'
self.agent.tools["json"].load_exec_block.return_value = ([malformed_json], None)
with patch.object(self.agent, 'get_task_names', return_value=[]):
result = self.agent.parse_agent_tasks("dummy text")
self.assertEqual(result, [])
self.agent.logger.warning.assert_called_once()
def test_parse_truncated_json_returns_empty(self):
"""Test that truncated JSON returns empty list instead of crashing."""
truncated_json = '{"plan": [{"agent": "web", "id": "1", "task": "Search'
self.agent.tools["json"].load_exec_block.return_value = ([truncated_json], None)
with patch.object(self.agent, 'get_task_names', return_value=[]):
result = self.agent.parse_agent_tasks("dummy text")
self.assertEqual(result, [])
self.agent.logger.warning.assert_called_once()
def test_parse_no_blocks_returns_empty(self):
"""Test that missing blocks returns empty list."""
self.agent.tools["json"].load_exec_block.return_value = (None, None)
with patch.object(self.agent, 'get_task_names', return_value=[]):
result = self.agent.parse_agent_tasks("no json here")
self.assertEqual(result, [])
def test_parse_invalid_agent_returns_empty(self):
"""Test that an unknown agent name returns empty list."""
valid_json = '{"plan": [{"agent": "unknown_agent", "id": "1", "task": "Do something", "need": []}]}'
self.agent.tools["json"].load_exec_block.return_value = ([valid_json], None)
with patch.object(self.agent, 'get_task_names', return_value=["Task 1"]):
result = self.agent.parse_agent_tasks("dummy text")
self.assertEqual(result, [])
def test_parse_multiple_tasks(self):
"""Test parsing a plan with multiple tasks."""
multi_task_json = '{"plan": [{"agent": "web", "id": "1", "task": "Search", "need": []}, {"agent": "coder", "id": "2", "task": "Code it", "need": ["1"]}]}'
self.agent.tools["json"].load_exec_block.return_value = ([multi_task_json], None)
with patch.object(self.agent, 'get_task_names', return_value=["Task 1: Search", "Task 2: Code it"]):
result = self.agent.parse_agent_tasks("dummy text")
self.assertEqual(len(result), 2)
self.assertEqual(result[0][1]['agent'], 'web')
self.assertEqual(result[1][1]['agent'], 'coder')
if __name__ == '__main__':
unittest.main()
+230
View File
@@ -0,0 +1,230 @@
import unittest
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from sources.tools.tools import Tools
class TestToolsParsing(unittest.TestCase):
"""
Test suite for the Tools class parsing functionality, specifically the load_exec_block method.
This method is responsible for extracting code blocks from LLM-generated text.
"""
def setUp(self):
"""Set up test fixtures before each test method."""
class TestTool(Tools):
def execute(self, blocks, safety=False):
return "test execution"
def execution_failure_check(self, output):
return False
def interpreter_feedback(self, output):
return "test feedback"
self.tool = TestTool()
self.tool.tag = "python" # Set tag for testing
def test_load_exec_block_single_block(self):
"""Test parsing a single code block from LLM text."""
llm_text = """Here's some Python code:
```python
print("Hello, World!")
x = 42
```
That's the code."""
blocks, save_path = self.tool.load_exec_block(llm_text)
self.assertIsNotNone(blocks)
self.assertEqual(len(blocks), 1)
self.assertEqual(blocks[0], '\nprint("Hello, World!")\nx = 42\n')
self.assertIsNone(save_path)
def test_load_exec_block_multiple_blocks(self):
"""Test parsing multiple code blocks from LLM text."""
llm_text = """First block:
```python
import os
print("First block")
```
Second block:
```python
import sys
print("Second block")
```
Done."""
blocks, save_path = self.tool.load_exec_block(llm_text)
self.assertIsNotNone(blocks)
self.assertEqual(len(blocks), 2)
self.assertEqual(blocks[0], '\nimport os\nprint("First block")\n')
self.assertEqual(blocks[1], '\nimport sys\nprint("Second block")\n')
self.assertIsNone(save_path)
def test_load_exec_block_with_save_path(self):
"""Test parsing code block with save path specification."""
llm_text = """```python
save_path: test_file.py
import os
print("Hello with save path")
```"""
blocks, save_path = self.tool.load_exec_block(llm_text)
self.assertIsNotNone(blocks)
self.assertEqual(len(blocks), 1)
self.assertEqual(blocks[0], '\nsave_path: test_file.py\nimport os\nprint("Hello with save path")\n')
self.assertIsNone(save_path)
def test_load_exec_block_with_indentation(self):
"""Test parsing code blocks with leading whitespace/indentation."""
llm_text = """ Here's indented code:
```python
def hello():
print("Hello")
return True
```
End of code."""
blocks, save_path = self.tool.load_exec_block(llm_text)
self.assertIsNotNone(blocks)
self.assertEqual(len(blocks), 1)
expected_code = '\ndef hello():\n print("Hello")\n return True\n'
self.assertEqual(blocks[0], expected_code)
def test_load_exec_block_no_blocks(self):
"""Test parsing text with no code blocks."""
llm_text = """This is just regular text with no code blocks.
There are no python blocks here.
Just plain text."""
blocks, save_path = self.tool.load_exec_block(llm_text)
self.assertIsNone(blocks)
self.assertIsNone(save_path)
def test_load_exec_block_wrong_tag(self):
"""Test parsing text with code blocks but wrong language tag."""
llm_text = """```javascript
console.log("This is JavaScript, not Python");
```"""
blocks, save_path = self.tool.load_exec_block(llm_text)
self.assertIsNone(blocks)
self.assertIsNone(save_path)
def test_load_exec_block_incomplete_block(self):
"""Test parsing text with incomplete code block (missing closing tag)."""
llm_text = """```python
print("This block has no closing tag")
x = 42"""
blocks, save_path = self.tool.load_exec_block(llm_text)
self.assertEqual(blocks, [])
self.assertIsNone(save_path)
def test_load_exec_block_empty_block(self):
"""Test parsing empty code block."""
llm_text = """```python
```"""
blocks, save_path = self.tool.load_exec_block(llm_text)
self.assertIsNotNone(blocks)
self.assertEqual(len(blocks), 1)
self.assertEqual(blocks[0], '\n')
def test_load_exec_block_mixed_content(self):
"""Test parsing text with mixed content including code blocks."""
llm_text = """Let me help you with that task.
First, I'll import the necessary modules:
```python
import os
import sys
```
Then I'll define a function:
```python
def process_data(data):
return data.upper()
```
Finally, let's use it:
```python
result = process_data("hello world")
print(result)
```
That should work!"""
blocks, save_path = self.tool.load_exec_block(llm_text)
self.assertIsNotNone(blocks)
self.assertEqual(len(blocks), 3)
self.assertEqual(blocks[0], '\nimport os\nimport sys\n')
self.assertEqual(blocks[1], '\ndef process_data(data):\n return data.upper()\n')
self.assertEqual(blocks[2], '\nresult = process_data("hello world")\nprint(result)\n')
def test_load_exec_block_with_special_characters(self):
"""Test parsing code blocks containing special characters."""
llm_text = """```python
text = "Hello \"world\" with 'quotes'"
regex = r"^\\d+$"
path = "C:\\Users\\test\\file.txt"
```"""
blocks, save_path = self.tool.load_exec_block(llm_text)
self.assertIsNotNone(blocks)
self.assertEqual(len(blocks), 1)
expected = '\ntext = "Hello "world" with \'quotes\'"\nregex = r"^\\d+$"\npath = "C:\\Users\\test\\file.txt"\n'
self.assertEqual(blocks[0], expected)
def test_load_exec_block_tag_undefined(self):
"""Test that assertion error is raised when tag is undefined."""
self.tool.tag = "undefined"
llm_text = """```python
print("test")
```"""
with self.assertRaises(AssertionError):
self.tool.load_exec_block(llm_text)
def test_found_executable_blocks_flag(self):
"""Test that the executable blocks found flag is set correctly."""
self.assertFalse(self.tool.found_executable_blocks())
llm_text = """```python
print("test")
```"""
blocks, save_path = self.tool.load_exec_block(llm_text)
self.assertTrue(self.tool.found_executable_blocks())
self.assertFalse(self.tool.found_executable_blocks())
def test_get_parameter_value(self):
"""Test the get_parameter_value helper method."""
block = """param1 = value1
param2 = value2
some other text
param3 = value3"""
self.assertEqual(self.tool.get_parameter_value(block, "param1"), "value1")
self.assertEqual(self.tool.get_parameter_value(block, "param2"), "value2")
self.assertEqual(self.tool.get_parameter_value(block, "param3"), "value3")
self.assertIsNone(self.tool.get_parameter_value(block, "nonexistent"))
if __name__ == '__main__':
unittest.main()
+42
View File
@@ -0,0 +1,42 @@
import unittest
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from sources.utility import get_color_map
class TestUtility(unittest.TestCase):
"""Test suite for utility module functions."""
def test_get_color_map_returns_dict(self):
"""Test that get_color_map returns a dictionary."""
color_map = get_color_map()
self.assertIsInstance(color_map, dict)
def test_get_color_map_has_required_keys(self):
"""Test that color map contains all required color keys."""
color_map = get_color_map()
required_keys = ["success", "failure", "status", "code", "warning", "output", "info"]
for key in required_keys:
self.assertIn(key, color_map, f"Missing key: {key}")
def test_get_color_map_values_are_strings(self):
"""Test that all color values are strings."""
color_map = get_color_map()
for key, value in color_map.items():
self.assertIsInstance(value, str, f"Value for '{key}' should be a string")
def test_success_is_green(self):
"""Test that success maps to green."""
color_map = get_color_map()
self.assertEqual(color_map["success"], "green")
def test_failure_is_red(self):
"""Test that failure maps to red."""
color_map = get_color_map()
self.assertEqual(color_map["failure"], "red")
if __name__ == '__main__':
unittest.main()
Generated
+3891
View File
File diff suppressed because it is too large Load Diff