mirror of
https://github.com/wassname/stampy-chat.git
synced 2026-09-11 12:50:34 +08:00
Merge pull request #56 from StampyAI/duckduckgo
link to duckduckgo when url field empty
This commit is contained in:
@@ -72,9 +72,14 @@ const ShowCitation: React.FC<{citation: Citation, i: number}> = ({citation, i})
|
||||
if (citation.date && citation.date !== "")
|
||||
c_str += " - " + citation.date;
|
||||
|
||||
// if we don't have a url, link to a duckduckgo search for the title instead
|
||||
const url = citation.url && citation.url !== ""
|
||||
? citation.url
|
||||
: `https://duckduckgo.com/?q=${encodeURIComponent(citation.title)}`;
|
||||
|
||||
return (
|
||||
<A className={Colours[i % Colours.length] + " border-2 flex items-center rounded my-2 text-sm no-underline w-fit"}
|
||||
href={citation.url}>
|
||||
href={url}>
|
||||
<span className="mx-1"> [{i + 1}] </span>
|
||||
<p className="mx-1 my-0"> {c_str} </p>
|
||||
</A>
|
||||
|
||||
Reference in New Issue
Block a user