upd ai_role
This commit is contained in:
parent
4a6c3e6d88
commit
bf53d0bd81
@ -8,6 +8,8 @@ from src.utils.agi.chat_gpt import chat_gpt_request
|
|||||||
from src.utils.stt import show_voice_input
|
from src.utils.stt import show_voice_input
|
||||||
from src.utils.tts import show_player
|
from src.utils.tts import show_player
|
||||||
|
|
||||||
|
AI_ROLE = f"{st.session_state.locale.ai_role_prefix} {st.session_state.role}. {st.session_state.locale.ai_role_postfix}"
|
||||||
|
|
||||||
|
|
||||||
def clear_chat() -> None:
|
def clear_chat() -> None:
|
||||||
st.session_state.generated = []
|
st.session_state.generated = []
|
||||||
@ -90,7 +92,7 @@ def show_conversation() -> None:
|
|||||||
st.session_state.messages.append({"role": "user", "content": st.session_state.user_text})
|
st.session_state.messages.append({"role": "user", "content": st.session_state.user_text})
|
||||||
else:
|
else:
|
||||||
st.session_state.messages = [
|
st.session_state.messages = [
|
||||||
{"role": "system", "content": f"{st.session_state.locale.ai_role_prefix} {st.session_state.role}."},
|
{"role": "system", "content": AI_ROLE},
|
||||||
{"role": "user", "content": st.session_state.user_text},
|
{"role": "user", "content": st.session_state.user_text},
|
||||||
]
|
]
|
||||||
if st.session_state.model == "bard":
|
if st.session_state.model == "bard":
|
||||||
|
@ -6,42 +6,13 @@ from typing import List
|
|||||||
@dataclass
|
@dataclass
|
||||||
class Locale:
|
class Locale:
|
||||||
ai_role_options: List[str]
|
ai_role_options: List[str]
|
||||||
ai_role_prefix: str
|
|
||||||
title: str
|
|
||||||
language: str
|
|
||||||
lang_code: str
|
|
||||||
donates: str
|
|
||||||
donates1: str
|
|
||||||
donates2: str
|
|
||||||
chat_placeholder: str
|
|
||||||
chat_run_btn: str
|
|
||||||
chat_clear_btn: str
|
|
||||||
chat_save_btn: str
|
|
||||||
speak_btn: str
|
|
||||||
input_kind: str
|
|
||||||
input_kind_1: str
|
|
||||||
input_kind_2: str
|
|
||||||
select_placeholder1: str
|
|
||||||
select_placeholder2: str
|
|
||||||
select_placeholder3: str
|
|
||||||
radio_placeholder: str
|
|
||||||
radio_text1: str
|
|
||||||
radio_text2: str
|
|
||||||
stt_placeholder: str
|
|
||||||
footer_title: str
|
|
||||||
footer_option0: str
|
|
||||||
footer_option1: str
|
|
||||||
footer_option2: str
|
|
||||||
footer_chat: str
|
|
||||||
footer_channel: str
|
|
||||||
responsibility_denial: str
|
|
||||||
donates_info: str
|
|
||||||
|
|
||||||
|
|
||||||
# Child data class for English
|
# Child data class for English
|
||||||
@dataclass
|
@dataclass
|
||||||
class EnLocale(Locale):
|
class EnLocale(Locale):
|
||||||
ai_role_prefix: str = "You are a female"
|
ai_role_prefix: str = "You are a female"
|
||||||
|
ai_role_postfix: str = "Answer as concisely as possible with a little humor expression."
|
||||||
title: str = "AI Talks"
|
title: str = "AI Talks"
|
||||||
language: str = "English"
|
language: str = "English"
|
||||||
lang_code: str = "en"
|
lang_code: str = "en"
|
||||||
@ -86,6 +57,7 @@ class EnLocale(Locale):
|
|||||||
@dataclass
|
@dataclass
|
||||||
class RuLocale(Locale):
|
class RuLocale(Locale):
|
||||||
ai_role_prefix: str = "Вы девушка"
|
ai_role_prefix: str = "Вы девушка"
|
||||||
|
ai_role_postfix: str = "Отвечай максимально лаконично, с легким налётом юмора."
|
||||||
title: str = "Разговорчики с ИИ"
|
title: str = "Разговорчики с ИИ"
|
||||||
language: str = "Russian"
|
language: str = "Russian"
|
||||||
lang_code: str = "ru"
|
lang_code: str = "ru"
|
||||||
|
Loading…
Reference in New Issue
Block a user