feat(tenant): 新空间开箱即用:自动初始化默认模型配置
- 新增 TenantBootstrapService:建空间后自动创建「新手入门」知识库 (绑定内置默认对话/向量化模型)、预置欢迎文档(走标准上传管道)、 配置租户级检索重排模型;整体 fail-open 且幂等,不阻断主流程 - 挂钩 Register(普通注册与 OIDC 首登自动开户均覆盖)与手动创建 工作区接口,内置模型宿主租户(10000)跳过 - CreateKnowledgeBase / CreateAgent 空的必填模型字段自动落系统默认 (is_default 优先,否则该类型第一个 active),API 直调路径同样兜底 - 自动化编辑器模型选择预填系统默认对话模型
This commit is contained in:
1 parent
4b899a4647
commit
3a578153bb
11 files changed
+344
-13
No files matched your search
@@ -313,6 +313,8 @@ import {
|
||||
type ScheduleKind,
|
||||
} from '@/utils/automationSchedule'
|
||||
import ModelSelector from '@/components/ModelSelector.vue'
|
||||
import { selectInitialModelId } from '@/utils/modelDefaults'
|
||||
import { useChatResourcesStore } from '@/stores/chatResources'
|
||||
import { useUIStore } from '@/stores/ui'
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -323,6 +325,7 @@ const emit = defineEmits<{ 'update:visible': [value: boolean]; saved: [value: Au
|
||||
|
||||
const { t, locale } = useI18n()
|
||||
const uiStore = useUIStore()
|
||||
const chatResources = useChatResourcesStore()
|
||||
|
||||
type Section = 'basic' | 'schedule' | 'execution' | 'notify'
|
||||
|
||||
@@ -409,6 +412,16 @@ watch(() => props.visible, (open) => {
|
||||
Object.assign(schedule, defaultScheduleForm())
|
||||
timezone.value = browserTimezone()
|
||||
maxMinutes.value = 30
|
||||
if (!a) {
|
||||
// 开箱即用:create 模式预填系统默认对话模型(与知识库/智能体编辑器
|
||||
// 的 applyDefaultModelsIfEmpty 同模式)。模型列表异步加载,回来后仅当
|
||||
// 仍为空时落值,不覆盖用户已选;编辑已有自动化时不做预填。
|
||||
void chatResources.ensureModels().then(() => {
|
||||
if (!props.automation && props.visible && !form.model_id) {
|
||||
form.model_id = selectInitialModelId(chatResources.allModels || [], 'KnowledgeQA') || ''
|
||||
}
|
||||
}).catch(() => {})
|
||||
}
|
||||
if (a) {
|
||||
Object.assign(form, {
|
||||
name: a.name,
|
||||
|
||||
Reference in new issue
Block a user