From b007f6b756fe4fc12f170052af5c9993299b59ad Mon Sep 17 00:00:00 2001 From: Evgeny Date: Mon, 11 Nov 2024 08:54:52 +0700 Subject: [PATCH] Add Perplexity search script --- samples/perplexity-search.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 samples/perplexity-search.lua diff --git a/samples/perplexity-search.lua b/samples/perplexity-search.lua new file mode 100644 index 0000000..f466062 --- /dev/null +++ b/samples/perplexity-search.lua @@ -0,0 +1,26 @@ +-- name = "Ask Perplexity AI" +-- description = "search what you want with perplexity" +-- data_source = "internal" +-- type = "search" +-- author = "JohnyWater" +-- version = "1.0" +-- prefix = "ask" + +text_from = "" +text_to = "" + +local urll = require "url" +local md_color = require "md_colors" +local green = md_colors.green_400 + +function on_search(input) + text_from = input + text_to = "" + search:show({input},{green}) +end + +function on_click(idx) + system:open_browser( + "https://www.perplexity.ai/?q=" .. urll.quote(text_from) + ) +end