diff options
Diffstat (limited to 'src/client/views/newlightbox/utils.ts')
-rw-r--r-- | src/client/views/newlightbox/utils.ts | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/client/views/newlightbox/utils.ts b/src/client/views/newlightbox/utils.ts index 29b83c4e0..6016abca4 100644 --- a/src/client/views/newlightbox/utils.ts +++ b/src/client/views/newlightbox/utils.ts @@ -9,9 +9,18 @@ export interface IDocRequest { } export const fetchRecommendations = async (src: string, query: string, docs?: IDocRequest[], dummy?: boolean) => { - console.log("making request with: ", query) + console.log("[rec] making request") if (dummy) { - return dummyRecs; + return { + "recommendations": dummyRecs, + "keywords": dummyKeywords, + "num_recommendations": 4, + "max_x": 100, + "max_y": 100, + "min_x": 0, + "min_y": 0 + + }; } const response = await fetch('http://127.0.0.1:8000/recommend', { method: 'POST', @@ -31,9 +40,11 @@ export const fetchRecommendations = async (src: string, query: string, docs?: ID } export const fetchKeywords = async (text: string, n: number, dummy?: boolean) => { - console.log("making request with: ", text) + console.log("[fetchKeywords]") if (dummy) { - return dummyKeywords; + return { + "keywords": dummyKeywords + }; } const response = await fetch('http://127.0.0.1:8000/keywords', { method: 'POST', @@ -69,8 +80,8 @@ export const getType = (type: DocumentType | string) => { } } -const dummyRecs: IRecommendation[] = [ - { +const dummyRecs = { + "a": { title: 'Vannevar Bush - American Engineer', previewUrl: 'https://cdn.britannica.com/98/23598-004-1E6A382E/Vannevar-Bush-Differential-Analyzer-1935.jpg', type: 'web', @@ -82,14 +93,14 @@ const dummyRecs: IRecommendation[] = [ y: 0 } }, - { + "b": { title: "From Memex to hypertext: Vannevar Bush and the mind's machine", type: 'pdf', distance: 5.4, source: 'Google Scholar', related_concepts: ['memex', 'vannevar bush', 'hypertext'], }, - { + "c": { title: 'How the hyperlink changed everything | Small Thing Big Idea, a TED series', previewUrl: 'https://pi.tedcdn.com/r/talkstar-photos.s3.amazonaws.com/uploads/b17d043f-2642-4117-a913-52204505513f/MargaretGouldStewart_2018V-embed.jpg?u%5Br%5D=2&u%5Bs%5D=0.5&u%5Ba%5D=0.8&u%5Bt%5D=0.03&quality=82w=640', type: 'youtube', @@ -97,7 +108,7 @@ const dummyRecs: IRecommendation[] = [ source: 'www.youtube.com', related_concepts: ['User Control', 'Explanations'] }, - { + "d": { title: 'Recommender Systems: Behind the Scenes of Machine Learning-Based Personalization', previewUrl: 'https://sloanreview.mit.edu/wp-content/uploads/2018/10/MAG-Ransbotham-Ratings-Recommendations-1200X627-1200x627.jpg', type: 'pdf', @@ -105,6 +116,6 @@ const dummyRecs: IRecommendation[] = [ source: 'www.altexsoft.com', related_concepts: ['User Control', 'Explanations'] } -] +} const dummyKeywords = ['user control', 'vannevar bush', 'hypermedia', 'hypertext']
\ No newline at end of file |