mix format
This commit is contained in:
parent
83d881dcb1
commit
b3220cc8fc
3 changed files with 10 additions and 4 deletions
|
@ -26,7 +26,9 @@ defp tier do
|
|||
@impl Akkoma.Translator
|
||||
def translate(string, to_language) do
|
||||
with {:ok, response} <- do_request(api_key(), tier(), string, to_language) do
|
||||
%{"translations" => [%{"text" => translated, "detected_source_language" => detected}]} = response.body
|
||||
%{"translations" => [%{"text" => translated, "detected_source_language" => detected}]} =
|
||||
response.body
|
||||
|
||||
{:ok, detected, translated}
|
||||
else
|
||||
{:error, reason} -> {:error, reason}
|
||||
|
|
|
@ -17,7 +17,9 @@ defp url do
|
|||
@impl Akkoma.Translator
|
||||
def translate(string, to_language) do
|
||||
with {:ok, response} <- do_request(string, to_language) do
|
||||
%{"translatedText" => translated, "detectedLanguage" => %{"language" => detected}} = response.body
|
||||
%{"translatedText" => translated, "detectedLanguage" => %{"language" => detected}} =
|
||||
response.body
|
||||
|
||||
{:ok, detected, translated}
|
||||
else
|
||||
{:error, reason} -> {:error, reason}
|
||||
|
|
|
@ -593,7 +593,6 @@ defp context do
|
|||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
defp translation do
|
||||
%Schema{
|
||||
|
@ -602,7 +601,10 @@ defp translation do
|
|||
type: :object,
|
||||
required: [:detected_language, :text],
|
||||
properties: %{
|
||||
detected_language: %Schema{type: :string, description: "The detected language of the text"},
|
||||
detected_language: %Schema{
|
||||
type: :string,
|
||||
description: "The detected language of the text"
|
||||
},
|
||||
text: %Schema{type: :string, description: "The translated text"}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue