forked from AntoniZap/IBM-Chatbot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlocal.py
More file actions
67 lines (64 loc) · 1.83 KB
/
local.py
File metadata and controls
67 lines (64 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
shortnames = {
"english" : "en",
"gaeilge" : "ga"
}
languages = {
"title" : {
"en" : "Customer Review Analyser",
"ga" : "Bota Comhrá C⁊F IBM",
},
"subheader" : {
"en" : "Select options in sidebar.",
"ga" : "Roghnaigh roghanna ar an dtaobhbharra."
},
"llm_choice_combo" : {
"en" : "Select LLM:",
"ga" : "Roghnaigh LLM:"
},
"loading" : {
"en" : "Loading…",
"ga" : "ag lódáil…"
},
"prompt_placeholder" : {
"en" : "Write your question...",
"ga" : "Clóscríobh do theachtaireacht..."
},
"user_role_label" : {
"en" : "User",
"ga" : "Tusa"
},
"assistant_role_label" : {
"en" : "Assistant",
"ga" : "Bota"
},
"llm_not_available" : {
"en" : "Unfortunately {llm_selection}'s LLM is not available at the moment.",
"ga" : "Faraor, níl MML {llm_selection} ar fáil faoi láthair."
},
"system_prompt" : {
"en" : "You are a helpful assistant. Answer all questions to the best of your ability with the following context:",
"ga" : "Is Bota Comhrá cabhrach tú. Freagair gach ceist leis an eolas thíos:",
},
"select_language" : {
"en" : "Select language:",
"ga" : "Roghnaigh teanga:"
},
"select_llm": {
"en" : "Select LLM:",
"ga" : "Roghnaigh LLM:",
},
"sources" : {
"en" : "Sources",
"ga" : "foinsí"
}
}
#used to translate simple ui elements into other languages
def resolve(language, key):
variations = languages[key]
language = language.lower()
if language in key:
return variations[language]
elif language in shortnames:
return variations[shortnames[language]]
else:
raise RuntimeError(f"Language `{language}` does not exist!")