oceansweep commited on
Commit
17d4987
·
verified ·
1 Parent(s): 7eaf18e

Upload Gradio_Related.py

Browse files

Fix for fstring + setting Mistral to default API wtih api key set as env secret since free requests for 15 days.

App_Function_Libraries/Gradio_Related.py CHANGED
@@ -669,8 +669,11 @@ def create_video_transcription_tab():
669
  api_name_input = gr.Dropdown(
670
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
671
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
672
- value=None, label="API Name (Mandatory)")
673
- api_key_input = gr.Textbox(label="API Key (Mandatory)", placeholder="Enter your API key here", type="password")
 
 
 
674
  keywords_input = gr.Textbox(label="Keywords", placeholder="Enter keywords here (comma-separated)",
675
  value="default,no_keyword_set")
676
  batch_size_input = gr.Slider(minimum=1, maximum=10, value=1, step=1,
@@ -1316,10 +1319,12 @@ def create_audio_processing_tab():
1316
  api_name_input = gr.Dropdown(
1317
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
1318
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
1319
- value=None,
1320
  label="API for Summarization (Optional)"
1321
  )
1322
- api_key_input = gr.Textbox(label="API Key (if required)", placeholder="Enter your API key here", type="password")
 
 
1323
  custom_keywords_input = gr.Textbox(label="Custom Keywords", placeholder="Enter custom keywords, comma-separated")
1324
  keep_original_input = gr.Checkbox(label="Keep original audio file", value=False)
1325
 
@@ -1424,10 +1429,12 @@ def create_podcast_tab():
1424
  podcast_api_name_input = gr.Dropdown(
1425
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter", "Llama.cpp",
1426
  "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
1427
- value=None,
1428
  label="API Name for Summarization (Optional)"
1429
  )
1430
- podcast_api_key_input = gr.Textbox(label="API Key (if required)", type="password")
 
 
1431
  podcast_whisper_model_input = gr.Dropdown(choices=whisper_models, value="medium", label="Whisper Model")
1432
 
1433
  keep_original_input = gr.Checkbox(label="Keep original audio file", value=False)
@@ -1545,9 +1552,13 @@ def create_website_scraping_tab():
1545
 
1546
  api_name_input = gr.Dropdown(
1547
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
1548
- "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"], value=None, label="API Name (Mandatory for Summarization)")
 
 
1549
  api_key_input = gr.Textbox(label="API Key (Mandatory if API Name is specified)",
1550
- placeholder="Enter your API key here; Ignore if using Local API or Built-in API", type="password")
 
 
1551
  keywords_input = gr.Textbox(label="Keywords", placeholder="Enter keywords here (comma-separated)",
1552
  value="default,no_keyword_set", visible=True)
1553
 
@@ -1655,8 +1666,12 @@ def create_resummary_tab():
1655
  api_name_input = gr.Dropdown(
1656
  choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
1657
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
1658
- value="Local-LLM", label="API Name")
1659
- api_key_input = gr.Textbox(label="API Key", placeholder="Enter your API key here", type="password")
 
 
 
 
1660
 
1661
  chunking_options_checkbox = gr.Checkbox(label="Use Chunking", value=False)
1662
  with gr.Row(visible=False) as chunking_options_box:
@@ -2853,9 +2868,13 @@ def create_chat_interface():
2853
  with gr.Row():
2854
  load_conversations_btn = gr.Button("Load Selected Conversation")
2855
 
2856
- api_endpoint = gr.Dropdown(label="Select API Endpoint", choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
2857
- "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"])
2858
- api_key = gr.Textbox(label="API Key (if required)", type="password")
 
 
 
 
2859
  custom_prompt_checkbox = gr.Checkbox(label="Use a Custom Prompt",
2860
  value=False,
2861
  visible=True)
@@ -3062,8 +3081,11 @@ def create_chat_interface_editable():
3062
 
3063
  api_endpoint = gr.Dropdown(label="Select API Endpoint",
3064
  choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
3065
- "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"])
3066
- api_key = gr.Textbox(label="API Key (if required)", type="password")
 
 
 
3067
  # preset_prompt_checkbox = gr.Checkbox(label="Use a pre-set Prompt",
