Spaces:
Running
Running
update Web UI, adding repos refs #8 and adding query option refs #6
Browse files
app.py
CHANGED
@@ -51,10 +51,14 @@ def get_similay(query: str, filter: Filter):
|
|
51 |
def main(
|
52 |
query: str,
|
53 |
repo_name: str,
|
|
|
54 |
) -> Iterable[tuple[str, tuple[str, str]]]:
|
55 |
options = [{"key": "metadata.repo_name", "value": repo_name}]
|
|
|
|
|
|
|
56 |
filter = make_filter_obj(options=options)
|
57 |
-
docs = get_similay(
|
58 |
for doc, score in docs:
|
59 |
text = doc.page_content
|
60 |
metadata = doc.metadata
|
@@ -70,7 +74,25 @@ with st.form("my_form"):
|
|
70 |
st.title("GitHub Issue Search")
|
71 |
query = st.text_input(label="query")
|
72 |
repo_name = st.radio(
|
73 |
-
options=[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
)
|
75 |
|
76 |
submitted = st.form_submit_button("Submit")
|
@@ -79,7 +101,7 @@ with st.form("my_form"):
|
|
79 |
st.header("Search Results")
|
80 |
st.divider()
|
81 |
with st.spinner("Searching..."):
|
82 |
-
results = main(query, repo_name)
|
83 |
for title, url, id_, text, score, is_comment in results:
|
84 |
with st.container():
|
85 |
if not is_comment:
|
|
|
51 |
def main(
|
52 |
query: str,
|
53 |
repo_name: str,
|
54 |
+
query_options: str,
|
55 |
) -> Iterable[tuple[str, tuple[str, str]]]:
|
56 |
options = [{"key": "metadata.repo_name", "value": repo_name}]
|
57 |
+
if query_options == "Empty":
|
58 |
+
query_options = ""
|
59 |
+
query_str = f"{query_options}{query}"
|
60 |
filter = make_filter_obj(options=options)
|
61 |
+
docs = get_similay(query_str, filter)
|
62 |
for doc, score in docs:
|
63 |
text = doc.page_content
|
64 |
metadata = doc.metadata
|
|
|
74 |
st.title("GitHub Issue Search")
|
75 |
query = st.text_input(label="query")
|
76 |
repo_name = st.radio(
|
77 |
+
options=[
|
78 |
+
"cpython",
|
79 |
+
"pyvista",
|
80 |
+
"plone",
|
81 |
+
"volto",
|
82 |
+
"plone.restapi",
|
83 |
+
"nvda",
|
84 |
+
"nvdajp",
|
85 |
+
"cocoa",
|
86 |
+
],
|
87 |
+
label="Repo name",
|
88 |
+
)
|
89 |
+
query_options = st.radio(
|
90 |
+
options=[
|
91 |
+
"query: ",
|
92 |
+
"query: passage: ",
|
93 |
+
"Empty",
|
94 |
+
],
|
95 |
+
label="Query options",
|
96 |
)
|
97 |
|
98 |
submitted = st.form_submit_button("Submit")
|
|
|
101 |
st.header("Search Results")
|
102 |
st.divider()
|
103 |
with st.spinner("Searching..."):
|
104 |
+
results = main(query, repo_name, query_options)
|
105 |
for title, url, id_, text, score, is_comment in results:
|
106 |
with st.container():
|
107 |
if not is_comment:
|