File size: 636 Bytes
36d5efe
 
fe7833a
 
 
 
 
 
36d5efe
fe7833a
36d5efe
fe7833a
 
36d5efe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fe7833a
 
36d5efe
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os
import git
import streamlit as st

from memory.code_indexer import index_codebase

st.title("AI Codebase Intelligence")

repo_url = st.text_input("GitHub Repository URL")

query = st.text_area("Ask Question")


if st.button("Analyze Repository"):

    repo_name = repo_url.split("/")[-1]

    if not os.path.exists(repo_name):
        git.Repo.clone_from(
            repo_url,
            repo_name
        )

    st.success("Repository cloned")

    vector_db = index_codebase(repo_name)

    docs = vector_db.similarity_search(
        query,
        k=3
    )

    for doc in docs:
        st.code(doc.page_content[:1500])