mirror of https://github.com/arc53/DocsGPT
commit
8b9ecc5965
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,3 @@
|
|||||||
|
<svg width="10" height="5" viewBox="0 0 10 5" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M0 0L5 5L10 0H0Z" fill="black" fill-opacity="0.54"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 163 B |
@ -1,33 +0,0 @@
|
|||||||
//Exporting Doc type from here since its the first place its used and seems needless to make an entire file for it.
|
|
||||||
export type Doc = {
|
|
||||||
name: string;
|
|
||||||
language: string;
|
|
||||||
version: string;
|
|
||||||
description: string;
|
|
||||||
fullName: string;
|
|
||||||
dat: string;
|
|
||||||
docLink: string;
|
|
||||||
model: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
//Fetches all JSON objects from the source. We only use the objects with the "model" property in SelectDocsModal.tsx. Hopefully can clean up the source file later.
|
|
||||||
export async function getDocs(): Promise<Doc[] | null> {
|
|
||||||
try {
|
|
||||||
//Fetch default source docs
|
|
||||||
const response = await fetch(
|
|
||||||
'https://d3dg1063dc54p9.cloudfront.net/combined.json',
|
|
||||||
);
|
|
||||||
const data = await response.json();
|
|
||||||
|
|
||||||
//Create array of Doc objects
|
|
||||||
const docs: Doc[] = [];
|
|
||||||
|
|
||||||
data.forEach((doc: object) => {
|
|
||||||
docs.push(doc as Doc);
|
|
||||||
});
|
|
||||||
|
|
||||||
return docs;
|
|
||||||
} catch (error) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue