You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -232,9 +232,18 @@ export class AiPlugin extends RuntimePlugin<AiPluginOptions> {
232
232
Tools are basically like commands that you can execute to perform specific actions based on user input.
233
233
Keep the response short and concise, and only use tools when necessary. Keep the response length under 2000 characters.
234
234
Do not include your own text in the response unless necessary. For text formatting, you can use discord's markdown syntax.
235
+
The current channel is ${
236
+
'name'inmessage.channel
237
+
? message.channel.name
238
+
: message.channel.recipient?.displayName||'DM'
239
+
} whose id is ${message.channelId}. ${
240
+
message.channel.isSendable()
241
+
? 'You can send messages in this channel.'
242
+
: 'You cannot send messages in this channel.'
243
+
}
235
244
${message.inGuild() ? `\nYou are currently in a guild named ${message.guild.name} whose id is ${message.guildId}. While in guild, you can fetch member information if needed.` : '\nYou are currently in a direct message with the user.'}
236
245
If the user asks you to create a poll or embeds, create a text containing the poll or embed information as a markdown instead of json. If structured response is possible, use the structured response format instead.
237
-
If the user asks you to perform a task that requires a tool, use the tool to perform the task and return the result.
246
+
If the user asks you to perform a task that requires a tool, use the tool to perform the task and return the result. Reject any requests that are not related to the tools you have access to.
238
247
`;
239
248
240
249
constuserInfo=`<user>
@@ -257,65 +266,38 @@ export class AiPlugin extends RuntimePlugin<AiPluginOptions> {
Copy file name to clipboardExpand all lines: packages/ai/src/schema.ts
+25-24Lines changed: 25 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,30 @@ const pollMediaObject = z
13
13
'An object representing the media for a poll question, containing the text of the question. Emoji cannot be used in question text.',
14
14
);
15
15
16
+
exportconstpollSchema=z
17
+
.object({
18
+
question: pollMediaObject,
19
+
answers: z
20
+
.array(pollMediaObject)
21
+
.min(1)
22
+
.max(10)
23
+
.describe('An array of answers for the poll'),
24
+
allow_multiselect: z
25
+
.boolean()
26
+
.optional()
27
+
.default(false)
28
+
.describe('Whether the poll allows multiple selections'),
29
+
duration: z
30
+
.number()
31
+
.int()
32
+
.min(1)
33
+
.max(32)
34
+
.optional()
35
+
.default(24)
36
+
.describe('The duration of the poll in hours'),
37
+
})
38
+
.describe('An object representing a poll to include in the message');
39
+
16
40
exportconstAiResponseSchema=z
17
41
.object({
18
42
content: z
@@ -95,30 +119,7 @@ export const AiResponseSchema = z
95
119
.describe(
96
120
'An object representing embeds to include in the discord message. This is an optional field.',
97
121
),
98
-
poll: z
99
-
.object({
100
-
question: pollMediaObject,
101
-
answers: z
102
-
.array(pollMediaObject)
103
-
.min(1)
104
-
.max(10)
105
-
.describe('An array of answers for the poll'),
106
-
allow_multiselect: z
107
-
.boolean()
108
-
.optional()
109
-
.default(false)
110
-
.describe('Whether the poll allows multiple selections'),
111
-
duration: z
112
-
.number()
113
-
.int()
114
-
.min(1)
115
-
.max(32)
116
-
.optional()
117
-
.default(24)
118
-
.describe('The duration of the poll in hours'),
119
-
})
120
-
.optional()
121
-
.describe('An object representing a poll to include in the message'),
122
+
poll: pollSchema.optional(),
122
123
})
123
124
.describe(
124
125
'The schema for an AI response message to be sent to discord, including content and embeds. At least one of content, embeds, or poll must be present.',
0 commit comments