This commit is contained in:
Martin McKeaveney 2023-04-26 15:58:21 +01:00
parent 4f020a4db4
commit e70e3ae662
4 changed files with 9 additions and 9 deletions

View File

@ -40,7 +40,7 @@ const ACTION_IMPLS: Record<
DELAY: delay.run,
FILTER: filter.run,
QUERY_ROWS: queryRow.run,
OPEN_AI: openai.run,
OPENAI: openai.run,
// these used to be lowercase step IDs, maintain for backwards compat
discord: discord.run,
slack: slack.run,
@ -61,7 +61,7 @@ export const BUILTIN_ACTION_DEFINITIONS: Record<string, AutomationStepSchema> =
FILTER: filter.definition,
QUERY_ROWS: queryRow.definition,
LOOP: loop.definition,
OPEN_AI: openai.definition,
OPENAI: openai.definition,
// these used to be lowercase step IDs, maintain for backwards compat
discord: discord.definition,
slack: slack.definition,

View File

@ -22,7 +22,7 @@ export const definition: AutomationStepSchema = {
description: "Interact with the OpenAI ChatGPT API.",
type: AutomationStepType.ACTION,
internal: true,
stepId: AutomationActionStepId.OPEN_AI,
stepId: AutomationActionStepId.OPENAI,
inputs: {
prompt: "",
},
@ -90,7 +90,7 @@ export async function run({ inputs, context }: AutomationStepInput) {
],
})
let response = completion?.data?.choices[0]?.message?.content
const response = completion?.data?.choices[0]?.message?.content
return {
response,

View File

@ -40,7 +40,7 @@ describe("test the openai action", () => {
it("should present the correct error message when the OPENAI_API_KEY variable isn't set", async () => {
delete environment.OPENAI_API_KEY
let res = await setup.runStep("OPEN_AI", {
let res = await setup.runStep("OPENAI", {
prompt: OPENAI_PROMPT,
})
expect(res.response).toEqual(
@ -50,7 +50,7 @@ describe("test the openai action", () => {
})
it("should be able to receive a response from ChatGPT given a prompt", async () => {
const res = await setup.runStep("OPEN_AI", {
const res = await setup.runStep("OPENAI", {
prompt: OPENAI_PROMPT,
})
expect(res.response).toEqual("This is a test")
@ -58,7 +58,7 @@ describe("test the openai action", () => {
})
it("should present the correct error message when a prompt is not provided", async () => {
const res = await setup.runStep("OPEN_AI", {
const res = await setup.runStep("OPENAI", {
prompt: null,
})
expect(res.response).toEqual(
@ -74,7 +74,7 @@ describe("test the openai action", () => {
}),
}))
const res = await setup.runStep("OPEN_AI", {
const res = await setup.runStep("OPENAI", {
prompt: OPENAI_PROMPT,
})

View File

@ -56,7 +56,7 @@ export enum AutomationActionStepId {
FILTER = "FILTER",
QUERY_ROWS = "QUERY_ROWS",
LOOP = "LOOP",
OPEN_AI = "OPEN_AI",
OPENAI = "OPENAI",
// these used to be lowercase step IDs, maintain for backwards compat
discord = "discord",
slack = "slack",