3068
  # value=False,
3069
  # visible=True)
@@ -3261,8 +3283,12 @@ def create_chat_interface_stacked():
3261
  search_conversations_btn = gr.Button("Search Conversations")
3262
  load_conversations_btn = gr.Button("Load Selected Conversation")
3263
  with gr.Column():
3264
- api_endpoint = gr.Dropdown(label="Select API Endpoint", choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "OpenRouter", "Mistral", "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"])
3265
- api_key = gr.Textbox(label="API Key (if required)", type="password")
 
 
 
 
3266
  preset_prompt = gr.Dropdown(label="Select Preset Prompt",
3267
  choices=load_preset_prompts(),
3268
  visible=True)
@@ -3432,8 +3458,11 @@ def create_chat_interface_multi_api():
3432
  api_endpoint = gr.Dropdown(label=f"API Endpoint {i + 1}",
3433
  choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq",
3434
  "DeepSeek", "Mistral", "OpenRouter", "Llama.cpp", "Kobold", "Ooba",
3435
- "Tabbyapi", "VLLM", "HuggingFace"])
3436
- api_key = gr.Textbox(label=f"API Key {i + 1} (if required)", type="password")
 
 
 
3437
  temperature = gr.Slider(label=f"Temperature {i + 1}", minimum=0.0, maximum=1.0, step=0.1, value=0.7)
3438
  chatbot = gr.Chatbot(height=800, elem_classes="chat-window")
3439
  chatbots.append(chatbot)
@@ -3543,8 +3572,9 @@ def create_chat_interface_four():
3543
  api_endpoint = gr.Dropdown(label=f"API Endpoint {i + 1}",
3544
  choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq",
3545
  "DeepSeek", "Mistral", "OpenRouter", "Llama.cpp", "Kobold", "Ooba",
3546
- "Tabbyapi", "VLLM", "HuggingFace"])
3547
- api_key = gr.Textbox(label=f"API Key {i + 1} (if required)", type="password")
 
3548
  temperature = gr.Slider(label=f"Temperature {i + 1}", minimum=0.0, maximum=1.0, step=0.1, value=0.7)
3549
  chatbot = gr.Chatbot(height=400, elem_classes="chat-window")
3550
  msg = gr.Textbox(label=f"Enter your message for Chat {i + 1}")
@@ -3629,9 +3659,13 @@ def create_chat_interface_vertical():
3629
  use_prompt = gr.Checkbox(label="Use Prompt")
3630
  save_conversation = gr.Checkbox(label="Save Conversation", value=False)
3631
  with gr.Row():
