internomega-terrablue Claude Sonnet 4.6 commited on
Commit
6235250
·
1 Parent(s): 186f0f5

fix: compact user chat bubble + move citations into expandable

Browse files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (2) hide show
  1. pages/chat.py +1 -7
  2. theme.py +2 -0
pages/chat.py CHANGED
@@ -21,16 +21,10 @@ def format_chatbot_messages(state: UserData) -> list[dict]:
21
  for msg in nb.messages:
22
  content = msg.content
23
  if msg.role == "assistant" and msg.citations:
24
- # Add citation chips
25
  chips = ""
26
  for c in msg.citations:
27
  chips += f'<span class="citation-chip">📄 {c["source"]} · p.{c["page"]}</span>'
28
- content += f"\n\n{chips}"
29
- # Add expandable passages
30
- passages = ""
31
- for c in msg.citations:
32
- passages += f'> *"{c["text"]}"*\n>\n> — **{c["source"]}**, page {c["page"]}\n\n'
33
- content += f"\n\n<details><summary>View cited passages</summary>\n\n{passages}</details>"
34
  formatted.append({"role": msg.role, "content": content})
35
  return formatted
36
 
 
21
  for msg in nb.messages:
22
  content = msg.content
23
  if msg.role == "assistant" and msg.citations:
 
24
  chips = ""
25
  for c in msg.citations:
26
  chips += f'<span class="citation-chip">📄 {c["source"]} · p.{c["page"]}</span>'
27
+ content += f"\n\n<details><summary>View cited passages</summary>\n\n{chips}\n\n</details>"
 
 
 
 
 
28
  formatted.append({"role": msg.role, "content": content})
29
  return formatted
30
 
theme.py CHANGED
@@ -188,6 +188,8 @@ CUSTOM_CSS = """
188
  color: white !important;
189
  border: none !important;
190
  box-shadow: 0 4px 14px rgba(102,126,234,0.25);
 
 
191
  }
192
  /* Assistant bubble */
193
  #chatbot .message.bot {
 
188
  color: white !important;
189
  border: none !important;
190
  box-shadow: 0 4px 14px rgba(102,126,234,0.25);
191
+ max-width: fit-content !important;
192
+ margin-left: auto !important;
193
  }
194
  /* Assistant bubble */
195
  #chatbot .message.bot {