Skip to content

Commit

Permalink
Merge pull request #1 from newfold-labs/develop
Browse files Browse the repository at this point in the history
add utility to call ai search
  • Loading branch information
amartya-dev authored May 25, 2023
2 parents 75409f1 + b43dab6 commit 02a51a8
Show file tree
Hide file tree
Showing 6 changed files with 504 additions and 0 deletions.
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import moduleAI from "./lib/moduleAI";

export {
moduleAI as default
}
18 changes: 18 additions & 0 deletions lib/core/AISearch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import apiFetch from "@wordpress/api-fetch";

const base = "newfold-ai/v1";

const AISearch = {
getSearchResult: (userPrompt, identifier, extra) =>
apiFetch({
path: base + "/search",
method: "POST",
data: {
user_prompt: userPrompt,
identifier: identifier,
extra: extra,
},
}),
};

export default AISearch;
7 changes: 7 additions & 0 deletions lib/moduleAI.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import AISearch from "./core/AISearch";

const moduleAI = {
search: AISearch,
}

export default moduleAI;
329 changes: 329 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@newfold-labs/wp-module-ai",
"version": "0.0.1",
"main": "index.js",
"description": "A module for providing artificial intelligence capabilities.",
"license": "GPL-2.0-or-later",
"private": true,
"author": {
"name": "Micah Wood",
"email": "[email protected]"
},
"dependencies": {
"@wordpress/api-fetch": "^6.28.0"
}
}
Loading

0 comments on commit 02a51a8

Please sign in to comment.