Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -45,12 +45,15 @@ def chatyuan_bot(input, history):
|
|
45 |
history = history[-5:]
|
46 |
|
47 |
context = "\n".join([f"用户:{input_text}\n小元:{answer_text}" for input_text, answer_text in history])
|
48 |
-
print(context)
|
49 |
|
50 |
input_text = context + "\n用户:" + input + "\n小元:"
|
51 |
output_text = answer(input_text)
|
|
|
|
|
|
|
52 |
history.append((input, output_text))
|
53 |
-
print(history)
|
54 |
return history, history
|
55 |
|
56 |
block = gr.Blocks()
|
@@ -96,12 +99,15 @@ def chatyuan_bot_api(api_key, input, history):
|
|
96 |
history = history[-5:]
|
97 |
|
98 |
context = "\n".join([f"用户:{input_text}\n小元:{answer_text}" for input_text, answer_text in history])
|
99 |
-
print(context)
|
100 |
|
101 |
input_text = context + "\n用户:" + input + "\n小元:"
|
102 |
output_text = ChatYuan(api_key, input_text)
|
|
|
|
|
|
|
103 |
history.append((input, output_text))
|
104 |
-
print(history)
|
105 |
return history, history
|
106 |
|
107 |
block = gr.Blocks()
|
|
|
45 |
history = history[-5:]
|
46 |
|
47 |
context = "\n".join([f"用户:{input_text}\n小元:{answer_text}" for input_text, answer_text in history])
|
48 |
+
#print(context)
|
49 |
|
50 |
input_text = context + "\n用户:" + input + "\n小元:"
|
51 |
output_text = answer(input_text)
|
52 |
+
print("="*20)
|
53 |
+
print(f"{input_text}\n{output_text}")
|
54 |
+
print("="*20)
|
55 |
history.append((input, output_text))
|
56 |
+
#print(history)
|
57 |
return history, history
|
58 |
|
59 |
block = gr.Blocks()
|
|
|
99 |
history = history[-5:]
|
100 |
|
101 |
context = "\n".join([f"用户:{input_text}\n小元:{answer_text}" for input_text, answer_text in history])
|
102 |
+
#print(context)
|
103 |
|
104 |
input_text = context + "\n用户:" + input + "\n小元:"
|
105 |
output_text = ChatYuan(api_key, input_text)
|
106 |
+
print("="*20)
|
107 |
+
print(f"api_key:{api_key}\n{input_text}\n{output_text}")
|
108 |
+
print("="*20)
|
109 |
history.append((input, output_text))
|
110 |
+
#print(history)
|
111 |
return history, history
|
112 |
|
113 |
block = gr.Blocks()
|