feat(tts): add api endpoints and optimization for apple silicon

Introduce a comprehensive TTS/ASR module that:
- Adds /v1/tts-asr/config, /status, /warmup, /tts, /asr endpoints with detailed JSON responses
- Implements Apple‑Silicon detection, device selection (MPS/CUDA/CPU), and memory limiting logic
- Supports selectable model size, quantization, and offline mode via environment variables
- Adds robust audio validation and multi‑path resampling fallback
- Provides new README sections for API usage, device detection, and performance benchmarking
- Includes a full testing suite: unit tests, integration tests, macOS simulation and performance reports
- Updates backend dependencies and CI scripts
- Adds new front‑end views and components for Univer editor integration

All changes are backward compatible; new features are exposed through environment variables and new API routes.
This commit is contained in:
2026-04-06 11:14:09 +08:00
parent c70cb2a9f0
commit 7985fe9641
27 changed files with 9304 additions and 260 deletions
+44
View File
@@ -1,7 +1,9 @@
<script setup>
import { ref } from 'vue'
import { defineAsyncComponent } from 'vue'
import { useRouter } from 'vue-router'
const router = useRouter()
const MilkdownEditor = defineAsyncComponent(() => import('../components/MilkdownEditor.vue'))
const markdown = ref('')
@@ -9,6 +11,14 @@ const markdown = ref('')
<template>
<div class="editor-view">
<div class="editor-toolbar">
<button class="docs-toggle" @click="router.push('/docs')" title="切换到文档模式">
<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor">
<path d="M0 2.5A1.5 1.5 0 011.5 1h2.793a.5.5 0 01.353.146l1.5 1.5a.5.5 0 00.354.146H13.5A1.5 1.5 0 0115 4.5v7.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12v-9.5z"/>
</svg>
<span class="toggle-label">文档</span>
</button>
</div>
<MilkdownEditor v-model:markdown="markdown" />
</div>
</template>
@@ -18,5 +28,39 @@ const markdown = ref('')
position: relative;
z-index: 1;
height: 100%;
display: flex;
flex-direction: column;
}
.editor-toolbar {
position: absolute;
top: 8px;
right: 16px;
z-index: 10;
}
.docs-toggle {
display: flex;
align-items: center;
gap: 6px;
padding: 6px 12px;
border: 1px solid var(--panel-border);
background: var(--app-bg);
color: var(--muted-text);
cursor: pointer;
border-radius: 6px;
font-size: 13px;
transition: all 0.2s ease;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.docs-toggle:hover {
color: var(--focus-ring);
border-color: var(--focus-ring);
background: var(--ghost-code-bg);
}
.toggle-label {
font-weight: 500;
}
</style>