mirror of
https://github.com/arc53/DocsGPT.git
synced 2026-05-02 06:56:29 +00:00
Merge pull request #970 from siiddhantt/feature/link-to-source
feat: remote sources have clickable links to original url
This commit is contained in:
@@ -69,6 +69,11 @@ class ClassicRAG(BaseRetriever):
|
|||||||
else i.page_content
|
else i.page_content
|
||||||
),
|
),
|
||||||
"text": i.page_content,
|
"text": i.page_content,
|
||||||
|
"source": (
|
||||||
|
i.metadata.get("source")
|
||||||
|
if i.metadata.get("source")
|
||||||
|
else "local"
|
||||||
|
),
|
||||||
}
|
}
|
||||||
for i in docs_temp
|
for i in docs_temp
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const ConversationBubble = forwardRef<
|
|||||||
className?: string;
|
className?: string;
|
||||||
feedback?: FEEDBACK;
|
feedback?: FEEDBACK;
|
||||||
handleFeedback?: (feedback: FEEDBACK) => void;
|
handleFeedback?: (feedback: FEEDBACK) => void;
|
||||||
sources?: { title: string; text: string }[];
|
sources?: { title: string; text: string; source: string }[];
|
||||||
}
|
}
|
||||||
>(function ConversationBubble(
|
>(function ConversationBubble(
|
||||||
{ message, type, className, feedback, handleFeedback, sources },
|
{ message, type, className, feedback, handleFeedback, sources },
|
||||||
@@ -177,7 +177,13 @@ const ConversationBubble = forwardRef<
|
|||||||
: 'bg-[#D7EBFD] hover:bg-[#BFE1FF]'
|
: 'bg-[#D7EBFD] hover:bg-[#BFE1FF]'
|
||||||
}`}
|
}`}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
setOpenSource(openSource === index ? null : index)
|
source.source !== 'local'
|
||||||
|
? window.open(
|
||||||
|
source.source,
|
||||||
|
'_blank',
|
||||||
|
'noopener, noreferrer',
|
||||||
|
)
|
||||||
|
: setOpenSource(openSource === index ? null : index)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<p
|
<p
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export interface Answer {
|
|||||||
answer: string;
|
answer: string;
|
||||||
query: string;
|
query: string;
|
||||||
result: string;
|
result: string;
|
||||||
sources: { title: string; text: string }[];
|
sources: { title: string; text: string; source: string }[];
|
||||||
conversationId: string | null;
|
conversationId: string | null;
|
||||||
title: string | null;
|
title: string | null;
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ export interface Query {
|
|||||||
response?: string;
|
response?: string;
|
||||||
feedback?: FEEDBACK;
|
feedback?: FEEDBACK;
|
||||||
error?: string;
|
error?: string;
|
||||||
sources?: { title: string; text: string }[];
|
sources?: { title: string; text: string; source: string }[];
|
||||||
conversationId?: string | null;
|
conversationId?: string | null;
|
||||||
title?: string | null;
|
title?: string | null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user