-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathweb.html
170 lines (157 loc) · 4.84 KB
/
web.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Ideation Tool</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<style>
.results-container {
height: 800px;
overflow-y: scroll;
}
.results-table {
max-width: 100%;
}
body {
background-color: #F0F0F0;
font-family: Helvetica, sans-serif;
color: #333333;
}
.container {
max-width: 1200px;
margin: 0 auto;
}
.form-row {
display: flex;
align-items: center;
margin-top: 1rem;
}
.form-row label {
margin-right: 1rem;
}
.form-row input[type="text"],
.form-row input[type="submit"] {
padding: 0.5rem;
border: none;
border-radius: 3px;
font-size: 1rem;
}
.form-row input[type="submit"] {
background-color: #4CAF50;
color: #FFFFFF;
cursor: pointer;
}
.checkbox-row {
display: flex;
align-items: center;
margin-top: 1rem;
}
.checkbox-row label {
margin-right: 1rem;
}
.results-table {
width: 100%;
margin-top: 1rem;
border-collapse: collapse;
}
.results-table th,
.results-table td {
padding: 0.5rem;
border: 1px solid #CCCCCC;
text-align: left;
}
.results-table th {
background-color: #D6EAF8;
font-weight: bold;
}
</style>
</head>
<body>
<div id="app" class="container">
<h1 style="text-align: center;">Ideation Tool</h1>
<div v-if="selectedResult !== null">
<h2>Details</h2>
<pre style="max-width: 80vw; overflow-x: auto;">{{ JSON.stringify(results[selectedResult], null, 4) }}</pre>
</div>
<form @submit.prevent="search">
<div class="form-row">
<label for="query">Enter your query:</label>
<input type="text" id="query" v-model="query" placeholder="Trendy startup-idea" style="width: 80%;">
<button type="submit">Search</button>
</div>
<div class="checkbox-row">
<label><input type="checkbox" v-model="sources.arxiv">Arxiv</label>
<label><input type="checkbox" v-model="sources.news">News</label>
<label><input type="checkbox" v-model="sources.patents">Patents</label>
<label><input type="checkbox" v-model="sources.openai">OpenAI</label>
<label><input type="checkbox" v-model="sources.ai_free">AI-free</label>
<label><input type="checkbox" v-model="sources.trends">Trends</label>
<label for="num">Number of results per type:</label>
<input type="number" id="num" v-model.number="num" min="5" max="150" step="10" style="width: 60px;">
</div>
</form>
<div class="results-container">
<table v-if="results.length" class="results-table">
<thead>
<tr>
<th style="width: 10%;">Type</th>
<th style="width: 90%;">Main info</th>
</tr>
</thead>
<tbody>
<tr v-for="(result, index) in results" :key="index" @click="showDetails(index)">
<td>{{ result.type }}</td>
<td>{{ result.main_info }}</td>
</tr>
</tbody>
</table>
</div>
</div>
<script>
const app = new Vue({
el: '#app',
data: {
query: '',
sources: {
arxiv: false,
news: false,
patents: false,
openai: false,
ai_free: false,
trends: false
},
selectedResult: null,
results: [],
num: 15
},
methods: {
search() {
// Build query parameters
const params = {
q: this.query,
arxiv: this.sources.arxiv,
news: this.sources.news,
patents: this.sources.patents,
openai: this.sources.openai,
ai_free: this.sources.ai_free,
trends: this.sources.trends,
num: this.num
};
// Make API request
axios.get('http://localhost:5000/search', { params })
.then(response => {
this.results = response.data.results;
this.results.sort(() => Math.random() - 0.5);
})
.catch(error => {
console.error(error);
});
},
showDetails(index) {
this.selectedResult = index;
},
},
});
</script>
</body>