pseudotensor commited on
Commit
64b21ba
1 Parent(s): 81bff31

Update with h2oGPT hash 1c8a0cdaca009bbce07e1f9eda2372252bdf57dd

Browse files
Files changed (2) hide show
  1. gradio_runner.py +10 -9
  2. utils.py +1 -1
gradio_runner.py CHANGED
@@ -499,26 +499,27 @@ def go_gradio(**kwargs):
499
  pass
500
  with gr.Row():
501
  with gr.Column(scale=1):
 
 
 
502
  add_placeholder = "e.g. UserData2, user_path2 (optional)" \
503
  if not is_public else "e.g. MyData2"
504
  remove_placeholder = "e.g. UserData2" if not is_public else "e.g. MyData2"
505
- new_langchain_mode_text = gr.Textbox(value="", visible=allow_upload_to_user_data or
506
- allow_upload_to_my_data,
507
  label='Add Collection',
508
  placeholder=add_placeholder,
509
  interactive=True)
510
- remove_langchain_mode_text = gr.Textbox(value="", visible=allow_upload_to_user_data or
511
- allow_upload_to_my_data,
512
  label='Remove Collection',
513
  placeholder=remove_placeholder,
514
  interactive=True)
515
  load_langchain = gr.Button(value="Load LangChain State", scale=0, size='sm',
516
- visible=allow_upload_to_user_data)
 
517
  with gr.Column(scale=1):
518
  df0 = get_df_langchain_mode_paths(selection_docs_state0)
519
  langchain_mode_path_text = gr.Dataframe(value=df0,
520
- visible=allow_upload_to_user_data or
521
- allow_upload_to_my_data,
522
  label='LangChain Mode-Path',
523
  show_label=False,
524
  interactive=False)
@@ -2543,7 +2544,7 @@ def get_sources(db1s, langchain_mode, dbs=None, docs_state0=None):
2543
  for k in db1s:
2544
  set_userid(db1s[k])
2545
 
2546
- if langchain_mode in ['ChatLLM', 'LLM']:
2547
  source_files_added = "NA"
2548
  source_list = []
2549
  elif langchain_mode in ['wiki_full']:
@@ -2787,7 +2788,7 @@ def get_db(db1s, langchain_mode, dbs=None):
2787
 
2788
  def get_source_files_given_langchain_mode(db1s, langchain_mode='UserData', dbs=None):
2789
  db = get_db(db1s, langchain_mode, dbs=dbs)
2790
- if langchain_mode in ['ChatLLM', 'LLM'] or db is None:
2791
  return "Sources: N/A"
2792
  return get_source_files(db=db, exceptions=None)
2793
 
 
499
  pass
500
  with gr.Row():
501
  with gr.Column(scale=1):
502
+ visible_add_remove_collection = (allow_upload_to_user_data or
503
+ allow_upload_to_my_data) and \
504
+ kwargs['langchain_mode'] != 'Disabled'
505
  add_placeholder = "e.g. UserData2, user_path2 (optional)" \
506
  if not is_public else "e.g. MyData2"
507
  remove_placeholder = "e.g. UserData2" if not is_public else "e.g. MyData2"
508
+ new_langchain_mode_text = gr.Textbox(value="", visible=visible_add_remove_collection,
 
509
  label='Add Collection',
510
  placeholder=add_placeholder,
511
  interactive=True)
512
+ remove_langchain_mode_text = gr.Textbox(value="", visible=visible_add_remove_collection,
 
513
  label='Remove Collection',
514
  placeholder=remove_placeholder,
515
  interactive=True)
516
  load_langchain = gr.Button(value="Load LangChain State", scale=0, size='sm',
517
+ visible=allow_upload_to_user_data and
518
+ kwargs['langchain_mode'] != 'Disabled')
519
  with gr.Column(scale=1):
520
  df0 = get_df_langchain_mode_paths(selection_docs_state0)
521
  langchain_mode_path_text = gr.Dataframe(value=df0,
522
+ visible=visible_add_remove_collection,
 
523
  label='LangChain Mode-Path',
524
  show_label=False,
525
  interactive=False)
 
2544
  for k in db1s:
2545
  set_userid(db1s[k])
2546
 
2547
+ if langchain_mode in ['LLM']:
2548
  source_files_added = "NA"
2549
  source_list = []
2550
  elif langchain_mode in ['wiki_full']:
 
2788
 
2789
  def get_source_files_given_langchain_mode(db1s, langchain_mode='UserData', dbs=None):
2790
  db = get_db(db1s, langchain_mode, dbs=dbs)
2791
+ if langchain_mode in ['LLM'] or db is None:
2792
  return "Sources: N/A"
2793
  return get_source_files(db=db, exceptions=None)
2794
 
utils.py CHANGED
@@ -1023,7 +1023,7 @@ def save_collection_names(langchain_modes, visible_langchain_modes, langchain_mo
1023
  scratch_collection_names = list(db1s.keys())
1024
  user_hash = db1s.get(LangChainMode.MY_DATA.value, '')[1]
1025
 
1026
- llms = ['ChatLLM', 'LLM', 'Disabled']
1027
 
1028
  scratch_langchain_modes = [x for x in langchain_modes if x in scratch_collection_names]
1029
  scratch_visible_langchain_modes = [x for x in visible_langchain_modes if x in scratch_collection_names]
 
1023
  scratch_collection_names = list(db1s.keys())
1024
  user_hash = db1s.get(LangChainMode.MY_DATA.value, '')[1]
1025
 
1026
+ llms = ['LLM', 'Disabled']
1027
 
1028
  scratch_langchain_modes = [x for x in langchain_modes if x in scratch_collection_names]
1029
  scratch_visible_langchain_modes = [x for x in visible_langchain_modes if x in scratch_collection_names]