源码
packages/ui/src/components/answer-sources.css
.message-action.answer-sources-trigger {
flex-shrink: 1;
width: auto;
min-width: 0;
max-width: 100%;
gap: 7px;
padding: 0 6px;
color: var(--color-text-subtle);
font-size: var(--text-small);
white-space: nowrap;
}
.answer-sources-trigger > span:last-child {
flex-shrink: 0;
}
.assistant-message-actions:has(.answer-sources-trigger) .message-time {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.assistant-message-actions:has(.answer-sources-trigger[data-state="open"]) {
opacity: 1;
}
.answer-sources-icons {
display: inline-flex;
flex: 0 1 auto;
min-width: 0;
align-items: center;
overflow: hidden;
padding-left: 4px;
}
.answer-source-icon {
display: inline-flex;
flex: 0 0 20px;
align-items: center;
justify-content: center;
width: 20px;
height: 20px;
overflow: hidden;
border: 2px solid var(--color-popover);
border-radius: 50%;
background: var(--color-surface-muted);
color: var(--color-text-subtle);
}
.answer-sources-icons > .answer-source-icon {
margin-left: -4px;
}
.answer-source-icon > img {
display: block;
width: 100%;
height: 100%;
object-fit: contain;
}
/* This content is portaled outside the conversation and owns its complete layout. */
.answer-sources-popover {
z-index: var(--layer-popover);
display: flex;
flex-direction: column;
width: 420px;
max-width: min(calc(100vw - 24px), var(--radix-popover-content-available-width, 420px));
max-height: min(480px, 65vh, var(--radix-popover-content-available-height, 480px));
overflow: hidden;
padding: 0;
border: 1px solid var(--color-border-strong);
border-radius: 12px;
background: var(--color-popover);
color: var(--color-foreground);
box-shadow: var(--shadow-popover);
font-family: var(--font-body);
font-size: var(--text-small);
font-weight: 400;
line-height: 1.5;
text-align: left;
white-space: normal;
}
.answer-sources-popover,
.answer-sources-popover * {
box-sizing: border-box;
}
.answer-sources-heading {
display: flex;
flex-shrink: 0;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 10px 14px;
border-bottom: 1px solid var(--color-border);
color: var(--color-text-subtle);
font-weight: 500;
}
.answer-sources-count {
margin-left: 4px;
font-weight: 400;
}
.answer-sources-close {
display: inline-flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
padding: 0;
border: 0;
border-radius: 6px;
background: transparent;
color: inherit;
cursor: pointer;
}
.answer-sources-list {
min-height: 0;
margin: 0;
padding: 0 6px;
overflow: auto;
overscroll-behavior: contain;
list-style: none;
}
.answer-source-item {
margin: 0;
padding: 0;
}
.answer-source-item + .answer-source-item {
border-top: 1px solid var(--color-border);
}
.answer-source-link {
display: flex;
flex-direction: column;
align-items: stretch;
gap: 4px;
width: 100%;
min-width: 0;
margin: 3px 0;
padding: 11px 8px;
border: 0;
border-radius: 7px;
background: transparent;
color: inherit;
font: inherit;
text-align: left;
overflow-wrap: anywhere;
cursor: pointer;
}
.answer-source-link:hover,
.answer-sources-close:hover,
.answer-sources-trigger[data-state="open"] {
background: var(--color-fill-hover);
}
.answer-source-link:focus-visible,
.answer-sources-close:focus-visible,
.answer-sources-trigger:focus-visible {
box-shadow: inset 0 0 0 2px var(--color-text-subtle);
}
.answer-source-site {
display: flex;
min-width: 0;
align-items: center;
gap: 7px;
color: var(--color-text-subtle);
font-size: var(--text-xs);
}
.answer-source-site > span:last-child {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.answer-source-title,
.answer-source-excerpt {
display: -webkit-box;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
}
.answer-source-title {
font-weight: 500;
line-height: 1.4;
}
.answer-source-date,
.answer-source-excerpt {
color: var(--color-text-subtle);
font-size: var(--text-small);
}