voice_adapter

package
v1.6.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvSpeechServiceURL         = "SPEECH_SERVICE_URL"
	EnvSpeechAPIKey             = "SPEECH_API_KEY"
	EnvSpeechTimeout            = "SPEECH_TIMEOUT"
	EnvSpeechMaxBodySize        = "SPEECH_MAX_BODY_SIZE"
	EnvFeedbackPrivacyURL       = "VOICE_FEEDBACK_PRIVACY_URL"
	EnvFeedbackUserAgreementURL = "VOICE_FEEDBACK_USER_AGREEMENT_URL"
	EnvASRServiceDocFile        = "VOICE_ASR_SERVICE_DOC_FILE"
	DefaultTimeoutSec           = 50
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AdapterConfig

type AdapterConfig struct {
	SpeechServiceURL   string
	SpeechAPIKey       string
	SpeechTimeout      time.Duration
	MaxBodySize        int64
	FeedbackPrivacyURL string
	UserAgreementURL   string
	ASRServiceDocFile  string
}

func NewAdapterConfigFromEnv

func NewAdapterConfigFromEnv() *AdapterConfig

type PutVocabularyRequest

type PutVocabularyRequest struct {
	SubjectID string `json:"subject_id"`
	ScopeType string `json:"scope_type"`
	ScopeID   string `json:"scope_id"`
	Content   string `json:"content"`
	UpdatedBy string `json:"updated_by"`
}

type SpeechClient

type SpeechClient struct {
	// contains filtered or unexported fields
}

func NewSpeechClient

func NewSpeechClient(baseURL, apiKey string, timeout time.Duration) *SpeechClient

func (*SpeechClient) DeleteLocalConfig added in v1.5.0

func (c *SpeechClient) DeleteLocalConfig(ctx context.Context, subjectID, scopeType, scopeID string) error

func (*SpeechClient) DeleteVocabulary

func (c *SpeechClient) DeleteVocabulary(ctx context.Context, subjectID, scopeType, scopeID string) error

func (*SpeechClient) ForwardTranscribe

func (c *SpeechClient) ForwardTranscribe(r *http.Request) (*http.Response, error)

func (*SpeechClient) ForwardTranscribeBody

func (c *SpeechClient) ForwardTranscribeBody(ctx context.Context, body io.Reader, contentType string) (*http.Response, error)

func (*SpeechClient) GetConfig

func (c *SpeechClient) GetConfig(ctx context.Context, subjectID, scopeType, scopeID string) (map[string]interface{}, error)

func (*SpeechClient) GetLocalConfig added in v1.5.0

func (c *SpeechClient) GetLocalConfig(ctx context.Context, subjectID, scopeType, scopeID string) (map[string]interface{}, error)

func (*SpeechClient) GetVocabulary

func (c *SpeechClient) GetVocabulary(ctx context.Context, subjectID, scopeType, scopeID string) (*VocabularyResponse, error)

func (*SpeechClient) PutLocalConfig added in v1.5.0

func (c *SpeechClient) PutLocalConfig(ctx context.Context, subjectID, scopeType, scopeID string, enabled bool, timeoutMs *int, probeURL, transcribeURL *string) error

func (*SpeechClient) PutVocabulary

func (c *SpeechClient) PutVocabulary(ctx context.Context, req PutVocabularyRequest) error

func (*SpeechClient) ResetLocalConfig added in v1.5.0

func (c *SpeechClient) ResetLocalConfig(ctx context.Context, subjectID, scopeType, scopeID string, enabled bool) error

type SpeechServiceError

type SpeechServiceError struct {
	StatusCode int
	Body       string
}

func (*SpeechServiceError) Error

func (e *SpeechServiceError) Error() string

type VocabularyResponse

type VocabularyResponse struct {
	HasContent bool   `json:"has_content"`
	Content    string `json:"content"`
	UpdatedAt  string `json:"updated_at"`
}

type VoiceAdapter

type VoiceAdapter struct {
	log.Log
	// contains filtered or unexported fields
}

func NewVoiceAdapter

func NewVoiceAdapter(ctx *config.Context, cfg *AdapterConfig) *VoiceAdapter

func (*VoiceAdapter) Route

func (a *VoiceAdapter) Route(r *wkhttp.WKHttp)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL