mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-12 11:26:07 +03:00
51de056e5f
Issue: https://github.com/users/StanGirard/projects/5/views/2?pane=issue&itemId=46291978 - Finalise steps based brain creation - Remove feature flag - Demo: <img width="1068" alt="Screenshot 2023-12-05 at 18 05 52" src="https://github.com/StanGirard/quivr/assets/63923024/99e38cab-d510-4bb5-8153-b0db406d1650"> https://github.com/StanGirard/quivr/assets/63923024/1850e2bd-5df1-43fe-be9e-261a3b90af2b https://github.com/StanGirard/quivr/assets/63923024/c7335679-b090-40ac-aece-fbaae0303d51
27 lines
728 B
TypeScript
27 lines
728 B
TypeScript
import {
|
|
FeedItemCrawlType,
|
|
FeedItemUploadType,
|
|
} from "@/app/chat/[chatId]/components/ActionsBar/types";
|
|
import { useKnowledgeToFeedContext } from "@/lib/context/KnowledgeToFeedProvider/hooks/useKnowledgeToFeedContext";
|
|
|
|
type UseKnowledgeToFeed = {
|
|
files: File[];
|
|
urls: string[];
|
|
};
|
|
export const useKnowledgeToFeedFilesAndUrls = (): UseKnowledgeToFeed => {
|
|
const { knowledgeToFeed } = useKnowledgeToFeedContext();
|
|
|
|
const files: File[] = (
|
|
knowledgeToFeed.filter((c) => c.source === "upload") as FeedItemUploadType[]
|
|
).map((c) => c.file);
|
|
|
|
const urls: string[] = (
|
|
knowledgeToFeed.filter((c) => c.source === "crawl") as FeedItemCrawlType[]
|
|
).map((c) => c.url);
|
|
|
|
return {
|
|
files,
|
|
urls,
|
|
};
|
|
};
|