Documentation
¶
Overview ¶
Package audio owns speech controls, local audio history commands, voice creation, and transcript/speech response handling. Application assembly supplies request and presentation policy; media processing and storage remain in audiomedia and audiohistory.
Index ¶
- Constants
- func CaptureText(request *http.Request, next func(*http.Request) (*http.Response, error)) (*http.Response, error)
- func ConfigureLiveTranslation(root *cli.Command, policy TranslationOptions)
- func ConfigureSpeech(root *cli.Command, ...)
- func ConfigureText(root *cli.Command)
- func ConfigureVoices(root *cli.Command, policy VoiceOptions)
- func EmbedVoiceBody(cmd *cli.Command, bodyMap map[string]any, stdin *requestconfig.OnceStdinReader) (body map[string]any, err error)
- func IsLocalCommand(command *cli.Command) bool
- func IsVoiceAction(cmd *cli.Command) bool
- func PreflightVoiceBody(cmd *cli.Command, bodyMap map[string]any) error
- func RegisterLocal(root *cli.Command, options LocalOptions)
- func SkipFirstRunSetup(root *cli.Command, args []string) bool
- func TextResult(ctx context.Context, operation string, kind transformers.OutputKind) (string, bool)
- func WriteSpeech(response *http.Response, stdout io.Writer, outfile string) (bool, string, error)
- type AuthenticationGuidance
- type LocalOptions
- type SpeechPresentation
- type TranslationOptions
- type VoiceOptions
- type VoiceTypeError
Constants ¶
const LocalMetadata = "openai-local-audio"
LocalMetadata identifies local history commands that do not require API setup.
Variables ¶
This section is empty.
Functions ¶
func CaptureText ¶
func CaptureText(request *http.Request, next func(*http.Request) (*http.Response, error)) (*http.Response, error)
CaptureText retains successful transcript text as the SDK consumes its response.
func ConfigureLiveTranslation ¶ added in v1.40.3
func ConfigureLiveTranslation(root *cli.Command, policy TranslationOptions)
ConfigureLiveTranslation adds an explicit browser workflow to the file-translation route. The original action still owns every invocation without --live.
func ConfigureSpeech ¶
func ConfigureSpeech(root *cli.Command, presentation func(context.Context, *cli.Command) SpeechPresentation)
ConfigureSpeech installs speech capture and interactive controls before generated dispatch.
func ConfigureText ¶
ConfigureText prepares capture because generated audio handlers parse their captured response as JSON even for text and subtitles. Retain those bytes while the SDK reads them, without changing generated code, the request, or the response consumed by the SDK.
func ConfigureVoices ¶
func ConfigureVoices(root *cli.Command, policy VoiceOptions)
ConfigureVoices keeps voice validation and credential selection outside generated handlers. Install before command aliases and presentation wrappers.
func EmbedVoiceBody ¶
func EmbedVoiceBody(cmd *cli.Command, bodyMap map[string]any, stdin *requestconfig.OnceStdinReader) (body map[string]any, err error)
EmbedVoiceBody resolves voice requirements before unrelated uploads can block or fail. Keep the type replay outside generic expansion and its partial-error cleanup.
func IsLocalCommand ¶
IsLocalCommand matches exact registered command nodes after descendant parsing; flag values and remote audio commands must never select this local path.
func IsVoiceAction ¶
IsVoiceAction reports whether voice preparation owns this command's request scope.
func PreflightVoiceBody ¶
PreflightVoiceBody checks known voice requirements before opening uploads. References and readers retain their context-aware inspection below; protected stdin stays literal.
func RegisterLocal ¶
func RegisterLocal(root *cli.Command, options LocalOptions)
RegisterLocal installs local history and playback commands with application output policy.
func SkipFirstRunSetup ¶
SkipFirstRunSetup classifies local audio paths synchronously from the current declarations. This does not parse values, invoke callbacks, cache nodes, or retain a command tree for the optional setup worker. Unrecognized prefixes keep the existing policy.
func TextResult ¶
func TextResult(ctx context.Context, operation string, kind transformers.OutputKind) (string, bool)
TextResult selects captured text only for successful transcription and translation results.
func WriteSpeech ¶
WriteSpeech intercepts only this command's capture or SSE response on the shared download path. Ordinary audio keeps the existing binary response behavior. The caller owns response.Body, including closing it on every handled path.
Types ¶
type AuthenticationGuidance ¶ added in v1.42.4
type AuthenticationGuidance struct {
Summary, Action string
}
AuthenticationGuidance supplies a cause and short recovery steps.
type LocalOptions ¶
type LocalOptions struct {
ShowData func(context.Context, *cli.Command, gjson.Result) error
ReportReceipt func(*cli.Command, io.Writer, string, error) error
}
LocalOptions supplies application output policy; both callbacks are required.
type SpeechPresentation ¶
type SpeechPresentation struct {
Raw bool
Render func(context.Context, io.Writer, jsonview.Iterator[clioutput.JSON]) error
AuthenticationGuidance func(*cli.Command, *openai.Error) AuthenticationGuidance
}
SpeechPresentation supplies speech output and safe authentication guidance. Render receives the response context and owns formatted event presentation.
type TranslationOptions ¶ added in v1.40.3
type TranslationOptions struct {
DefaultRequestOptions func(*cli.Command) []option.RequestOption
RequestOptions func(*cli.Command) ([]option.RequestOption, error)
}
TranslationOptions supplies the application's existing credential and transport policy.
type VoiceOptions ¶
type VoiceOptions struct {
DefaultRequestOptions func(*cli.Command) []option.RequestOption
RequestOptions func(*cli.Command) ([]option.RequestOption, error)
ShowResponse func(context.Context, *cli.Command, gjson.Result) error
}
VoiceOptions supplies application request/output policy; every callback is required.
type VoiceTypeError ¶
type VoiceTypeError struct{}
VoiceTypeError reports unsupported voice discriminators without echoing values.
func (*VoiceTypeError) Error ¶
func (e *VoiceTypeError) Error() string
Source Files
¶
- audio_actions.go
- audio_command_view.go
- audio_commands.go
- audio_cursor.go
- audio_failure_view.go
- audio_feedback.go
- audio_generate.go
- audio_history_search.go
- audio_history_view.go
- audio_licenses.go
- audio_navigation.go
- audio_playback_progress.go
- audio_save_path.go
- audio_seek.go
- audio_settings.go
- audio_skip_setup.go
- audio_translation.go
- audio_voices.go
- audio_waveform.go
- audio_waveform_hairline.go
- audio_workbench.go
- audio_workbench_run.go
- audio_workbench_view.go
- audio_workspace_view.go
- doc.go
- readable_audio.go
- readable_speech.go
- voice_body.go