grimjim commited on
Commit
c32cd1c
·
1 Parent(s): 1f92812
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -293,7 +293,7 @@ def run_completion(
293
  def generate_opening(request: gr.Request):
294
  state = get_state(request)
295
  if state.get("opening"):
296
- return [("", state["opening"])]
297
 
298
  print("Generating opening scene", flush=True)
299
  llm = get_llm()
@@ -314,7 +314,7 @@ def generate_opening(request: gr.Request):
314
  opening = opening.strip() or "You come to under a failing fluorescent light."
315
  state["opening"] = opening
316
  state["last_event"] = opening
317
- return [("", opening)]
318
 
319
 
320
  def respond(
@@ -355,10 +355,11 @@ def respond(
355
  yield response
356
 
357
 
358
- chat_window = gr.Chatbot()
359
 
360
  chatbot = gr.ChatInterface(
361
  respond,
 
362
  chatbot=chat_window,
363
  additional_inputs=[
364
  gr.Textbox(value=DEFAULT_SYSTEM_PROMPT, label="Narration policy"),
 
293
  def generate_opening(request: gr.Request):
294
  state = get_state(request)
295
  if state.get("opening"):
296
+ return [{"role": "assistant", "content": state["opening"]}]
297
 
298
  print("Generating opening scene", flush=True)
299
  llm = get_llm()
 
314
  opening = opening.strip() or "You come to under a failing fluorescent light."
315
  state["opening"] = opening
316
  state["last_event"] = opening
317
+ return [{"role": "assistant", "content": opening}]
318
 
319
 
320
  def respond(
 
355
  yield response
356
 
357
 
358
+ chat_window = gr.Chatbot(type="messages")
359
 
360
  chatbot = gr.ChatInterface(
361
  respond,
362
+ type="messages",
363
  chatbot=chat_window,
364
  additional_inputs=[
365
  gr.Textbox(value=DEFAULT_SYSTEM_PROMPT, label="Narration policy"),