31 Commits

Author SHA1 Message Date
ecbb8a90e4 fix: add missing browser tool wrappers to fix KeyError in registration 2026-05-08 18:20:12 +08:00
8f11f41f7b fix: restore skill_tools dictionary and imports for tool registration 2026-05-08 18:14:01 +08:00
ce6b6fd45a feat: implement actual tool logic in base_tools (read, write, search, terminal, execute_code, memory, skills, todo) 2026-05-08 17:55:57 +08:00
93edc7cde3 fix: grant full permissions to internal calls (empty context) 2026-05-08 15:58:33 +08:00
63a89d6db2 fix: replace uuid.uuid4() with getID() from appPublic.uniqueID for all table ID generation 2026-05-08 15:47:22 +08:00
eb9a90ee42 fix: add env.get_module_dbname() for dynamic database lookup 2026-05-08 15:34:13 +08:00
34fd3ada5c fix: DBPools Singleton - manually set db.databases after getting instance 2026-05-08 15:17:17 +08:00
22820b85cd fix: DBPools(config.databases) instead of DBPools() for subprocess context 2026-05-08 14:49:17 +08:00
fe6666b665 fix: DBPools() not in __init__, sqlorContext uses module name not default 2026-05-08 11:41:53 +08:00
f9705f3892 fix: handle non-JSON LLM API responses gracefully
- Check resp.content_type before calling resp.json()
- Return clear error if server returns HTML (e.g. proxy error or wrong endpoint)
- Prevents 'Attempt to decode JSON with unexpected mimetype' crashes
2026-05-07 18:25:00 +08:00
e5e6796a4b feat: decrypt API key using ServerEnv.password_decode
- Add API key decryption in _resolve_provider using env.password_decode
- Matches project standard for encrypted credentials
2026-05-07 17:31:05 +08:00
1dbfd25772 fix: correct sor.R() call pattern - ns dict contains filters+sort
- sor.R signature: R(tablename, ns, filters=None)
- ns (2nd arg) is a combined dict: filter conditions + sort options
- No 3-arg calls or ns= keyword argument used
- All queries include user_id for multi-user isolation

Fixed in:
- llm_client.py: _get_llm_config uses sor.R(ns_dict)
- core.py: memory, sessions, skills, workflows, executions
- orchestrator.py: workflow tasks loading, execution recording
2026-05-07 17:08:29 +08:00
a88c964666 fix: multi-user isolation and sqlor-compatible queries
- Replace all sor.sqlExe(ORDER BY/LIMIT) with sor.R(ns={sort:...}) pattern
- Add user_id filter to all database queries for multi-user isolation
- Replace invalid sor.R(orderby=...) with ns={sort:...}
- _get_llm_config: use sor.R with user_id filter and ns sort
- core.py: fix _get_intelligent_memory_context, search_sessions,
  list_workflows, list_executions, manage_remote_skills (list)
- core.py: _update_memory_access_stats now requires user_id param
- orchestrator.py: fix _load_workflow_definition ns sort,
  _record_execution_end requires user_id param
