Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,7 +20,10 @@ def format_prompt(message, history):
|
|
| 20 |
def chat_inf(system_prompt,prompt,history):
|
| 21 |
if not history:
|
| 22 |
history = []
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
| 24 |
seed = random.randint(1,1111111111111111)
|
| 25 |
generate_kwargs = dict(
|
| 26 |
temperature=0.9,
|
|
@@ -38,7 +41,9 @@ def chat_inf(system_prompt,prompt,history):
|
|
| 38 |
for response in stream:
|
| 39 |
output += response.token.text
|
| 40 |
if history:
|
| 41 |
-
|
|
|
|
|
|
|
| 42 |
else:
|
| 43 |
hist=[(prompt,output)]
|
| 44 |
yield hist
|
|
|
|
| 20 |
def chat_inf(system_prompt,prompt,history):
|
| 21 |
if not history:
|
| 22 |
history = []
|
| 23 |
+
hist_len=0
|
| 24 |
+
if history:
|
| 25 |
+
hist_len=len(history)
|
| 26 |
+
print(hist_len)
|
| 27 |
seed = random.randint(1,1111111111111111)
|
| 28 |
generate_kwargs = dict(
|
| 29 |
temperature=0.9,
|
|
|
|
| 41 |
for response in stream:
|
| 42 |
output += response.token.text
|
| 43 |
if history:
|
| 44 |
+
history[hist_len+1]=[(prompt,output)]
|
| 45 |
+
hist=history
|
| 46 |
+
#hist=[history,(prompt,output)]
|
| 47 |
else:
|
| 48 |
hist=[(prompt,output)]
|
| 49 |
yield hist
|