Blood076 commited on
Commit
a4fd8f9
verified
1 Parent(s): d029d41

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -22,11 +22,12 @@ def respond(
22
  messages.append({"role": "Narrator", "content": initial_context_message})
23
 
24
  # Processa o hist贸rico para adicionar ao contexto
25
- for val in history:
26
- if val[0]:
27
- messages.append({"role": "user", "content": val[0]})
28
- if val[1]:
29
- messages.append({"role": "Narrator", "content": val[1]})
 
30
 
31
  # Adiciona a nova mensagem do usu谩rio
32
  messages.append({"role": "user", "content": message})
@@ -108,7 +109,7 @@ with gr.Blocks() as demo:
108
  chat_interface = gr.Interface(
109
  fn=respond,
110
  inputs=[chat_input, character, initial_context_message, max_tokens, temperature, top_p],
111
- outputs=initial_context_message,
112
  title="King B",
113
  description="Story",
114
  )
 
22
  messages.append({"role": "Narrator", "content": initial_context_message})
23
 
24
  # Processa o hist贸rico para adicionar ao contexto
25
+ for val in history:
26
+ if len(val) > 0 and val[0]: # Verifica se existe um primeiro elemento
27
+ messages.append({"role": "user", "content": val[0]})
28
+ if len(val) > 1 and val[1]: # Verifica se existe um segundo elemento
29
+ messages.append({"role": "narrator", "content": val[1]})
30
+
31
 
32
  # Adiciona a nova mensagem do usu谩rio
33
  messages.append({"role": "user", "content": message})
 
109
  chat_interface = gr.Interface(
110
  fn=respond,
111
  inputs=[chat_input, character, initial_context_message, max_tokens, temperature, top_p],
112
+ outputs=chat_output,
113
  title="King B",
114
  description="Story",
115
  )