2026-04-12 23:23:50 +08:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { computed } from 'vue'
|
|
|
|
|
import { NSelect } from 'naive-ui'
|
2026-04-16 08:38:18 +08:00
|
|
|
import { useAppStore } from '@/stores/hermes/app'
|
2026-04-15 16:36:04 +08:00
|
|
|
import { useI18n } from 'vue-i18n'
|
|
|
|
|
|
|
|
|
|
const { t } = useI18n()
|
2026-04-12 23:23:50 +08:00
|
|
|
|
|
|
|
|
const appStore = useAppStore()
|
|
|
|
|
|
|
|
|
|
const options = computed(() =>
|
|
|
|
|
appStore.modelGroups.map(g => ({
|
|
|
|
|
label: g.label,
|
|
|
|
|
type: 'group' as const,
|
|
|
|
|
key: g.provider,
|
|
|
|
|
children: g.models.map(m => ({
|
|
|
|
|
label: m,
|
|
|
|
|
value: m,
|
|
|
|
|
})),
|
|
|
|
|
})),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
function handleChange(value: string | number | Array<string | number>) {
|
|
|
|
|
if (typeof value === 'string') {
|
|
|
|
|
appStore.switchModel(value)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<div class="model-selector">
|
2026-04-15 16:36:04 +08:00
|
|
|
<div class="model-label">{{ t('models.title') }}</div>
|
2026-04-12 23:23:50 +08:00
|
|
|
<NSelect
|
|
|
|
|
:value="appStore.selectedModel"
|
|
|
|
|
:options="options"
|
|
|
|
|
size="small"
|
|
|
|
|
@update:value="handleChange"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
@use '@/styles/variables' as *;
|
|
|
|
|
|
|
|
|
|
.model-selector {
|
|
|
|
|
padding: 0 12px;
|
|
|
|
|
margin-bottom: 8px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.model-label {
|
|
|
|
|
font-size: 11px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
color: $text-muted;
|
|
|
|
|
text-transform: uppercase;
|
|
|
|
|
letter-spacing: 0.5px;
|
|
|
|
|
margin-bottom: 6px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|