Skip to content

Commit fdbb71c

Browse files
authored
New Components - openperplex (#13856)
* new components * pnpm-lock.yaml
1 parent 8d0cefa commit fdbb71c

File tree

7 files changed

+450
-8
lines changed

7 files changed

+450
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import openperplex from "../../openperplex.app.mjs";
2+
3+
export default {
4+
key: "openperplex-get-website-screenshot",
5+
name: "Get Website Screenshot",
6+
description: "Get a screenshot of a website using Openperplex. [See the documentation](https://docs.openperplex.com/api-reference/endpoint/get-website-screenshot)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
openperplex,
11+
url: {
12+
type: "string",
13+
label: "URL",
14+
description: "The URL to create a screenshot of",
15+
},
16+
},
17+
async run({ $ }) {
18+
const response = await this.openperplex.getWebsiteScreenshot({
19+
$,
20+
params: {
21+
url: this.url,
22+
},
23+
});
24+
$.export("$summary", "Successfully created screenshot");
25+
return response;
26+
},
27+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import openperplex from "../../openperplex.app.mjs";
2+
3+
export default {
4+
key: "openperplex-query-from-url",
5+
name: "Query From URL",
6+
description: "Queries content from a specific URL using Openperplex. [See the documentation](https://docs.openperplex.com/api-reference/endpoint/query-from-url)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
openperplex,
11+
url: {
12+
type: "string",
13+
label: "URL",
14+
description: "The URL to search",
15+
},
16+
query: {
17+
propDefinition: [
18+
openperplex,
19+
"query",
20+
],
21+
},
22+
responseLanguage: {
23+
propDefinition: [
24+
openperplex,
25+
"responseLanguage",
26+
],
27+
},
28+
answerType: {
29+
propDefinition: [
30+
openperplex,
31+
"answerType",
32+
],
33+
},
34+
},
35+
async run({ $ }) {
36+
const response = await this.openperplex.queryFromUrl({
37+
$,
38+
params: {
39+
url: this.url,
40+
query: this.query,
41+
response_language: this.responseLanguage,
42+
answer_type: this.answerType,
43+
},
44+
});
45+
$.export("$summary", "Successfully performed search");
46+
return response;
47+
},
48+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import openperplex from "../../openperplex.app.mjs";
2+
3+
export default {
4+
key: "openperplex-simple-search",
5+
name: "Simple Search",
6+
description: "Perform a simple search using Openperplex. [See the documentation](https://docs.openperplex.com/api-reference/endpoint/search-simple)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
openperplex,
11+
query: {
12+
propDefinition: [
13+
openperplex,
14+
"query",
15+
],
16+
},
17+
dateContext: {
18+
type: "string",
19+
label: "Date Context",
20+
description: "A date for context. Format: `YYYY-MM-DD` or `YYYY-MM-DD HH:MM AM/PM`. If not provided, the API uses the current date.",
21+
optional: true,
22+
},
23+
location: {
24+
propDefinition: [
25+
openperplex,
26+
"location",
27+
],
28+
},
29+
responseLanguage: {
30+
propDefinition: [
31+
openperplex,
32+
"responseLanguage",
33+
],
34+
},
35+
answerType: {
36+
propDefinition: [
37+
openperplex,
38+
"answerType",
39+
],
40+
},
41+
},
42+
async run({ $ }) {
43+
const response = await this.openperplex.simpleSearch({
44+
$,
45+
params: {
46+
query: this.query,
47+
date_context: this.dateContext,
48+
location: this.location,
49+
response_language: this.responseLanguage,
50+
answer_type: this.answerType,
51+
},
52+
});
53+
$.export("$summary", "Successfully performed search");
54+
return response;
55+
},
56+
};
+241
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
const ANSWER_TYPES = [
2+
"text",
3+
"markdown",
4+
"html",
5+
];
6+
7+
const COUNTRIES = [
8+
{
9+
label: "United States",
10+
value: "us",
11+
},
12+
{
13+
label: "Canada",
14+
value: "ca",
15+
},
16+
{
17+
label: "United Kingdom",
18+
value: "uk",
19+
},
20+
{
21+
label: "Mexico",
22+
value: "mx",
23+
},
24+
{
25+
label: "Spain",
26+
value: "es",
27+
},
28+
{
29+
label: "Germany",
30+
value: "de",
31+
},
32+
{
33+
label: "France",
34+
value: "fr",
35+
},
36+
{
37+
label: "Belgium",
38+
value: "be",
39+
},
40+
{
41+
label: "Portugal",
42+
value: "pt",
43+
},
44+
{
45+
label: "Netherlands",
46+
value: "nl",
47+
},
48+
{
49+
label: "Turkey",
50+
value: "tr",
51+
},
52+
{
53+
label: "Italy",
54+
value: "it",
55+
},
56+
{
57+
label: "Poland",
58+
value: "pl",
59+
},
60+
{
61+
label: "Russia",
62+
value: "ru",
63+
},
64+
{
65+
label: "South Africa",
66+
value: "za",
67+
},
68+
{
69+
label: "United Arab Emirates",
70+
value: "ae",
71+
},
72+
{
73+
label: "Saudi Arabia",
74+
value: "sa",
75+
},
76+
{
77+
label: "Argentina",
78+
value: "ar",
79+
},
80+
{
81+
label: "Brazil",
82+
value: "br",
83+
},
84+
{
85+
label: "Australia",
86+
value: "au",
87+
},
88+
{
89+
label: "China",
90+
value: "cn",
91+
},
92+
{
93+
label: "Korea",
94+
value: "kr",
95+
},
96+
{
97+
label: "Japan",
98+
value: "jp",
99+
},
100+
{
101+
label: "India",
102+
value: "in",
103+
},
104+
{
105+
label: "Palestine",
106+
value: "ps",
107+
},
108+
{
109+
label: "Kuwait",
110+
value: "kw",
111+
},
112+
{
113+
label: "Oman",
114+
value: "om",
115+
},
116+
{
117+
label: "Qatar",
118+
value: "qa",
119+
},
120+
{
121+
label: "Israel",
122+
value: "il",
123+
},
124+
{
125+
label: "Morocco",
126+
value: "ma",
127+
},
128+
{
129+
label: "Egypt",
130+
value: "eg",
131+
},
132+
{
133+
label: "Iran",
134+
value: "ir",
135+
},
136+
{
137+
label: "Libya",
138+
value: "ly",
139+
},
140+
{
141+
label: "Yemen",
142+
value: "ye",
143+
},
144+
{
145+
label: "Indonesia",
146+
value: "id",
147+
},
148+
{
149+
label: "Pakistan",
150+
value: "pk",
151+
},
152+
{
153+
label: "Bangladesh",
154+
value: "bd",
155+
},
156+
{
157+
label: "Malaysia",
158+
value: "my",
159+
},
160+
{
161+
label: "Philippines",
162+
value: "ph",
163+
},
164+
{
165+
label: "Thailand",
166+
value: "th",
167+
},
168+
{
169+
label: "Vietnam",
170+
value: "vn",
171+
},
172+
];
173+
174+
const LANGUAGES = [
175+
{
176+
label: "English",
177+
value: "en",
178+
},
179+
{
180+
label: "French",
181+
value: "fr",
182+
},
183+
{
184+
label: "Spanish",
185+
value: "es",
186+
},
187+
{
188+
label: "German",
189+
value: "de",
190+
},
191+
{
192+
label: "Italian",
193+
value: "it",
194+
},
195+
{
196+
label: "Portuguese",
197+
value: "pt",
198+
},
199+
{
200+
label: "Dutch",
201+
value: "nl",
202+
},
203+
{
204+
label: "Japanese",
205+
value: "ja",
206+
},
207+
{
208+
label: "Korean",
209+
value: "ko",
210+
},
211+
{
212+
label: "Chinese",
213+
value: "zh",
214+
},
215+
{
216+
label: "Arabic",
217+
value: "ar",
218+
},
219+
{
220+
label: "Russian",
221+
value: "ru",
222+
},
223+
{
224+
label: "Turkish",
225+
value: "tr",
226+
},
227+
{
228+
label: "Hindi",
229+
value: "hi",
230+
},
231+
{
232+
label: "Auto-detect",
233+
value: "auto",
234+
},
235+
];
236+
237+
export default {
238+
ANSWER_TYPES,
239+
COUNTRIES,
240+
LANGUAGES,
241+
};

0 commit comments

Comments
 (0)