TomLii commited on
Commit
7079bfe
ยท
1 Parent(s): e8728d6

Restructure UI into left chat and right utility panel

Browse files
Files changed (1) hide show
  1. app.py +84 -46
app.py CHANGED
@@ -22,6 +22,10 @@ DEFAULT_FREE_MODELS = [
22
  "meta-llama/Llama-3.1-8B-Instruct",
23
  ]
24
  DEFAULT_MODEL = os.getenv("DEFAULT_MODEL", DEFAULT_FREE_MODELS[0])
 
 
 
 
25
 
26
  SYSTEM_PROMPT = """You are a Deep Research assistant.
27
  You can think step by step, use tools, and then return a final answer.
@@ -125,6 +129,40 @@ CUSTOM_CSS = """
125
  color: #374151;
126
  margin-bottom: 8px;
127
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  """
129
 
130
 
@@ -421,58 +459,53 @@ with gr.Blocks(
421
  ),
422
  css=CUSTOM_CSS,
423
  ) as demo:
424
- gr.HTML(
425
- """
426
- <div class="banner-card">
427
- <div class="banner-inner">
428
- <div class="banner-title">QUEST Deep Research Agent</div>
429
- </div>
430
- <div class="banner-subtitle">
431
- Multi-turn research agent with search + visit tools. Start with free models now, switch to your own model later.
432
- </div>
433
- </div>
434
- """
435
- )
436
- with gr.Row(elem_classes="banner-inner"):
437
- with gr.Column(scale=2, elem_classes="banner-logo-wrap"):
438
- gr.Image(
439
- value=LOGO_PATH,
440
- show_label=False,
441
- container=False,
442
- interactive=False,
443
- show_download_button=False,
444
- show_fullscreen_button=False,
445
- elem_classes="banner-logo-image",
446
- )
447
- with gr.Column(scale=5):
448
- gr.Markdown("")
449
-
450
- with gr.Row():
451
- with gr.Column(scale=5):
452
  with gr.Group(elem_classes="section-card"):
453
- gr.HTML('<div class="section-title">Research Question</div>')
454
  question = gr.Textbox(
455
  show_label=False,
456
- placeholder="e.g. Compare top open-source deep research agents and summarize differences.",
457
  lines=6,
458
  )
459
  with gr.Row():
460
  run_btn = gr.Button("Run Research", variant="primary", size="lg")
461
  stop_btn = gr.Button("Stop", variant="stop", size="lg")
462
  clear_btn = gr.Button("Clear", variant="secondary", size="lg")
463
- gr.Examples(
464
- examples=[
465
- ["Compare RAG and fine-tuning: trade-offs, cost, and when to use each."],
466
- ["Summarize the differences between Qwen2.5, Llama 3.1, and Mistral 7B for agent tasks."],
467
- ["What are the key design patterns for long-context research agents?"],
468
- ],
469
- inputs=question,
470
- label="Quick Examples",
 
 
 
 
 
 
 
 
 
 
471
  )
472
 
473
- with gr.Column(scale=3):
474
  with gr.Group(elem_classes="section-card"):
475
- gr.HTML('<div class="section-title">Model & Runtime Settings</div>')
 
 
 
 
 
 
 
 
 
 
 
 
476
  model = gr.Dropdown(
477
  label="Model",
478
  choices=DEFAULT_FREE_MODELS,
@@ -488,12 +521,17 @@ with gr.Blocks(
488
  label="Temperature", minimum=0.0, maximum=1.5, value=0.4, step=0.1
489
  )
490
 
491
- with gr.Group(elem_classes="section-card"):
492
- with gr.Tabs():
493
- with gr.TabItem("Final Answer"):
494
- answer = gr.Markdown(label="Final Answer")
495
- with gr.TabItem("Execution Trace (JSON)"):
496
- trace = gr.Code(label="Execution Trace (JSON)", language="json")
 
 
 
 
 
497
 
498
  run_event = run_btn.click(
499
  fn=run_ui,
 
22
  "meta-llama/Llama-3.1-8B-Instruct",
23
  ]
24
  DEFAULT_MODEL = os.getenv("DEFAULT_MODEL", DEFAULT_FREE_MODELS[0])
25
+ PAPER_URL = os.getenv("PAPER_URL", "#")
26
+ CODE_URL = os.getenv("CODE_URL", "#")
27
+ DATASET_URL = os.getenv("DATASET_URL", "#")
28
+ MODEL_URL = os.getenv("MODEL_URL", "#")
29
 
30
  SYSTEM_PROMPT = """You are a Deep Research assistant.
31
  You can think step by step, use tools, and then return a final answer.
 
129
  color: #374151;
130
  margin-bottom: 8px;
131
  }
132
+
133
+ .layout-gap {
134
+ gap: 12px;
135
+ }
136
+
137
+ .right-stack > * {
138
+ margin-bottom: 10px;
139
+ }
140
+
141
+ .icon-grid {
142
+ display: grid;
143
+ grid-template-columns: repeat(2, minmax(0, 1fr));
144
+ gap: 8px;
145
+ }
146
+
147
+ .icon-link {
148
+ display: flex;
149
+ align-items: center;
150
+ justify-content: center;
151
+ gap: 6px;
152
+ padding: 8px 10px;
153
+ border: 1px solid #e5e7eb;
154
+ border-radius: 10px;
155
+ text-decoration: none !important;
156
+ color: #1f2937 !important;
157
+ background: #ffffff;
158
+ font-weight: 600;
159
+ font-size: 13px;
160
+ }
161
+
162
+ .icon-link:hover {
163
+ background: #f8fafc;
164
+ border-color: #cbd5e1;
165
+ }
166
  """
167
 
168
 
 
459
  ),
460
  css=CUSTOM_CSS,
461
  ) as demo:
462
+ with gr.Row(elem_classes="layout-gap"):
463
+ with gr.Column(scale=7):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
464
  with gr.Group(elem_classes="section-card"):
465
+ gr.HTML('<div class="section-title">Chat</div>')
466
  question = gr.Textbox(
467
  show_label=False,
468
+ placeholder="Ask anything you want to research...",
469
  lines=6,
470
  )
471
  with gr.Row():
472
  run_btn = gr.Button("Run Research", variant="primary", size="lg")
473
  stop_btn = gr.Button("Stop", variant="stop", size="lg")
474
  clear_btn = gr.Button("Clear", variant="secondary", size="lg")
475
+
476
+ with gr.Group(elem_classes="section-card"):
477
+ with gr.Tabs():
478
+ with gr.TabItem("Result"):
479
+ answer = gr.Markdown(label="Final Answer")
480
+ with gr.TabItem("Record"):
481
+ trace = gr.Code(label="Execution Trace (JSON)", language="json")
482
+
483
+ with gr.Column(scale=3, elem_classes="right-stack"):
484
+ with gr.Group(elem_classes="section-card"):
485
+ gr.Image(
486
+ value=LOGO_PATH,
487
+ show_label=False,
488
+ container=False,
489
+ interactive=False,
490
+ show_download_button=False,
491
+ show_fullscreen_button=False,
492
+ elem_classes="banner-logo-image",
493
  )
494
 
 
495
  with gr.Group(elem_classes="section-card"):
496
+ gr.HTML(
497
+ f"""
498
+ <div class="icon-grid">
499
+ <a class="icon-link" href="{PAPER_URL}" target="_blank" rel="noopener noreferrer">๐Ÿ“„ Paper</a>
500
+ <a class="icon-link" href="{CODE_URL}" target="_blank" rel="noopener noreferrer">๐Ÿ’ป Code</a>
501
+ <a class="icon-link" href="{DATASET_URL}" target="_blank" rel="noopener noreferrer">๐Ÿ—‚๏ธ Dataset</a>
502
+ <a class="icon-link" href="{MODEL_URL}" target="_blank" rel="noopener noreferrer">๐Ÿง  Model</a>
503
+ </div>
504
+ """
505
+ )
506
+
507
+ with gr.Group(elem_classes="section-card"):
508
+ gr.HTML('<div class="section-title">Settings</div>')
509
  model = gr.Dropdown(
510
  label="Model",
511
  choices=DEFAULT_FREE_MODELS,
 
521
  label="Temperature", minimum=0.0, maximum=1.5, value=0.4, step=0.1
522
  )
523
 
524
+ with gr.Group(elem_classes="section-card"):
525
+ gr.HTML('<div class="section-title">Recommended Dialogues</div>')
526
+ gr.Examples(
527
+ examples=[
528
+ ["Compare RAG and fine-tuning: trade-offs, cost, and when to use each."],
529
+ ["Summarize the differences between Qwen2.5, Llama 3.1, and Mistral 7B for agent tasks."],
530
+ ["What are the key design patterns for long-context research agents?"],
531
+ ],
532
+ inputs=question,
533
+ label="",
534
+ )
535
 
536
  run_event = run_btn.click(
537
  fn=run_ui,