-
Notifications
You must be signed in to change notification settings - Fork 216
feat: Add Olostep integration with 4 web data actions #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ZeeshanAdilButt
wants to merge
4
commits into
vercel-labs:main
Choose a base branch
from
ZeeshanAdilButt:add-olostep-integration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
39bd8c8
feat: Add Olostep integration with 4 web data actions
ZeeshanAdilButt 79ef885
fix: Add maxRetries = 0 to all Olostep step functions
ZeeshanAdilButt 01de114
fix: Validate API key exists before testing Olostep connection
ZeeshanAdilButt 8e49654
fix: Filter search results before applying limit to return correct count
ZeeshanAdilButt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| /** | ||
| * Code generation template for Olostep Answer action | ||
| * This template is used when exporting workflows to standalone Next.js projects | ||
| * It uses environment variables instead of integrationId | ||
| */ | ||
| export const answerCodegenTemplate = `export async function olostepAnswerStep(input: { | ||
| question: string; | ||
| urls?: string[]; | ||
| searchQuery?: string; | ||
| }) { | ||
| "use step"; | ||
|
|
||
| const requestBody: Record<string, unknown> = { | ||
| question: input.question, | ||
| }; | ||
|
|
||
| if (input.urls && input.urls.length > 0) { | ||
| requestBody.urls = input.urls; | ||
| } | ||
|
|
||
| if (input.searchQuery) { | ||
| requestBody.search_query = input.searchQuery; | ||
| } | ||
|
|
||
| const response = await fetch('https://api.olostep.com/v1/answer', { | ||
| method: 'POST', | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| 'Authorization': \`Bearer \${process.env.OLOSTEP_API_KEY}\`, | ||
| }, | ||
| body: JSON.stringify(requestBody), | ||
| }); | ||
|
|
||
| if (!response.ok) { | ||
| throw new Error(\`Olostep API error: \${await response.text()}\`); | ||
| } | ||
|
|
||
| const result = await response.json(); | ||
|
|
||
| return { | ||
| answer: result.answer || result.response || '', | ||
| sources: (result.sources || result.references || []).map((source: any) => ({ | ||
| url: source.url || source.link, | ||
| title: source.title, | ||
| })), | ||
| }; | ||
| }`; | ||
|
|
||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| /** | ||
| * Code generation template for Olostep Map action | ||
| * This template is used when exporting workflows to standalone Next.js projects | ||
| * It uses environment variables instead of integrationId | ||
| */ | ||
| export const mapCodegenTemplate = `export async function olostepMapStep(input: { | ||
| url: string; | ||
| limit?: number; | ||
| includeSubdomains?: boolean; | ||
| }) { | ||
| "use step"; | ||
|
|
||
| const response = await fetch('https://api.olostep.com/v1/map', { | ||
| method: 'POST', | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| 'Authorization': \`Bearer \${process.env.OLOSTEP_API_KEY}\`, | ||
| }, | ||
| body: JSON.stringify({ | ||
| url: input.url, | ||
| limit: input.limit || 100, | ||
| include_subdomains: input.includeSubdomains || false, | ||
| }), | ||
| }); | ||
|
|
||
| if (!response.ok) { | ||
| throw new Error(\`Olostep API error: \${await response.text()}\`); | ||
| } | ||
|
|
||
| const result = await response.json(); | ||
| const urls = result.urls || result.links || []; | ||
|
|
||
| return { | ||
| urls: urls.slice(0, input.limit || 100), | ||
| totalUrls: urls.length, | ||
| }; | ||
| }`; | ||
|
|
||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| /** | ||
| * Code generation template for Olostep Scrape action | ||
| * This template is used when exporting workflows to standalone Next.js projects | ||
| * It uses environment variables instead of integrationId | ||
| */ | ||
| export const scrapeCodegenTemplate = `export async function olostepScrapeStep(input: { | ||
| url: string; | ||
| formats?: ('markdown' | 'html' | 'text')[]; | ||
| waitForSelector?: string; | ||
| }) { | ||
| "use step"; | ||
|
|
||
| const response = await fetch('https://api.olostep.com/v1/scrapes', { | ||
| method: 'POST', | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| 'Authorization': \`Bearer \${process.env.OLOSTEP_API_KEY}\`, | ||
| }, | ||
| body: JSON.stringify({ | ||
| url_to_scrape: input.url, | ||
| formats: input.formats || ['markdown'], | ||
| wait_for_selector: input.waitForSelector, | ||
| }), | ||
| }); | ||
|
|
||
| if (!response.ok) { | ||
| throw new Error(\`Olostep API error: \${await response.text()}\`); | ||
| } | ||
|
|
||
| const result = await response.json(); | ||
|
|
||
| return { | ||
| markdown: result.markdown_content || result.markdown, | ||
| html: result.html_content || result.html, | ||
| metadata: { | ||
| title: result.title, | ||
| url: result.url, | ||
| statusCode: result.status_code, | ||
| }, | ||
| }; | ||
| }`; | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,52 @@ | ||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||
| * Code generation template for Olostep Search action | ||||||||||||||||||||||||||||||||||||||||||||
| * This template is used when exporting workflows to standalone Next.js projects | ||||||||||||||||||||||||||||||||||||||||||||
| * It uses environment variables instead of integrationId | ||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||
| export const searchCodegenTemplate = `export async function olostepSearchStep(input: { | ||||||||||||||||||||||||||||||||||||||||||||
| query: string; | ||||||||||||||||||||||||||||||||||||||||||||
| limit?: number; | ||||||||||||||||||||||||||||||||||||||||||||
| country?: string; | ||||||||||||||||||||||||||||||||||||||||||||
| }) { | ||||||||||||||||||||||||||||||||||||||||||||
| "use step"; | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| const params = new URLSearchParams({ | ||||||||||||||||||||||||||||||||||||||||||||
| query: input.query, | ||||||||||||||||||||||||||||||||||||||||||||
| limit: String(input.limit || 10), | ||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| if (input.country) { | ||||||||||||||||||||||||||||||||||||||||||||
| params.append('country', input.country); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| const response = await fetch( | ||||||||||||||||||||||||||||||||||||||||||||
| \`https://api.olostep.com/v1/google-search?\${params.toString()}\`, | ||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||
| method: 'GET', | ||||||||||||||||||||||||||||||||||||||||||||
| headers: { | ||||||||||||||||||||||||||||||||||||||||||||
| 'Authorization': \`Bearer \${process.env.OLOSTEP_API_KEY}\`, | ||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| if (!response.ok) { | ||||||||||||||||||||||||||||||||||||||||||||
| throw new Error(\`Olostep API error: \${await response.text()}\`); | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| const result = await response.json(); | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| return { | ||||||||||||||||||||||||||||||||||||||||||||
| results: (result.results || result.items || []).slice(0, input.limit || 10).map((item: any) => ({ | ||||||||||||||||||||||||||||||||||||||||||||
| url: item.url || item.link, | ||||||||||||||||||||||||||||||||||||||||||||
| title: item.title, | ||||||||||||||||||||||||||||||||||||||||||||
| description: item.description || item.snippet, | ||||||||||||||||||||||||||||||||||||||||||||
| markdown: item.markdown, | ||||||||||||||||||||||||||||||||||||||||||||
| })), | ||||||||||||||||||||||||||||||||||||||||||||
| totalResults: result.total_results, | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+38
to
+45
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Olostep search codegen template is missing URL filter and totalResults fallback, causing exported code to behave differently from the platform step function. |
||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||
| }`; | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| export function OlostepIcon({ className }: { className?: string }) { | ||
| return ( | ||
| <svg | ||
| aria-label="Olostep" | ||
| className={className} | ||
| viewBox="0 0 100 100" | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| > | ||
| <title>Olostep</title> | ||
| <rect width="100" height="100" rx="20" fill="#6366F1" /> | ||
| <text | ||
| x="50" | ||
| y="72" | ||
| textAnchor="middle" | ||
| fill="white" | ||
| fontSize="60" | ||
| fontWeight="bold" | ||
| fontFamily="system-ui, -apple-system, sans-serif" | ||
| > | ||
| O | ||
| </text> | ||
| </svg> | ||
| ); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Broken merge in plugins/index.ts causes a syntax error: missing
export type {prefix on line 34, plus fully duplicated export blocks.