fix: Remove Collections from all index names (#473)

Co-authored-by: Tadashi <tadashi@cinnamon.is>
This commit is contained in:
Pedro Lima 2024-12-04 02:40:46 +00:00 committed by GitHub
parent 32732c35de
commit 159f4da7c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 6 additions and 7 deletions

View File

@ -303,7 +303,8 @@ KH_INDEX_TYPES = [
GRAPHRAG_INDICES = [
{
"name": graph_type.split(".")[-1].replace("Index", ""), # get last name
"name": graph_type.split(".")[-1].replace("Index", "")
+ " Collection", # get last name
"config": {
"supported_file_types": (
".png, .jpeg, .jpg, .tiff, .tif, .pdf, .xls, .xlsx, .doc, .docx, "
@ -318,7 +319,7 @@ GRAPHRAG_INDICES = [
KH_INDICES = [
{
"name": "File",
"name": "File Collection",
"config": {
"supported_file_types": (
".png, .jpeg, .jpg, .tiff, .tif, .pdf, .xls, .xlsx, .doc, .docx, "

View File

@ -84,7 +84,7 @@ class App(BaseApp):
) as self._tabs["indices-tab"]:
for index in self.index_manager.indices:
with gr.Tab(
f"{index.name} Collection",
index.name,
elem_id=f"{index.id}-tab",
) as self._tabs[f"{index.id}-tab"]:
page = index.get_index_page_ui()

View File

@ -132,9 +132,7 @@ class ChatPage(BasePage):
continue
index_ui.unrender() # need to rerender later within Accordion
with gr.Accordion(
label=f"{index.name} Collection", open=index_id < 1
):
with gr.Accordion(label=index.name, open=index_id < 1):
index_ui.render()
gr_index = index_ui.as_gradio_component()

View File

@ -272,7 +272,7 @@ class SettingsPage(BasePage):
id2name = {k: v.name for k, v in self._app.index_manager.info().items()}
with gr.Tab("Retrieval settings", visible=self._render_index_tab):
for pn, sig in self._default_settings.index.options.items():
name = "{} Collection".format(id2name.get(pn, f"<id {pn}>"))
name = id2name.get(pn, f"<id {pn}>")
with gr.Tab(name):
for n, si in sig.settings.items():
obj = render_setting_item(si, si.value)