forked from chaspy/slack-ask-chatgpt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
workflow.ts
36 lines (34 loc) · 990 Bytes
/
workflow.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { DefineWorkflow, Schema } from "deno-slack-sdk/mod.ts";
import { ChatGPTFunction } from "./function.ts";
export const ChatGPTWorkflow = DefineWorkflow({
callback_id: "example-workflow",
title: "Example Workflow",
input_parameters: {
properties: {
channel_id: {
type: Schema.slack.types.channel_id,
},
user_id: {
type: Schema.slack.types.user_id,
},
message_ts: {
type: Schema.slack.types.message_ts,
},
thread_ts: {
type: Schema.slack.types.message_ts,
},
question: {
type: Schema.types.string,
},
},
required: ["channel_id", "question"],
},
});
// OpenAI をコールする Step
ChatGPTWorkflow.addStep(ChatGPTFunction, {
user_id: ChatGPTWorkflow.inputs.user_id,
question: ChatGPTWorkflow.inputs.question,
channel_id: ChatGPTWorkflow.inputs.channel_id,
message_ts: ChatGPTWorkflow.inputs.message_ts,
thread_ts: ChatGPTWorkflow.inputs.thread_ts,
});