forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmessage.input.ts
More file actions
110 lines (82 loc) · 2.27 KB
/
Copy pathmessage.input.ts
File metadata and controls
110 lines (82 loc) · 2.27 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import { Field, InputType } from "type-graphql";
import { MessageRole } from "../types/enums";
import { BaseMessageInput } from "../types/base";
@InputType()
export class TextMessageInput {
@Field(() => String)
content: string;
@Field(() => String, { nullable: true })
parentMessageId?: string;
@Field(() => MessageRole)
role: MessageRole;
}
@InputType()
export class ActionExecutionMessageInput {
@Field(() => String)
name: string;
@Field(() => String)
arguments: string;
@Field(() => String, { nullable: true })
parentMessageId?: string;
@Field(() => String, {
nullable: true,
deprecationReason: "This field will be removed in a future version",
})
scope?: String;
}
@InputType()
export class ResultMessageInput {
@Field(() => String)
actionExecutionId: string;
@Field(() => String)
actionName: string;
@Field(() => String, { nullable: true })
parentMessageId?: string;
@Field(() => String)
result: string;
}
@InputType()
export class AgentStateMessageInput {
@Field(() => String)
threadId: string;
@Field(() => String)
agentName: string;
@Field(() => MessageRole)
role: MessageRole;
@Field(() => String)
state: string;
@Field(() => Boolean)
running: boolean;
@Field(() => String)
nodeName: string;
@Field(() => String)
runId: string;
@Field(() => Boolean)
active: boolean;
}
@InputType()
export class ImageMessageInput {
@Field(() => String)
format: string;
@Field(() => String)
bytes: string;
@Field(() => String, { nullable: true })
parentMessageId?: string;
@Field(() => MessageRole)
role: MessageRole;
}
// GraphQL does not support union types in inputs, so we need to use
// optional fields for the different subtypes.
@InputType()
export class MessageInput extends BaseMessageInput {
@Field(() => TextMessageInput, { nullable: true })
textMessage?: TextMessageInput;
@Field(() => ActionExecutionMessageInput, { nullable: true })
actionExecutionMessage?: ActionExecutionMessageInput;
@Field(() => ResultMessageInput, { nullable: true })
resultMessage?: ResultMessageInput;
@Field(() => AgentStateMessageInput, { nullable: true })
agentStateMessage?: AgentStateMessageInput;
@Field(() => ImageMessageInput, { nullable: true })
imageMessage?: ImageMessageInput;
}