mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-13 06:14:51 +00:00
Link only citations that have a source card to jump to
A pill for [N] beyond the answer's sources, or on an answer whose sources are hidden, scrolled to nothing.
This commit is contained in:
1 parent
2496374904
commit
845e39969e
2 files changed
+14
-4
No files matched your search
@@ -26,6 +26,8 @@ type AnswerFlowProps = {
|
||||
// Absent on reload, where the order is synthesized from the flat fields.
|
||||
segments?: AnswerSegment[];
|
||||
isStreaming?: boolean;
|
||||
/** How many sources the answer can cite; see `MarkdownAnswer`. */
|
||||
sourceCount?: number;
|
||||
agentId?: string;
|
||||
/** Set when the bubble already carries its own progress UI (a research run). */
|
||||
suppressStatusLine?: boolean;
|
||||
@@ -51,6 +53,7 @@ export default function AnswerFlow({
|
||||
toolCalls,
|
||||
segments,
|
||||
isStreaming,
|
||||
sourceCount,
|
||||
agentId,
|
||||
suppressStatusLine,
|
||||
artifacts,
|
||||
@@ -136,6 +139,7 @@ export default function AnswerFlow({
|
||||
<MarkdownAnswer
|
||||
content={message}
|
||||
isStreaming={isStreaming}
|
||||
sourceCount={sourceCount}
|
||||
artifacts={artifacts}
|
||||
turnArtifacts={turnArtifacts}
|
||||
onOpenArtifact={onOpenArtifact}
|
||||
|
||||
@@ -279,15 +279,18 @@ const ConversationBubble = forwardRef<
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
const showSources = !(
|
||||
DisableSourceFE ||
|
||||
type === 'ERROR' ||
|
||||
sources?.length === 0 ||
|
||||
sources?.some((source) => source.link === 'None')
|
||||
);
|
||||
bubble = (
|
||||
<div
|
||||
ref={ref}
|
||||
className={cn('flex flex-wrap self-start', className, 'group flex-col')}
|
||||
>
|
||||
{DisableSourceFE ||
|
||||
type === 'ERROR' ||
|
||||
sources?.length === 0 ||
|
||||
sources?.some((source) => source.link === 'None')
|
||||
{!showSources
|
||||
? null
|
||||
: sources && (
|
||||
// Stretched, not shrink-to-fit: the grid below sizes off this box,
|
||||
@@ -446,6 +449,9 @@ const ConversationBubble = forwardRef<
|
||||
toolCalls={toolCalls}
|
||||
segments={segments}
|
||||
isStreaming={isStreaming}
|
||||
// A citation pill jumps to a source card, so an answer whose
|
||||
// sources are not shown has nothing to cite.
|
||||
sourceCount={showSources ? (sources?.length ?? 0) : 0}
|
||||
agentId={agentId}
|
||||
// A research run already narrates itself above; the status line
|
||||
// would be a second live indicator away from the point of action.
|
||||
|
||||
Reference in new issue
Block a user