Skip to content
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

tweak: hardcode to config #738

Merged
merged 2 commits into from
Nov 19, 2023
Merged
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
2 changes: 2 additions & 0 deletions config/example/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,8 @@ enabled_away_missions = [
tts_enabled = false
# If enabled, what token does it use for API
tts_token_silero = ""
# api url for your tts provider
tts_api_url_silero = "http://you.tts.provider.com:port/endpoint"
# Are the audio files saved after usage
tts_cache_enabled = false
# What CPU threads are used for ffmpeg. Example valid values: "0-3" or "1,4-7"
Expand Down
7 changes: 7 additions & 0 deletions modular_ss220/text_to_speech/code/configuration.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
var/tts_enabled = FALSE
/// TTS API token for silero provider
var/tts_token_silero = ""
/// TTS API url for silero provide
var/tts_api_url_silero = "http://s2.ss220.club:9999/voice"
/// Should oggs be cached
var/tts_cache_enabled = FALSE
/// What cpu threads should ffmpeg use
Expand All @@ -23,6 +25,7 @@
CONFIG_LOAD_STR(tts_token_silero, data["tts_token_silero"])
CONFIG_LOAD_BOOL(tts_cache_enabled, data["tts_cache_enabled"])
CONFIG_LOAD_STR(ffmpeg_cpuaffinity, data["ffmpeg_cpuaffinity"])
CONFIG_LOAD_STR(tts_api_url_silero, data["tts_api_url_silero"])

tts_enabled = tts_token_silero && tts_enabled
var/sanitized = regex(@"[^0-9,-]", "g").Replace(ffmpeg_cpuaffinity, "")
Expand All @@ -32,3 +35,7 @@
/datum/http_request/vv_get_var(var_name)
if(var_name == "body")
return FALSE

/datum/configuration_section/tts_configuration/vv_get_var(var_name, var_value)
if(var_name == "tts_api_url_silero")
return FALSE
8 changes: 1 addition & 7 deletions modular_ss220/text_to_speech/code/providers/silero.dm
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
/datum/tts_provider/silero
name = "Silero"
is_enabled = TRUE
api_url = "http://s2.ss220.club:9999/voice"

/datum/tts_provider/silero/vv_edit_var(var_name, var_value)
if(var_name == "api_url")
return FALSE
return ..()

/datum/tts_provider/silero/request(text, datum/tts_seed/silero/seed, datum/callback/proc_callback)
if(throttle_check())
Expand All @@ -28,7 +22,7 @@
req_body["format"] = "ogg"
req_body["word_ts"] = FALSE

SShttp.create_async_request(RUSTG_HTTP_METHOD_POST, api_url, json_encode(req_body), list("content-type" = "application/json"), proc_callback)
SShttp.create_async_request(RUSTG_HTTP_METHOD_POST, GLOB.configuration.tts.tts_api_url_silero , json_encode(req_body), list("content-type" = "application/json"), proc_callback)

return TRUE

Expand Down