feat: 新增语音转文字(ASR)功能
- 后端:新增 /api/audio/transcribe 接口,调用 Ollama whisper 进行语音识别 - 前端:新增 AudioTranscribePage.vue 页面,支持 MP3/WAV/M4A/OGG/FLAC 等格式 - 注册路由、工具卡片、智能助手欢迎语更新 Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
<template>
|
||||
<div v-if="section" class="section-tabs">
|
||||
<div class="section-tabs-inner">
|
||||
<el-tabs
|
||||
:model-value="activeTabPath"
|
||||
class="tabs-nav"
|
||||
@tab-change="handleTabChange"
|
||||
>
|
||||
<el-tab-pane
|
||||
v-for="tab in section.tabs"
|
||||
:key="tab.path"
|
||||
:name="tab.path"
|
||||
>
|
||||
<template #label>
|
||||
<span class="tab-label">
|
||||
<span>{{ tab.label }}</span>
|
||||
<el-badge
|
||||
v-if="tab.path === '/notifications' && unread > 0"
|
||||
:value="unread"
|
||||
:max="99"
|
||||
class="tab-badge"
|
||||
/>
|
||||
</span>
|
||||
</template>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { useAuthStore } from '@/store/auth'
|
||||
import { useNotificationStore } from '@/store/notification'
|
||||
import { resolveSection, resolveTab } from '@/config/navigation'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const auth = useAuthStore()
|
||||
const notif = useNotificationStore()
|
||||
|
||||
const section = computed(() => resolveSection(route.path, auth.isAdmin))
|
||||
const activeTabPath = computed(() => resolveTab(route.path, auth.isAdmin)?.path || '')
|
||||
const unread = computed(() => notif.unread)
|
||||
|
||||
function handleTabChange(path) {
|
||||
if (typeof path === 'string' && path && path !== route.path) {
|
||||
router.push(path)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.section-tabs {
|
||||
padding: 0 24px;
|
||||
background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
|
||||
border-bottom: 1px solid var(--surface-border);
|
||||
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
|
||||
}
|
||||
|
||||
.section-tabs-inner {
|
||||
min-height: var(--top-rail-height);
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.tabs-nav :deep(.el-tabs__header) {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.tabs-nav {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.tabs-nav :deep(.el-tabs__nav) {
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.tabs-nav :deep(.el-tabs__nav-wrap) {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.tabs-nav :deep(.el-tabs__nav-wrap::after) {
|
||||
background-color: var(--surface-border);
|
||||
}
|
||||
|
||||
.tabs-nav :deep(.el-tabs__item) {
|
||||
height: 44px;
|
||||
line-height: 44px;
|
||||
color: #606266;
|
||||
font-size: 14px;
|
||||
padding: 0 18px;
|
||||
border-radius: 10px 10px 0 0;
|
||||
transition: color 0.2s ease, background-color 0.2s ease;
|
||||
}
|
||||
|
||||
.tabs-nav :deep(.el-tabs__item:hover) {
|
||||
color: var(--surface-text);
|
||||
background: rgba(64, 158, 255, 0.08);
|
||||
}
|
||||
|
||||
.tabs-nav :deep(.el-tabs__item.is-active) {
|
||||
color: var(--el-color-primary);
|
||||
font-weight: 600;
|
||||
background: linear-gradient(180deg, rgba(64, 158, 255, 0.12) 0%, rgba(64, 158, 255, 0.06) 100%);
|
||||
}
|
||||
|
||||
.tabs-nav :deep(.el-tabs__active-bar) {
|
||||
height: 3px;
|
||||
border-radius: 999px;
|
||||
}
|
||||
|
||||
.tab-label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user