@@ -35,6 +35,7 @@ let peopleAnswer = "";
35
35
let knowledgeAnswer = "" ;
36
36
let toolsAnswer = "" ;
37
37
let gnomeAnswer = "" ;
38
+ let memeAnwser = "" ;
38
39
39
40
fetch ( 'https://tasks.aidevs.pl/token/helloapi' , {
40
41
method : 'POST' ,
@@ -810,19 +811,19 @@ fetch('https://tasks.aidevs.pl/token/ownapi', {
810
811
} )
811
812
. catch ( error => console . error ( 'Error:' , error ) ) ;
812
813
813
- // Example call to my API
814
- // fetch('https://frog01-21730.wykr.es/answer', {
815
- // method: 'POST',
816
- // headers: {
817
- // 'Content-Type': 'application/json'
818
- // },
819
- // body: JSON.stringify({ question: "What is the weather today?" })
820
- // })
821
- // .then(async (response) => {
822
- // const data = await response.json();
823
- // console.log(data);
824
- // })
825
- // .catch(error => console.error('Error:', error));
814
+ Example call to my API
815
+ fetch ( 'https://frog01-21730.wykr.es/answer' , {
816
+ method : 'POST' ,
817
+ headers : {
818
+ 'Content-Type' : 'application/json'
819
+ } ,
820
+ body : JSON . stringify ( { question : "What is the weather today?" } )
821
+ } )
822
+ . then ( async ( response ) => {
823
+ const data = await response . json ( ) ;
824
+ console . log ( data ) ;
825
+ } )
826
+ . catch ( error => console . error ( 'Error:' , error ) ) ;
826
827
827
828
fetch ( 'https://tasks.aidevs.pl/token/ownapipro' , {
828
829
@@ -854,58 +855,123 @@ fetch('https://tasks.aidevs.pl/token/ownapi', {
854
855
} )
855
856
. catch ( error => console . error ( 'Error:' , error ) ) ;
856
857
857
- // Example chat
858
- // fetch('http://localhost:3000/chat', {
858
+ Example chat
859
+ fetch ( 'http://localhost:3000/chat' , {
859
860
860
- // method: 'POST',
861
- // headers: {
862
- // 'Content-Type': 'application/json'
863
- // },
864
- // body: JSON.stringify({ question: "I'm 5 years old. How old am I?" })
865
- // })
866
- // .then(async (response) => {
867
- // const data = await response.json();
868
- // const answer = data.reply;
869
- // console.log(answer);
870
- // fetch('http://localhost:3000/chat', {
861
+ method : 'POST' ,
862
+ headers : {
863
+ 'Content-Type' : 'application/json'
864
+ } ,
865
+ body : JSON . stringify ( { question : "I'm 5 years old. How old am I?" } )
866
+ } )
867
+ . then ( async ( response ) => {
868
+ const data = await response . json ( ) ;
869
+ const answer = data . reply ;
870
+ console . log ( answer ) ;
871
+ fetch ( 'http://localhost:3000/chat' , {
871
872
872
- // method: 'POST',
873
- // headers: {
874
- // 'Content-Type': 'application/json'
875
- // },
876
- // body: JSON.stringify({ question: "My name is Mike. How old am I?" })
877
- // }).then(async (response) => {
878
- // const data = await response.json();
879
- // const answer = data.reply;
880
- // console.log(answer);
881
- // fetch('http://localhost:3000/chat', {
873
+ method : 'POST' ,
874
+ headers : {
875
+ 'Content-Type' : 'application/json'
876
+ } ,
877
+ body : JSON . stringify ( { question : "My name is Mike. How old am I?" } )
878
+ } ) . then ( async ( response ) => {
879
+ const data = await response . json ( ) ;
880
+ const answer = data . reply ;
881
+ console . log ( answer ) ;
882
+ fetch ( 'http://localhost:3000/chat' , {
882
883
883
- // method: 'POST',
884
- // headers: {
885
- // 'Content-Type': 'application/json'
886
- // },
887
- // body: JSON.stringify({ question: "What's my name? I'm from Ohio." })
888
- // }).then(async (response) => {
889
- // const data = await response.json();
890
- // const answer = data.reply;
891
- // console.log(answer);
892
- // });
893
- // });
894
- // // const taskUrl = `https://tasks.aidevs.pl/task/${token}`;
895
- // // const response2 = await makeRequestWithDelay(taskUrl, {
896
- // // method: 'GET',
897
- // // headers: {
898
- // // 'Content-Type': 'application/json'
899
- // // }
900
- // // }, 10);
901
- // // console.log(response2)
902
- // // const response4 = await makeRequestWithDelay(`https://tasks.aidevs.pl/answer/${token}`, {
903
- // // method: 'POST',
904
- // // headers: {
905
- // // 'Content-Type': 'application/json'
906
- // // },
907
- // // body: JSON.stringify({answer: 'https://frog01-21730.wykr.es/answer'})
908
- // // }, 10);
909
- // // console.log('Answer from API', response4);
910
- // })
911
- // .catch(error => console.error('Error:', error));
884
+ method : 'POST' ,
885
+ headers : {
886
+ 'Content-Type' : 'application/json'
887
+ } ,
888
+ body : JSON . stringify ( { question : "What's my name? I'm from Ohio." } )
889
+ } ) . then ( async ( response ) => {
890
+ const data = await response . json ( ) ;
891
+ const answer = data . reply ;
892
+ console . log ( answer ) ;
893
+ } ) ;
894
+ } ) ;
895
+ // const taskUrl = `https://tasks.aidevs.pl/task/${token}`;
896
+ // const response2 = await makeRequestWithDelay(taskUrl, {
897
+ // method: 'GET',
898
+ // headers: {
899
+ // 'Content-Type': 'application/json'
900
+ // }
901
+ // }, 10);
902
+ // console.log(response2)
903
+ // const response4 = await makeRequestWithDelay(`https://tasks.aidevs.pl/answer/${token}`, {
904
+ // method: 'POST',
905
+ // headers: {
906
+ // 'Content-Type': 'application/json'
907
+ // },
908
+ // body: JSON.stringify({answer: 'https://frog01-21730.wykr.es/answer'})
909
+ // }, 10);
910
+ // console.log('Answer from API', response4);
911
+ } )
912
+ . catch ( error => console . error ( 'Error:' , error ) ) ;
913
+
914
+ fetch ( 'https://tasks.aidevs.pl/token/meme' , {
915
+ method : 'POST' ,
916
+ headers : {
917
+ 'Content-Type' : 'application/json'
918
+ } ,
919
+ body : JSON . stringify ( { apikey : APIKey } )
920
+ } )
921
+ . then ( async ( response ) => {
922
+ const data = await response . json ( ) ;
923
+ const token = data . token ;
924
+ const taskUrl = `https://tasks.aidevs.pl/task/${ token } ` ;
925
+ const response2 = await makeRequestWithDelay ( taskUrl , {
926
+ method : 'GET' ,
927
+ headers : {
928
+ 'Content-Type' : 'application/json'
929
+ }
930
+ } , 10 ) ;
931
+ console . log ( response2 )
932
+ fetch ( 'https://get.renderform.io/api/v2/render' , {
933
+ method : 'POST' ,
934
+ headers : {
935
+ 'Content-Type' : 'application/json' ,
936
+ 'X-API-KEY' : 'key-XZc3QNWlmEqDUremH04CUjntXDE75bCED6'
937
+ } ,
938
+ body : JSON . stringify ( {
939
+ template : 'silly-hares-race-loosely-1467' ,
940
+ data : {
941
+ 'title.text' : '#FFFFFF' ,
942
+ 'title.text' : response2 . text ,
943
+ 'image.src' : response2 . image
944
+ } ,
945
+ "fileName" : "automation-meme" ,
946
+ "version" : "my-cache-key" ,
947
+ "metadata" : {
948
+ "my-text.text" : "Automation"
949
+ } ,
950
+ "batchName" : "my-batch-name"
951
+ } )
952
+ } ) . then ( async ( response ) => {
953
+ const data = await response . json ( ) ;
954
+ memeAnwser = data . href ;
955
+ const response4 = await makeRequestWithDelay ( `https://tasks.aidevs.pl/answer/${ token } ` , {
956
+ method : 'POST' ,
957
+ headers : {
958
+ 'Content-Type' : 'application/json'
959
+ } ,
960
+ body : JSON . stringify ( { answer : memeAnwser } )
961
+ } , 10 ) ;
962
+ console . log ( response4 ) ;
963
+
964
+ } )
965
+ . catch ( error => console . error ( 'Error:' , error ) ) ;
966
+
967
+
968
+ // const response4 = await makeRequestWithDelay(`https://tasks.aidevs.pl/answer/${token}`, {
969
+ // method: 'POST',
970
+ // headers: {
971
+ // 'Content-Type': 'application/json'
972
+ // },
973
+ // body: JSON.stringify({answer: 'https://frog01-21730.wykr.es/chat'})
974
+ // }, 10);
975
+ // console.log('Answer from API', response4);
976
+ } )
977
+ . catch ( error => console . error ( 'Error:' , error ) ) ;
0 commit comments