Skip to content

Commit

Permalink
Fixing UI issue where at max 20 assistants were shown in explore assi…
Browse files Browse the repository at this point in the history
…stants
  • Loading branch information
sanjay920 committed Feb 13, 2024
1 parent bb2bb74 commit 5718c29
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions services/frontend/ui/app/pages/2_🤖_Explore_Assistants.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,21 @@
from rubra_ui_utils import remove_streamlit_elements


def get_assistants():
# Function to get the list of assistants from your API
return rubra_client.beta.assistants.list().data
def get_all_assistants():
all_assistants = []
while True:
response = rubra_client.beta.assistants.list(limit=100, after=after)
assistants = response.data

all_assistants.extend(assistants)

if len(assistants) < 100:
break
else:
after = assistants[-1]["id"]

return all_assistants



def create_assistant(name, description, instructions, model, file_ids, tools):
Expand Down Expand Up @@ -187,7 +199,7 @@ def main():
del st.session_state["delete_message"]

# Display each assistant with delete and modify options
for assistant in get_assistants():
for assistant in get_all_assistants():
with st.container():
st.markdown(f"### {assistant.name}")

Expand Down Expand Up @@ -241,7 +253,7 @@ def main():
if "modify_id" in st.session_state and st.session_state["modify_id"]:
modify_assistant_id = st.session_state["modify_id"]
# Find the assistant details
for assistant in get_assistants():
for assistant in get_all_assistants():
if assistant.id == modify_assistant_id:
with modify_form_placeholder.container():
with st.form(f"modify_{assistant.id}_form"):
Expand Down

0 comments on commit 5718c29

Please sign in to comment.