feat: refine admin shell and model fallback

This commit is contained in:
2026-06-22 02:46:21 +08:00
parent 705cfe47e8
commit 1dd7805712
9 changed files with 23 additions and 9 deletions
@@ -435,5 +435,5 @@ class IntentNode(BaseNode):
'default': 'intent_result', 'default': 'intent_result',
}, },
}, },
'required': ['model_id', 'intents'], 'required': ['intents'],
} }
@@ -1065,5 +1065,5 @@ class LLMNode(BaseNode):
'default': 'llm_response', 'default': 'llm_response',
}, },
}, },
'required': ['model_id'], 'required': [],
} }
@@ -241,8 +241,6 @@ class AgentService:
if not model: if not model:
return None return None
agent.model_id = model.id
await self._db.flush()
logger.info( logger.info(
"Agent %s has no active model, fallback to default chat model %s", "Agent %s has no active model, fallback to default chat model %s",
getattr(agent, "code", agent.id), getattr(agent, "code", agent.id),
@@ -66,7 +66,7 @@ const getWidget = (i: string) => {
const getAnimationDelay = (i: string) => { const getAnimationDelay = (i: string) => {
if (!dashboardConfig.value) return 0; if (!dashboardConfig.value) return 0;
const index = dashboardConfig.value.widgets.findIndex((w) => w.i === i); const index = dashboardConfig.value.widgets.findIndex((w) => w.i === i);
return index * 80; // 每个组件延迟 80ms return index * 20;
}; };
</script> </script>
@@ -249,7 +249,7 @@ const animationClass = computed(() => {
<!-- 加载状态 --> <!-- 加载状态 -->
<div <div
v-if="isLoading" v-if="isLoading"
class="absolute inset-0 z-10 flex items-center justify-center bg-white/50" class="widget-loading-mask absolute inset-0 z-10 flex items-center justify-center"
> >
<Loader2 class="text-primary h-6 w-6 animate-spin" /> <Loader2 class="text-primary h-6 w-6 animate-spin" />
</div> </div>
@@ -296,7 +296,9 @@ const animationClass = computed(() => {
.widget-enter { .widget-enter {
opacity: 0; opacity: 0;
transform: translateY(20px) scale(0.95); transform: translateY(20px) scale(0.95);
transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); transition:
opacity 0.22s cubic-bezier(0.22, 1, 0.36, 1),
transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
} }
.widget-entered { .widget-entered {
@@ -310,4 +312,8 @@ const animationClass = computed(() => {
} }
/* 入场动画 */ /* 入场动画 */
.widget-loading-mask {
background: color-mix(in srgb, var(--el-bg-color) 78%, transparent);
}
</style> </style>
+1 -1
View File
@@ -17,7 +17,7 @@ export const overridesPreferences = defineOverridesPreferences({
accessMode: 'mixed', accessMode: 'mixed',
authPageLayout: 'panel-center', authPageLayout: 'panel-center',
defaultHomePath: '/page-render/main_home', defaultHomePath: '/page-render/main_home',
layout: 'sidebar-nav', layout: 'header-sidebar-nav',
preferencesButtonPosition: 'header', preferencesButtonPosition: 'header',
}, },
sidebar: { sidebar: {
@@ -784,6 +784,7 @@ onMounted(() => {
</template> </template>
<ElSelect <ElSelect
v-model="formData.model_id" v-model="formData.model_id"
clearable
filterable filterable
:placeholder="$t('ai-platform.agent.model.placeholder')" :placeholder="$t('ai-platform.agent.model.placeholder')"
style="width: 100%" style="width: 100%"
@@ -795,6 +796,9 @@ onMounted(() => {
:value="model.id" :value="model.id"
/> />
</ElSelect> </ElSelect>
<div class="text-muted-foreground mt-1 text-xs">
留空时发布和运行会自动使用当前启用的默认 chat 模型。
</div>
</ElFormItem> </ElFormItem>
<ElFormItem> <ElFormItem>
@@ -124,7 +124,8 @@ const removeExample = (intentIndex: number, exampleIndex: number) => {
<ElFormItem :label="$t('ai-platform.workflow.panels.common.model')"> <ElFormItem :label="$t('ai-platform.workflow.panels.common.model')">
<ElSelect <ElSelect
v-model="form.model_id" v-model="form.model_id"
placeholder="{{ $t('ai-platform.workflow.panels.intent.selectModelHint') }}" clearable
:placeholder="$t('ai-platform.workflow.panels.intent.selectModelHint')"
> >
<ElOption <ElOption
v-for="m in models" v-for="m in models"
@@ -135,6 +136,7 @@ const removeExample = (intentIndex: number, exampleIndex: number) => {
</ElSelect> </ElSelect>
<div class="text-muted-foreground mt-1 text-xs"> <div class="text-muted-foreground mt-1 text-xs">
{{ $t('ai-platform.workflow.panels.intent.modelHint') }} {{ $t('ai-platform.workflow.panels.intent.modelHint') }}
留空时运行会自动使用当前启用的默认 chat 模型
</div> </div>
</ElFormItem> </ElFormItem>
@@ -174,6 +174,7 @@ watch(
<ElFormItem :label="$t('ai-platform.workflow.panels.common.model')"> <ElFormItem :label="$t('ai-platform.workflow.panels.common.model')">
<ElSelect <ElSelect
v-model="form.model_id" v-model="form.model_id"
clearable
:placeholder="$t('ai-platform.workflow.panels.common.selectModel')" :placeholder="$t('ai-platform.workflow.panels.common.selectModel')"
> >
<ElOption <ElOption
@@ -183,6 +184,9 @@ watch(
:value="m.id" :value="m.id"
/> />
</ElSelect> </ElSelect>
<div class="text-muted-foreground mt-1 text-xs">
留空时运行会自动使用当前启用的默认 chat 模型
</div>
</ElFormItem> </ElFormItem>
<ElFormItem> <ElFormItem>