Skip to content

Commit

Permalink
[Components] kodagpt #11938 (#12369)
Browse files Browse the repository at this point in the history
* Added actions

* Added actions

* Added actions

* Fixed requested changes
  • Loading branch information
lcaresia committed Jul 3, 2024
1 parent 9db1ae4 commit 38deb0d
Show file tree
Hide file tree
Showing 22 changed files with 112 additions and 25 deletions.
2 changes: 1 addition & 1 deletion components/deepseek/deepseek.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/drchrono/drchrono.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/hackerone/hackerone.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/html_to_image/html_to_image.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/hubstaff/hubstaff.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/ikas/ikas.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
41 changes: 41 additions & 0 deletions components/kodagpt/actions/semantic-search/semantic-search.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import app from "../../kodagpt.app.mjs";

export default {
key: "kodagpt-semantic-search",
name: "Semantic Search",
description: "Perform a semantic search within chatbot data [See the documentation](https://kodagpt.readme.io/reference/buscas-semanticas)",
version: "0.0.1",
type: "action",
props: {
app,
question: {
propDefinition: [
app,
"question",
],
},
chatbotId: {
propDefinition: [
app,
"chatbotId",
],
optional: true,
},
alert: {
type: "alert",
alertType: "info",
content: "Bot ID is required if you don't specify Bot ID on the connection popup",
},
},
async run({ $ }) {
const response = await this.app.semanticSearch({
$,
question: this.question,
chatbotId: this.chatbotId,
});

$.export("$summary", `Successfully generated '${response.length}' answers`);

return response;
},
};
45 changes: 41 additions & 4 deletions components/kodagpt/kodagpt.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,48 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "kodagpt",
propDefinitions: {},
propDefinitions: {
question: {
type: "string",
label: "Question",
description: "The question to ask the chatbot",
},
chatbotId: {
type: "string",
label: "Chatbot ID",
description: "To get your Chatbot ID, sign in, go to \"Integrations\". Copy your Chatbot ID from \"My Chatbots\".",
},
},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "https://kodagpt.com.br/api/v1";
},
async _makeRequest(opts = {}) {
const {
$ = this,
path,
headers,
...otherOpts
} = opts;
return axios($, {
...otherOpts,
url: this._baseUrl() + path,
headers: {
...headers,
"Content-Type": "application/json",
"API_KEY": `${this.$auth.api_key}`,
},
});
},
async semanticSearch({
question, chatbotId, ...args
}) {
return this._makeRequest({
path: `/embed/${this.$auth.chatbot_id || chatbotId}/${question}`,
...args,
});
},
},
};
7 changes: 5 additions & 2 deletions components/kodagpt/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/kodagpt",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream KodaGPT Components",
"main": "kodagpt.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.0"
}
}
}
2 changes: 1 addition & 1 deletion components/leadoku/leadoku.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/llamaindex/llamaindex.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/mslm_cloud/mslm_cloud.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/parma/parma.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/pdffiller/pdffiller.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/procfu/procfu.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/signpath/signpath.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/ticket_source/ticket_source.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/undetectable_ai/undetectable_ai.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/unstructured/unstructured.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
8 changes: 7 additions & 1 deletion pnpm-lock.yaml

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

0 comments on commit 38deb0d

Please sign in to comment.