Skip to content

ModelSelector 模型选择器 ​

专为 AI 模型切换设计的选择器,展示模型名称、上下文窗口、能力标签与描述。

基础用法 ​

<script setup>
import { ref } from 'vue'
import ModelSelector from '@/vue/components/ModelSelector.vue'

const modelId = ref('gpt-4o')
const models = [
  { id: 'gpt-4o', name: 'GPT-4o', contextLength: '128K', description: '通用多模态旗舰模型', tags: ['Vision', 'Tools'] },
  { id: 'deepseek-r1', name: 'DeepSeek-R1', contextLength: '64K', description: '深度推理模型', tags: ['Thinking'] },
  { id: 'claude-3-7', name: 'Claude 3.7', contextLength: '200K', description: '代码生成与架构分析', tags: ['Coding', 'Agent'] }
]
</script>

<template>
  <ModelSelector v-model="modelId" :models="models" />
</template>

API ​

属性名说明类型默认值
modelValue / value当前选中的模型 IDstring—
models模型选项列表ModelOption[][]
size触发器尺寸'small' | 'default' | 'large''default'
disabled是否禁用booleanfalse

基于 MIT 许可发布