3632
- api_endpoint = gr.Dropdown(label="Select API Endpoint", choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter", "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"])
 
 
3633
  with gr.Row():
3634
- api_key = gr.Textbox(label="API Key (if required)", type="password")
 
 
3635
  with gr.Row():
3636
  temperature = gr.Slider(label="Temperature", minimum=0.0, maximum=1.0, step=0.1, value=0.7)
3637
  with gr.Row():
@@ -4325,9 +4359,12 @@ def create_import_item_tab():
4325
  api_name_input = gr.Dropdown(
4326
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
4327
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
4328
- label="API for Auto-summarization"
 
4329
  )
4330
- api_key_input = gr.Textbox(label="API Key", type="password")
 
 
4331
  with gr.Row():
4332
  import_button = gr.Button("Import Data")
4333
  with gr.Row():
@@ -4659,9 +4696,12 @@ def create_import_book_tab():
4659
  api_name_input = gr.Dropdown(
4660
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
4661
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
4662
- label="API for Auto-summarization"
 
4663
  )
4664
- api_key_input = gr.Textbox(label="API Key", type="password")
 
 
4665
  import_button = gr.Button("Import eBook")
4666
  with gr.Column():
4667
  with gr.Row():
@@ -4761,6 +4801,47 @@ def export_items_by_keyword(keyword: str) -> str:
4761
  return None
4762
 
4763
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4764
 
4765
 
4766
  def display_search_results_export_tab(search_query: str, search_type: str, page: int = 1, items_per_page: int = 10):
@@ -5052,11 +5133,12 @@ def create_document_editing_tab():
5052
  api_name_input = gr.Dropdown(
5053
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
5054
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
5055
- value=None,
5056
  label="API for Grammar Check"
5057
  )
5058
  api_key_input = gr.Textbox(label="API Key (if not set in config.txt)", placeholder="Enter your API key here",
5059
- type="password")
 
5060
  check_grammar_button = gr.Button("Check Grammar and Style")
5061
 
5062
  with gr.Column():
@@ -5081,11 +5163,12 @@ def create_document_editing_tab():
5081
  api_name_input = gr.Dropdown(
5082
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
5083
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
5084
- value=None,
5085
  label="API for Grammar Check"
5086
  )
5087
  api_key_input = gr.Textbox(label="API Key (if not set in config.txt)", placeholder="Enter your API key here",
5088
- type="password")
 
5089
  adjust_btn = gr.Button("Adjust Tone")
5090
 
5091
  with gr.Column():
 
669
  api_name_input = gr.Dropdown(
670
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
671
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
672
+ value="Mistral",
673
+ label="API Name (Mandatory)")
674
+ api_key_input = gr.Textbox(label="API Key (Mandatory)", placeholder="Enter your API key here",
675
+ type="password",
676
+ value=f"{MISTRAL_TOKEN}")
677
  keywords_input = gr.Textbox(label="Keywords", placeholder="Enter keywords here (comma-separated)",
678
  value="default,no_keyword_set")
679
  batch_size_input = gr.Slider(minimum=1, maximum=10, value=1, step=1,
 
1319
  api_name_input = gr.Dropdown(
1320
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
1321
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
1322
+ value="Mistral",
1323
  label="API for Summarization (Optional)"
1324
  )
1325
+ api_key_input = gr.Textbox(label="API Key (if required)", placeholder="Enter your API key here",
1326
+ type="password",
1327
+ value=f"{MISTRAL_TOKEN}")
1328
  custom_keywords_input = gr.Textbox(label="Custom Keywords", placeholder="Enter custom keywords, comma-separated")
1329
  keep_original_input = gr.Checkbox(label="Keep original audio file", value=False)
1330
 
 
1429
  podcast_api_name_input = gr.Dropdown(
1430
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter", "Llama.cpp",
1431
  "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
1432
+ value="Mistral",
1433
  label="API Name for Summarization (Optional)"
1434
  )
1435
+ podcast_api_key_input = gr.Textbox(label="API Key (if required)",
1436
+ type="password",
1437
+ value=f"{MISTRAL_TOKEN}")
1438
  podcast_whisper_model_input = gr.Dropdown(choices=whisper_models, value="medium", label="Whisper Model")
1439
 
1440
  keep_original_input = gr.Checkbox(label="Keep original audio file", value=False)
 
1552
 
1553
  api_name_input = gr.Dropdown(
1554
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
1555
+ "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
1556
+ value="Mistral",
1557
+ label="API Name (Mandatory for Summarization)")
1558
  api_key_input = gr.Textbox(label="API Key (Mandatory if API Name is specified)",
1559
+ placeholder="Enter your API key here; Ignore if using Local API or Built-in API",
1560
+ type="password",
1561
+ value=f"{MISTRAL_TOKEN}")
1562
  keywords_input = gr.Textbox(label="Keywords", placeholder="Enter keywords here (comma-separated)",
1563
  value="default,no_keyword_set", visible=True)
1564
 
 
1666
  api_name_input = gr.Dropdown(
1667
  choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
1668
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
1669
+ value="Mistral",
1670
+ label="API Name")
1671
+ api_key_input = gr.Textbox(label="API Key",
1672
+ placeholder="Enter your API key here",
1673
+ type="password",
1674
+ value=f"{MISTRAL_TOKEN}")
1675
 
1676
  chunking_options_checkbox = gr.Checkbox(label="Use Chunking", value=False)
1677
  with gr.Row(visible=False) as chunking_options_box:
 
2868
  with gr.Row():
2869
  load_conversations_btn = gr.Button("Load Selected Conversation")
2870
 
2871
+ api_endpoint = gr.Dropdown(label="Select API Endpoint",
2872
+ choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
2873
+ "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
2874
+ value="Mistral")
2875
+ api_key = gr.Textbox(label="API Key (if required)",
2876
+ type="password",
2877
+ value=f"{MISTRAL_TOKEN}")
2878
  custom_prompt_checkbox = gr.Checkbox(label="Use a Custom Prompt",
2879
  value=False,
2880
  visible=True)
 
3081
 
3082
  api_endpoint = gr.Dropdown(label="Select API Endpoint",
3083
  choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
3084
+ "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
3085
+ value="Mistral")
3086
+ api_key = gr.Textbox(label="API Key (if required)",
3087
+ type="password",
3088
+ value=f"{MISTRAL_TOKEN}")
3089
  # preset_prompt_checkbox = gr.Checkbox(label="Use a pre-set Prompt",
3090
  # value=False,
3091
  # visible=True)
 
3283
  search_conversations_btn = gr.Button("Search Conversations")
3284
  load_conversations_btn = gr.Button("Load Selected Conversation")
3285
  with gr.Column():
3286
+ api_endpoint = gr.Dropdown(label="Select API Endpoint",
3287
+ choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "OpenRouter", "Mistral", "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
3288
+ value="Mistral")
3289
+ api_key = gr.Textbox(label="API Key (if required)",
3290
+ type="password",
3291
+ value=f"{MISTRAL_TOKEN}")
3292
  preset_prompt = gr.Dropdown(label="Select Preset Prompt",
3293
  choices=load_preset_prompts(),
3294
  visible=True)
 
3458
  api_endpoint = gr.Dropdown(label=f"API Endpoint {i + 1}",
3459
  choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq",
3460
  "DeepSeek", "Mistral", "OpenRouter", "Llama.cpp", "Kobold", "Ooba",
3461
+ "Tabbyapi", "VLLM", "HuggingFace"],
3462
+ value="Mistral")
3463
+ api_key = gr.Textbox(label=f"API Key {i + 1} (if required)",
3464
+ type="password",
3465
+ value=f"{MISTRAL_TOKEN}")
3466
  temperature = gr.Slider(label=f"Temperature {i + 1}", minimum=0.0, maximum=1.0, step=0.1, value=0.7)
3467
  chatbot = gr.Chatbot(height=800, elem_classes="chat-window")
3468
  chatbots.append(chatbot)
 
3572
  api_endpoint = gr.Dropdown(label=f"API Endpoint {i + 1}",
3573
  choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq",
3574
  "DeepSeek", "Mistral", "OpenRouter", "Llama.cpp", "Kobold", "Ooba",
3575
+ "Tabbyapi", "VLLM", "HuggingFace"],
3576
+ value="Mistral")
3577
+ api_key = gr.Textbox(label=f"API Key {i + 1} (if required)", type="password", value=f"{MISTRAL_TOKEN}")
3578
  temperature = gr.Slider(label=f"Temperature {i + 1}", minimum=0.0, maximum=1.0, step=0.1, value=0.7)
