Commit Graph

3572 Commits

Author SHA1 Message Date
DrSmoothl
34bd115fa1 efactor(network): centralize port validation and enforce strict configured ports
add a shared port checker utility for availability and conflict detection
migrate WebUI, message server, and additional API server to use the new module
fail fast with clear error hints when a configured port is occupied (no auto-increment)
2026-03-04 22:14:53 +08:00
DrSmoothl
2a33fd1121 refactor(llm): enable hot-reload for model config and client runtime
make LLM task config resolution dynamic in LLMRequest
load model clients on demand from latest config
clear client instance cache on config reload
remove stale module-level model_config usage in llm_api
add hot-reload tests for LLM/config watcher flow
2026-03-04 21:56:50 +08:00
DrSmoothl
b3a81754e6 feat(config): harden file watcher hot-reload flow and add test coverage
refactor FileWatcher to subscription-based dispatch with path/change filters
add callback timeout, failure cooldown, auto-retry loop, and runtime stats
strengthen ConfigManager hot-reload with throttling, timeout guard, and watcher stats logging
add pytest suites for watcher behavior and config hot-reload edge cases
2026-03-04 21:39:26 +08:00
DrSmoothl
5cccdf6715 feat(llm): 添加响应格式转换功能,支持JSON_SCHEMA输出 2026-03-04 21:11:10 +08:00
UnCLAS-Prommer
81bc25dba8 Merge branch 'r-dev' of github.com:Mai-with-u/MaiBot into r-dev 2026-03-04 21:06:53 +08:00
UnCLAS-Prommer
d03dc3601e 消息构建器:将消息转换为可读消息;其对应的测试文件 2026-03-04 21:01:51 +08:00
晴猫
46babf7294 添加TODO注释以提醒测试trigger_tracker方法 2026-03-03 02:18:59 +09:00
晴猫
71a5acbac5 优化ReflectTracker逻辑,确保在追踪时表达不为None,简化代码并增强可读性 2026-03-03 02:18:04 +09:00
晴猫
efaff7ac60 实现追踪检查逻辑,添加消息数量和LLM判断,更新表达并持久化到数据库 2026-03-03 02:18:04 +09:00
UnCLAS-Prommer
c16ced765e 适配db的修改;MessageComponent更新 2026-03-02 20:37:15 +08:00
UnCLAS-Prommer
3f93d93b9a 补上default 2026-03-02 20:34:52 +08:00
UnCLAS-Prommer
0751ac5066 Merge branch 'r-dev' of github.com:Mai-with-u/MaiBot into r-dev 2026-03-02 17:23:45 +08:00
UnCLAS-Prommer
e200b5b581 给Expression系统的一些准备文件 2026-03-02 17:18:13 +08:00
DrSmoothl
416bf36f1a refactor(database_model): replace Literal with Enum for modified_by field 2026-02-28 22:47:40 +08:00
UnCLAS-Prommer
1e917cc87d Merge branch 'r-dev' of github.com:Mai-with-u/MaiBot into r-dev 2026-02-28 21:16:41 +08:00
UnCLAS-Prommer
a39ccedb9a 应要求提交上未完成的HFC, expression部分 2026-02-28 21:14:46 +08:00
DrSmoothl
5f5bdab85d 补全 WebUI 缺失文件 2026-02-28 20:50:04 +08:00
UnCLAS-Prommer
c58da95353 链式调用构建消息 2026-02-28 16:54:38 +08:00
UnCLAS-Prommer
78983c4ed8 expression 2026-02-28 15:57:44 +08:00
UnCLAS-Prommer
b9faed4924 拆分新的utils 2026-02-27 22:07:26 +08:00
UnCLAS-Prommer
e253a2ed2a 分离提及和at必回复 2026-02-27 16:11:47 +08:00
UnCLAS-Prommer
7ef21c516a 一点注释和渲染修改 2026-02-24 16:01:39 +08:00
UnCLAS-Prommer
a8e8f6b7b3 HFC对应修改(部分) 2026-02-24 15:59:35 +08:00
UnCLAS-Prommer
0d07e85434 全新的process方法完成(Message其他部分仍未完成);对应测试;调整部分注释;数据库检索优化 2026-02-23 21:29:17 +08:00
UnCLAS-Prommer
698b8355a4 移除旧文件;补充chat_manager方法 2026-02-22 22:33:54 +08:00
UnCLAS-Prommer
37f8c923c1 ChatSession(原ChatStream)与ChatManager;由于功能简单,测试略 2026-02-22 22:26:28 +08:00
UnCLAS-Prommer
04a5bf3c6d Merge branch 'r-dev' of github.com:Mai-with-u/MaiBot into r-dev 2026-02-21 23:50:53 +08:00
UnCLAS-Prommer
8674f50d90 PersonInfo相关提交,添加注释,重命名文件 2026-02-21 23:50:18 +08:00
DrSmoothl
6378bb2052 fix Ruff 2026-02-21 16:29:30 +08:00
DrSmoothl
eaef7f0e98 Ruff Format 2026-02-21 16:24:24 +08:00
DrSmoothl
2cb512120b feat(plugin-system): harden P0 safety with workflow timeout, service ACL, and contract validation
- enforce step timeout/cancellation in workflow engine
- add caller authorization boundary for cross-plugin service calls
- validate params_schema and return_schema at runtime
2026-02-21 16:11:52 +08:00
UnCLAS-Prommer
6d196454ee Merge branch 'r-dev' of github.com:Mai-with-u/MaiBot into r-dev 2026-02-21 15:55:57 +08:00
UnCLAS-Prommer
119241f251 PersonInfoModel; 修改部分方法参数和部分文件位置;移除多余文件;炸毁可启动性 2026-02-21 15:54:03 +08:00
DrSmoothl
6fcc53a22b feat(plugin-system): add workflow pipeline and cross-plugin service registry 2026-02-20 19:24:05 +08:00
UnCLAS-Prommer
1c0580c577 ImageManager及测试 2026-02-19 19:02:44 +08:00
UnCLAS-Prommer
0a572515ba 表情管理器调整,减少计算 2026-02-19 00:04:53 +08:00
UnCLAS-Prommer
537b24c24e 获取和注册一体化修正 2026-02-18 21:34:56 +08:00
UnCLAS-Prommer
ccd1be7bed Merge branch 'r-dev' of github.com:Mai-with-u/MaiBot into r-dev 2026-02-18 16:00:58 +08:00
UnCLAS-Prommer
c9f72f7f2f 修改部分字段含义,维护缓存 2026-02-18 16:00:45 +08:00
DrSmoothl
f66e25b1a7 fix(webui): fix missing imports and create toml_utils module
- Create src/common/toml_utils.py with TOML utility functions
- Fix APIAdapterConfig → ModelConfig in config.py (4 locations)
- Fix git_mirror_service import path in plugin.py
- Fix emoji.py type annotations and unused imports
- Fix jargon.py comment (ChatStreams → ChatSession)
- All routers now import successfully
- Zero Peewee remnants verified across src/webui/
2026-02-17 20:19:37 +08:00
DrSmoothl
7255cc5602 fix(webui): remove references to deleted Expression fields
- 移除 ExpressionUpdateRequest 中的 checked/rejected/require_unchecked 字段
- 移除更新逻辑中的 setattr
- 添加 chat_id → session_id 映射
2026-02-17 19:58:29 +08:00
DrSmoothl
390d1daefd refactor(webui): migrate jargon routes from Peewee to SQLModel
- 完全迁移到 SQLModel
- chat_id → session_id 映射
- ChatStreams → ChatSession 替代
- 移除 is_global 字段
- 使用 group_id 替代 group_name
2026-02-17 19:58:21 +08:00
DrSmoothl
7da0811b5c refactor(webui): migrate emoji routes from Peewee to SQLModel
- 完全迁移到 SQLModel,所有 DB 操作使用 get_db_session()
- 字段映射:image_hash → emoji_hash
- datetime 时间戳转换
- 移除 format/usage_count 字段
2026-02-17 19:58:14 +08:00
DrSmoothl
0ea18a4edc fix minssing files 2026-02-17 19:04:54 +08:00
DrSmoothl
ed27217c94 feat(config): add UI metadata to all Bot config sections
- BotConfig: 5/5 fields (100%)
- ChatConfig: 9/9 fields (100%)
- PersonalityConfig: 8/8 fields (100%)
- MemoryConfig: 9/9 fields (100%)
- ExpressionConfig: 13/13 fields (100%)
- WebUIConfig: 8/8 fields (100%)
- DatabaseConfig: 1/1 fields (100%)

