Commit Graph

5193 Commits

Author SHA1 Message Date
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
6bcd7cbebb Merge branch 'r-dev' of github.com:Mai-with-u/MaiBot into r-dev 2026-02-19 19:03:25 +08:00
UnCLAS-Prommer
1c0580c577 ImageManager及测试 2026-02-19 19:02:44 +08:00
DrSmoothl
6a54a796f1 修复 build 问题 2026-02-19 18:56:49 +08:00
DrSmoothl
79871100be feat(theme): add theme import/export and cleanup legacy code 2026-02-19 18:31:10 +08:00
DrSmoothl
bb556dc7ae feat(theme): extend settings UI with token controls and custom CSS editor 2026-02-19 18:22:35 +08:00
DrSmoothl
06a88a877f refactor(theme): migrate all CSS variable references and adapt third-party components
- Task 10: Bulk migrate CSS variable references from --primary/--secondary/etc to --color-primary/--color-secondary/etc across all components
- Task 11: Adapt CodeEditor to auto-detect theme from ThemeProvider context, remove hardcoded theme='dark' from plugin-config and bot config pages
2026-02-19 18:01:14 +08:00
DrSmoothl
b5088fa455 feat(theme): migrate CSS variables and Tailwind config, refactor settings UI color picker
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-19 17:44:49 +08:00
DrSmoothl
8fb137a318 feat(theme): add CSS injection pipeline, presets, rewrite ThemeProvider, FOUC prevention 2026-02-19 17:26:53 +08:00
DrSmoothl
6aa1132f4c feat(theme): add design token schema, palette derivation, CSS sanitizer, and storage manager 2026-02-19 17:16:28 +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
f97c24bf9e test(webui): add pytest tests for emoji, jargon, expression routes
- test_emoji_routes.py: 21 tests covering list/get/update/delete/batch operations
- test_jargon_routes.py: 25 tests covering CRUD + stats + chat list (2 skipped due to DB model)
- test_expression_routes.py: 24 tests covering legacy field compatibility + field removal
- All use in-memory SQLite + StaticPool for isolation
- All tests passing (68/68, 2 skipped)
2026-02-17 20:12:57 +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
760561f45e fix(version): update APP_VERSION to 1.0.0 2026-02-17 18:52:06 +08:00
DrSmoothl
6bb0bc9afc feat(dashboard): integrate DynamicConfigForm in model config page
- Add DynamicConfigForm import and fieldHooks integration
- Replace TaskConfigCard list with DynamicConfigForm in tasks tab
- Use hardcoded schema POC approach (fields: [], nested: {})
- Maintain existing auto-save and state management logic
- TypeScript compilation verified

Task 14 complete - Wave 4 finished (4/4)
2026-02-17 18:32:31 +08:00
DrSmoothl
2de618464a docs(dashboard): add comprehensive dynamic form system documentation
- Overview of schema-driven UI system
- Quick start guide with examples
- Backend UI metadata guide (json_schema_extra)
- Hook component creation tutorial
- API reference for all components
- Troubleshooting section
2026-02-17 18:18:51 +08:00
DrSmoothl
fa15fef1f0 feat(dashboard): convert 4 Sections to Hook components
- Create PersonalitySectionHook (medium complexity)
- Create DebugSectionHook (simple complexity)
- Create ExpressionSectionHook (high complexity)
- Create BotInfoSectionHook (simple complexity)
- Update hooks/index.ts with exports
- Pattern validated across different complexity levels
2026-02-17 18:18:44 +08:00
DrSmoothl
69dfd0cac6 test(dashboard): add unit tests for dynamic form components
- Create comprehensive test suite for DynamicField (21 tests)
- Create comprehensive test suite for DynamicConfigForm (10 tests)
- Create comprehensive test suite for FieldHookRegistry (21 tests)
- Configure Vitest 4.0.18 with jsdom environment
- Add test setup with ResizeObserver and matchMedia polyfills
- 52 tests total covering all core functionality
2026-02-17 18:18:32 +08:00
DrSmoothl
c58ad64352 feat(dashboard): integrate DynamicConfigForm for ChatSection POC
- Register ChatSectionHook as 'replace' mode field hook
- Replace ChatSection rendering with DynamicConfigForm
- Use hardcoded minimal schema (POC - API integration pending)
- Preserve all existing state management and auto-save logic
- TypeScript compilation: ✓ PASSED

Complete Task 11 (Wave 3)
Ref: WebUI config visualization refactor plan
2026-02-17 17:46:40 +08:00
DrSmoothl
3fcf02866a feat(dashboard): export ChatSectionHook in hooks index
- Add ChatSectionHook export to hooks/index.ts
- Complete Task 10 (Wave 3)
- ChatSectionHook now available for import and registration
2026-02-17 17:41:41 +08:00
DrSmoothl
b382747398 feat(dashboard): convert ChatSection to Hook component 2026-02-17 17:37:47 +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
b1c01d0a0c feat: add .sisyphus/ to .gitignore 2026-02-17 17:22:35 +08:00
DrSmoothl
449e2f470c feat(dashboard): create DynamicConfigForm component with Hook integration
- Accept schema, values, onChange, hooks props
- Check for field hooks, use if present (replace/wrapper modes)
- Fall back to DynamicField for non-hooked fields
- Support nested schema rendering with recursive calls
- Export DynamicConfigForm and DynamicField from index

Groups with Task 5. Completes Task 6 of webui-config-visualization-refactor plan.
2026-02-17 17:20:50 +08:00
DrSmoothl
4e5d091417 test(webui): add unit tests for ConfigSchemaGenerator
- Test field descriptions from field_docs
- Test json_schema_extra merging
- Test Pydantic constraints mapping
- Test nested model schema handling
- Test fields without extra metadata

All 5 tests passing. Completes Task 7 of webui-config-visualization-refactor plan.
2026-02-17 17:14:48 +08:00
DrSmoothl
2962a95341 feat(dashboard): create DynamicField renderer component
- Render fields based on x-widget or type
- Support slider, switch, textarea, select, custom widgets
- Include label, icon, description rendering
- Placeholder for unsupported types (array, object)

Completes Task 5 of webui-config-visualization-refactor plan.
2026-02-17 17:14:41 +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
DrSmoothl
e530ee8fa6 feat(dashboard): create FieldHookRegistry for dynamic form hooks 2026-02-17 16:49:32 +08:00
DrSmoothl
5838dda175 feat(dashboard): add UI metadata fields to FieldSchema type 2026-02-17 16:48:58 +08:00
UnCLAS-Prommer
545e3b4982 Merge branch 'r-dev' of github.com:Mai-with-u/MaiBot into r-dev 2026-02-15 22:57:01 +08:00
UnCLAS-Prommer
75e154741d 方法名调整;确保公共属性被定义 2026-02-15 22:56:26 +08:00
DrSmoothl
b6441ea17b 更新 WebUI 版本 2026-02-15 16:46:52 +08:00
DrSmoothl
c834f8c59c 优化 pyproject.toml 文件,调整 setuptools 配置以正确包含和排除包 2026-02-15 16:46:11 +08:00
DrSmoothl
275608abea test WebUI CI x5 2026-02-15 16:39:32 +08:00