feat(tenant): 新空间开箱即用:自动初始化默认模型配置

- 新增 TenantBootstrapService:建空间后自动创建「新手入门」知识库
  (绑定内置默认对话/向量化模型)、预置欢迎文档(走标准上传管道)、
  配置租户级检索重排模型;整体 fail-open 且幂等,不阻断主流程
- 挂钩 Register(普通注册与 OIDC 首登自动开户均覆盖)与手动创建
  工作区接口,内置模型宿主租户(10000)跳过
- CreateKnowledgeBase / CreateAgent 空的必填模型字段自动落系统默认
  (is_default 优先,否则该类型第一个 active),API 直调路径同样兜底
- 自动化编辑器模型选择预填系统默认对话模型
This commit is contained in:
runny committed 2026-11-19 22:33:21 +08:00
1 parent 4b899a4647
commit 3a578153bb
11 files changed
+344 -13

No files matched your search

+1 -1
View File
@@ -90,7 +90,7 @@ func TestSetUserStatus_NotFound404(t *testing.T) {
require.NoError(t, err)
t.Cleanup(func() { require.NoError(t, sqlDB.Close()) })
require.NoError(t, db.AutoMigrate(&types.User{}))
svc := service.NewUserService(nil, repository.NewUserRepository(db), nil, nil, nil, nil, nil)
svc := service.NewUserService(nil, repository.NewUserRepository(db), nil, nil, nil, nil, nil, nil)
h := &SystemHandler{userSvc: svc}
r := statusRouter(h, "admin-1")
body, _ := json.Marshal(map[string]any{"user_id": "ghost", "is_active": true})