TheoLvs commited on
Commit
eda3a25
1 Parent(s): d26538b

Test of scrollable sources

Browse files
Files changed (2) hide show
  1. app.py +2 -2
  2. style.css +5 -1
app.py CHANGED
@@ -82,7 +82,7 @@ def parse_output_llm_with_sources(output):
82
  if part.startswith("Doc"):
83
  subparts = part.split(",")
84
  subparts = [subpart.lower().replace("doc","").strip() for subpart in subparts]
85
- subparts = [f"<span class='doc-ref'><sup>{subpart}</sup></span>" for subpart in subparts]
86
  parts.append("".join(subparts))
87
  else:
88
  parts.append(part)
@@ -322,7 +322,7 @@ def make_html_source(source,i):
322
  if meta["chunk_type"] == "text":
323
 
324
  card = f"""
325
- <div class="card">
326
  <div class="card-content">
327
  <h2>Doc {i} - {meta['short_name']} - Page {int(meta['page_number'])}</h2>
328
  <p>{content}</p>
 
82
  if part.startswith("Doc"):
83
  subparts = part.split(",")
84
  subparts = [subpart.lower().replace("doc","").strip() for subpart in subparts]
85
+ subparts = [f"""<a href="#doc{subpart}" class="a-doc-ref" target="_self"><span class='doc-ref'><sup>{subpart}</sup></span></a>""" for subpart in subparts]
86
  parts.append("".join(subparts))
87
  else:
88
  parts.append(part)
 
322
  if meta["chunk_type"] == "text":
323
 
324
  card = f"""
325
+ <div class="card" id="doc{i}">
326
  <div class="card-content">
327
  <h2>Doc {i} - {meta['short_name']} - Page {int(meta['page_number'])}</h2>
328
  <p>{content}</p>
style.css CHANGED
@@ -358,4 +358,8 @@ span.chatbot > p > img{
358
  #tab-examples > div > .form{
359
  border:none;
360
  background:none !important;
361
- }
 
 
 
 
 
358
  #tab-examples > div > .form{
359
  border:none;
360
  background:none !important;
361
+ }
362
+
363
+ .a-doc-ref{
364
+ text-decoration: none !important;
365
+ }