-
Notifications
You must be signed in to change notification settings - Fork 0
[v9] スピーカースピード設定機能の実装 #233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feat/go
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements a speaker speed setting feature for the TTS system, allowing users to adjust the playback speed of text-to-speech audio. The feature adds a new /tts speed <value> command that accepts values from 50 to 200 (representing 0.5x to 2.0x speed), with a default of 100 (1.0x speed).
Changes:
- Added
SpeedScalefield toTTSPersonalSettingmodel to store per-user speed preferences - Extended the VoiceVox API client's
Synthesizemethod to accept and apply speed scale parameter - Implemented new
/tts speedsubcommand with validation and user feedback - Updated help documentation to include the new speed command
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/internal/model/tts_personal_setting.go |
Added SpeedScale field (int64) with default value of 100 to store speed preference |
src/internal/repository/tts_personal_setting.go |
Updated default TTS personal setting to include SpeedScale: 100 |
src/internal/api/voicevox/client.go |
Added speedScale parameter to Synthesize method and applied it to the query |
src/internal/bot/voice/player.go |
Updated worker to pass speed scale value (converted to float64) to synthesizer |
src/internal/bot/command/general/tts/speed.go |
New command handler implementing speed setting functionality with validation |
src/internal/bot/command/general/tts.go |
Registered new speed subcommand in TTS command handler map |
src/internal/bot/command/general/help/help-commands.go |
Added documentation for /tts skip and /tts speed commands |
src/internal/bot/command/general/help.go |
Added "TTS Speed" choice to help command options |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // バリデーション | ||
| if speed < 50 || speed > 200 { | ||
| s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{ | ||
| Type: discordgo.InteractionResponseChannelMessageWithSource, | ||
| Data: &discordgo.InteractionResponseData{ | ||
| Embeds: []*discordgo.MessageEmbed{ | ||
| { | ||
| Title: "エラー", | ||
| Description: "速度は50-200の範囲で指定してください。", | ||
| Color: ctx.Config.Colors.Error, | ||
| Footer: &discordgo.MessageEmbedFooter{ | ||
| Text: "Requested by " + i.Member.DisplayName(), | ||
| IconURL: i.Member.AvatarURL(""), | ||
| }, | ||
| }, | ||
| }, | ||
| Flags: discordgo.MessageFlagsEphemeral, | ||
| }, | ||
| }) | ||
| return | ||
| } | ||
|
|
Copilot
AI
Jan 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The validation check at lines 35-54 is redundant because Discord already enforces these constraints through the MinValue and MaxValue options defined at lines 23-24. This validation will never trigger unless Discord's validation fails.
Consider removing this redundant validation or at least documenting why it's needed as a defensive check.
| // バリデーション | |
| if speed < 50 || speed > 200 { | |
| s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{ | |
| Type: discordgo.InteractionResponseChannelMessageWithSource, | |
| Data: &discordgo.InteractionResponseData{ | |
| Embeds: []*discordgo.MessageEmbed{ | |
| { | |
| Title: "エラー", | |
| Description: "速度は50-200の範囲で指定してください。", | |
| Color: ctx.Config.Colors.Error, | |
| Footer: &discordgo.MessageEmbedFooter{ | |
| Text: "Requested by " + i.Member.DisplayName(), | |
| IconURL: i.Member.AvatarURL(""), | |
| }, | |
| }, | |
| }, | |
| Flags: discordgo.MessageFlagsEphemeral, | |
| }, | |
| }) | |
| return | |
| } |
yuito-it
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
カラムが重複してます...
5a0c2ae to
b086d28
Compare
…UniBot into ibuki-hum4/issue212
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
おそらくはdb.goのSetupDBにこの記述がいる。
db.Migrator().DropColumn(&model.TTSPersonalSetting{}, "speaker_seed")
db.Migrator().DropColumn(&model.TTSPersonalSetting{}, "speaker_pitch")
db.Migrator().DropColumn(&model.TTSPersonalSetting{}, "speed_scale")また、fkであるmembersをうまく処理できていない模様。
2026/01/31 10:36:18 Error updating TTS personal setting: ERROR: insert or update on table "tts_personal_settings" violates foreign key constraint "fk_members_tts_personal_setting" (SQLSTATE 23503)
Overview
ttsにspeedサブコマンド追加
/tts speed <value><value>: 最低50-最高200、初期値(デフォ値)100issue
#212