Skip to content

Commit

Permalink
Merge pull request #416 from mynaparrot/limit_trans
Browse files Browse the repository at this point in the history
feat: option to limit for selecting number of translation languages
  • Loading branch information
jibon57 authored Jan 31, 2024
2 parents ca418fe + 56e5f68 commit 0db3258
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
3 changes: 3 additions & 0 deletions config_sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ shared_notepad:
api_key: "eb2fb3fb78ca29eb6896852517d34a1be5f320664e3cce3a522a06dfa278f169"
azure_cognitive_services_speech:
enabled: false
# The Maximum number of translation languages allows selecting. Default: 2
# The pricing will be different if allow more languages. Please check azure pricing.
max_num_tran_langs: 2
subscription_keys:
-
id: "key_1"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/jordic/lti v0.0.0-20160211051708-2c756eacbab9
github.com/livekit/protocol v1.9.7
github.com/livekit/server-sdk-go v1.1.7
github.com/mynaparrot/plugnmeet-protocol v0.0.0-20240130150836-c3c695d665f0
github.com/mynaparrot/plugnmeet-protocol v0.0.0-20240131100938-adb55e0ea556
github.com/redis/go-redis/v9 v9.4.0
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.8.4
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mynaparrot/plugnmeet-protocol v0.0.0-20240130150836-c3c695d665f0 h1:1QOsvkKSsf+YUk/LGuUAh0fr+k1NVNBFud7yRk9nti0=
github.com/mynaparrot/plugnmeet-protocol v0.0.0-20240130150836-c3c695d665f0/go.mod h1:7zLIRcjwDR2Ewc6X7PcNrWgoElybhI8k73d/QfGxnRo=
github.com/mynaparrot/plugnmeet-protocol v0.0.0-20240131100938-adb55e0ea556 h1:gxN2VKOKpWl7LGkkHUR8c8MhBL3po2ZF+ITY6YOIWGI=
github.com/mynaparrot/plugnmeet-protocol v0.0.0-20240131100938-adb55e0ea556/go.mod h1:7zLIRcjwDR2Ewc6X7PcNrWgoElybhI8k73d/QfGxnRo=
github.com/nats-io/nats.go v1.32.0 h1:Bx9BZS+aXYlxW08k8Gd3yR2s73pV5XSoAQUyp1Kwvp0=
github.com/nats-io/nats.go v1.32.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8=
github.com/nats-io/nkeys v0.4.7 h1:RwNJbbIdYCoClSDNY7QVKZlyb/wfT6ugvFCiKy6vDvI=
Expand Down
5 changes: 3 additions & 2 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ type EtherpadInfo struct {
}

type AzureCognitiveServicesSpeech struct {
Enabled bool `yaml:"enabled"`
SubscriptionKeys []AzureSubscriptionKey `yaml:"subscription_keys"`
Enabled bool `yaml:"enabled"`
MaxNumTranLangsAllowSelecting int32 `yaml:"max_num_tran_langs"`
SubscriptionKeys []AzureSubscriptionKey `yaml:"subscription_keys"`
}

type AzureSubscriptionKey struct {
Expand Down
12 changes: 10 additions & 2 deletions pkg/models/room_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,19 @@ func (am *RoomAuthModel) CreateRoom(r *plugnmeet.CreateRoomReq) (bool, string, *
}

// Azure cognitive services
if !config.AppCnf.AzureCognitiveServicesSpeech.Enabled {
azu := config.AppCnf.AzureCognitiveServicesSpeech
if !azu.Enabled {
r.Metadata.RoomFeatures.SpeechToTextTranslationFeatures.IsAllow = false
} else {
var maxAllow int32 = 2
if azu.MaxNumTranLangsAllowSelecting > 0 {
maxAllow = azu.MaxNumTranLangsAllowSelecting
}
r.Metadata.RoomFeatures.SpeechToTextTranslationFeatures.MaxNumTranLangsAllowSelecting = maxAllow
}

if r.Metadata.IsBreakoutRoom && r.Metadata.RoomFeatures.EnableAnalytics {
// at present, we'll disable analytic report for breakout rooms
// at present, we'll disable an analytic report for breakout rooms
r.Metadata.RoomFeatures.EnableAnalytics = false
}

Expand Down

0 comments on commit 0db3258

Please sign in to comment.