Spaces:
Build error
Build error
Update app.py
Browse files199 unmodified lines200201202203204205206207208209210211212213199 unmodified lineshistory_state = gr.State([])last_message_state = gr.State("")def user_interaction(message, history, api_key, max_tokens, top_p, temperature):loading_message = history + [(message, "Loading...", "You", "P-ALPLE", sessions[api_key]["avatar"], ASSISTANT_PIC_PATH)]yield render_message(loading_message), loading_message, ""partial_history = historyfor partial_reply in respond(message, api_key, max_tokens, top_p, temperature):partial_history = history + [(message, partial_reply, "You", "P-ALPLE", sessions[api_key]["avatar"], ASSISTANT_PIC_PATH)]yield render_message(partial_history), partial_history, ""199 unmodified lines200201202203204205206207208209210211212213214215216217218199 unmodified lineshistory_state = gr.State([])last_message_state = gr.State("")def user_interaction(message, history, api_key, max_tokens, top_p, temperature):loading_message = history + [(message, "Loading...", "You", "P-ALPLE", sessions[api_key]["avatar"], ASSISTANT_PIC_PATH)]yield render_message(loading_message), loading_message, ""assistant_response = ""for partial_reply in respond(message, api_key, max_tokens, top_p, temperature):assistant_response = partial_reply # Accumulate streamed responsepartial_history = history + [(message, assistant_response, "You", "P-ALPLE", sessions[api_key]["avatar"], ASSISTANT_PIC_PATH)]yield render_message(partial_history), partial_history, ""final_history = history + [(message, assistant_response, "You", "P-ALPLE", sessions[api_key]["avatar"], ASSISTANT_PIC_PATH)]yield render_message(final_history), final_history, ""
app.py+13-8