Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,11 @@ from langchain.tools import tool
|
|
| 7 |
# Define the custom tool for checking Streamlit documentation updates
|
| 8 |
@tool
|
| 9 |
def check_streamlit_updates(previous_hash: str) -> str:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
doc_url = 'https://docs.streamlit.io/'
|
| 11 |
response = requests.get(doc_url)
|
| 12 |
content = response.text
|
|
@@ -16,10 +21,11 @@ def check_streamlit_updates(previous_hash: str) -> str:
|
|
| 16 |
else:
|
| 17 |
return 'No updates in Streamlit documentation.', current_hash
|
| 18 |
|
| 19 |
-
# Define the Streamlit Documentation Expert agent
|
| 20 |
streamlit_expert = Agent(
|
| 21 |
role='Streamlit Documentation Expert',
|
| 22 |
goal='Stay updated with the latest Streamlit documentation and notify users',
|
|
|
|
| 23 |
tools=[check_streamlit_updates],
|
| 24 |
verbose=True
|
| 25 |
)
|
|
@@ -43,11 +49,8 @@ st.title('CrewAI Streamlit Documentation Expert Control Panel')
|
|
| 43 |
# Manual update button
|
| 44 |
if st.button('Check for Streamlit Documentation Updates Now'):
|
| 45 |
# Trigger the Crew to perform the update task manually
|
| 46 |
-
# Note: Implement the logic to run the task synchronously within Streamlit
|
| 47 |
result = crew.kickoff() # or similar logic based on CrewAI's execution model
|
| 48 |
st.write(result)
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
st.write('
|
| 52 |
-
|
| 53 |
-
# Note: Additional interactive elements and displays can be added as needed
|
|
|
|
| 7 |
# Define the custom tool for checking Streamlit documentation updates
|
| 8 |
@tool
|
| 9 |
def check_streamlit_updates(previous_hash: str) -> str:
|
| 10 |
+
"""
|
| 11 |
+
Checks for updates in the Streamlit documentation.
|
| 12 |
+
Input: previous_hash - The hash of the previously known state of the documentation.
|
| 13 |
+
Output: A tuple containing a message indicating update status and the new hash.
|
| 14 |
+
"""
|
| 15 |
doc_url = 'https://docs.streamlit.io/'
|
| 16 |
response = requests.get(doc_url)
|
| 17 |
content = response.text
|
|
|
|
| 21 |
else:
|
| 22 |
return 'No updates in Streamlit documentation.', current_hash
|
| 23 |
|
| 24 |
+
# Define the Streamlit Documentation Expert agent with a backstory
|
| 25 |
streamlit_expert = Agent(
|
| 26 |
role='Streamlit Documentation Expert',
|
| 27 |
goal='Stay updated with the latest Streamlit documentation and notify users',
|
| 28 |
+
backstory='An AI agent specialized in monitoring and reporting the latest changes in Streamlit documentation.',
|
| 29 |
tools=[check_streamlit_updates],
|
| 30 |
verbose=True
|
| 31 |
)
|
|
|
|
| 49 |
# Manual update button
|
| 50 |
if st.button('Check for Streamlit Documentation Updates Now'):
|
| 51 |
# Trigger the Crew to perform the update task manually
|
|
|
|
| 52 |
result = crew.kickoff() # or similar logic based on CrewAI's execution model
|
| 53 |
st.write(result)
|
| 54 |
+
st.write('Latest check results: ...')
|
| 55 |
+
else:
|
| 56 |
+
st.write('Click the button above to check for updates.')
|
|
|
|
|
|