Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -50,9 +50,9 @@ with gr.Blocks(theme=gr.themes.Glass()) as demo:
|
|
| 50 |
msg = msg + f"\nRemember to answer in {language}"
|
| 51 |
chatbot += [msg, None]
|
| 52 |
state += {'role':'user','content':'msg'}
|
| 53 |
-
return
|
| 54 |
|
| 55 |
-
def bot(chatbot, state, mode):
|
| 56 |
#Bot context
|
| 57 |
if mode == "mode1":
|
| 58 |
context = themewhatcanido
|
|
@@ -63,12 +63,12 @@ with gr.Blocks(theme=gr.themes.Glass()) as demo:
|
|
| 63 |
|
| 64 |
#remind mission
|
| 65 |
if len(state) == 0:
|
| 66 |
-
state
|
| 67 |
elif len(state) > 10:
|
| 68 |
-
state
|
| 69 |
response = answer(state)
|
| 70 |
-
chatbot
|
| 71 |
-
state
|
| 72 |
return chatbot, state
|
| 73 |
|
| 74 |
def refresh(language: str):
|
|
|
|
| 50 |
msg = msg + f"\nRemember to answer in {language}"
|
| 51 |
chatbot += [msg, None]
|
| 52 |
state += {'role':'user','content':'msg'}
|
| 53 |
+
return "", chatbot, state
|
| 54 |
|
| 55 |
+
def bot(chatbot, state, mode: str):
|
| 56 |
#Bot context
|
| 57 |
if mode == "mode1":
|
| 58 |
context = themewhatcanido
|
|
|
|
| 63 |
|
| 64 |
#remind mission
|
| 65 |
if len(state) == 0:
|
| 66 |
+
state .append({'role':'system','content':f"Take notice of your mission:\n\n{context}"})
|
| 67 |
elif len(state) > 10:
|
| 68 |
+
state.append({'role':'system','content':f"Remember your mission as briefed earlier:\n\n{context}"})
|
| 69 |
response = answer(state)
|
| 70 |
+
chatbot.append([None, response])
|
| 71 |
+
state.append({'role':'assistant','content':'response'})
|
| 72 |
return chatbot, state
|
| 73 |
|
| 74 |
def refresh(language: str):
|