Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -26,9 +26,17 @@ with gr.Blocks() as demo:
|
|
26 |
def user(user_message, history):
|
27 |
return "", history + [[user_message, None]]
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
def bot(history):
|
30 |
print("history: ",history)
|
31 |
-
prompt = f"Jesteś AI assystentem. Odpowiadaj po polsku. <user>: {history
|
32 |
print("prompt: ",prompt)
|
33 |
stream = llm(prompt, **params)
|
34 |
history[-1][1] = ""
|
|
|
26 |
def user(user_message, history):
|
27 |
return "", history + [[user_message, None]]
|
28 |
|
29 |
+
def parse_history(hist):
|
30 |
+
history_ = ""
|
31 |
+
for q, a in hist:
|
32 |
+
history_ += f"<user>: {q } \n"
|
33 |
+
if a:
|
34 |
+
history_ += f"<assistant>: {a} \n"
|
35 |
+
return history_
|
36 |
+
|
37 |
def bot(history):
|
38 |
print("history: ",history)
|
39 |
+
prompt = f"Jesteś AI assystentem. Odpowiadaj po polsku. <user>: {parse_history(history)}. <assistant>:"
|
40 |
print("prompt: ",prompt)
|
41 |
stream = llm(prompt, **params)
|
42 |
history[-1][1] = ""
|