From 322061c387cbb0b3281af5255e9e1cce8a32a565 Mon Sep 17 00:00:00 2001 From: hhs <386998068@qq.com> Date: Sat, 13 Jun 2026 21:57:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20MiMo=20ASR=20=E8=AE=A4=E8=AF=81=E5=A4=B4?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=20Authorization:=20Bearer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MiMo API 使用标准 Bearer Token 认证,而非自定义 api-key 头。 --- backend/internal/ai/stt/mimo.go | 2 +- backend/internal/ai/stt/mimo_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/internal/ai/stt/mimo.go b/backend/internal/ai/stt/mimo.go index 49d96fd..887b285 100644 --- a/backend/internal/ai/stt/mimo.go +++ b/backend/internal/ai/stt/mimo.go @@ -134,7 +134,7 @@ func (m *MiMoService) Recognize(ctx context.Context, audio []byte, opts Options) return "", fmt.Errorf("stt: create request: %w", err) } req.Header.Set("Content-Type", "application/json") - req.Header.Set("api-key", m.apiKey) + req.Header.Set("Authorization", "Bearer "+m.apiKey) resp, err := http.DefaultClient.Do(req) if err != nil { diff --git a/backend/internal/ai/stt/mimo_test.go b/backend/internal/ai/stt/mimo_test.go index 80c4cf1..435a926 100644 --- a/backend/internal/ai/stt/mimo_test.go +++ b/backend/internal/ai/stt/mimo_test.go @@ -21,8 +21,8 @@ func newTestMiMoService(handler http.HandlerFunc) (*MiMoService, *httptest.Serve func TestMiMoService_Recognize_Success(t *testing.T) { s, srv := newTestMiMoService(func(w http.ResponseWriter, r *http.Request) { // 验证请求 - if r.Header.Get("api-key") != "test-key" { - t.Errorf("expected api-key test-key, got %s", r.Header.Get("api-key")) + if r.Header.Get("Authorization") != "Bearer test-key" { + t.Errorf("expected Authorization Bearer test-key, got %s", r.Header.Get("Authorization")) } if r.URL.Path != "/chat/completions" { t.Errorf("expected path /chat/completions, got %s", r.URL.Path) -- 2.49.1