All user-facing fields now have x-widget and x-icon metadata.
Complex fields marked as 'custom' for Hook rendering.

Completes Task 9 of webui-config-visualization-refactor plan.
2026-02-17 17:35:18 +08:00
DrSmoothl
bae87d122b feat(config): add UI metadata to ModelConfig fields
Add json_schema_extra UI metadata to all Model-related configuration classes:
- APIProvider (7 fields): name, base_url, api_key, client_type, max_retry, timeout, retry_interval
- ModelInfo (8 fields): model_identifier, name, api_provider, price_in, price_out, temperature, max_tokens, force_stream_mode, extra_params
- TaskConfig (5 fields): model_list, max_tokens, temperature, slow_threshold, selection_strategy
- ModelTaskConfig (9 fields): utils, replyer, vlm, voice, tool_use, planner, embedding, lpmm_entity_extract, lpmm_rdf_build

Pattern: Field(default=..., [ge/le constraints], json_schema_extra={x-widget, x-icon, [step]})
Widget types: input, slider, switch, select, custom (for complex types)
Constraints mapped: ge/le to minValue/maxValue in Schema output (Task 1d)

All 30 user-facing fields now have complete metadata coverage:
- x-widget: rendering hint for frontend
- x-icon: icon identifier from lucide-react
- Constraints: ge, le for numeric validation

