Revert "Feat/speech support (#392)" (#393)

This reverts commit c9dcfe287f.
This commit is contained in:
Acbox
2026-04-22 00:11:16 +08:00
committed by GitHub
parent c9dcfe287f
commit fd8f1ec078
70 changed files with 1689 additions and 6609 deletions
+7 -15
View File
@@ -126,9 +126,9 @@ func (s *Service) List(ctx context.Context) ([]GetResponse, error) {
return s.convertToGetResponseList(dbModels), nil
}
// ListByType returns models filtered by type.
// ListByType returns models filtered by type (chat, embedding, or speech).
func (s *Service) ListByType(ctx context.Context, modelType ModelType) ([]GetResponse, error) {
if modelType != ModelTypeChat && modelType != ModelTypeEmbedding && modelType != ModelTypeSpeech && modelType != ModelTypeTranscription {
if modelType != ModelTypeChat && modelType != ModelTypeEmbedding && modelType != ModelTypeSpeech {
return nil, fmt.Errorf("invalid model type: %s", modelType)
}
@@ -165,7 +165,7 @@ func (s *Service) ListEnabled(ctx context.Context) ([]GetResponse, error) {
// ListEnabledByType returns models from enabled providers filtered by type.
func (s *Service) ListEnabledByType(ctx context.Context, modelType ModelType) ([]GetResponse, error) {
if modelType != ModelTypeChat && modelType != ModelTypeEmbedding && modelType != ModelTypeSpeech && modelType != ModelTypeTranscription {
if modelType != ModelTypeChat && modelType != ModelTypeEmbedding && modelType != ModelTypeSpeech {
return nil, fmt.Errorf("invalid model type: %s", modelType)
}
dbModels, err := s.queries.ListEnabledModelsByType(ctx, string(modelType))
@@ -206,7 +206,7 @@ func (s *Service) ListByProviderID(ctx context.Context, providerID string) ([]Ge
// ListByProviderIDAndType returns models filtered by provider ID and type.
func (s *Service) ListByProviderIDAndType(ctx context.Context, providerID string, modelType ModelType) ([]GetResponse, error) {
if modelType != ModelTypeChat && modelType != ModelTypeEmbedding && modelType != ModelTypeSpeech && modelType != ModelTypeTranscription {
if modelType != ModelTypeChat && modelType != ModelTypeEmbedding && modelType != ModelTypeSpeech {
return nil, fmt.Errorf("invalid model type: %s", modelType)
}
if strings.TrimSpace(providerID) == "" {
@@ -361,7 +361,7 @@ func (s *Service) Count(ctx context.Context) (int64, error) {
// CountByType returns the number of models of a specific type.
func (s *Service) CountByType(ctx context.Context, modelType ModelType) (int64, error) {
if modelType != ModelTypeChat && modelType != ModelTypeEmbedding && modelType != ModelTypeSpeech && modelType != ModelTypeTranscription {
if modelType != ModelTypeChat && modelType != ModelTypeEmbedding && modelType != ModelTypeSpeech {
return 0, fmt.Errorf("invalid model type: %s", modelType)
}
@@ -432,19 +432,13 @@ func IsValidClientType(clientType ClientType) bool {
ClientTypeGitHubCopilot,
ClientTypeEdgeSpeech,
ClientTypeOpenAISpeech,
ClientTypeOpenAITranscription,
ClientTypeOpenRouterSpeech,
ClientTypeOpenRouterTranscription,
ClientTypeElevenLabsSpeech,
ClientTypeElevenLabsTranscription,
ClientTypeDeepgramSpeech,
ClientTypeDeepgramTranscription,
ClientTypeMiniMaxSpeech,
ClientTypeVolcengineSpeech,
ClientTypeAlibabaSpeech,
ClientTypeMicrosoftSpeech,
ClientTypeGoogleSpeech,
ClientTypeGoogleTranscription:
ClientTypeMicrosoftSpeech:
return true
default:
return false
@@ -454,9 +448,7 @@ func IsValidClientType(clientType ClientType) bool {
// IsLLMClientType returns true if the client type belongs to the LLM domain
// (chat/embedding), excluding speech-only types (any type ending in "-speech").
func IsLLMClientType(clientType ClientType) bool {
return IsValidClientType(clientType) &&
!strings.HasSuffix(string(clientType), "-speech") &&
!strings.HasSuffix(string(clientType), "-transcription")
return IsValidClientType(clientType) && !strings.HasSuffix(string(clientType), "-speech")
}
// SelectMemoryModel selects a chat model for memory operations.
+19 -26
View File
@@ -9,36 +9,29 @@ import (
type ModelType string
const (
ModelTypeChat ModelType = "chat"
ModelTypeEmbedding ModelType = "embedding"
ModelTypeSpeech ModelType = "speech"
ModelTypeTranscription ModelType = "transcription"
ModelTypeChat ModelType = "chat"
ModelTypeEmbedding ModelType = "embedding"
ModelTypeSpeech ModelType = "speech"
)
type ClientType string
const (
ClientTypeOpenAIResponses ClientType = "openai-responses"
ClientTypeOpenAICompletions ClientType = "openai-completions"
ClientTypeAnthropicMessages ClientType = "anthropic-messages"
ClientTypeGoogleGenerativeAI ClientType = "google-generative-ai"
ClientTypeOpenAICodex ClientType = "openai-codex"
ClientTypeGitHubCopilot ClientType = "github-copilot"
ClientTypeEdgeSpeech ClientType = "edge-speech"
ClientTypeOpenAISpeech ClientType = "openai-speech"
ClientTypeOpenAITranscription ClientType = "openai-transcription"
ClientTypeOpenRouterSpeech ClientType = "openrouter-speech"
ClientTypeOpenRouterTranscription ClientType = "openrouter-transcription"
ClientTypeElevenLabsSpeech ClientType = "elevenlabs-speech"
ClientTypeElevenLabsTranscription ClientType = "elevenlabs-transcription"
ClientTypeDeepgramSpeech ClientType = "deepgram-speech"
ClientTypeDeepgramTranscription ClientType = "deepgram-transcription"
ClientTypeMiniMaxSpeech ClientType = "minimax-speech"
ClientTypeVolcengineSpeech ClientType = "volcengine-speech"
ClientTypeAlibabaSpeech ClientType = "alibabacloud-speech"
ClientTypeMicrosoftSpeech ClientType = "microsoft-speech"
ClientTypeGoogleSpeech ClientType = "google-speech"
ClientTypeGoogleTranscription ClientType = "google-transcription"
ClientTypeOpenAIResponses ClientType = "openai-responses"
ClientTypeOpenAICompletions ClientType = "openai-completions"
ClientTypeAnthropicMessages ClientType = "anthropic-messages"
ClientTypeGoogleGenerativeAI ClientType = "google-generative-ai"
ClientTypeOpenAICodex ClientType = "openai-codex"
ClientTypeGitHubCopilot ClientType = "github-copilot"
ClientTypeEdgeSpeech ClientType = "edge-speech"
ClientTypeOpenAISpeech ClientType = "openai-speech"
ClientTypeOpenRouterSpeech ClientType = "openrouter-speech"
ClientTypeElevenLabsSpeech ClientType = "elevenlabs-speech"
ClientTypeDeepgramSpeech ClientType = "deepgram-speech"
ClientTypeMiniMaxSpeech ClientType = "minimax-speech"
ClientTypeVolcengineSpeech ClientType = "volcengine-speech"
ClientTypeAlibabaSpeech ClientType = "alibabacloud-speech"
ClientTypeMicrosoftSpeech ClientType = "microsoft-speech"
)
const (
@@ -95,7 +88,7 @@ func (m *Model) Validate() error {
if _, err := uuid.Parse(m.ProviderID); err != nil {
return errors.New("provider ID must be a valid UUID")
}
if m.Type != ModelTypeChat && m.Type != ModelTypeEmbedding && m.Type != ModelTypeSpeech && m.Type != ModelTypeTranscription {
if m.Type != ModelTypeChat && m.Type != ModelTypeEmbedding && m.Type != ModelTypeSpeech {
return errors.New("invalid model type")
}
if m.Type == ModelTypeEmbedding {