Faran Butt
commited on
Commit
β’
b0f6bf5
1
Parent(s):
1285890
Updated Code with dummy fetch connections to apis
Browse files- package-lock.json +91 -0
- package.json +1 -0
- src/pages/index.tsx +17 -2
package-lock.json
CHANGED
@@ -22,6 +22,7 @@
|
|
22 |
"@types/node": "20.1.4",
|
23 |
"@types/react": "18.2.6",
|
24 |
"@types/react-dom": "18.2.4",
|
|
|
25 |
"class-variance-authority": "^0.7.0",
|
26 |
"clsx": "^2.0.0",
|
27 |
"eslint": "8.40.0",
|
@@ -1785,6 +1786,11 @@
|
|
1785 |
"resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.7.tgz",
|
1786 |
"integrity": "sha512-eBvWn1lvIApYMhzQMsu9ciLfkBY499mFZlNqG+/9WR7PVlroQw0vG30cOQQbaKz3sCEc44TAOu2ykzqXSNnwag=="
|
1787 |
},
|
|
|
|
|
|
|
|
|
|
|
1788 |
"node_modules/autoprefixer": {
|
1789 |
"version": "10.4.16",
|
1790 |
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.16.tgz",
|
@@ -1841,6 +1847,16 @@
|
|
1841 |
"node": ">=4"
|
1842 |
}
|
1843 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1844 |
"node_modules/axobject-query": {
|
1845 |
"version": "3.1.1",
|
1846 |
"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.1.1.tgz",
|
@@ -2116,6 +2132,17 @@
|
|
2116 |
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
2117 |
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
2118 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2119 |
"node_modules/commander": {
|
2120 |
"version": "4.1.1",
|
2121 |
"resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
|
@@ -2295,6 +2322,14 @@
|
|
2295 |
"url": "https://github.com/sponsors/ljharb"
|
2296 |
}
|
2297 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2298 |
"node_modules/didyoumean": {
|
2299 |
"version": "1.2.2",
|
2300 |
"resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz",
|
@@ -3078,6 +3113,25 @@
|
|
3078 |
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz",
|
3079 |
"integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ=="
|
3080 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3081 |
"node_modules/for-each": {
|
3082 |
"version": "0.3.3",
|
3083 |
"resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz",
|
@@ -3086,6 +3140,19 @@
|
|
3086 |
"is-callable": "^1.1.3"
|
3087 |
}
|
3088 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3089 |
"node_modules/fraction.js": {
|
3090 |
"version": "4.3.7",
|
3091 |
"resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz",
|
@@ -3992,6 +4059,25 @@
|
|
3992 |
"node": ">=8.6"
|
3993 |
}
|
3994 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3995 |
"node_modules/mimic-fn": {
|
3996 |
"version": "4.0.0",
|
3997 |
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz",
|
@@ -4648,6 +4734,11 @@
|
|
4648 |
"react-is": "^16.13.1"
|
4649 |
}
|
4650 |
},
|
|
|
|
|
|
|
|
|
|
|
4651 |
"node_modules/punycode": {
|
4652 |
"version": "2.3.0",
|
4653 |
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz",
|
|
|
22 |
"@types/node": "20.1.4",
|
23 |
"@types/react": "18.2.6",
|
24 |
"@types/react-dom": "18.2.4",
|
25 |
+
"axios": "^1.6.1",
|
26 |
"class-variance-authority": "^0.7.0",
|
27 |
"clsx": "^2.0.0",
|
28 |
"eslint": "8.40.0",
|
|
|
1786 |
"resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.7.tgz",
|
1787 |
"integrity": "sha512-eBvWn1lvIApYMhzQMsu9ciLfkBY499mFZlNqG+/9WR7PVlroQw0vG30cOQQbaKz3sCEc44TAOu2ykzqXSNnwag=="
|
1788 |
},
|
1789 |
+
"node_modules/asynckit": {
|
1790 |
+
"version": "0.4.0",
|
1791 |
+
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
1792 |
+
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
|
1793 |
+
},
|
1794 |
"node_modules/autoprefixer": {
|
1795 |
"version": "10.4.16",
|
1796 |
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.16.tgz",
|
|
|
1847 |
"node": ">=4"
|
1848 |
}
|
1849 |
},
|
1850 |
+
"node_modules/axios": {
|
1851 |
+
"version": "1.6.1",
|
1852 |
+
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.1.tgz",
|
1853 |
+
"integrity": "sha512-vfBmhDpKafglh0EldBEbVuoe7DyAavGSLWhuSm5ZSEKQnHhBf0xAAwybbNH1IkrJNGnS/VG4I5yxig1pCEXE4g==",
|
1854 |
+
"dependencies": {
|
1855 |
+
"follow-redirects": "^1.15.0",
|
1856 |
+
"form-data": "^4.0.0",
|
1857 |
+
"proxy-from-env": "^1.1.0"
|
1858 |
+
}
|
1859 |
+
},
|
1860 |
"node_modules/axobject-query": {
|
1861 |
"version": "3.1.1",
|
1862 |
"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.1.1.tgz",
|
|
|
2132 |
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
2133 |
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
2134 |
},
|
2135 |
+
"node_modules/combined-stream": {
|
2136 |
+
"version": "1.0.8",
|
2137 |
+
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
2138 |
+
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
2139 |
+
"dependencies": {
|
2140 |
+
"delayed-stream": "~1.0.0"
|
2141 |
+
},
|
2142 |
+
"engines": {
|
2143 |
+
"node": ">= 0.8"
|
2144 |
+
}
|
2145 |
+
},
|
2146 |
"node_modules/commander": {
|
2147 |
"version": "4.1.1",
|
2148 |
"resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
|
|
|
2322 |
"url": "https://github.com/sponsors/ljharb"
|
2323 |
}
|
2324 |
},
|
2325 |
+
"node_modules/delayed-stream": {
|
2326 |
+
"version": "1.0.0",
|
2327 |
+
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
2328 |
+
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
|
2329 |
+
"engines": {
|
2330 |
+
"node": ">=0.4.0"
|
2331 |
+
}
|
2332 |
+
},
|
2333 |
"node_modules/didyoumean": {
|
2334 |
"version": "1.2.2",
|
2335 |
"resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz",
|
|
|
3113 |
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz",
|
3114 |
"integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ=="
|
3115 |
},
|
3116 |
+
"node_modules/follow-redirects": {
|
3117 |
+
"version": "1.15.3",
|
3118 |
+
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz",
|
3119 |
+
"integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==",
|
3120 |
+
"funding": [
|
3121 |
+
{
|
3122 |
+
"type": "individual",
|
3123 |
+
"url": "https://github.com/sponsors/RubenVerborgh"
|
3124 |
+
}
|
3125 |
+
],
|
3126 |
+
"engines": {
|
3127 |
+
"node": ">=4.0"
|
3128 |
+
},
|
3129 |
+
"peerDependenciesMeta": {
|
3130 |
+
"debug": {
|
3131 |
+
"optional": true
|
3132 |
+
}
|
3133 |
+
}
|
3134 |
+
},
|
3135 |
"node_modules/for-each": {
|
3136 |
"version": "0.3.3",
|
3137 |
"resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz",
|
|
|
3140 |
"is-callable": "^1.1.3"
|
3141 |
}
|
3142 |
},
|
3143 |
+
"node_modules/form-data": {
|
3144 |
+
"version": "4.0.0",
|
3145 |
+
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
3146 |
+
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
3147 |
+
"dependencies": {
|
3148 |
+
"asynckit": "^0.4.0",
|
3149 |
+
"combined-stream": "^1.0.8",
|
3150 |
+
"mime-types": "^2.1.12"
|
3151 |
+
},
|
3152 |
+
"engines": {
|
3153 |
+
"node": ">= 6"
|
3154 |
+
}
|
3155 |
+
},
|
3156 |
"node_modules/fraction.js": {
|
3157 |
"version": "4.3.7",
|
3158 |
"resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz",
|
|
|
4059 |
"node": ">=8.6"
|
4060 |
}
|
4061 |
},
|
4062 |
+
"node_modules/mime-db": {
|
4063 |
+
"version": "1.52.0",
|
4064 |
+
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
4065 |
+
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
4066 |
+
"engines": {
|
4067 |
+
"node": ">= 0.6"
|
4068 |
+
}
|
4069 |
+
},
|
4070 |
+
"node_modules/mime-types": {
|
4071 |
+
"version": "2.1.35",
|
4072 |
+
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
4073 |
+
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
4074 |
+
"dependencies": {
|
4075 |
+
"mime-db": "1.52.0"
|
4076 |
+
},
|
4077 |
+
"engines": {
|
4078 |
+
"node": ">= 0.6"
|
4079 |
+
}
|
4080 |
+
},
|
4081 |
"node_modules/mimic-fn": {
|
4082 |
"version": "4.0.0",
|
4083 |
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz",
|
|
|
4734 |
"react-is": "^16.13.1"
|
4735 |
}
|
4736 |
},
|
4737 |
+
"node_modules/proxy-from-env": {
|
4738 |
+
"version": "1.1.0",
|
4739 |
+
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
4740 |
+
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
|
4741 |
+
},
|
4742 |
"node_modules/punycode": {
|
4743 |
"version": "2.3.0",
|
4744 |
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz",
|
package.json
CHANGED
@@ -37,6 +37,7 @@
|
|
37 |
"@types/node": "20.1.4",
|
38 |
"@types/react": "18.2.6",
|
39 |
"@types/react-dom": "18.2.4",
|
|
|
40 |
"class-variance-authority": "^0.7.0",
|
41 |
"clsx": "^2.0.0",
|
42 |
"eslint": "8.40.0",
|
|
|
37 |
"@types/node": "20.1.4",
|
38 |
"@types/react": "18.2.6",
|
39 |
"@types/react-dom": "18.2.4",
|
40 |
+
"axios": "^1.6.1",
|
41 |
"class-variance-authority": "^0.7.0",
|
42 |
"clsx": "^2.0.0",
|
43 |
"eslint": "8.40.0",
|
src/pages/index.tsx
CHANGED
@@ -3,13 +3,28 @@ import Link from "next/link";
|
|
3 |
import { useState } from "react";
|
4 |
import { Button } from "@/components/ui/button";
|
5 |
import { Input } from "@/components/ui/input";
|
6 |
-
|
7 |
export default function Home() {
|
8 |
const [file,setFile] = useState(null);
|
9 |
const [result,setResult] = useState('');
|
10 |
const handleFileChange = (event:any) => {
|
|
|
11 |
setFile(event.target.files[0]);
|
12 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
return (
|
14 |
<>
|
15 |
<Head>
|
@@ -36,7 +51,7 @@ export default function Home() {
|
|
36 |
<Input type='file' onChange={handleFileChange}/>
|
37 |
<p className="mt-1 text-sm text-gray-500 dark:text-gray-300" id="file_input_help">TXT, DOCX, PPTX, JPG, PNG, HTML or PDF</p>
|
38 |
</div>
|
39 |
-
<Button className='border-2 border-blue-500 bg-white text-blue-500 font-bold hover:text-white hover:bg-blue-500'>Submit</Button>
|
40 |
</div>
|
41 |
</div>
|
42 |
</div>
|
|
|
3 |
import { useState } from "react";
|
4 |
import { Button } from "@/components/ui/button";
|
5 |
import { Input } from "@/components/ui/input";
|
6 |
+
import axios from "axios";
|
7 |
export default function Home() {
|
8 |
const [file,setFile] = useState(null);
|
9 |
const [result,setResult] = useState('');
|
10 |
const handleFileChange = (event:any) => {
|
11 |
+
console.log(event.target.files[0])
|
12 |
setFile(event.target.files[0]);
|
13 |
}
|
14 |
+
const SendFile = async() => {
|
15 |
+
try{
|
16 |
+
const response = await axios.post('/embed',{
|
17 |
+
"collection_name": "{collection_name}",
|
18 |
+
"file_url": file
|
19 |
+
},{
|
20 |
+
headers:{
|
21 |
+
'Content-Type':"application/json"
|
22 |
+
}
|
23 |
+
})
|
24 |
+
}catch(error){
|
25 |
+
console.error('Error:', error);
|
26 |
+
}
|
27 |
+
}
|
28 |
return (
|
29 |
<>
|
30 |
<Head>
|
|
|
51 |
<Input type='file' onChange={handleFileChange}/>
|
52 |
<p className="mt-1 text-sm text-gray-500 dark:text-gray-300" id="file_input_help">TXT, DOCX, PPTX, JPG, PNG, HTML or PDF</p>
|
53 |
</div>
|
54 |
+
<Button className='border-2 border-blue-500 bg-white text-blue-500 font-bold hover:text-white hover:bg-blue-500' disabled={!file} onClick={SendFile} >Submit</Button>
|
55 |
</div>
|
56 |
</div>
|
57 |
</div>
|