-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,26 @@ | ||
--- | ||
version: 0.1.0 | ||
type: lib | ||
description: |- | ||
the simple fetch web page content from url. | ||
It can be used in prompt. eg, `user: "think about the following web content: @url(https://www.example.com)"` | ||
tag: | ||
- url | ||
- loader | ||
- prompt | ||
- lib | ||
input: | ||
- 0 # The url passed by the prompt(position argument) | ||
- content # The url passed by the prompt | ||
- onlyContent: {type: "boolean"} # Only return the content | ||
output: # the web page content | ||
type: "string" | ||
--- | ||
!fn |- | ||
async function loadUrl() { | ||
let url = this.content || this[0] | ||
const content = await fetch(url).then(res => res.text()) | ||
return `web url: ${url}\nweb content:\n${content}` | ||
} | ||
$loadUrl |