Tobias Geisler commited on
Commit
7db7d27
·
1 Parent(s): 420aaf5

added some logging

Browse files
Files changed (2) hide show
  1. app.py +2 -0
  2. tabs/create_chatbot.py +10 -2
app.py CHANGED
@@ -3,6 +3,8 @@ from tabs.chat import create_chat_tab, load_chatbot
3
  from tabs.create_chatbot import create_chatbot_tab
4
  # from tabs.admin import create_admin_tab
5
 
 
 
6
  def create_app():
7
  with gr.Blocks(
8
  title="codora KI-App-Ersteller v0",
 
3
  from tabs.create_chatbot import create_chatbot_tab
4
  # from tabs.admin import create_admin_tab
5
 
6
+ print("Gradio Version:", gr.__version__)
7
+
8
  def create_app():
9
  with gr.Blocks(
10
  title="codora KI-App-Ersteller v0",
tabs/create_chatbot.py CHANGED
@@ -2,6 +2,10 @@ import gradio as gr
2
  from utils.utils import get_secret
3
  from database import create_chatbot, filter_profanity
4
 
 
 
 
 
5
  CREATE_APP_PW = get_secret("CREATE_APP_PW")
6
 
7
  def create_chatbot_interface(name, custom_instruction, password):
@@ -11,8 +15,12 @@ def create_chatbot_interface(name, custom_instruction, password):
11
  filtered_name = filter_profanity(name)
12
  filtered_instruction = filter_profanity(custom_instruction)
13
 
14
- chatbot = create_chatbot(filtered_name, filtered_instruction)
15
- return f"Chatbot erstellt mit ID: {chatbot.chatbot_id}", chatbot.chatbot_id, chatbot.name
 
 
 
 
16
 
17
  def create_chatbot_tab():
18
  with gr.Group():
 
2
  from utils.utils import get_secret
3
  from database import create_chatbot, filter_profanity
4
 
5
+ import logging
6
+ logging.basicConfig(level=logging.INFO)
7
+ logger = logging.getLogger(__name__)
8
+
9
  CREATE_APP_PW = get_secret("CREATE_APP_PW")
10
 
11
  def create_chatbot_interface(name, custom_instruction, password):
 
15
  filtered_name = filter_profanity(name)
16
  filtered_instruction = filter_profanity(custom_instruction)
17
 
18
+ try:
19
+ chatbot = create_chatbot(filtered_name, filtered_instruction)
20
+ return f"Chatbot erstellt mit ID: {chatbot.chatbot_id}", chatbot.chatbot_id, chatbot.name
21
+ except Exception as e:
22
+ logger.error(f"Error creating chatbot: {e}")
23
+ return "Fehler bei der Erstellung des Chatbots", None, None
24
 
25
  def create_chatbot_tab():
26
  with gr.Group():