mirror of
https://github.com/xtekky/gpt4free.git
synced 2024-12-26 12:41:56 +03:00
Refactor conversation selection
This commit is contained in:
parent
8b0cb0cbc1
commit
2140fc87cb
@ -105,7 +105,7 @@ st.sidebar.header("Conversation History")
|
|||||||
for idx, conversation in enumerate(st.session_state.conversations):
|
for idx, conversation in enumerate(st.session_state.conversations):
|
||||||
if st.sidebar.button(f"Conversation {idx + 1}: {conversation['user_inputs'][0]}", key=f"sidebar_btn_{idx}"):
|
if st.sidebar.button(f"Conversation {idx + 1}: {conversation['user_inputs'][0]}", key=f"sidebar_btn_{idx}"):
|
||||||
st.session_state['selected_conversation'] = idx
|
st.session_state['selected_conversation'] = idx
|
||||||
st.session_state['current_conversation'] = st.session_state.conversations[idx]
|
st.session_state['current_conversation'] = conversation
|
||||||
|
|
||||||
if st.session_state['selected_conversation'] is not None:
|
if st.session_state['selected_conversation'] is not None:
|
||||||
conversation_to_display = st.session_state.conversations[st.session_state['selected_conversation']]
|
conversation_to_display = st.session_state.conversations[st.session_state['selected_conversation']]
|
||||||
@ -115,4 +115,4 @@ else:
|
|||||||
if conversation_to_display['generated_responses']:
|
if conversation_to_display['generated_responses']:
|
||||||
for i in range(len(conversation_to_display['generated_responses']) - 1, -1, -1):
|
for i in range(len(conversation_to_display['generated_responses']) - 1, -1, -1):
|
||||||
message(conversation_to_display["generated_responses"][i], key=f"display_generated_{i}")
|
message(conversation_to_display["generated_responses"][i], key=f"display_generated_{i}")
|
||||||
message(conversation_to_display['user_inputs'][i], is_user=True, key=f"display_user_{i}")
|
message(conversation_to_display['user_inputs'][i], is_user=True, key=f"display_user_{i}")
|
Loading…
Reference in New Issue
Block a user