diff --git a/.changeset/happy-suits-say.md b/.changeset/happy-suits-say.md new file mode 100644 index 0000000..f02d0c1 --- /dev/null +++ b/.changeset/happy-suits-say.md @@ -0,0 +1,5 @@ +--- +"@iqai/mcp-discord": patch +--- + +Adds timeout setting in env for sampling messages diff --git a/src/config.ts b/src/config.ts index 75550ee..1e763d1 100644 --- a/src/config.ts +++ b/src/config.ts @@ -32,6 +32,14 @@ const envSchema = z.object({ .optional() .default(true) .describe('Only respond to messages that mention the bot'), + SAMPLING_DEFAULT_TIMEOUT: z + .number() + .optional() + .describe('A timeout (in milliseconds) for this request'), + SAMPLING_REACTION_TIMEOUT: z + .number() + .optional() + .describe('A timeout for sending reactions to discord'), BLOCK_DMS: z .stringbool() .optional() diff --git a/src/sampling.ts b/src/sampling.ts index 63adae2..15f02f7 100644 --- a/src/sampling.ts +++ b/src/sampling.ts @@ -187,7 +187,10 @@ export class SamplingHandler { maxTokens: 10, }, }, - z.any() + z.any(), + { + timeout: env.SAMPLING_REACTION_TIMEOUT, + } ); const response = @@ -225,7 +228,8 @@ export class SamplingHandler { maxTokens: 200, }, }, - z.any() + z.any(), + { timeout: env.SAMPLING_DEFAULT_TIMEOUT } ); }