diff --git a/extension/.vscode/extensions.json b/extension/.vscode/extensions.json new file mode 100644 index 0000000..24d7cc6 --- /dev/null +++ b/extension/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["tauri-apps.tauri-vscode", "rust-lang.rust-analyzer"] +} diff --git a/extension/.vscode/settings.json b/extension/.vscode/settings.json new file mode 100644 index 0000000..8b856a5 --- /dev/null +++ b/extension/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "editor.defaultFormatter": "esbenp.prettier-vscode", + "[javascript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + } +} diff --git a/extension/src/background/messages/getGpts.ts b/extension/src/background/messages/getGpts.ts index 3dc849f..8d95e2e 100644 --- a/extension/src/background/messages/getGpts.ts +++ b/extension/src/background/messages/getGpts.ts @@ -3,6 +3,11 @@ import type { PlasmoMessaging } from "@plasmohq/messaging" import { getGpts } from "~services/gpts" const handler: PlasmoMessaging.MessageHandler = async (req, res) => { + console.log( + "debug", + process.env.PLASMO_BROWSER, + process.env.PLASMO_INDEX_API_BASE_URI + ) const data = await getGpts() console.log("get gpts in back", data) diff --git a/extension/src/background/messages/searchGpts.ts b/extension/src/background/messages/searchGpts.ts new file mode 100644 index 0000000..b02e6ed --- /dev/null +++ b/extension/src/background/messages/searchGpts.ts @@ -0,0 +1,15 @@ +import type { PlasmoMessaging } from "@plasmohq/messaging" + +import { searchGpts } from "~services/gpts" + +const handler: PlasmoMessaging.MessageHandler = async (req, res) => { + const { question } = req.body + const data = await searchGpts(question) + console.log("search gpts in back", data) + + res.send({ + data + }) +} + +export default handler diff --git a/extension/src/components/GptsList/index.tsx b/extension/src/components/GptsList/index.tsx new file mode 100644 index 0000000..e23481c --- /dev/null +++ b/extension/src/components/GptsList/index.tsx @@ -0,0 +1,43 @@ +import type { Gpts } from "~types/gpts" + +interface Props { + gpts: Gpts[] +} + +export default ({ gpts }: Props) => { + return ( +
+ {item.description} +
+- {item.description} -
-- {count} fantastic GPTs - stored - - Submit yours 👉 - -
++ {count} fantastic GPTs stored + + Submit yours 👉 + +