Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,20 +1,34 @@
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
|
| 3 |
-
from agents.crew import build_crew
|
| 4 |
from memory.code_indexer import index_codebase
|
| 5 |
|
| 6 |
st.title("AI Codebase Intelligence")
|
| 7 |
|
| 8 |
-
|
| 9 |
-
query = st.text_area("Ask your coding question")
|
| 10 |
|
| 11 |
-
|
| 12 |
-
vector_db = index_codebase(repo_path)
|
| 13 |
|
| 14 |
-
crew = build_crew(vector_db)
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
)
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import git
|
| 3 |
import streamlit as st
|
| 4 |
|
|
|
|
| 5 |
from memory.code_indexer import index_codebase
|
| 6 |
|
| 7 |
st.title("AI Codebase Intelligence")
|
| 8 |
|
| 9 |
+
repo_url = st.text_input("GitHub Repository URL")
|
|
|
|
| 10 |
|
| 11 |
+
query = st.text_area("Ask Question")
|
|
|
|
| 12 |
|
|
|
|
| 13 |
|
| 14 |
+
if st.button("Analyze Repository"):
|
| 15 |
+
|
| 16 |
+
repo_name = repo_url.split("/")[-1]
|
| 17 |
+
|
| 18 |
+
if not os.path.exists(repo_name):
|
| 19 |
+
git.Repo.clone_from(
|
| 20 |
+
repo_url,
|
| 21 |
+
repo_name
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
st.success("Repository cloned")
|
| 25 |
+
|
| 26 |
+
vector_db = index_codebase(repo_name)
|
| 27 |
+
|
| 28 |
+
docs = vector_db.similarity_search(
|
| 29 |
+
query,
|
| 30 |
+
k=3
|
| 31 |
)
|
| 32 |
|
| 33 |
+
for doc in docs:
|
| 34 |
+
st.code(doc.page_content[:1500])
|