Verification:
✓ All classes import successfully
✓ 100% metadata coverage on user-facing fields
✓ Config instance creation works
✓ Backward compatible with existing validation

Relates to: Task 12 (Wave 3) of webui-config-visualization-refactor
2026-02-17 17:25:48 +08:00
DrSmoothl
5879164bfe feat(config): add UI metadata to remaining ChatConfig fields (Wave 2)
- plan_reply_log_max_per_chat: input widget + file-text icon
- llm_quote: switch widget + quote icon
- enable_talk_value_rules: switch widget + settings icon
- talk_value_rules: custom widget + list icon

All ChatConfig fields now have json_schema_extra metadata for complete UI visualization support.
2026-02-17 17:09:07 +08:00
DrSmoothl
278a084c23 feat(webui): enhance ConfigSchemaGenerator with field_docs and UI metadata
- Add AttrDocBase.get_class_field_docs() classmethod for class-level field docs extraction
- Merge json_schema_extra (x-widget, x-icon, step) into schema output
- Map Pydantic constraints (ge/le) to minValue/maxValue for frontend compatibility
- Add ge=0, le=1 constraints to ChatConfig.talk_value for validation

Completes Task 1 (including subtasks 1a, 1b, 1c, 1d) of webui-config-visualization-refactor plan.
2026-02-17 17:05:25 +08:00
DrSmoothl
19c9c5a39a feat(webui): use get_class_field_docs for schema field descriptions 2026-02-17 16:58:59 +08:00
DrSmoothl
1631774452 feat(config): add UI metadata to ChatConfig sample fields 2026-02-17 16:49:49 +08:00