-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into azure_model
# Conflicts: # platform/poetry.lock # platform/pyproject.toml # platform/reworkd_platform/tests/test_settings.py # platform/reworkd_platform/web/api/workflow/blocks/web/__init__.py # platform/reworkd_platform/web/api/workflowchat/views.py
- Loading branch information
Showing
99 changed files
with
947 additions
and
7,119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import clsx from "clsx"; | ||
import { SyntheticEvent } from "react"; | ||
import SourceLink from "./SourceLink"; | ||
import { api } from "../../utils/api"; | ||
|
||
interface MessageInfo { | ||
messageInfo: string; | ||
} | ||
|
||
const SourceCard = ({ messageInfo }: MessageInfo) => { | ||
const regex = /(?=\[(!\[.+?\]\(.+?\)|.+?)]\((https?:\/\/[^\)]+)\))/gi; | ||
const linksSet = new Set<string>(); | ||
const linksMatches = [...messageInfo.matchAll(regex)]; | ||
linksMatches.forEach((m) => linksSet.add(m[2] as string)); | ||
const linksArray = Array.from(linksSet); | ||
|
||
if (linksArray.length === 0) return null; | ||
|
||
return ( | ||
<> | ||
<hr className="my-2 border border-white/20" /> | ||
<div className="grid grid-cols-2 gap-2 md:grid-cols-3 lg:grid-cols-4" > | ||
{linksArray.map((link, index) => { | ||
return <SourceLink key={link} link={link} index={index} />; | ||
})} | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default SourceCard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import type { SyntheticEvent } from "react"; | ||
|
||
import { api } from "../../utils/api"; | ||
import FadeIn from "../motions/FadeIn"; | ||
|
||
interface LinkInfo { | ||
link: string; | ||
index: number; | ||
} | ||
|
||
const SourceLink = ({ link, index }: LinkInfo) => { | ||
const linkMeta = api.linkMeta.get.useQuery(link); | ||
const addImageFallback = (event: SyntheticEvent<HTMLImageElement, Event>) => { | ||
event.currentTarget.src = "/errorFavicon.ico"; | ||
}; | ||
|
||
return ( | ||
<FadeIn> | ||
<a href={link} target="_blank"> | ||
<div className="group h-full space-y-2 rounded border border-white/20 bg-white/5 p-2 transition-colors duration-300 hover:bg-white/10"> | ||
{linkMeta.isLoading ? ( | ||
<div className="animate-pulse space-y-2"> | ||
<div className="h-2 rounded bg-gray-500"></div> | ||
<div className="h-2 rounded bg-gray-500"></div> | ||
<div className="flex items-center gap-2"> | ||
<div className="h-4 w-4 rounded bg-gray-500"></div> | ||
<div className="h-2 w-2/3 rounded bg-gray-500"></div> | ||
</div> | ||
</div> | ||
) : linkMeta.isSuccess ? ( | ||
<> | ||
<p className="line-clamp-2 text-xs">{linkMeta.data.title}</p> | ||
<div className="flex gap-2"> | ||
<img | ||
className="inline h-4 w-4" | ||
src={linkMeta.data.favicon || ""} | ||
alt="Logo" | ||
onError={addImageFallback} | ||
/> | ||
<p className="line-clamp-1">{linkMeta.data.hostname}</p> | ||
<p className="rounded-full bg-white/20 px-1 text-gray-300 transition-colors duration-300 group-hover:bg-sky-600"> | ||
{index + 1} | ||
</p> | ||
</div> | ||
</> | ||
) : linkMeta.isError ? ( | ||
<div className="flex gap-2"> | ||
<p className="line-clamp-1">{link}</p> | ||
<p className="rounded-full bg-white/20 px-1 text-gray-300">{index + 1}</p> | ||
</div> | ||
) : null} | ||
</div> | ||
</a> | ||
</FadeIn> | ||
); | ||
}; | ||
|
||
export default SourceLink; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.