select role from frontend
This commit is contained in:
parent
04868e022d
commit
90218b8a58
@ -11,13 +11,22 @@ import streamlit as st
|
|||||||
|
|
||||||
class DP:
|
class DP:
|
||||||
|
|
||||||
def __init__(self, dst: DST, llm_rephrasing=True, character='ramsay'): #TODO: a way to set llm_rephrasing status and a character
|
def __init__(self, dst: DST, llm_rephrasing=False, character='default'): #TODO: a way to set llm_rephrasing status and a character
|
||||||
self.dst_module = dst
|
self.dst_module = dst
|
||||||
self.llm_rephrasing = llm_rephrasing
|
self.llm_rephrasing = llm_rephrasing
|
||||||
with open('ai_talks/AMUseBotBackend/utils/characters_dict.json') as f:
|
with open('ai_talks/AMUseBotBackend/utils/characters_dict.json') as f:
|
||||||
characters_dict = json.load(f)
|
characters_dict = json.load(f)
|
||||||
self.character = characters_dict[character]
|
self.character = characters_dict[character]
|
||||||
|
|
||||||
|
def change_character(self, character):
|
||||||
|
with open('ai_talks/AMUseBotBackend/utils/characters_dict.json') as f:
|
||||||
|
characters_dict = json.load(f)
|
||||||
|
self.character = characters_dict[character]
|
||||||
|
if self.character == 'default':
|
||||||
|
self.llm_rephrasing = False
|
||||||
|
else:
|
||||||
|
self.llm_rephrasing = True
|
||||||
|
|
||||||
|
|
||||||
def llm_rephrase(self, character, response):
|
def llm_rephrase(self, character, response):
|
||||||
model = character['model']
|
model = character['model']
|
||||||
@ -40,7 +49,6 @@ class DP:
|
|||||||
|
|
||||||
|
|
||||||
def generate_response(self, intents: List[str]) -> str:
|
def generate_response(self, intents: List[str]) -> str:
|
||||||
|
|
||||||
# Prompt
|
# Prompt
|
||||||
if (None == intents):
|
if (None == intents):
|
||||||
return NLG.MESSAGE_PROMPT
|
return NLG.MESSAGE_PROMPT
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
{
|
{
|
||||||
"default": {"model": "gpt-3.5-turbo-0613", "prompt":
|
"default": {"model": "", "prompt": "", "leftside_input":"", "rightside_input": ""},
|
||||||
|
|
||||||
|
"helpful_chef": {"model": "gpt-3.5-turbo-0613", "prompt":
|
||||||
"You're a master chef known for treating everyone like your equal. You're currently reading steps of a recipe to your apprentice.",
|
"You're a master chef known for treating everyone like your equal. You're currently reading steps of a recipe to your apprentice.",
|
||||||
"leftside_input": "Rephrase this step of a recipe to make it sound more like a natural, full English sentence: '",
|
"leftside_input": "Rephrase this step of a recipe to make it sound more like a natural, full English sentence: '",
|
||||||
"rightside_input": "'."},
|
"rightside_input": "'."},
|
||||||
|
@ -107,8 +107,11 @@ def main() -> None:
|
|||||||
horizontal=True,
|
horizontal=True,
|
||||||
)
|
)
|
||||||
if role_kind == st.session_state.locale.radio_text1:
|
if role_kind == st.session_state.locale.radio_text1:
|
||||||
c2.selectbox(label=st.session_state.locale.select_placeholder2, key="role",
|
character_type = c2.selectbox(label=st.session_state.locale.select_placeholder2, key="role",
|
||||||
options=st.session_state.locale.ai_role_options)
|
options=st.session_state.locale.ai_role_options)
|
||||||
|
st.session_state.dp.change_character(character_type)
|
||||||
|
|
||||||
|
|
||||||
elif role_kind == st.session_state.locale.radio_text2:
|
elif role_kind == st.session_state.locale.radio_text2:
|
||||||
c2.text_input(label=st.session_state.locale.select_placeholder3, key="role")
|
c2.text_input(label=st.session_state.locale.select_placeholder3, key="role")
|
||||||
|
|
||||||
|
@ -1,16 +1,6 @@
|
|||||||
AI_ROLE_OPTIONS_EN: list[str] = [
|
AI_ROLE_OPTIONS_EN: list[str] = [
|
||||||
"helpful assistant",
|
"default",
|
||||||
"code assistant",
|
"helpful_chef",
|
||||||
"code reviewer",
|
"ramsay",
|
||||||
"text improver",
|
|
||||||
"cinema expert",
|
|
||||||
"sport expert",
|
|
||||||
"online games expert",
|
|
||||||
"food recipes expert",
|
|
||||||
"English grammar expert",
|
|
||||||
"friendly and helpful teaching assistant",
|
|
||||||
"laconic assistant",
|
|
||||||
"helpful, pattern-following assistant",
|
|
||||||
"translate corporate jargon into plain English",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user