feat(contextualGuides): add multiple contextual guide components for agent and knowledge base creation
- Introduced new components: AgentCreateContextualGuide, KbCreateContextualGuide, TenantModelsGuide, and SpotlightGuide to enhance user onboarding. - Implemented dynamic step configurations for each guide, allowing tailored user experiences based on context. - Enhanced the existing NewUserGuide component to utilize the new SpotlightGuide for improved visual guidance. - Updated localization files to include new strings for contextual guides, ensuring a comprehensive user experience across languages. - Refactored existing components to integrate with the new guide system, improving maintainability and user interaction.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { listModels, type ModelConfig } from '@/api/model'
|
||||
|
||||
export interface TenantModelReadiness {
|
||||
chatCount: number
|
||||
embeddingCount: number
|
||||
hasChat: boolean
|
||||
hasEmbedding: boolean
|
||||
/** 文档库默认开启向量/关键词检索时所需的模型是否齐备 */
|
||||
isReadyForDocumentKb: boolean
|
||||
/** 创建智能体至少需要对话模型 */
|
||||
isReadyForAgent: boolean
|
||||
}
|
||||
|
||||
export function evaluateTenantModelReadiness(models: ModelConfig[]): TenantModelReadiness {
|
||||
const chatCount = models.filter((m) => m.type === 'KnowledgeQA').length
|
||||
const embeddingCount = models.filter((m) => m.type === 'Embedding').length
|
||||
const hasChat = chatCount > 0
|
||||
const hasEmbedding = embeddingCount > 0
|
||||
return {
|
||||
chatCount,
|
||||
embeddingCount,
|
||||
hasChat,
|
||||
hasEmbedding,
|
||||
isReadyForDocumentKb: hasChat && hasEmbedding,
|
||||
isReadyForAgent: hasChat,
|
||||
}
|
||||
}
|
||||
|
||||
export async function fetchTenantModelReadiness(): Promise<TenantModelReadiness> {
|
||||
try {
|
||||
const models = await listModels()
|
||||
return evaluateTenantModelReadiness(models || [])
|
||||
} catch {
|
||||
return evaluateTenantModelReadiness([])
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user