- Add debug logging for config lookup (user_id, dbname, row data)
2026-05-07 16:39:07 +08:00
8e10a24d55 fix: LLM config query uses 'default' DB only, not calling module's DB
Problem: When integrated_crm_app calls llm_chat(), _get_llm_config() used
env.get_module_dbname('harnessed_agent') which returned 'crm_db' (the
calling module's DB), causing it to read stale/wrong config (qwen3-max)
instead of the correct config from default DB (qwen3.6-plus).

Fix: Remove get_module_dbname() call. LLM config is global and shared
across all modules, so always query from 'default' database.
2026-05-07 15:49:12 +08:00
6165c4b1cd fix: replace invalid sor.R(orderby/limit) calls with sqlExe
- All sor.R() calls with orderby= and/or limit= parameters replaced
  with raw SQL via sor.sqlExe() for correct execution
- Fixed in core.py (memory, sessions, workflows, executions, skills)
- Fixed in llm_client.py (config lookup)
2026-05-07 15:32:42 +08:00
a7f99fc710 fix: fallback to default DB for LLM config lookup
- _get_llm_config now tries module DB and 'default' DB
- Adds logging to show which DB is accessed
- Prevents empty config when table is in default DB
2026-05-07 15:10:53 +08:00
d22dfdf383 fix: correct agent config form URLs and add config management menu item
- Fix agent_config_form.ui data_url and submit_url paths
  (wwwroot/ to wwwroot/api/ needs 'api/', not '../api/')
- Add '配置管理' menu entry to menu.ui pointing to harnessed_agent_config_view CRUD
2026-05-07 13:50:12 +08:00
4e65ff8fe4 refactor: LLM client for calling supplier LLM APIs (not server)
Replaces wrong-direction llm_api.py (which served OpenAI endpoints)
with llm_client.py -- a client that calls supplier LLM APIs.

New module: llm_client.py
  - llm_chat(messages, model, temperature, ...) -> OpenAI response dict
  - llm_chat_stream(messages, ...) -> async generator of SSE chunks
  - llm_simple(prompt, system) -> plain text response
  - llm_list_models() -> list available models from provider
  - llm_get_config() -> show current config (key masked)
  - Supports provider presets: openai, dashscope, deepseek, siliconflow
  - Retry with exponential backoff (3 attempts)
  - 429 rate limit handling with Retry-After
  - Structured logging via appPublic.log

Model changes (harnessed_agent_config):
  - Add llm_provider (preset name: dashscope/openai/deepseek/siliconflow)
  - Add top_p field
  - llm_service_url defaults to DashScope compatible endpoint

Other:
  - Remove wrong-direction /v1/ endpoints
  - Fix pyproject.toml deps: only sqlor + bricks_for_python
  - Update init/data.json seed data with LLM config fields
  - Update CRUD view with llm_provider dropdown
2026-05-07 11:57:04 +08:00
e4f935de07 fix: add retry, rate limiting, and logging to LLM API
- Add exponential backoff retry (3 attempts) for transient failures
- Add 429 rate limit handling with Retry-After header support
- Add 500 server error retry with backoff
- Add timeout retry handling (300s per attempt)
- Add structured logging via appPublic.log (info/warning/error)
- Log request params (model, stream, message count) on entry
- Log response timing and token usage on completion
- Log error details on failure

All HIGH/MEDIUM severity LLM API issues resolved.
2026-05-07 11:43:10 +08:00
608413a5d5 feat: implement OpenAI-compatible LLM API
- Add /v1/chat/completions endpoint (POST) with streaming support
- Add /v1/models endpoint (GET) listing available models
- Add /v1/completions endpoint (POST) legacy compatibility
- Add llm_api.py module with OpenAI API proxy via aiohttp
- Add llm_service_url, llm_api_key, available_models to config model
- Update harnessed_agent_config_view CRUD to protect API key field
- Register new functions in init.py (harnessed_llm_chat_completions etc.)
- Add .gitignore for pycache files

Endpoints available under module path:
  POST /harnessed_agent/v1/chat/completions
  GET  /harnessed_agent/v1/models
  POST /harnessed_agent/v1/completions
2026-05-07 11:36:35 +08:00
52f88239ed fix: add length/dec attributes to float/decimal fields in model definitions 2026-05-07 10:39:26 +08:00
3e33bc0924 添加代理执行和模型配置:创建代理执行控制台UI和API,扩展config模型添加default_model/default_temperature/enable_streaming字段 2026-05-06 15:05:57 +08:00
ee4b416b50 修复菜单URL与CRUD alias不匹配:menu.ui使用正确的alias路径,.ui文件引用修正为JSON定义的alias 2026-05-06 14:25:27 +08:00
790a4f0e50 补全CRUD配置和API:为12个JSON添加editable段,创建36个.dspy API文件,修复.ui文件中entire_url引号 2026-05-06 14:05:16 +08:00
b27a089916 feat: add menu.ui with data table and feature menu items 2026-05-05 21:56:01 +08:00
ca16edf609 feat: add models, CRUD UI, config functions and config model definitions
- Add hermes_executions, hermes_tasks, hermes_workflows, task_dependencies models
- Add harnessed_agent_config model and view CRUD JSON
- Add config_functions.py for agent configuration
- Add agent_config.ui and ios_design.css frontend files
2026-05-04 11:56:37 +08:00
434ac73465 add design style 2026-05-04 10:09:04 +08:00
f5c6f6927e bugfix 2026-04-17 16:40:12 +08:00
a28cd7dedf bugfix 2026-04-17 11:00:42 +08:00
d70824198b bugfix 2026-04-16 17:14:06 +08:00
2f189c9291 bugfix 2026-04-16 15:40:17 +08:00