ochyai commited on
Commit
1338dd1
·
verified ·
1 Parent(s): 6b84ca2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -9,10 +9,10 @@ def chat_with_openai(user_input, history):
9
  if history is None:
10
  history = []
11
  # OpenAI APIに送信するメッセージの構築
12
- messages = [{"role": "system", "content": "You are a helpful assistant."}]
13
  for human, assistant in history:
14
  messages.append({"role": "user", "content": human})
15
- if assistant is not None:
16
  messages.append({"role": "assistant", "content": assistant})
17
  messages.append({"role": "user", "content": user_input})
18
 
@@ -33,13 +33,14 @@ with gr.Blocks() as demo:
33
  state = gr.State([])
34
 
35
  with gr.Row():
36
- with gr.Column(scale=0.85):
37
  txt = gr.Textbox(
38
  show_label=False,
39
  placeholder="メッセージを入力してください...",
40
- lines=1
41
- ).style(container=False)
42
- with gr.Column(scale=0.15, min_width=0):
 
43
  btn = gr.Button("送信")
44
 
45
  def on_submit(user_input, chat_history):
 
9
  if history is None:
10
  history = []
11
  # OpenAI APIに送信するメッセージの構築
12
+ messages = []
13
  for human, assistant in history:
14
  messages.append({"role": "user", "content": human})
15
+ if assistant:
16
  messages.append({"role": "assistant", "content": assistant})
17
  messages.append({"role": "user", "content": user_input})
18
 
 
33
  state = gr.State([])
34
 
35
  with gr.Row():
36
+ with gr.Column(scale=8):
37
  txt = gr.Textbox(
38
  show_label=False,
39
  placeholder="メッセージを入力してください...",
40
+ lines=1,
41
+ container=False
42
+ )
43
+ with gr.Column(scale=2, min_width=0):
44
  btn = gr.Button("送信")
45
 
46
  def on_submit(user_input, chat_history):