3579
  chatbot = gr.Chatbot(height=400, elem_classes="chat-window")
3580
  msg = gr.Textbox(label=f"Enter your message for Chat {i + 1}")
 
3659
  use_prompt = gr.Checkbox(label="Use Prompt")
3660
  save_conversation = gr.Checkbox(label="Save Conversation", value=False)
3661
  with gr.Row():
3662
+ api_endpoint = gr.Dropdown(label="Select API Endpoint",
3663
+ choices=["Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter", "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
3664
+ value="Mistral")
3665
  with gr.Row():
3666
+ api_key = gr.Textbox(label="API Key (if required)",
3667
+ type="password",
3668
+ value=f"{MISTRAL_TOKEN}")
3669
  with gr.Row():
3670
  temperature = gr.Slider(label="Temperature", minimum=0.0, maximum=1.0, step=0.1, value=0.7)
3671
  with gr.Row():
 
4359
  api_name_input = gr.Dropdown(
4360
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
4361
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
4362
+ label="API for Auto-summarization",
4363
+ value="Mistral"
4364
  )
4365
+ api_key_input = gr.Textbox(label="API Key",
4366
+ type="password",
4367
+ value=f"{MISTRAL_TOKEN}")
4368
  with gr.Row():
4369
  import_button = gr.Button("Import Data")
4370
  with gr.Row():
 
4696
  api_name_input = gr.Dropdown(
4697
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
4698
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
4699
+ label="API for Auto-summarization",
4700
+ value="Mistral"
4701
  )
4702
+ api_key_input = gr.Textbox(label="API Key",
4703
+ type="password",
4704
+ value=f"{MISTRAL_TOKEN}")
4705
  import_button = gr.Button("Import eBook")
4706
  with gr.Column():
4707
  with gr.Row():
 
4801
  return None
4802
 
4803
 
4804
+ def export_selected_items(selected_items: List[Dict]) -> Tuple[Optional[str], str]:
4805
+ try:
4806
+ logger.debug(f"Received selected_items: {selected_items}")
4807
+ if not selected_items:
4808
+ logger.warning("No items selected for export")
4809
+ return None, "No items selected for export"
4810
+
4811
+ markdown_content = "# Selected Items\n\n"
4812
+ for item in selected_items:
4813
+ logger.debug(f"Processing item: {item}")
4814
+ try:
4815
+ # Check if 'value' is a string (JSON) or already a dictionary
4816
+ if isinstance(item, str):
4817
+ item_data = json.loads(item)
4818
+ elif isinstance(item, dict) and 'value' in item:
4819
+ item_data = item['value'] if isinstance(item['value'], dict) else json.loads(item['value'])
4820
+ else:
4821
+ item_data = item
4822
+
4823
+ logger.debug(f"Item data after processing: {item_data}")
4824
+
4825
+ if 'id' not in item_data:
4826
+ logger.error(f"'id' not found in item data: {item_data}")
4827
+ continue
4828
+
4829
+ content, prompt, summary = fetch_item_details(item_data['id'])
4830
+ markdown_content += f"## {item_data.get('title', 'Item {}'.format(item_data['id']))}\n\n### Prompt\n{prompt}\n\n### Summary\n{summary}\n\n### Content\n{content}\n\n---\n\n"
4831
+ except Exception as e:
4832
+ logger.error(f"Error processing item {item}: {str(e)}")
4833
+ markdown_content += f"## Error\n\nUnable to process this item.\n\n---\n\n"
4834
+
4835
+ filename = "export_selected_items.md"
4836
+ with open(filename, "w", encoding='utf-8') as f:
4837
+ f.write(markdown_content)
4838
+
4839
+ logger.info(f"Successfully exported {len(selected_items)} selected items to {filename}")
4840
+ return filename, f"Successfully exported {len(selected_items)} items to {filename}"
4841
+ except Exception as e:
4842
+ error_message = f"Error exporting selected items: {str(e)}"
4843
+ logger.error(error_message)
4844
+ return None, error_message
4845
 
4846
 
4847
  def display_search_results_export_tab(search_query: str, search_type: str, page: int = 1, items_per_page: int = 10):
 
5133
  api_name_input = gr.Dropdown(
5134
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
5135
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
5136
+ value="Mistral",
5137
  label="API for Grammar Check"
5138
  )
5139
  api_key_input = gr.Textbox(label="API Key (if not set in config.txt)", placeholder="Enter your API key here",
5140
+ type="password",
5141
+ value=f"{MISTRAL_TOKEN}")
5142
  check_grammar_button = gr.Button("Check Grammar and Style")
5143
 
5144
  with gr.Column():
 
5163
  api_name_input = gr.Dropdown(
5164
  choices=[None, "Local-LLM", "OpenAI", "Anthropic", "Cohere", "Groq", "DeepSeek", "Mistral", "OpenRouter",
5165
  "Llama.cpp", "Kobold", "Ooba", "Tabbyapi", "VLLM", "HuggingFace"],
5166
+ value="Mistral",
5167
  label="API for Grammar Check"
5168
  )
5169
  api_key_input = gr.Textbox(label="API Key (if not set in config.txt)", placeholder="Enter your API key here",
5170
+ type="password",
5171
+ value=f"{MISTRAL_TOKEN}")
5172
  adjust_btn = gr.Button("Adjust Tone")
5173
 
5174
  with gr.Column():