Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -109,33 +109,35 @@ async def rollback_last(
|
|
109 |
res[idx].pingpongs = res[idx].pingpongs[:-1]
|
110 |
|
111 |
ppm.add_pingpong(
|
112 |
-
PingPong(last_user_message,
|
113 |
-
)
|
114 |
prompt = build_prompts(ppm, global_context, ctx_num_lconv)
|
|
|
115 |
|
116 |
#######
|
117 |
-
if internet_option:
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
'repetition_penalty': res_rpen
|
133 |
-
}
|
134 |
-
):
|
135 |
-
ppm.append_pong(result)
|
136 |
-
yield prompt, ppm.build_uis(), str(res), gr.update(interactive=False), "off"
|
137 |
-
|
138 |
-
yield prompt, ppm.build_uis(), str(res), gr.update(interactive=True), "off"
|
139 |
|
140 |
def reset_chat(idx, ld, state, palm_if):
|
141 |
res = [state["ppmanager_type"].from_json(json.dumps(ppm_str)) for ppm_str in ld]
|
|
|
109 |
res[idx].pingpongs = res[idx].pingpongs[:-1]
|
110 |
|
111 |
ppm.add_pingpong(
|
112 |
+
PingPong(last_user_message, '')
|
113 |
+
)
|
114 |
prompt = build_prompts(ppm, global_context, ctx_num_lconv)
|
115 |
+
print(prompt)
|
116 |
|
117 |
#######
|
118 |
+
# if internet_option:
|
119 |
+
# search_prompt = None
|
120 |
+
# for tmp_prompt, uis in internet_search(ppm, serper_api_key, global_context, ctx_num_lconv):
|
121 |
+
# search_prompt = tmp_prompt
|
122 |
+
# yield "", prompt, uis, str(res), gr.update(interactive=False), "off"
|
123 |
+
|
124 |
+
parameters = {
|
125 |
+
# 'model': 'models/text-bison-001',
|
126 |
+
'candidate_count': 1,
|
127 |
+
'temperature': res_temp,
|
128 |
+
'top_k': res_topk,
|
129 |
+
'top_p': res_topp,
|
130 |
+
}
|
131 |
|
132 |
+
palm_if, response_txt = gen_text(
|
133 |
+
prompt,
|
134 |
+
parameters=parameters
|
135 |
+
)
|
136 |
+
|
137 |
+
ppm = res[idx]
|
138 |
+
ppm.replace_last_pong(response_txt)
|
139 |
+
|
140 |
+
return "", "", ppm.build_uis(), str(res), gr.update(interactive=True), "off"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
|
142 |
def reset_chat(idx, ld, state, palm_if):
|
143 |
res = [state["ppmanager_type"].from_json(json.dumps(ppm_str)) for ppm_str in ld]
|