Spaces:
Running
Running
marcellopoliti
commited on
Commit
•
977f5f5
1
Parent(s):
391d4c1
feat: rename knowledge base
Browse files
pages/manage_knowledge_box.py
CHANGED
@@ -11,6 +11,7 @@ import wave
|
|
11 |
from dotenv import load_dotenv
|
12 |
import requests
|
13 |
import uuid
|
|
|
14 |
|
15 |
from retrieve_kb import get_current_knowledge_bases, get_knowledge_base_information
|
16 |
from generate_kb import add_links_to_knowledge_base
|
@@ -186,8 +187,16 @@ else:
|
|
186 |
st.warning(f"{collection_name} KB is empty")
|
187 |
|
188 |
|
189 |
-
tab1, tab2, tab3, tab4, tab5, tab6 = st.tabs(
|
190 |
-
[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
)
|
192 |
|
193 |
# remove stuff tab
|
@@ -331,3 +340,25 @@ with tab6:
|
|
331 |
st.success("Added")
|
332 |
except Exception as e:
|
333 |
st.error(f"{str(e)}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
from dotenv import load_dotenv
|
12 |
import requests
|
13 |
import uuid
|
14 |
+
import time
|
15 |
|
16 |
from retrieve_kb import get_current_knowledge_bases, get_knowledge_base_information
|
17 |
from generate_kb import add_links_to_knowledge_base
|
|
|
187 |
st.warning(f"{collection_name} KB is empty")
|
188 |
|
189 |
|
190 |
+
tab1, tab2, tab3, tab4, tab5, tab6, tab7 = st.tabs(
|
191 |
+
[
|
192 |
+
"Remove",
|
193 |
+
"Add URL",
|
194 |
+
"Multiple URL",
|
195 |
+
"Add PDF",
|
196 |
+
"Add Youtube",
|
197 |
+
"Notion and Jina",
|
198 |
+
"Rename",
|
199 |
+
]
|
200 |
)
|
201 |
|
202 |
# remove stuff tab
|
|
|
340 |
st.success("Added")
|
341 |
except Exception as e:
|
342 |
st.error(f"{str(e)}")
|
343 |
+
|
344 |
+
with tab7:
|
345 |
+
|
346 |
+
# remove a split
|
347 |
+
st.header("Rename collection")
|
348 |
+
new_name = st.text_input("New collection name")
|
349 |
+
collection_info, coll, client = get_knowledge_base_information(
|
350 |
+
client=client,
|
351 |
+
embedding_function=default_embedding_function,
|
352 |
+
kb_name=collection_name,
|
353 |
+
)
|
354 |
+
|
355 |
+
if st.button("rename"):
|
356 |
+
try:
|
357 |
+
coll.modify(
|
358 |
+
name=new_name,
|
359 |
+
)
|
360 |
+
except Exception as e:
|
361 |
+
st.error(f"{str(e)}")
|
362 |
+
st.success("Done")
|
363 |
+
time.sleep(1)
|
364 |
+
st.experimental_rerun()
|