Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions internal/cli/custom/custom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2956,16 +2956,15 @@ func TestTTSVoicePrompt(t *testing.T) {
if lastVoiceBody["store"] != true {
t.Errorf("store = %v, want true", lastVoiceBody["store"])
}
voiceObj, _ := lastVoiceBody["voice"].(map[string]any)
if _, hasModel := voiceObj["model"]; hasModel {
t.Errorf("voice.model = %v, want omitted so server selects default voice design model", voiceObj["model"])
if _, hasModel := lastVoiceBody["model"]; hasModel {
t.Errorf("model = %v, want omitted so server selects default voice design model", lastVoiceBody["model"])
}
promptedObj, _ := voiceObj["prompted"].(map[string]any)
promptedObj, _ := lastVoiceBody["prompted"].(map[string]any)
if got := promptedObj["input"]; got != "A warm British voice" {
t.Errorf("voice.prompted.input = %q, want trimmed %q", got, "A warm British voice")
t.Errorf("prompted.input = %q, want trimmed %q", got, "A warm British voice")
}
if got := voiceObj["language_code"]; got != "en-GB" {
t.Errorf("voice.language_code = %q, want en-GB", got)
if got := lastVoiceBody["language_code"]; got != "en-GB" {
t.Errorf("language_code = %q, want en-GB", got)
}
genCfg, _ := lastInteractionBody["generation_config"].(map[string]any)
speechArr, _ := genCfg["speech_config"].([]any)
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/custom/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func register(root *cobra.Command) error {
if voicesCreate == nil {
return fmt.Errorf("voices create: command is not registered")
}
voicesCreate.Example = " gemini-api voices create --store=true --voice '{\"prompted\":{\"input\":\"A warm, calm narrator with a British accent\"},\"type\":\"prompted\"}'"
voicesCreate.Example = " gemini-api voices create --store=true --type prompted --prompted '{\"input\":\"A warm, calm narrator with a British accent\"}'"
if err := normalizeIdentifier(findChild(voices, "get"), "id", normalizeVoicePositional); err != nil {
return fmt.Errorf("voices get: %w", err)
}
Expand Down
12 changes: 5 additions & 7 deletions internal/cli/custom/tts.go
Original file line number Diff line number Diff line change
Expand Up @@ -611,20 +611,18 @@ func extractAudio(it *interactions.Interaction) ([]byte, string, int, int, error
// returns its voice_<id> so `gemini-api tts --voice-prompt` can synthesize
// immediately with the newly designed voice.
func designVoiceForTTS(cmd *cobra.Command, s *sdk.GeminiAPI, opts []operations.Option, prompt, language string) (string, error) {
voiceInput := voices.VoiceInput{
Type: voices.VoiceTypePrompted,
body := voices.VoiceCreateParams{
Store: boolPtr(true),
Type: voices.VoiceTypePrompted,
Prompted: &voices.PromptedVoice{
Input: prompt,
},
}
if language != "" {
voiceInput.LanguageCode = stringPtr(language)
body.LanguageCode = stringPtr(language)
}
req := operations.CreateVoiceRequest{
Body: voices.CreateVoiceRequest{
Store: boolPtr(true),
Voice: voiceInput,
},
Body: body,
}
if !isDryRun(cmd) {
progress(cmd, "Designing custom voice...")
Expand Down
16 changes: 14 additions & 2 deletions internal/cli/voices/create.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions internal/sdk/models/operations/createvoice.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions internal/sdk/models/operations/getvoice.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 0 additions & 39 deletions internal/sdk/models/voices/createvoicerequest.go

This file was deleted.

4 changes: 2 additions & 2 deletions internal/sdk/models/voices/listvoicesresponse.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading