ivanoctaviogaitansantos commited on
Commit
bbafee3
verified
1 Parent(s): 5bb7c4b

Actualizar app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -14
app.py CHANGED
@@ -4,23 +4,24 @@ from orchestrator import SuperOrchestrator, SuperConfig
4
 
5
  def main():
6
  config = SuperConfig(
7
- openai_api_key=os.getenv("OPENAI_API_KEY", ""),
8
- deepseek_api_key=os.getenv("DEEPSEEK_API_KEY", ""),
9
- gemini_api_key=os.getenv("GEMINI_API_KEY", ""),
10
- enable_local_models=False,
11
- debug_mode=False,
12
  )
13
- orchestrator = SuperOrchestrator(config)
14
 
15
  def responde(message, history, task_type):
16
- response = orchestrator.process(message, task_type)
17
- return history + [[message, response.content]]
 
18
 
19
  with gr.Blocks() as demo:
20
  gr.Markdown("# 馃 Super Chatbot Multi-Agente")
21
  chat = gr.Chatbot()
22
  with gr.Row():
23
- msg = gr.Textbox(placeholder="Escribe tu mensaje aqu铆...")
24
  task_type = gr.Dropdown(
25
  choices=[
26
  "conversaci贸n","c贸digo","depuraci贸n","explicaci贸n_c贸digo",
@@ -30,12 +31,12 @@ def main():
30
  value="conversaci贸n",
31
  label="Tipo de tarea"
32
  )
33
- send = gr.Button("Enviar")
34
- clear = gr.Button("Limpiar chat")
35
 
36
- send.click(responde, inputs=[msg, chat, task_type], outputs=chat)
37
- msg.submit(responde, inputs=[msg, chat, task_type], outputs=chat)
38
- clear.click(lambda: [], outputs=chat)
39
 
40
  demo.launch()
41
 
 
4
 
5
  def main():
6
  config = SuperConfig(
7
+ deepseek_api_key=os.getenv("DEEPSEEK_KEY", ""),
8
+ openai_api_key=os.getenv("OPENAI_KEY", ""),
9
+ hf_token=os.getenv("HF_TOKEN", ""),
10
+ enable_local_models=True,
11
+ debug_mode=True
12
  )
13
+ orb = SuperOrchestrator(config)
14
 
15
  def responde(message, history, task_type):
16
+ resp = orb.process(message, task_type)
17
+ history.append([message, resp.content])
18
+ return history, history
19
 
20
  with gr.Blocks() as demo:
21
  gr.Markdown("# 馃 Super Chatbot Multi-Agente")
22
  chat = gr.Chatbot()
23
  with gr.Row():
24
+ msg = gr.Textbox(label="Escribe tu mensaje", placeholder="驴Qu茅 necesitas?")
25
  task_type = gr.Dropdown(
26
  choices=[
27
  "conversaci贸n","c贸digo","depuraci贸n","explicaci贸n_c贸digo",
 
31
  value="conversaci贸n",
32
  label="Tipo de tarea"
33
  )
34
+ enviar = gr.Button("Enviar")
35
+ limpiar = gr.Button("Limpiar chat")
36
 
37
+ enviar.click(responde, inputs=[msg, chat, task_type], outputs=[chat, chat])
38
+ msg.submit(responde, inputs=[msg, chat, task_type], outputs=[chat, chat])
39
+ limpiar.click(lambda: [], outputs=[chat])
40
 
41
  demo.launch()
42